From e4858c6361a78fe4e5cfe17ce02b47be3f8abe9d Mon Sep 17 00:00:00 2001
From: Kevin Fourie
Date: Wed, 20 Jun 2007 13:09:21 +0000
Subject: [PATCH] Updated SVN properties.
---
about.php | 2 +-
bin/openoffice/pdfgen.py | 2 +-
bin/storageverification.php | 2 +-
bin/upgrade/pear-upgrade.bat | 54 +++++++++++++++++++++++++++---------------------------
docs/COPYING | 386 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
docs/README.txt | 26 +++++++++++++-------------
ktwsapi/README.txt | 8 ++++----
lib/actions/bulkaction.php | 2 +-
lib/actions/documentviewlet.inc.php | 2 +-
lib/actions/entitylist.php | 2 +-
lib/authentication/interceptorinstances.inc.php | 2 +-
lib/browse/columnentry.inc.php | 2 +-
lib/browse/columnregistry.inc.php | 2 +-
lib/metadata/fieldsetregistry.inc.php | 2 +-
lib/util/KTStopwords.php | 2 +-
lib/validation/basevalidator.inc.php | 2 +-
lib/validation/validatorfactory.inc.php | 2 +-
lib/widgets/basewidget.inc.php | 2 +-
lib/widgets/forms.inc.php | 2 +-
lib/widgets/widgetfactory.inc.php | 2 +-
lib/workflow/workflowadminutil.inc.php | 2 +-
lib/workflow/workflowtrigger.inc.php | 2 +-
lib/workflow/workflowtriggerinstance.inc.php | 2 +-
olddashboard.php | 4 ++--
plugins/ktcore/KTColumns.inc.php | 2 +-
plugins/ktcore/KTValidators.php | 2 +-
plugins/ktcore/KTWidgets.php | 2 +-
plugins/ktcore/KTWorkflowTriggers.inc.php | 2 +-
plugins/ktcore/admin/documentFieldsv2.php | 2 +-
plugins/ktcore/admin/expungeList.php | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------
plugins/ktcore/admin/fieldsets/basic.inc.php | 2 +-
plugins/ktcore/admin/fieldsets/conditional.inc.php | 2 +-
plugins/ktcore/admin/manageViews.php | 2 +-
plugins/ktcore/admin/workflow/newworkflow.inc.php | 2 +-
plugins/ktcore/admin/workflowsv2.php | 2 +-
plugins/ktstandard/ImmutableActionPlugin.php | 2 +-
plugins/ktstandard/KTAdminVersionPlugin.php | 2 +-
plugins/ktstandard/KTDocumentLinksColumns.php | 2 +-
plugins/ktstandard/KTWebDAVDashletPlugin.php | 2 +-
plugins/ktstandard/contents/XmlHtmlIndexer.php | 2 +-
resources/css/kt-ie-7.css | 6 +++---
rss.php | 268 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------
sql/mysql/install/rebuild.bat | 40 ++++++++++++++++++++--------------------
sql/mysql/upgrade/3.3.1/rss.sql | 28 ++++++++++++++--------------
sql/mysql/upgrade/3.3.2/tagclouds.sql | 54 +++++++++++++++++++++++++++---------------------------
sql/mysql/upgrade/3.3.3/fieldsets_disable.sql | 4 ++--
sql/mysql/upgrade/3.4.0/upload_download.sql | 50 +++++++++++++++++++++++++-------------------------
templates/ktstandard/PDFPlugin/PDFPlugin.smarty | 6 +++---
templates/ktstandard/ktwebdavdashlet/dashlet.smarty | 16 ++++++++--------
thirdparty/pear/Console/Getopt.php | 2 +-
thirdparty/pear/GraphViz.php | 2 +-
thirdparty/pear/HTTP/Client.php | 4 ++--
thirdparty/pear/HTTP/Client/CookieManager.php | 4 ++--
thirdparty/pear/HTTP/Download.php | 2062 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdparty/pear/HTTP/Download/Archive.php | 244 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------
thirdparty/pear/HTTP/Download/PgLOB.php | 354 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdparty/pear/HTTP/Header.php | 1062 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdparty/pear/HTTP/Header/Cache.php | 476 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdparty/pear/HTTP/Request.php | 2 +-
thirdparty/pear/HTTP/Request/Listener.php | 4 ++--
thirdparty/pear/HTTP/Upload.php | 1710 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdparty/pear/HTTP/WebDAV/Server.php | 2 +-
thirdparty/pear/HTTP/WebDAV/Tools/_parse_lockinfo.php | 2 +-
thirdparty/pear/HTTP/WebDAV/Tools/_parse_propfind.php | 2 +-
thirdparty/pear/HTTP/WebDAV/Tools/_parse_proppatch.php | 2 +-
thirdparty/pear/JSON.php | 2 +-
thirdparty/pear/Net/CheckIP.php | 2 +-
thirdparty/pear/Net/Curl.php | 2 +-
thirdparty/pear/Net/DIME.php | 1256 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdparty/pear/Net/Dict.php | 2 +-
thirdparty/pear/Net/Dig.php | 2 +-
thirdparty/pear/Net/Finger.php | 4 ++--
thirdparty/pear/Net/Geo.php | 2 +-
thirdparty/pear/Net/IPv4.php | 2 +-
thirdparty/pear/Net/IPv6.php | 436 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdparty/pear/Net/Ident.php | 2 +-
thirdparty/pear/Net/POP3.php | 2 +-
thirdparty/pear/Net/Ping.php | 6 +++---
thirdparty/pear/Net/SMTP.php | 2 +-
thirdparty/pear/Net/SmartIRC.php | 10 +++++-----
thirdparty/pear/Net/Socket.php | 2 +-
thirdparty/pear/Net/Whois.php | 2 +-
thirdparty/pear/SOAP/Type/hexBinary.php | 2 +-
thirdparty/pear/SOAP/example/com_client.php | 2 +-
thirdparty/pear/SOAP/example/disco_server.php | 2 +-
thirdparty/pear/SOAP/example/email_client.php | 2 +-
thirdparty/pear/SOAP/example/email_gateway.php | 2 +-
thirdparty/pear/SOAP/example/email_pop_gateway.php | 2 +-
thirdparty/pear/SOAP/example/email_pop_server.php | 2 +-
thirdparty/pear/SOAP/example/email_server.php | 2 +-
thirdparty/pear/SOAP/example/example_server.php | 2 +-
thirdparty/pear/SOAP/example/server.php | 2 +-
thirdparty/pear/SOAP/example/server2.php | 2 +-
thirdparty/pear/SOAP/example/smtp.php | 2 +-
thirdparty/pear/SOAP/example/stockquote.php | 2 +-
thirdparty/pear/SOAP/example/tcp_client.php | 2 +-
thirdparty/pear/SOAP/example/tcp_server.php | 2 +-
thirdparty/pear/SOAP/example/wsdl_client.php | 2 +-
thirdparty/pear/System.php | 4 ++--
thirdparty/simpletest/simpletest/exceptions.php | 2 +-
thirdpartyjs/curvycorners/lgpl.txt | 1002 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/animation/README | 68 ++++++++++++++++++++++++++++++++++----------------------------------
thirdpartyjs/yui/animation/animation-debug.js | 2552 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/animation/animation.js | 2544 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/autocomplete/README | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------
thirdpartyjs/yui/calendar/README | 214 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/calendar/assets/calendar.css | 382 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/calendar/calendar-debug.js | 8552 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/calendar/calendar-min.js | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/calendar/calendar.js | 8476 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/connection/README | 302 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/connection/connection-debug.js | 1954 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/connection/connection-min.js | 196 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------
thirdpartyjs/yui/connection/connection.js | 1918 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/container/README | 230 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/container/assets/container.css | 422 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/container/container-debug.js | 9202 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/container/container-min.js | 292 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/container/container.js | 9120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/container/container_core-debug.js | 5820 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/container/container_core-min.js | 196 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------
thirdpartyjs/yui/container/container_core.js | 5766 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/dom/README | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------
thirdpartyjs/yui/dom/dom-debug.js | 1832 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/dom/dom.js | 1762 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/dragdrop/README | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------
thirdpartyjs/yui/dragdrop/dragdrop-debug.js | 6094 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/dragdrop/dragdrop.js | 5884 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/event/README | 244 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/event/event-debug.js | 3532 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/event/event.js | 3476 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/fonts/README | 26 +++++++++++++-------------
thirdpartyjs/yui/fonts/fonts-min.css | 2 +-
thirdpartyjs/yui/fonts/fonts.css | 62 +++++++++++++++++++++++++++++++-------------------------------
thirdpartyjs/yui/grids/README | 78 +++++++++++++++++++++++++++++++++++++++---------------------------------------
thirdpartyjs/yui/grids/grids-min.css | 2 +-
thirdpartyjs/yui/grids/grids.css | 258 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/logger/README | 68 ++++++++++++++++++++++++++++++++++----------------------------------
thirdpartyjs/yui/menu/README | 446 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/menu/assets/menu.css | 592 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/menu/menu-debug.js | 14446 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/menu/menu.js | 13556 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/reset-fonts-grids/README | 14 +++++++-------
thirdpartyjs/yui/reset-fonts-grids/reset-fonts-grids-min.css | 6 +++---
thirdpartyjs/yui/reset-fonts-grids/reset-fonts-grids.css | 346 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/reset/README | 32 ++++++++++++++++----------------
thirdpartyjs/yui/reset/reset.css | 28 ++++++++++++++--------------
thirdpartyjs/yui/slider/README | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------
thirdpartyjs/yui/slider/slider-debug.js | 2304 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/slider/slider.js | 2226 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/tabview/README | 12 ++++++------
thirdpartyjs/yui/tabview/assets/border_tabs.css | 86 +++++++++++++++++++++++++++++++++++++++++++-------------------------------------------
thirdpartyjs/yui/tabview/assets/tabs.css | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------
thirdpartyjs/yui/tabview/tabview-debug.js | 3900 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/tabview/tabview.js | 3898 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/treeview/README | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/treeview/assets/tree.css | 196 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------
thirdpartyjs/yui/treeview/treeview-debug.js | 4456 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/treeview/treeview.js | 4364 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/utilities/README | 40 ++++++++++++++++++++--------------------
thirdpartyjs/yui/utilities/utilities.js | 198 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------
thirdpartyjs/yui/yahoo-dom-event/README | 46 +++++++++++++++++++++++-----------------------
thirdpartyjs/yui/yahoo/README | 74 +++++++++++++++++++++++++++++++++++++-------------------------------------
thirdpartyjs/yui/yahoo/yahoo-debug.js | 290 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------
thirdpartyjs/yui/yahoo/yahoo.js | 290 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------
165 files changed, 72175 insertions(+), 72175 deletions(-)
diff --git a/about.php b/about.php
index d61f199..08bff5d 100644
--- a/about.php
+++ b/about.php
@@ -1,7 +1,7 @@
, Jam Warehouse (Pty) Ltd, South Africa
*/
diff --git a/plugins/ktcore/KTColumns.inc.php b/plugins/ktcore/KTColumns.inc.php
index 7601419..8c1c194 100644
--- a/plugins/ktcore/KTColumns.inc.php
+++ b/plugins/ktcore/KTColumns.inc.php
@@ -1,6 +1,6 @@
0){
- $pages = floor($items/10)+1;
-}else{
- $pages = ($items/10);
-}
-if($pageNum == 1){
- $listStart = 0;
- $listEnd = 9;
-}elseif($pageNum == $pages){
- $listStart = (10*($pageNum-1));
- $listEnd = count($aDocuments)-1;
-}else{
- $listStart = (10*($pageNum-1));
- $listEnd = $listStart+9;
-}
-for($i = $listStart; $i <= $listEnd; $i++){
- $output .= "
-
- ".$aDocuments[$i]->getName()."
- ".$aDocuments[$i]->getLastModifiedDate()."
- ".$aDocuments[$i]->getLastDeletionComment()."
- ";
-}
-echo $output;
-?>
+ 0){
+ $pages = floor($items/10)+1;
+}else{
+ $pages = ($items/10);
+}
+if($pageNum == 1){
+ $listStart = 0;
+ $listEnd = 9;
+}elseif($pageNum == $pages){
+ $listStart = (10*($pageNum-1));
+ $listEnd = count($aDocuments)-1;
+}else{
+ $listStart = (10*($pageNum-1));
+ $listEnd = $listStart+9;
+}
+for($i = $listStart; $i <= $listEnd; $i++){
+ $output .= "
+
+ ".$aDocuments[$i]->getName()."
+ ".$aDocuments[$i]->getLastModifiedDate()."
+ ".$aDocuments[$i]->getLastDeletionComment()."
+ ";
+}
+echo $output;
+?>
diff --git a/plugins/ktcore/admin/fieldsets/basic.inc.php b/plugins/ktcore/admin/fieldsets/basic.inc.php
index 2003389..6f4c558 100644
--- a/plugins/ktcore/admin/fieldsets/basic.inc.php
+++ b/plugins/ktcore/admin/fieldsets/basic.inc.php
@@ -1,7 +1,7 @@
'id',));
- $id = $user[$_SERVER['PHP_AUTH_USER']]['id'];
-
-
- if(KTUtil::arrayGet($_REQUEST, 'docId')){ // if a docId parameter is passed
- // get document id from http request object
- $iDocumentId = KTUtil::arrayGet($_REQUEST, 'docId');
-
- if(KTrss::validateDocumentPermissions($id, $iDocumentId)){ // if document passes validation check
- // get document info
- $aDocumentInfo[] = KTrss::getOneDocument($iDocumentId, $id);
-
- if($aDocumentInfo){
- // create rss xml for document
- $documentFeed = KTrss::arrayToXML($aDocumentInfo);
- }else{
- // create rss xml for the error
- $error = KTrss::errorToXML(_kt('This document has returned a empty response'));
- }
- }else{
- // create rss xml for error
- $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this document or it does not exist.' .
- ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid document.'));
- }
- if(isset($error)){ // if an error exist, output...else out the result
- echo $error;
- }else{
- echo $documentFeed;
- }
- }elseif(KTUtil::arrayGet($_REQUEST, 'folderId')){ // if a folderId parameter is passed
- // get folder id from http request object
- $iFolderId = KTUtil::arrayGet($_REQUEST, 'folderId');
-
- if(KTrss::validateFolderPermissions($id, $iFolderId)){ // if folder passes validation check
- // get folder info
- $aFolderInfo[] = KTrss::getOneFolder($iFolderId);
-
- if($aFolderInfo){
- // create rss xml for folder
- $folderFeed = KTrss::arrayToXML($aFolderInfo);
- }else{
- // create rss xml for error
- $error = KTrss::errorToXML(_kt('This document has returned a empty response'));
- }
- }else{
- // create rss xml for error
- $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this folder or it does not exist.' .
- ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid folder.'));
- }
- if(isset($error)){ // if an error exist, output...else out the result
- echo $error;
- }else{
- echo $folderFeed;
- }
- }else{ // else do normal rss parsing
- // get full list of subscribed documents and folders
- $aFullList = array_merge(KTrss::getDocuments($id), KTrss::getFolders($id));
- $internalFeed = KTrss::arrayToXML($aFullList);
- echo $internalFeed;
- }
-}
-
-// Validate user credentials
-function validateUser($username, $password){
- return DBAuthenticator::checkPassword($username, $password);
-}
-?>
+'id',));
+ $id = $user[$_SERVER['PHP_AUTH_USER']]['id'];
+
+
+ if(KTUtil::arrayGet($_REQUEST, 'docId')){ // if a docId parameter is passed
+ // get document id from http request object
+ $iDocumentId = KTUtil::arrayGet($_REQUEST, 'docId');
+
+ if(KTrss::validateDocumentPermissions($id, $iDocumentId)){ // if document passes validation check
+ // get document info
+ $aDocumentInfo[] = KTrss::getOneDocument($iDocumentId, $id);
+
+ if($aDocumentInfo){
+ // create rss xml for document
+ $documentFeed = KTrss::arrayToXML($aDocumentInfo);
+ }else{
+ // create rss xml for the error
+ $error = KTrss::errorToXML(_kt('This document has returned a empty response'));
+ }
+ }else{
+ // create rss xml for error
+ $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this document or it does not exist.' .
+ ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid document.'));
+ }
+ if(isset($error)){ // if an error exist, output...else out the result
+ echo $error;
+ }else{
+ echo $documentFeed;
+ }
+ }elseif(KTUtil::arrayGet($_REQUEST, 'folderId')){ // if a folderId parameter is passed
+ // get folder id from http request object
+ $iFolderId = KTUtil::arrayGet($_REQUEST, 'folderId');
+
+ if(KTrss::validateFolderPermissions($id, $iFolderId)){ // if folder passes validation check
+ // get folder info
+ $aFolderInfo[] = KTrss::getOneFolder($iFolderId);
+
+ if($aFolderInfo){
+ // create rss xml for folder
+ $folderFeed = KTrss::arrayToXML($aFolderInfo);
+ }else{
+ // create rss xml for error
+ $error = KTrss::errorToXML(_kt('This document has returned a empty response'));
+ }
+ }else{
+ // create rss xml for error
+ $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this folder or it does not exist.' .
+ ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid folder.'));
+ }
+ if(isset($error)){ // if an error exist, output...else out the result
+ echo $error;
+ }else{
+ echo $folderFeed;
+ }
+ }else{ // else do normal rss parsing
+ // get full list of subscribed documents and folders
+ $aFullList = array_merge(KTrss::getDocuments($id), KTrss::getFolders($id));
+ $internalFeed = KTrss::arrayToXML($aFullList);
+ echo $internalFeed;
+ }
+}
+
+// Validate user credentials
+function validateUser($username, $password){
+ return DBAuthenticator::checkPassword($username, $password);
+}
+?>
diff --git a/sql/mysql/install/rebuild.bat b/sql/mysql/install/rebuild.bat
index 961155d..bf56b25 100644
--- a/sql/mysql/install/rebuild.bat
+++ b/sql/mysql/install/rebuild.bat
@@ -1,21 +1,21 @@
-@ECHO OFF
-CLS
-ECHO.
-FOR /F "tokens=5* delims= " %%A IN ('VOL C: ^| FIND "drive C"') DO SET OLDLABEL=%%B
-ECHO Enter name of database (default is dms):
-FOR /F "TOKENS=*" %%? IN ('LABEL C: 2^>NUL') DO SET INPUT=%%?
-SET INPUT
-CLS
-LABEL C: %OLDLABEL%
-PAUSE
-CLS
-ECHO ---- Dropping database %INPUT% ----
-mysqladmin -u root -p -f drop %INPUT%
-ECHO ---- Creating database %INPUT% ----
-mysqladmin -u root -p create %INPUT%
-ECHO ---- Creating structure for database %INPUT% ----
-mysql -u root %INPUT%NUL') DO SET INPUT=%%?
+SET INPUT
+CLS
+LABEL C: %OLDLABEL%
+PAUSE
+CLS
+ECHO ---- Dropping database %INPUT% ----
+mysqladmin -u root -p -f drop %INPUT%
+ECHO ---- Creating database %INPUT% ----
+mysqladmin -u root -p create %INPUT%
+ECHO ---- Creating structure for database %INPUT% ----
+mysql -u root %INPUT% get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{i18n}Generate PDF of{/i18n}: {$context->oDocument->getName()}
-
-{$form->render()}
+ get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{i18n}Generate PDF of{/i18n}: {$context->oDocument->getName()}
+
+{$form->render()}
diff --git a/templates/ktstandard/ktwebdavdashlet/dashlet.smarty b/templates/ktstandard/ktwebdavdashlet/dashlet.smarty
index 25a74ba..16c86c9 100644
--- a/templates/ktstandard/ktwebdavdashlet/dashlet.smarty
+++ b/templates/ktstandard/ktwebdavdashlet/dashlet.smarty
@@ -1,8 +1,8 @@
-
-
{i18n arg_appname="$appname"}To connect to #appname# via a third-party WebDAV client, please use the following address{/i18n}:
-{$url}ktwebdav/ktwebdav.php
-{i18n arg_appname="$appname"}To connect with the #appname# Tools Suite, use this address{/i18n}:
-{$url}
-
-
-
+
+
{i18n arg_appname="$appname"}To connect to #appname# via a third-party WebDAV client, please use the following address{/i18n}:
+{$url}ktwebdav/ktwebdav.php
+{i18n arg_appname="$appname"}To connect with the #appname# Tools Suite, use this address{/i18n}:
+{$url}
+
+
+
diff --git a/thirdparty/pear/Console/Getopt.php b/thirdparty/pear/Console/Getopt.php
index 7966d1a..52b2dea 100644
--- a/thirdparty/pear/Console/Getopt.php
+++ b/thirdparty/pear/Console/Getopt.php
@@ -16,7 +16,7 @@
// | Author: Andrei Zmievski |
// +----------------------------------------------------------------------+
//
-// $Id: Getopt.php,v 1.21.4.7 2003/12/05 21:57:01 andrei Exp $
+// $Id$
require_once 'PEAR.php';
diff --git a/thirdparty/pear/GraphViz.php b/thirdparty/pear/GraphViz.php
index b439ad4..5224018 100644
--- a/thirdparty/pear/GraphViz.php
+++ b/thirdparty/pear/GraphViz.php
@@ -21,7 +21,7 @@
* @author Michael Lively Jr.
* @copyright 2001-2006 Sebastian Bergmann
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: GraphViz.php,v 1.25 2006/05/16 15:49:19 sebastian Exp $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Image_GraphViz
* @since File available since Release 0.1
*/
diff --git a/thirdparty/pear/HTTP/Client.php b/thirdparty/pear/HTTP/Client.php
index 5708cc3..dc6bfac 100644
--- a/thirdparty/pear/HTTP/Client.php
+++ b/thirdparty/pear/HTTP/Client.php
@@ -16,7 +16,7 @@
// | Author: Alexey Borzov |
// +----------------------------------------------------------------------+
//
-// $Id: Client.php,v 1.4 2004/03/23 13:35:37 avb Exp $
+// $Id$
require_once 'HTTP/Request.php';
require_once 'HTTP/Client/CookieManager.php';
@@ -29,7 +29,7 @@ require_once 'HTTP/Client/CookieManager.php';
*
* @package HTTP_Client
* @author Alexey Borzov
- * @version $Revision: 1.4 $
+ * @version $Revision$
*/
class HTTP_Client
{
diff --git a/thirdparty/pear/HTTP/Client/CookieManager.php b/thirdparty/pear/HTTP/Client/CookieManager.php
index 3b9abb2..407bdca 100644
--- a/thirdparty/pear/HTTP/Client/CookieManager.php
+++ b/thirdparty/pear/HTTP/Client/CookieManager.php
@@ -16,14 +16,14 @@
// | Author: Alexey Borzov |
// +----------------------------------------------------------------------+
//
-// $Id: CookieManager.php,v 1.3 2004/04/10 10:04:52 avb Exp $
+// $Id$
/**
* This class is used to store cookies and pass them between HTTP requests.
*
* @package HTTP_Client
* @author Alexey Borzov
- * @version $Revision: 1.3 $
+ * @version $Revision$
*/
class HTTP_Client_CookieManager
{
diff --git a/thirdparty/pear/HTTP/Download.php b/thirdparty/pear/HTTP/Download.php
index 51d496a..04e8c8d 100644
--- a/thirdparty/pear/HTTP/Download.php
+++ b/thirdparty/pear/HTTP/Download.php
@@ -1,1031 +1,1031 @@
-
- * @copyright 2003-2005 Michael Wallner
- * @license BSD, revised
- * @version CVS: $Id: Download.php,v 1.75 2005/11/13 19:18:53 mike Exp $
- * @link http://pear.php.net/package/HTTP_Download
- */
-
-// {{{ includes
-/**
- * Requires PEAR
- */
-require_once 'PEAR.php';
-
-/**
- * Requires HTTP_Header
- */
-require_once 'HTTP/Header.php';
-// }}}
-
-// {{{ constants
-/**#@+ Use with HTTP_Download::setContentDisposition() **/
-/**
- * Send data as attachment
- */
-define('HTTP_DOWNLOAD_ATTACHMENT', 'attachment');
-/**
- * Send data inline
- */
-define('HTTP_DOWNLOAD_INLINE', 'inline');
-/**#@-**/
-
-/**#@+ Use with HTTP_Download::sendArchive() **/
-/**
- * Send as uncompressed tar archive
- */
-define('HTTP_DOWNLOAD_TAR', 'TAR');
-/**
- * Send as gzipped tar archive
- */
-define('HTTP_DOWNLOAD_TGZ', 'TGZ');
-/**
- * Send as bzip2 compressed tar archive
- */
-define('HTTP_DOWNLOAD_BZ2', 'BZ2');
-/**
- * Send as zip archive
- */
-define('HTTP_DOWNLOAD_ZIP', 'ZIP');
-/**#@-**/
-
-/**#@+
- * Error constants
- */
-define('HTTP_DOWNLOAD_E_HEADERS_SENT', -1);
-define('HTTP_DOWNLOAD_E_NO_EXT_ZLIB', -2);
-define('HTTP_DOWNLOAD_E_NO_EXT_MMAGIC', -3);
-define('HTTP_DOWNLOAD_E_INVALID_FILE', -4);
-define('HTTP_DOWNLOAD_E_INVALID_PARAM', -5);
-define('HTTP_DOWNLOAD_E_INVALID_RESOURCE', -6);
-define('HTTP_DOWNLOAD_E_INVALID_REQUEST', -7);
-define('HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE', -8);
-define('HTTP_DOWNLOAD_E_INVALID_ARCHIVE_TYPE', -9);
-/**#@-**/
-// }}}
-
-/**
- * Send HTTP Downloads/Responses.
- *
- * With this package you can handle (hidden) downloads.
- * It supports partial downloads, resuming and sending
- * raw data ie. from database BLOBs.
- *
- * ATTENTION:
- * You shouldn't use this package together with ob_gzhandler or
- * zlib.output_compression enabled in your php.ini, especially
- * if you want to send already gzipped data!
- *
- * @access public
- * @version $Revision: 1.75 $
- */
-class HTTP_Download
-{
- // {{{ protected member variables
- /**
- * Path to file for download
- *
- * @see HTTP_Download::setFile()
- * @access protected
- * @var string
- */
- var $file = '';
-
- /**
- * Data for download
- *
- * @see HTTP_Download::setData()
- * @access protected
- * @var string
- */
- var $data = null;
-
- /**
- * Resource handle for download
- *
- * @see HTTP_Download::setResource()
- * @access protected
- * @var int
- */
- var $handle = null;
-
- /**
- * Whether to gzip the download
- *
- * @access protected
- * @var bool
- */
- var $gzip = false;
-
- /**
- * Whether to allow caching of the download on the clients side
- *
- * @access protected
- * @var bool
- */
- var $cache = true;
-
- /**
- * Size of download
- *
- * @access protected
- * @var int
- */
- var $size = 0;
-
- /**
- * Last modified
- *
- * @access protected
- * @var int
- */
- var $lastModified = 0;
-
- /**
- * HTTP headers
- *
- * @access protected
- * @var array
- */
- var $headers = array(
- 'Content-Type' => 'application/x-octetstream',
- 'Pragma' => 'cache',
- 'Cache-Control' => 'public, must-revalidate, max-age=0',
- 'Accept-Ranges' => 'bytes',
- 'X-Sent-By' => 'PEAR::HTTP::Download'
- );
-
- /**
- * HTTP_Header
- *
- * @access protected
- * @var object
- */
- var $HTTP = null;
-
- /**
- * ETag
- *
- * @access protected
- * @var string
- */
- var $etag = '';
-
- /**
- * Buffer Size
- *
- * @access protected
- * @var int
- */
- var $bufferSize = 2097152;
-
- /**
- * Throttle Delay
- *
- * @access protected
- * @var float
- */
- var $throttleDelay = 0;
-
- /**
- * Sent Bytes
- *
- * @access public
- * @var int
- */
- var $sentBytes = 0;
- // }}}
-
- // {{{ constructor
- /**
- * Constructor
- *
- * Set supplied parameters.
- *
- * @access public
- * @param array $params associative array of parameters
- *
- * one of:
- * o 'file' => path to file for download
- * o 'data' => raw data for download
- * o 'resource' => resource handle for download
- *
- * and any of:
- * o 'cache' => whether to allow cs caching
- * o 'gzip' => whether to gzip the download
- * o 'lastmodified' => unix timestamp
- * o 'contenttype' => content type of download
- * o 'contentdisposition' => content disposition
- * o 'buffersize' => amount of bytes to buffer
- * o 'throttledelay' => amount of secs to sleep
- * o 'cachecontrol' => cache privacy and validity
- *
- *
- * 'Content-Disposition' is not HTTP compliant, but most browsers
- * follow this header, so it was borrowed from MIME standard.
- *
- * It looks like this:
- * "Content-Disposition: attachment; filename=example.tgz".
- *
- * @see HTTP_Download::setContentDisposition()
- */
- function HTTP_Download($params = array())
- {
- $this->HTTP = &new HTTP_Header;
- $this->setParams($params);
- }
- // }}}
-
- // {{{ public methods
- /**
- * Set parameters
- *
- * Set supplied parameters through its accessor methods.
- *
- * @access public
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param array $params associative array of parameters
- *
- * @see HTTP_Download::HTTP_Download()
- */
- function setParams($params)
- {
- foreach((array) $params as $param => $value){
- $method = 'set'. $param;
-
- if (!method_exists($this, $method)) {
- return PEAR::raiseError(
- "Method '$method' doesn't exist.",
- HTTP_DOWNLOAD_E_INVALID_PARAM
- );
- }
-
- $e = call_user_func_array(array(&$this, $method), (array) $value);
-
- if (PEAR::isError($e)) {
- return $e;
- }
- }
- return true;
- }
-
- /**
- * Set path to file for download
- *
- * The Last-Modified header will be set to files filemtime(), actually.
- * Returns PEAR_Error (HTTP_DOWNLOAD_E_INVALID_FILE) if file doesn't exist.
- * Sends HTTP 404 status if $send_404 is set to true.
- *
- * @access public
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param string $file path to file for download
- * @param bool $send_404 whether to send HTTP/404 if
- * the file wasn't found
- */
- function setFile($file, $send_404 = true)
- {
- $file = realpath($file);
- if (!is_file($file)) {
- if ($send_404) {
- $this->HTTP->sendStatusCode(404);
- }
- return PEAR::raiseError(
- "File '$file' not found.",
- HTTP_DOWNLOAD_E_INVALID_FILE
- );
- }
- $this->setLastModified(filemtime($file));
- $this->file = $file;
- $this->size = filesize($file);
- return true;
- }
-
- /**
- * Set data for download
- *
- * Set $data to null if you want to unset this.
- *
- * @access public
- * @return void
- * @param $data raw data to send
- */
- function setData($data = null)
- {
- $this->data = $data;
- $this->size = strlen($data);
- }
-
- /**
- * Set resource for download
- *
- * The resource handle supplied will be closed after sending the download.
- * Returns a PEAR_Error (HTTP_DOWNLOAD_E_INVALID_RESOURCE) if $handle
- * is no valid resource. Set $handle to null if you want to unset this.
- *
- * @access public
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param int $handle resource handle
- */
- function setResource($handle = null)
- {
- if (!isset($handle)) {
- $this->handle = null;
- $this->size = 0;
- return true;
- }
-
- if (is_resource($handle)) {
- $this->handle = $handle;
- $filestats = fstat($handle);
- $this->size = $filestats['size'];
- return true;
- }
-
- return PEAR::raiseError(
- "Handle '$handle' is no valid resource.",
- HTTP_DOWNLOAD_E_INVALID_RESOURCE
- );
- }
-
- /**
- * Whether to gzip the download
- *
- * Returns a PEAR_Error (HTTP_DOWNLOAD_E_NO_EXT_ZLIB)
- * if ext/zlib is not available/loadable.
- *
- * @access public
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param bool $gzip whether to gzip the download
- */
- function setGzip($gzip = false)
- {
- if ($gzip && !PEAR::loadExtension('zlib')){
- return PEAR::raiseError(
- 'GZIP compression (ext/zlib) not available.',
- HTTP_DOWNLOAD_E_NO_EXT_ZLIB
- );
- }
- $this->gzip = (bool) $gzip;
- return true;
- }
-
- /**
- * Whether to allow caching
- *
- * If set to true (default) we'll send some headers that are commonly
- * used for caching purposes like ETag, Cache-Control and Last-Modified.
- *
- * If caching is disabled, we'll send the download no matter if it
- * would actually be cached at the client side.
- *
- * @access public
- * @return void
- * @param bool $cache whether to allow caching
- */
- function setCache($cache = true)
- {
- $this->cache = (bool) $cache;
- }
-
- /**
- * Whether to allow proxies to cache
- *
- * If set to 'private' proxies shouldn't cache the response.
- * This setting defaults to 'public' and affects only cached responses.
- *
- * @access public
- * @return bool
- * @param string $cache private or public
- * @param int $maxage maximum age of the client cache entry
- */
- function setCacheControl($cache = 'public', $maxage = 0)
- {
- switch ($cache = strToLower($cache))
- {
- case 'private':
- case 'public':
- $this->headers['Cache-Control'] =
- $cache .', must-revalidate, max-age='. abs($maxage);
- return true;
- break;
- }
- return false;
- }
-
- /**
- * Set ETag
- *
- * Sets a user-defined ETag for cache-validation. The ETag is usually
- * generated by HTTP_Download through its payload information.
- *
- * @access public
- * @return void
- * @param string $etag Entity tag used for strong cache validation.
- */
- function setETag($etag = null)
- {
- $this->etag = (string) $etag;
- }
-
- /**
- * Set Size of Buffer
- *
- * The amount of bytes specified as buffer size is the maximum amount
- * of data read at once from resources or files. The default size is 2M
- * (2097152 bytes). Be aware that if you enable gzip compression and
- * you set a very low buffer size that the actual file size may grow
- * due to added gzip headers for each sent chunk of the specified size.
- *
- * Returns PEAR_Error (HTTP_DOWNLOAD_E_INVALID_PARAM) if $size is not
- * greater than 0 bytes.
- *
- * @access public
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param int $bytes Amount of bytes to use as buffer.
- */
- function setBufferSize($bytes = 2097152)
- {
- if (0 >= $bytes) {
- return PEAR::raiseError(
- 'Buffer size must be greater than 0 bytes ('. $bytes .' given)',
- HTTP_DOWNLOAD_E_INVALID_PARAM);
- }
- $this->bufferSize = abs($bytes);
- return true;
- }
-
- /**
- * Set Throttle Delay
- *
- * Set the amount of seconds to sleep after each chunck that has been
- * sent. One can implement some sort of throttle through adjusting the
- * buffer size and the throttle delay. With the following settings
- * HTTP_Download will sleep a second after each 25 K of data sent.
- *
- *
- * Array(
- * 'throttledelay' => 1,
- * 'buffersize' => 1024 * 25,
- * )
- *
- *
- * Just be aware that if gzipp'ing is enabled, decreasing the chunk size
- * too much leads to proportionally increased network traffic due to added
- * gzip header and bottom bytes around each chunk.
- *
- * @access public
- * @return void
- * @param float $seconds Amount of seconds to sleep after each
- * chunk that has been sent.
- */
- function setThrottleDelay($seconds = 0)
- {
- $this->throttleDelay = abs($seconds) * 1000;
- }
-
- /**
- * Set "Last-Modified"
- *
- * This is usually determined by filemtime() in HTTP_Download::setFile()
- * If you set raw data for download with HTTP_Download::setData() and you
- * want do send an appropiate "Last-Modified" header, you should call this
- * method.
- *
- * @access public
- * @return void
- * @param int unix timestamp
- */
- function setLastModified($last_modified)
- {
- $this->lastModified = $this->headers['Last-Modified'] = (int) $last_modified;
- }
-
- /**
- * Set Content-Disposition header
- *
- * @see HTTP_Download::HTTP_Download
- *
- * @access public
- * @return void
- * @param string $disposition whether to send the download
- * inline or as attachment
- * @param string $file_name the filename to display in
- * the browser's download window
- *
- * Example:
- *
- * $HTTP_Download->setContentDisposition(
- * HTTP_DOWNLOAD_ATTACHMENT,
- * 'download.tgz'
- * );
- *
- */
- function setContentDisposition( $disposition = HTTP_DOWNLOAD_ATTACHMENT,
- $file_name = null)
- {
- $cd = $disposition;
- if (isset($file_name)) {
- $cd .= '; filename="' . $file_name . '"';
- } elseif ($this->file) {
- $cd .= '; filename="' . basename($this->file) . '"';
- }
- $this->headers['Content-Disposition'] = $cd;
- }
-
- /**
- * Set content type of the download
- *
- * Default content type of the download will be 'application/x-octetstream'.
- * Returns PEAR_Error (HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE) if
- * $content_type doesn't seem to be valid.
- *
- * @access public
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param string $content_type content type of file for download
- */
- function setContentType($content_type = 'application/x-octetstream')
- {
- if (!preg_match('/^[a-z]+\w*\/[a-z]+[\w.;= -]*$/', $content_type)) {
- return PEAR::raiseError(
- "Invalid content type '$content_type' supplied.",
- HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE
- );
- }
- $this->headers['Content-Type'] = $content_type;
- return true;
- }
-
- /**
- * Guess content type of file
- *
- * First we try to use PEAR::MIME_Type, if installed, to detect the content
- * type, else we check if ext/mime_magic is loaded and properly configured.
- *
- * Returns PEAR_Error if:
- * o if PEAR::MIME_Type failed to detect a proper content type
- * (HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE)
- * o ext/magic.mime is not installed, or not properly configured
- * (HTTP_DOWNLOAD_E_NO_EXT_MMAGIC)
- * o mime_content_type() couldn't guess content type or returned
- * a content type considered to be bogus by setContentType()
- * (HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE)
- *
- * @access public
- * @return mixed Returns true on success or PEAR_Error on failure.
- */
- function guessContentType()
- {
- if (class_exists('MIME_Type') || @include_once 'MIME/Type.php') {
- if (PEAR::isError($mime_type = MIME_Type::autoDetect($this->file))) {
- return PEAR::raiseError($mime_type->getMessage(),
- HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE);
- }
- return $this->setContentType($mime_type);
- }
- if (!function_exists('mime_content_type')) {
- return PEAR::raiseError(
- 'This feature requires ext/mime_magic!',
- HTTP_DOWNLOAD_E_NO_EXT_MMAGIC
- );
- }
- if (!is_file(ini_get('mime_magic.magicfile'))) {
- return PEAR::raiseError(
- 'ext/mime_magic is loaded but not properly configured!',
- HTTP_DOWNLOAD_E_NO_EXT_MMAGIC
- );
- }
- if (!$content_type = @mime_content_type($this->file)) {
- return PEAR::raiseError(
- 'Couldn\'t guess content type with mime_content_type().',
- HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE
- );
- }
- return $this->setContentType($content_type);
- }
-
- /**
- * Send
- *
- * Returns PEAR_Error if:
- * o HTTP headers were already sent (HTTP_DOWNLOAD_E_HEADERS_SENT)
- * o HTTP Range was invalid (HTTP_DOWNLOAD_E_INVALID_REQUEST)
- *
- * @access public
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param bool $autoSetContentDisposition Whether to set the
- * Content-Disposition header if it isn't already.
- */
- function send($autoSetContentDisposition = true)
- {
- if (headers_sent()) {
- return PEAR::raiseError(
- 'Headers already sent.',
- HTTP_DOWNLOAD_E_HEADERS_SENT
- );
- }
-
- if (!ini_get('safe_mode')) {
- @set_time_limit(0);
- }
-
- if ($autoSetContentDisposition &&
- !isset($this->headers['Content-Disposition'])) {
- $this->setContentDisposition();
- }
-
- if ($this->cache) {
- $this->headers['ETag'] = $this->generateETag();
- if ($this->isCached()) {
- $this->HTTP->sendStatusCode(304);
- $this->sendHeaders();
- return true;
- }
- } else {
- unset($this->headers['Last-Modified']);
- }
-
- while (@ob_end_clean());
-
- if ($this->gzip) {
- @ob_start('ob_gzhandler');
- } else {
- ob_start();
- }
-
- $this->sentBytes = 0;
-
- if ($this->isRangeRequest()) {
- $this->HTTP->sendStatusCode(206);
- $chunks = $this->getChunks();
- } else {
- $this->HTTP->sendStatusCode(200);
- $chunks = array(array(0, $this->size));
- if (!$this->gzip && count(ob_list_handlers()) < 2) {
- $this->headers['Content-Length'] = $this->size;
- }
- }
-
- if (PEAR::isError($e = $this->sendChunks($chunks))) {
- ob_end_clean();
- $this->HTTP->sendStatusCode(416);
- return $e;
- }
-
- ob_end_flush();
- flush();
- return true;
- }
-
- /**
- * Static send
- *
- * @see HTTP_Download::HTTP_Download()
- * @see HTTP_Download::send()
- *
- * @static
- * @access public
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param array $params associative array of parameters
- * @param bool $guess whether HTTP_Download::guessContentType()
- * should be called
- */
- function staticSend($params, $guess = false)
- {
- $d = &new HTTP_Download();
- $e = $d->setParams($params);
- if (PEAR::isError($e)) {
- return $e;
- }
- if ($guess) {
- $e = $d->guessContentType();
- if (PEAR::isError($e)) {
- return $e;
- }
- }
- return $d->send();
- }
-
- /**
- * Send a bunch of files or directories as an archive
- *
- * Example:
- *
- * require_once 'HTTP/Download.php';
- * HTTP_Download::sendArchive(
- * 'myArchive.tgz',
- * '/var/ftp/pub/mike',
- * HTTP_DOWNLOAD_TGZ,
- * '',
- * '/var/ftp/pub'
- * );
- *
- *
- * @see Archive_Tar::createModify()
- * @deprecated use HTTP_Download_Archive::send()
- * @static
- * @access public
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param string $name name the sent archive should have
- * @param mixed $files files/directories
- * @param string $type archive type
- * @param string $add_path path that should be prepended to the files
- * @param string $strip_path path that should be stripped from the files
- */
- function sendArchive( $name,
- $files,
- $type = HTTP_DOWNLOAD_TGZ,
- $add_path = '',
- $strip_path = '')
- {
- require_once 'HTTP/Download/Archive.php';
- return HTTP_Download_Archive::send($name, $files, $type,
- $add_path, $strip_path);
- }
- // }}}
-
- // {{{ protected methods
- /**
- * Generate ETag
- *
- * @access protected
- * @return string
- */
- function generateETag()
- {
- if (!$this->etag) {
- if ($this->data) {
- $md5 = md5($this->data);
- } else {
- $fst = is_resource($this->handle) ?
- fstat($this->handle) : stat($this->file);
- $md5 = md5($fst['mtime'] .'='. $fst['ino'] .'='. $fst['size']);
- }
- $this->etag = '"' . $md5 . '-' . crc32($md5) . '"';
- }
- return $this->etag;
- }
-
- /**
- * Send multiple chunks
- *
- * @access protected
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param array $chunks
- */
- function sendChunks($chunks)
- {
- if (count($chunks) == 1) {
- return $this->sendChunk(array_shift($chunks));
- }
-
- $bound = uniqid('HTTP_DOWNLOAD-', true);
- $cType = $this->headers['Content-Type'];
- $this->headers['Content-Type'] =
- 'multipart/byteranges; boundary=' . $bound;
- $this->sendHeaders();
- foreach ($chunks as $chunk){
- if (PEAR::isError($e = $this->sendChunk($chunk, $cType, $bound))) {
- return $e;
- }
- }
- #echo "\r\n--$bound--\r\n";
- return true;
- }
-
- /**
- * Send chunk of data
- *
- * @access protected
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param array $chunk start and end offset of the chunk to send
- * @param string $cType actual content type
- * @param string $bound boundary for multipart/byteranges
- */
- function sendChunk($chunk, $cType = null, $bound = null)
- {
- list($offset, $lastbyte) = $chunk;
- $length = ($lastbyte - $offset) + 1;
-
- if ($length < 1) {
- return PEAR::raiseError(
- "Error processing range request: $offset-$lastbyte/$length",
- HTTP_DOWNLOAD_E_INVALID_REQUEST
- );
- }
-
- $range = $offset . '-' . $lastbyte . '/' . $this->size;
-
- if (isset($cType, $bound)) {
- echo "\r\n--$bound\r\n",
- "Content-Type: $cType\r\n",
- "Content-Range: bytes $range\r\n\r\n";
- } else {
- if ($this->isRangeRequest()) {
- $this->headers['Content-Range'] = 'bytes '. $range;
- }
- $this->sendHeaders();
- }
-
- if ($this->data) {
- while (($length -= $this->bufferSize) > 0) {
- $this->flush(substr($this->data, $offset, $this->bufferSize));
- $this->throttleDelay and $this->sleep();
- $offset += $this->bufferSize;
- }
- if ($length) {
- $this->flush(substr($this->data, $offset, $this->bufferSize + $length));
- }
- } else {
- if (!is_resource($this->handle)) {
- $this->handle = fopen($this->file, 'rb');
- }
- fseek($this->handle, $offset);
- while (($length -= $this->bufferSize) > 0) {
- $this->flush(fread($this->handle, $this->bufferSize));
- $this->throttleDelay and $this->sleep();
- }
- if ($length) {
- $this->flush(fread($this->handle, $this->bufferSize + $length));
- }
- }
- return true;
- }
-
- /**
- * Get chunks to send
- *
- * @access protected
- * @return array
- */
- function getChunks()
- {
- $parts = array();
- foreach (explode(',', $this->getRanges()) as $chunk){
- list($o, $e) = explode('-', $chunk);
- if ($e >= $this->size || (empty($e) && $e !== 0 && $e !== '0')) {
- $e = $this->size - 1;
- }
- if (empty($o) && $o !== 0 && $o !== '0') {
- $o = $this->size - $e;
- $e = $this->size - 1;
- }
- $parts[] = array($o, $e);
- }
- return $parts;
- }
-
- /**
- * Check if range is requested
- *
- * @access protected
- * @return bool
- */
- function isRangeRequest()
- {
- if (!isset($_SERVER['HTTP_RANGE'])) {
- return false;
- }
- return $this->isValidRange();
- }
-
- /**
- * Get range request
- *
- * @access protected
- * @return array
- */
- function getRanges()
- {
- return preg_match('/^bytes=((\d*-\d*,? ?)+)$/',
- @$_SERVER['HTTP_RANGE'], $matches) ? $matches[1] : array();
- }
-
- /**
- * Check if entity is cached
- *
- * @access protected
- * @return bool
- */
- function isCached()
- {
- return (
- (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
- $this->lastModified == strtotime(current($a = explode(
- ';', $_SERVER['HTTP_IF_MODIFIED_SINCE'])))) ||
- (isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
- $this->compareAsterisk('HTTP_IF_NONE_MATCH', $this->etag))
- );
- }
-
- /**
- * Check if entity hasn't changed
- *
- * @access protected
- * @return bool
- */
- function isValidRange()
- {
- if (isset($_SERVER['HTTP_IF_MATCH']) &&
- !$this->compareAsterisk('HTTP_IF_MATCH', $this->etag)) {
- return false;
- }
- if (isset($_SERVER['HTTP_IF_RANGE']) &&
- $_SERVER['HTTP_IF_RANGE'] !== $this->etag &&
- strtotime($_SERVER['HTTP_IF_RANGE']) !== $this->lastModified) {
- return false;
- }
- if (isset($_SERVER['HTTP_IF_UNMODIFIED_SINCE'])) {
- $lm = array_shift(explode(';', $_SERVER['HTTP_IF_UNMODIFIED_SINCE']));
- if (strtotime($lm) !== $this->lastModified) {
- return false;
- }
- }
- if (isset($_SERVER['HTTP_UNLESS_MODIFIED_SINCE'])) {
- $lm = array_shift(explode(';', $_SERVER['HTTP_UNLESS_MODIFIED_SINCE']));
- if (strtotime($lm) !== $this->lastModified) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Compare against an asterisk or check for equality
- *
- * @access protected
- * @return bool
- * @param string key for the $_SERVER array
- * @param string string to compare
- */
- function compareAsterisk($svar, $compare)
- {
- foreach (array_map('trim', explode(',', $_SERVER[$svar])) as $request) {
- if ($request === '*' || $request === $compare) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Send HTTP headers
- *
- * @access protected
- * @return void
- */
- function sendHeaders()
- {
- foreach ($this->headers as $header => $value) {
- $this->HTTP->setHeader($header, $value);
- }
- $this->HTTP->sendHeaders();
- /* NSAPI won't output anything if we did this */
- if (strncasecmp(PHP_SAPI, 'nsapi', 5)) {
- ob_flush();
- flush();
- }
- }
-
- /**
- * Flush
- *
- * @access protected
- * @return void
- * @param string $data
- */
- function flush($data = '')
- {
- if ($dlen = strlen($data)) {
- $this->sentBytes += $dlen;
- echo $data;
- }
- ob_flush();
- flush();
- }
-
- /**
- * Sleep
- *
- * @access protected
- * @return void
- */
- function sleep()
- {
- if (OS_WINDOWS) {
- com_message_pump($this->throttleDelay);
- } else {
- usleep($this->throttleDelay * 1000);
- }
- }
- // }}}
-}
-?>
+
+ * @copyright 2003-2005 Michael Wallner
+ * @license BSD, revised
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTTP_Download
+ */
+
+// {{{ includes
+/**
+ * Requires PEAR
+ */
+require_once 'PEAR.php';
+
+/**
+ * Requires HTTP_Header
+ */
+require_once 'HTTP/Header.php';
+// }}}
+
+// {{{ constants
+/**#@+ Use with HTTP_Download::setContentDisposition() **/
+/**
+ * Send data as attachment
+ */
+define('HTTP_DOWNLOAD_ATTACHMENT', 'attachment');
+/**
+ * Send data inline
+ */
+define('HTTP_DOWNLOAD_INLINE', 'inline');
+/**#@-**/
+
+/**#@+ Use with HTTP_Download::sendArchive() **/
+/**
+ * Send as uncompressed tar archive
+ */
+define('HTTP_DOWNLOAD_TAR', 'TAR');
+/**
+ * Send as gzipped tar archive
+ */
+define('HTTP_DOWNLOAD_TGZ', 'TGZ');
+/**
+ * Send as bzip2 compressed tar archive
+ */
+define('HTTP_DOWNLOAD_BZ2', 'BZ2');
+/**
+ * Send as zip archive
+ */
+define('HTTP_DOWNLOAD_ZIP', 'ZIP');
+/**#@-**/
+
+/**#@+
+ * Error constants
+ */
+define('HTTP_DOWNLOAD_E_HEADERS_SENT', -1);
+define('HTTP_DOWNLOAD_E_NO_EXT_ZLIB', -2);
+define('HTTP_DOWNLOAD_E_NO_EXT_MMAGIC', -3);
+define('HTTP_DOWNLOAD_E_INVALID_FILE', -4);
+define('HTTP_DOWNLOAD_E_INVALID_PARAM', -5);
+define('HTTP_DOWNLOAD_E_INVALID_RESOURCE', -6);
+define('HTTP_DOWNLOAD_E_INVALID_REQUEST', -7);
+define('HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE', -8);
+define('HTTP_DOWNLOAD_E_INVALID_ARCHIVE_TYPE', -9);
+/**#@-**/
+// }}}
+
+/**
+ * Send HTTP Downloads/Responses.
+ *
+ * With this package you can handle (hidden) downloads.
+ * It supports partial downloads, resuming and sending
+ * raw data ie. from database BLOBs.
+ *
+ * ATTENTION:
+ * You shouldn't use this package together with ob_gzhandler or
+ * zlib.output_compression enabled in your php.ini, especially
+ * if you want to send already gzipped data!
+ *
+ * @access public
+ * @version $Revision$
+ */
+class HTTP_Download
+{
+ // {{{ protected member variables
+ /**
+ * Path to file for download
+ *
+ * @see HTTP_Download::setFile()
+ * @access protected
+ * @var string
+ */
+ var $file = '';
+
+ /**
+ * Data for download
+ *
+ * @see HTTP_Download::setData()
+ * @access protected
+ * @var string
+ */
+ var $data = null;
+
+ /**
+ * Resource handle for download
+ *
+ * @see HTTP_Download::setResource()
+ * @access protected
+ * @var int
+ */
+ var $handle = null;
+
+ /**
+ * Whether to gzip the download
+ *
+ * @access protected
+ * @var bool
+ */
+ var $gzip = false;
+
+ /**
+ * Whether to allow caching of the download on the clients side
+ *
+ * @access protected
+ * @var bool
+ */
+ var $cache = true;
+
+ /**
+ * Size of download
+ *
+ * @access protected
+ * @var int
+ */
+ var $size = 0;
+
+ /**
+ * Last modified
+ *
+ * @access protected
+ * @var int
+ */
+ var $lastModified = 0;
+
+ /**
+ * HTTP headers
+ *
+ * @access protected
+ * @var array
+ */
+ var $headers = array(
+ 'Content-Type' => 'application/x-octetstream',
+ 'Pragma' => 'cache',
+ 'Cache-Control' => 'public, must-revalidate, max-age=0',
+ 'Accept-Ranges' => 'bytes',
+ 'X-Sent-By' => 'PEAR::HTTP::Download'
+ );
+
+ /**
+ * HTTP_Header
+ *
+ * @access protected
+ * @var object
+ */
+ var $HTTP = null;
+
+ /**
+ * ETag
+ *
+ * @access protected
+ * @var string
+ */
+ var $etag = '';
+
+ /**
+ * Buffer Size
+ *
+ * @access protected
+ * @var int
+ */
+ var $bufferSize = 2097152;
+
+ /**
+ * Throttle Delay
+ *
+ * @access protected
+ * @var float
+ */
+ var $throttleDelay = 0;
+
+ /**
+ * Sent Bytes
+ *
+ * @access public
+ * @var int
+ */
+ var $sentBytes = 0;
+ // }}}
+
+ // {{{ constructor
+ /**
+ * Constructor
+ *
+ * Set supplied parameters.
+ *
+ * @access public
+ * @param array $params associative array of parameters
+ *
+ * one of:
+ * o 'file' => path to file for download
+ * o 'data' => raw data for download
+ * o 'resource' => resource handle for download
+ *
+ * and any of:
+ * o 'cache' => whether to allow cs caching
+ * o 'gzip' => whether to gzip the download
+ * o 'lastmodified' => unix timestamp
+ * o 'contenttype' => content type of download
+ * o 'contentdisposition' => content disposition
+ * o 'buffersize' => amount of bytes to buffer
+ * o 'throttledelay' => amount of secs to sleep
+ * o 'cachecontrol' => cache privacy and validity
+ *
+ *
+ * 'Content-Disposition' is not HTTP compliant, but most browsers
+ * follow this header, so it was borrowed from MIME standard.
+ *
+ * It looks like this:
+ * "Content-Disposition: attachment; filename=example.tgz".
+ *
+ * @see HTTP_Download::setContentDisposition()
+ */
+ function HTTP_Download($params = array())
+ {
+ $this->HTTP = &new HTTP_Header;
+ $this->setParams($params);
+ }
+ // }}}
+
+ // {{{ public methods
+ /**
+ * Set parameters
+ *
+ * Set supplied parameters through its accessor methods.
+ *
+ * @access public
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param array $params associative array of parameters
+ *
+ * @see HTTP_Download::HTTP_Download()
+ */
+ function setParams($params)
+ {
+ foreach((array) $params as $param => $value){
+ $method = 'set'. $param;
+
+ if (!method_exists($this, $method)) {
+ return PEAR::raiseError(
+ "Method '$method' doesn't exist.",
+ HTTP_DOWNLOAD_E_INVALID_PARAM
+ );
+ }
+
+ $e = call_user_func_array(array(&$this, $method), (array) $value);
+
+ if (PEAR::isError($e)) {
+ return $e;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Set path to file for download
+ *
+ * The Last-Modified header will be set to files filemtime(), actually.
+ * Returns PEAR_Error (HTTP_DOWNLOAD_E_INVALID_FILE) if file doesn't exist.
+ * Sends HTTP 404 status if $send_404 is set to true.
+ *
+ * @access public
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param string $file path to file for download
+ * @param bool $send_404 whether to send HTTP/404 if
+ * the file wasn't found
+ */
+ function setFile($file, $send_404 = true)
+ {
+ $file = realpath($file);
+ if (!is_file($file)) {
+ if ($send_404) {
+ $this->HTTP->sendStatusCode(404);
+ }
+ return PEAR::raiseError(
+ "File '$file' not found.",
+ HTTP_DOWNLOAD_E_INVALID_FILE
+ );
+ }
+ $this->setLastModified(filemtime($file));
+ $this->file = $file;
+ $this->size = filesize($file);
+ return true;
+ }
+
+ /**
+ * Set data for download
+ *
+ * Set $data to null if you want to unset this.
+ *
+ * @access public
+ * @return void
+ * @param $data raw data to send
+ */
+ function setData($data = null)
+ {
+ $this->data = $data;
+ $this->size = strlen($data);
+ }
+
+ /**
+ * Set resource for download
+ *
+ * The resource handle supplied will be closed after sending the download.
+ * Returns a PEAR_Error (HTTP_DOWNLOAD_E_INVALID_RESOURCE) if $handle
+ * is no valid resource. Set $handle to null if you want to unset this.
+ *
+ * @access public
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param int $handle resource handle
+ */
+ function setResource($handle = null)
+ {
+ if (!isset($handle)) {
+ $this->handle = null;
+ $this->size = 0;
+ return true;
+ }
+
+ if (is_resource($handle)) {
+ $this->handle = $handle;
+ $filestats = fstat($handle);
+ $this->size = $filestats['size'];
+ return true;
+ }
+
+ return PEAR::raiseError(
+ "Handle '$handle' is no valid resource.",
+ HTTP_DOWNLOAD_E_INVALID_RESOURCE
+ );
+ }
+
+ /**
+ * Whether to gzip the download
+ *
+ * Returns a PEAR_Error (HTTP_DOWNLOAD_E_NO_EXT_ZLIB)
+ * if ext/zlib is not available/loadable.
+ *
+ * @access public
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param bool $gzip whether to gzip the download
+ */
+ function setGzip($gzip = false)
+ {
+ if ($gzip && !PEAR::loadExtension('zlib')){
+ return PEAR::raiseError(
+ 'GZIP compression (ext/zlib) not available.',
+ HTTP_DOWNLOAD_E_NO_EXT_ZLIB
+ );
+ }
+ $this->gzip = (bool) $gzip;
+ return true;
+ }
+
+ /**
+ * Whether to allow caching
+ *
+ * If set to true (default) we'll send some headers that are commonly
+ * used for caching purposes like ETag, Cache-Control and Last-Modified.
+ *
+ * If caching is disabled, we'll send the download no matter if it
+ * would actually be cached at the client side.
+ *
+ * @access public
+ * @return void
+ * @param bool $cache whether to allow caching
+ */
+ function setCache($cache = true)
+ {
+ $this->cache = (bool) $cache;
+ }
+
+ /**
+ * Whether to allow proxies to cache
+ *
+ * If set to 'private' proxies shouldn't cache the response.
+ * This setting defaults to 'public' and affects only cached responses.
+ *
+ * @access public
+ * @return bool
+ * @param string $cache private or public
+ * @param int $maxage maximum age of the client cache entry
+ */
+ function setCacheControl($cache = 'public', $maxage = 0)
+ {
+ switch ($cache = strToLower($cache))
+ {
+ case 'private':
+ case 'public':
+ $this->headers['Cache-Control'] =
+ $cache .', must-revalidate, max-age='. abs($maxage);
+ return true;
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * Set ETag
+ *
+ * Sets a user-defined ETag for cache-validation. The ETag is usually
+ * generated by HTTP_Download through its payload information.
+ *
+ * @access public
+ * @return void
+ * @param string $etag Entity tag used for strong cache validation.
+ */
+ function setETag($etag = null)
+ {
+ $this->etag = (string) $etag;
+ }
+
+ /**
+ * Set Size of Buffer
+ *
+ * The amount of bytes specified as buffer size is the maximum amount
+ * of data read at once from resources or files. The default size is 2M
+ * (2097152 bytes). Be aware that if you enable gzip compression and
+ * you set a very low buffer size that the actual file size may grow
+ * due to added gzip headers for each sent chunk of the specified size.
+ *
+ * Returns PEAR_Error (HTTP_DOWNLOAD_E_INVALID_PARAM) if $size is not
+ * greater than 0 bytes.
+ *
+ * @access public
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param int $bytes Amount of bytes to use as buffer.
+ */
+ function setBufferSize($bytes = 2097152)
+ {
+ if (0 >= $bytes) {
+ return PEAR::raiseError(
+ 'Buffer size must be greater than 0 bytes ('. $bytes .' given)',
+ HTTP_DOWNLOAD_E_INVALID_PARAM);
+ }
+ $this->bufferSize = abs($bytes);
+ return true;
+ }
+
+ /**
+ * Set Throttle Delay
+ *
+ * Set the amount of seconds to sleep after each chunck that has been
+ * sent. One can implement some sort of throttle through adjusting the
+ * buffer size and the throttle delay. With the following settings
+ * HTTP_Download will sleep a second after each 25 K of data sent.
+ *
+ *
+ * Array(
+ * 'throttledelay' => 1,
+ * 'buffersize' => 1024 * 25,
+ * )
+ *
+ *
+ * Just be aware that if gzipp'ing is enabled, decreasing the chunk size
+ * too much leads to proportionally increased network traffic due to added
+ * gzip header and bottom bytes around each chunk.
+ *
+ * @access public
+ * @return void
+ * @param float $seconds Amount of seconds to sleep after each
+ * chunk that has been sent.
+ */
+ function setThrottleDelay($seconds = 0)
+ {
+ $this->throttleDelay = abs($seconds) * 1000;
+ }
+
+ /**
+ * Set "Last-Modified"
+ *
+ * This is usually determined by filemtime() in HTTP_Download::setFile()
+ * If you set raw data for download with HTTP_Download::setData() and you
+ * want do send an appropiate "Last-Modified" header, you should call this
+ * method.
+ *
+ * @access public
+ * @return void
+ * @param int unix timestamp
+ */
+ function setLastModified($last_modified)
+ {
+ $this->lastModified = $this->headers['Last-Modified'] = (int) $last_modified;
+ }
+
+ /**
+ * Set Content-Disposition header
+ *
+ * @see HTTP_Download::HTTP_Download
+ *
+ * @access public
+ * @return void
+ * @param string $disposition whether to send the download
+ * inline or as attachment
+ * @param string $file_name the filename to display in
+ * the browser's download window
+ *
+ * Example:
+ *
+ * $HTTP_Download->setContentDisposition(
+ * HTTP_DOWNLOAD_ATTACHMENT,
+ * 'download.tgz'
+ * );
+ *
+ */
+ function setContentDisposition( $disposition = HTTP_DOWNLOAD_ATTACHMENT,
+ $file_name = null)
+ {
+ $cd = $disposition;
+ if (isset($file_name)) {
+ $cd .= '; filename="' . $file_name . '"';
+ } elseif ($this->file) {
+ $cd .= '; filename="' . basename($this->file) . '"';
+ }
+ $this->headers['Content-Disposition'] = $cd;
+ }
+
+ /**
+ * Set content type of the download
+ *
+ * Default content type of the download will be 'application/x-octetstream'.
+ * Returns PEAR_Error (HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE) if
+ * $content_type doesn't seem to be valid.
+ *
+ * @access public
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param string $content_type content type of file for download
+ */
+ function setContentType($content_type = 'application/x-octetstream')
+ {
+ if (!preg_match('/^[a-z]+\w*\/[a-z]+[\w.;= -]*$/', $content_type)) {
+ return PEAR::raiseError(
+ "Invalid content type '$content_type' supplied.",
+ HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE
+ );
+ }
+ $this->headers['Content-Type'] = $content_type;
+ return true;
+ }
+
+ /**
+ * Guess content type of file
+ *
+ * First we try to use PEAR::MIME_Type, if installed, to detect the content
+ * type, else we check if ext/mime_magic is loaded and properly configured.
+ *
+ * Returns PEAR_Error if:
+ * o if PEAR::MIME_Type failed to detect a proper content type
+ * (HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE)
+ * o ext/magic.mime is not installed, or not properly configured
+ * (HTTP_DOWNLOAD_E_NO_EXT_MMAGIC)
+ * o mime_content_type() couldn't guess content type or returned
+ * a content type considered to be bogus by setContentType()
+ * (HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE)
+ *
+ * @access public
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ */
+ function guessContentType()
+ {
+ if (class_exists('MIME_Type') || @include_once 'MIME/Type.php') {
+ if (PEAR::isError($mime_type = MIME_Type::autoDetect($this->file))) {
+ return PEAR::raiseError($mime_type->getMessage(),
+ HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE);
+ }
+ return $this->setContentType($mime_type);
+ }
+ if (!function_exists('mime_content_type')) {
+ return PEAR::raiseError(
+ 'This feature requires ext/mime_magic!',
+ HTTP_DOWNLOAD_E_NO_EXT_MMAGIC
+ );
+ }
+ if (!is_file(ini_get('mime_magic.magicfile'))) {
+ return PEAR::raiseError(
+ 'ext/mime_magic is loaded but not properly configured!',
+ HTTP_DOWNLOAD_E_NO_EXT_MMAGIC
+ );
+ }
+ if (!$content_type = @mime_content_type($this->file)) {
+ return PEAR::raiseError(
+ 'Couldn\'t guess content type with mime_content_type().',
+ HTTP_DOWNLOAD_E_INVALID_CONTENT_TYPE
+ );
+ }
+ return $this->setContentType($content_type);
+ }
+
+ /**
+ * Send
+ *
+ * Returns PEAR_Error if:
+ * o HTTP headers were already sent (HTTP_DOWNLOAD_E_HEADERS_SENT)
+ * o HTTP Range was invalid (HTTP_DOWNLOAD_E_INVALID_REQUEST)
+ *
+ * @access public
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param bool $autoSetContentDisposition Whether to set the
+ * Content-Disposition header if it isn't already.
+ */
+ function send($autoSetContentDisposition = true)
+ {
+ if (headers_sent()) {
+ return PEAR::raiseError(
+ 'Headers already sent.',
+ HTTP_DOWNLOAD_E_HEADERS_SENT
+ );
+ }
+
+ if (!ini_get('safe_mode')) {
+ @set_time_limit(0);
+ }
+
+ if ($autoSetContentDisposition &&
+ !isset($this->headers['Content-Disposition'])) {
+ $this->setContentDisposition();
+ }
+
+ if ($this->cache) {
+ $this->headers['ETag'] = $this->generateETag();
+ if ($this->isCached()) {
+ $this->HTTP->sendStatusCode(304);
+ $this->sendHeaders();
+ return true;
+ }
+ } else {
+ unset($this->headers['Last-Modified']);
+ }
+
+ while (@ob_end_clean());
+
+ if ($this->gzip) {
+ @ob_start('ob_gzhandler');
+ } else {
+ ob_start();
+ }
+
+ $this->sentBytes = 0;
+
+ if ($this->isRangeRequest()) {
+ $this->HTTP->sendStatusCode(206);
+ $chunks = $this->getChunks();
+ } else {
+ $this->HTTP->sendStatusCode(200);
+ $chunks = array(array(0, $this->size));
+ if (!$this->gzip && count(ob_list_handlers()) < 2) {
+ $this->headers['Content-Length'] = $this->size;
+ }
+ }
+
+ if (PEAR::isError($e = $this->sendChunks($chunks))) {
+ ob_end_clean();
+ $this->HTTP->sendStatusCode(416);
+ return $e;
+ }
+
+ ob_end_flush();
+ flush();
+ return true;
+ }
+
+ /**
+ * Static send
+ *
+ * @see HTTP_Download::HTTP_Download()
+ * @see HTTP_Download::send()
+ *
+ * @static
+ * @access public
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param array $params associative array of parameters
+ * @param bool $guess whether HTTP_Download::guessContentType()
+ * should be called
+ */
+ function staticSend($params, $guess = false)
+ {
+ $d = &new HTTP_Download();
+ $e = $d->setParams($params);
+ if (PEAR::isError($e)) {
+ return $e;
+ }
+ if ($guess) {
+ $e = $d->guessContentType();
+ if (PEAR::isError($e)) {
+ return $e;
+ }
+ }
+ return $d->send();
+ }
+
+ /**
+ * Send a bunch of files or directories as an archive
+ *
+ * Example:
+ *
+ * require_once 'HTTP/Download.php';
+ * HTTP_Download::sendArchive(
+ * 'myArchive.tgz',
+ * '/var/ftp/pub/mike',
+ * HTTP_DOWNLOAD_TGZ,
+ * '',
+ * '/var/ftp/pub'
+ * );
+ *
+ *
+ * @see Archive_Tar::createModify()
+ * @deprecated use HTTP_Download_Archive::send()
+ * @static
+ * @access public
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param string $name name the sent archive should have
+ * @param mixed $files files/directories
+ * @param string $type archive type
+ * @param string $add_path path that should be prepended to the files
+ * @param string $strip_path path that should be stripped from the files
+ */
+ function sendArchive( $name,
+ $files,
+ $type = HTTP_DOWNLOAD_TGZ,
+ $add_path = '',
+ $strip_path = '')
+ {
+ require_once 'HTTP/Download/Archive.php';
+ return HTTP_Download_Archive::send($name, $files, $type,
+ $add_path, $strip_path);
+ }
+ // }}}
+
+ // {{{ protected methods
+ /**
+ * Generate ETag
+ *
+ * @access protected
+ * @return string
+ */
+ function generateETag()
+ {
+ if (!$this->etag) {
+ if ($this->data) {
+ $md5 = md5($this->data);
+ } else {
+ $fst = is_resource($this->handle) ?
+ fstat($this->handle) : stat($this->file);
+ $md5 = md5($fst['mtime'] .'='. $fst['ino'] .'='. $fst['size']);
+ }
+ $this->etag = '"' . $md5 . '-' . crc32($md5) . '"';
+ }
+ return $this->etag;
+ }
+
+ /**
+ * Send multiple chunks
+ *
+ * @access protected
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param array $chunks
+ */
+ function sendChunks($chunks)
+ {
+ if (count($chunks) == 1) {
+ return $this->sendChunk(array_shift($chunks));
+ }
+
+ $bound = uniqid('HTTP_DOWNLOAD-', true);
+ $cType = $this->headers['Content-Type'];
+ $this->headers['Content-Type'] =
+ 'multipart/byteranges; boundary=' . $bound;
+ $this->sendHeaders();
+ foreach ($chunks as $chunk){
+ if (PEAR::isError($e = $this->sendChunk($chunk, $cType, $bound))) {
+ return $e;
+ }
+ }
+ #echo "\r\n--$bound--\r\n";
+ return true;
+ }
+
+ /**
+ * Send chunk of data
+ *
+ * @access protected
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param array $chunk start and end offset of the chunk to send
+ * @param string $cType actual content type
+ * @param string $bound boundary for multipart/byteranges
+ */
+ function sendChunk($chunk, $cType = null, $bound = null)
+ {
+ list($offset, $lastbyte) = $chunk;
+ $length = ($lastbyte - $offset) + 1;
+
+ if ($length < 1) {
+ return PEAR::raiseError(
+ "Error processing range request: $offset-$lastbyte/$length",
+ HTTP_DOWNLOAD_E_INVALID_REQUEST
+ );
+ }
+
+ $range = $offset . '-' . $lastbyte . '/' . $this->size;
+
+ if (isset($cType, $bound)) {
+ echo "\r\n--$bound\r\n",
+ "Content-Type: $cType\r\n",
+ "Content-Range: bytes $range\r\n\r\n";
+ } else {
+ if ($this->isRangeRequest()) {
+ $this->headers['Content-Range'] = 'bytes '. $range;
+ }
+ $this->sendHeaders();
+ }
+
+ if ($this->data) {
+ while (($length -= $this->bufferSize) > 0) {
+ $this->flush(substr($this->data, $offset, $this->bufferSize));
+ $this->throttleDelay and $this->sleep();
+ $offset += $this->bufferSize;
+ }
+ if ($length) {
+ $this->flush(substr($this->data, $offset, $this->bufferSize + $length));
+ }
+ } else {
+ if (!is_resource($this->handle)) {
+ $this->handle = fopen($this->file, 'rb');
+ }
+ fseek($this->handle, $offset);
+ while (($length -= $this->bufferSize) > 0) {
+ $this->flush(fread($this->handle, $this->bufferSize));
+ $this->throttleDelay and $this->sleep();
+ }
+ if ($length) {
+ $this->flush(fread($this->handle, $this->bufferSize + $length));
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Get chunks to send
+ *
+ * @access protected
+ * @return array
+ */
+ function getChunks()
+ {
+ $parts = array();
+ foreach (explode(',', $this->getRanges()) as $chunk){
+ list($o, $e) = explode('-', $chunk);
+ if ($e >= $this->size || (empty($e) && $e !== 0 && $e !== '0')) {
+ $e = $this->size - 1;
+ }
+ if (empty($o) && $o !== 0 && $o !== '0') {
+ $o = $this->size - $e;
+ $e = $this->size - 1;
+ }
+ $parts[] = array($o, $e);
+ }
+ return $parts;
+ }
+
+ /**
+ * Check if range is requested
+ *
+ * @access protected
+ * @return bool
+ */
+ function isRangeRequest()
+ {
+ if (!isset($_SERVER['HTTP_RANGE'])) {
+ return false;
+ }
+ return $this->isValidRange();
+ }
+
+ /**
+ * Get range request
+ *
+ * @access protected
+ * @return array
+ */
+ function getRanges()
+ {
+ return preg_match('/^bytes=((\d*-\d*,? ?)+)$/',
+ @$_SERVER['HTTP_RANGE'], $matches) ? $matches[1] : array();
+ }
+
+ /**
+ * Check if entity is cached
+ *
+ * @access protected
+ * @return bool
+ */
+ function isCached()
+ {
+ return (
+ (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
+ $this->lastModified == strtotime(current($a = explode(
+ ';', $_SERVER['HTTP_IF_MODIFIED_SINCE'])))) ||
+ (isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
+ $this->compareAsterisk('HTTP_IF_NONE_MATCH', $this->etag))
+ );
+ }
+
+ /**
+ * Check if entity hasn't changed
+ *
+ * @access protected
+ * @return bool
+ */
+ function isValidRange()
+ {
+ if (isset($_SERVER['HTTP_IF_MATCH']) &&
+ !$this->compareAsterisk('HTTP_IF_MATCH', $this->etag)) {
+ return false;
+ }
+ if (isset($_SERVER['HTTP_IF_RANGE']) &&
+ $_SERVER['HTTP_IF_RANGE'] !== $this->etag &&
+ strtotime($_SERVER['HTTP_IF_RANGE']) !== $this->lastModified) {
+ return false;
+ }
+ if (isset($_SERVER['HTTP_IF_UNMODIFIED_SINCE'])) {
+ $lm = array_shift(explode(';', $_SERVER['HTTP_IF_UNMODIFIED_SINCE']));
+ if (strtotime($lm) !== $this->lastModified) {
+ return false;
+ }
+ }
+ if (isset($_SERVER['HTTP_UNLESS_MODIFIED_SINCE'])) {
+ $lm = array_shift(explode(';', $_SERVER['HTTP_UNLESS_MODIFIED_SINCE']));
+ if (strtotime($lm) !== $this->lastModified) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Compare against an asterisk or check for equality
+ *
+ * @access protected
+ * @return bool
+ * @param string key for the $_SERVER array
+ * @param string string to compare
+ */
+ function compareAsterisk($svar, $compare)
+ {
+ foreach (array_map('trim', explode(',', $_SERVER[$svar])) as $request) {
+ if ($request === '*' || $request === $compare) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Send HTTP headers
+ *
+ * @access protected
+ * @return void
+ */
+ function sendHeaders()
+ {
+ foreach ($this->headers as $header => $value) {
+ $this->HTTP->setHeader($header, $value);
+ }
+ $this->HTTP->sendHeaders();
+ /* NSAPI won't output anything if we did this */
+ if (strncasecmp(PHP_SAPI, 'nsapi', 5)) {
+ ob_flush();
+ flush();
+ }
+ }
+
+ /**
+ * Flush
+ *
+ * @access protected
+ * @return void
+ * @param string $data
+ */
+ function flush($data = '')
+ {
+ if ($dlen = strlen($data)) {
+ $this->sentBytes += $dlen;
+ echo $data;
+ }
+ ob_flush();
+ flush();
+ }
+
+ /**
+ * Sleep
+ *
+ * @access protected
+ * @return void
+ */
+ function sleep()
+ {
+ if (OS_WINDOWS) {
+ com_message_pump($this->throttleDelay);
+ } else {
+ usleep($this->throttleDelay * 1000);
+ }
+ }
+ // }}}
+}
+?>
diff --git a/thirdparty/pear/HTTP/Download/Archive.php b/thirdparty/pear/HTTP/Download/Archive.php
index 2aa5b8b..c3745fe 100644
--- a/thirdparty/pear/HTTP/Download/Archive.php
+++ b/thirdparty/pear/HTTP/Download/Archive.php
@@ -1,122 +1,122 @@
-
- * @copyright 2003-2005 Michael Wallner
- * @license BSD, revisewd
- * @version CVS: $Id: Archive.php,v 1.4 2005/11/13 19:18:55 mike Exp $
- * @link http://pear.php.net/package/HTTP_Download
- */
-
-/**
- * Requires HTTP_Download
- */
-require_once 'HTTP/Download.php';
-
-/**
- * Requires System
- */
-require_once 'System.php';
-
-/**
- * HTTP_Download_Archive
- *
- * Helper class for sending Archives.
- *
- * @access public
- * @version $Revision: 1.4 $
- */
-class HTTP_Download_Archive
-{
- /**
- * Send a bunch of files or directories as an archive
- *
- * Example:
- *
- * require_once 'HTTP/Download/Archive.php';
- * HTTP_Download_Archive::send(
- * 'myArchive.tgz',
- * '/var/ftp/pub/mike',
- * HTTP_DOWNLOAD_BZ2,
- * '',
- * '/var/ftp/pub'
- * );
- *
- *
- * @see Archive_Tar::createModify()
- * @static
- * @access public
- * @return mixed Returns true on success or PEAR_Error on failure.
- * @param string $name name the sent archive should have
- * @param mixed $files files/directories
- * @param string $type archive type
- * @param string $add_path path that should be prepended to the files
- * @param string $strip_path path that should be stripped from the files
- */
- function send($name, $files, $type = HTTP_DOWNLOAD_TGZ, $add_path = '', $strip_path = '')
- {
- $tmp = System::mktemp();
-
- switch ($type = strToUpper($type))
- {
- case HTTP_DOWNLOAD_TAR:
- include_once 'Archive/Tar.php';
- $arc = &new Archive_Tar($tmp);
- $content_type = 'x-tar';
- break;
-
- case HTTP_DOWNLOAD_TGZ:
- include_once 'Archive/Tar.php';
- $arc = &new Archive_Tar($tmp, 'gz');
- $content_type = 'x-gzip';
- break;
-
- case HTTP_DOWNLOAD_BZ2:
- include_once 'Archive/Tar.php';
- $arc = &new Archive_Tar($tmp, 'bz2');
- $content_type = 'x-bzip2';
- break;
-
- case HTTP_DOWNLOAD_ZIP:
- include_once 'Archive/Zip.php';
- $arc = &new Archive_Zip($tmp);
- $content_type = 'x-zip';
- break;
-
- default:
- return PEAR::raiseError(
- 'Archive type not supported: ' . $type,
- HTTP_DOWNLOAD_E_INVALID_ARCHIVE_TYPE
- );
- }
-
- if ($type == HTTP_DOWNLOAD_ZIP) {
- $options = array( 'add_path' => $add_path,
- 'remove_path' => $strip_path);
- if (!$arc->create($files, $options)) {
- return PEAR::raiseError('Archive creation failed.');
- }
- } else {
- if (!$e = $arc->createModify($files, $add_path, $strip_path)) {
- return PEAR::raiseError('Archive creation failed.');
- }
- if (PEAR::isError($e)) {
- return $e;
- }
- }
- unset($arc);
-
- $dl = &new HTTP_Download(array('file' => $tmp));
- $dl->setContentType('application/' . $content_type);
- $dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, $name);
- return $dl->send();
- }
-}
-?>
+
+ * @copyright 2003-2005 Michael Wallner
+ * @license BSD, revisewd
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTTP_Download
+ */
+
+/**
+ * Requires HTTP_Download
+ */
+require_once 'HTTP/Download.php';
+
+/**
+ * Requires System
+ */
+require_once 'System.php';
+
+/**
+ * HTTP_Download_Archive
+ *
+ * Helper class for sending Archives.
+ *
+ * @access public
+ * @version $Revision$
+ */
+class HTTP_Download_Archive
+{
+ /**
+ * Send a bunch of files or directories as an archive
+ *
+ * Example:
+ *
+ * require_once 'HTTP/Download/Archive.php';
+ * HTTP_Download_Archive::send(
+ * 'myArchive.tgz',
+ * '/var/ftp/pub/mike',
+ * HTTP_DOWNLOAD_BZ2,
+ * '',
+ * '/var/ftp/pub'
+ * );
+ *
+ *
+ * @see Archive_Tar::createModify()
+ * @static
+ * @access public
+ * @return mixed Returns true on success or PEAR_Error on failure.
+ * @param string $name name the sent archive should have
+ * @param mixed $files files/directories
+ * @param string $type archive type
+ * @param string $add_path path that should be prepended to the files
+ * @param string $strip_path path that should be stripped from the files
+ */
+ function send($name, $files, $type = HTTP_DOWNLOAD_TGZ, $add_path = '', $strip_path = '')
+ {
+ $tmp = System::mktemp();
+
+ switch ($type = strToUpper($type))
+ {
+ case HTTP_DOWNLOAD_TAR:
+ include_once 'Archive/Tar.php';
+ $arc = &new Archive_Tar($tmp);
+ $content_type = 'x-tar';
+ break;
+
+ case HTTP_DOWNLOAD_TGZ:
+ include_once 'Archive/Tar.php';
+ $arc = &new Archive_Tar($tmp, 'gz');
+ $content_type = 'x-gzip';
+ break;
+
+ case HTTP_DOWNLOAD_BZ2:
+ include_once 'Archive/Tar.php';
+ $arc = &new Archive_Tar($tmp, 'bz2');
+ $content_type = 'x-bzip2';
+ break;
+
+ case HTTP_DOWNLOAD_ZIP:
+ include_once 'Archive/Zip.php';
+ $arc = &new Archive_Zip($tmp);
+ $content_type = 'x-zip';
+ break;
+
+ default:
+ return PEAR::raiseError(
+ 'Archive type not supported: ' . $type,
+ HTTP_DOWNLOAD_E_INVALID_ARCHIVE_TYPE
+ );
+ }
+
+ if ($type == HTTP_DOWNLOAD_ZIP) {
+ $options = array( 'add_path' => $add_path,
+ 'remove_path' => $strip_path);
+ if (!$arc->create($files, $options)) {
+ return PEAR::raiseError('Archive creation failed.');
+ }
+ } else {
+ if (!$e = $arc->createModify($files, $add_path, $strip_path)) {
+ return PEAR::raiseError('Archive creation failed.');
+ }
+ if (PEAR::isError($e)) {
+ return $e;
+ }
+ }
+ unset($arc);
+
+ $dl = &new HTTP_Download(array('file' => $tmp));
+ $dl->setContentType('application/' . $content_type);
+ $dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, $name);
+ return $dl->send();
+ }
+}
+?>
diff --git a/thirdparty/pear/HTTP/Download/PgLOB.php b/thirdparty/pear/HTTP/Download/PgLOB.php
index 19de2bc..bb97bf3 100644
--- a/thirdparty/pear/HTTP/Download/PgLOB.php
+++ b/thirdparty/pear/HTTP/Download/PgLOB.php
@@ -1,177 +1,177 @@
-
- * @copyright 2003-2005 Michael Wallner
- * @license BSD, revised
- * @version CVS: $Id: PgLOB.php,v 1.14 2005/11/13 19:18:55 mike Exp $
- * @link http://pear.php.net/package/HTTP_Download
- */
-
-$GLOBALS['_HTTP_Download_PgLOB_Connection'] = null;
-stream_register_wrapper('pglob', 'HTTP_Download_PgLOB');
-
-/**
- * PgSQL large object stream interface for HTTP_Download
- *
- * Usage:
- *
- * require_once 'HTTP/Download.php';
- * require_once 'HTTP/Download/PgLOB.php';
- * $db = &DB::connect('pgsql://user:pass@host/db');
- * // or $db = pg_connect(...);
- * $lo = HTTP_Download_PgLOB::open($db, 12345);
- * $dl = &new HTTP_Download;
- * $dl->setResource($lo);
- * $dl->send()
- *
- *
- * @access public
- * @version $Revision: 1.14 $
- */
-class HTTP_Download_PgLOB
-{
- /**
- * Set Connection
- *
- * @static
- * @access public
- * @return bool
- * @param mixed $conn
- */
- function setConnection($conn)
- {
- if (is_a($conn, 'DB_Common')) {
- $conn = $conn->dbh;
- } elseif ( is_a($conn, 'MDB_Common') ||
- is_a($conn, 'MDB2_Driver_Common')) {
- $conn = $conn->connection;
- }
- if ($isResource = is_resource($conn)) {
- $GLOBALS['_HTTP_Download_PgLOB_Connection'] = $conn;
- }
- return $isResource;
- }
-
- /**
- * Get Connection
- *
- * @static
- * @access public
- * @return resource
- */
- function getConnection()
- {
- if (is_resource($GLOBALS['_HTTP_Download_PgLOB_Connection'])) {
- return $GLOBALS['_HTTP_Download_PgLOB_Connection'];
- }
- return null;
- }
-
- /**
- * Open
- *
- * @static
- * @access public
- * @return resource
- * @param mixed $conn
- * @param int $loid
- * @param string $mode
- */
- function open($conn, $loid, $mode = 'rb')
- {
- HTTP_Download_PgLOB::setConnection($conn);
- return fopen('pglob:///'. $loid, $mode);
- }
-
- /**#@+
- * Stream Interface Implementation
- * @internal
- */
- var $ID = 0;
- var $size = 0;
- var $conn = null;
- var $handle = null;
-
- function stream_open($path, $mode)
- {
- if (!$this->conn = HTTP_Download_PgLOB::getConnection()) {
- return false;
- }
- if (!preg_match('/(\d+)/', $path, $matches)) {
- return false;
- }
- $this->ID = $matches[1];
-
- if (!pg_query($this->conn, 'BEGIN')) {
- return false;
- }
-
- $this->handle = pg_lo_open($this->conn, $this->ID, $mode);
- if (!is_resource($this->handle)) {
- return false;
- }
-
- // fetch size of lob
- pg_lo_seek($this->handle, 0, PGSQL_SEEK_END);
- $this->size = (int) pg_lo_tell($this->handle);
- pg_lo_seek($this->handle, 0, PGSQL_SEEK_SET);
-
- return true;
- }
-
- function stream_read($length)
- {
- return pg_lo_read($this->handle, $length);
- }
-
- function stream_seek($offset, $whence = SEEK_SET)
- {
- return pg_lo_seek($this->handle, $offset, $whence);
- }
-
- function stream_tell()
- {
- return pg_lo_tell($this->handle);
- }
-
- function stream_eof()
- {
- return pg_lo_tell($this->handle) >= $this->size;
- }
-
- function stream_flush()
- {
- return true;
- }
-
- function stream_stat()
- {
- return array('size' => $this->size, 'ino' => $this->ID);
- }
-
- function stream_write($data)
- {
- return pg_lo_write($this->handle, $data);
- }
-
- function stream_close()
- {
- if (pg_lo_close($this->handle)) {
- return pg_query($this->conn, 'COMMIT');
- } else {
- pg_query($this->conn ,'ROLLBACK');
- return false;
- }
- }
- /**#@-*/
-}
-
-?>
+
+ * @copyright 2003-2005 Michael Wallner
+ * @license BSD, revised
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTTP_Download
+ */
+
+$GLOBALS['_HTTP_Download_PgLOB_Connection'] = null;
+stream_register_wrapper('pglob', 'HTTP_Download_PgLOB');
+
+/**
+ * PgSQL large object stream interface for HTTP_Download
+ *
+ * Usage:
+ *
+ * require_once 'HTTP/Download.php';
+ * require_once 'HTTP/Download/PgLOB.php';
+ * $db = &DB::connect('pgsql://user:pass@host/db');
+ * // or $db = pg_connect(...);
+ * $lo = HTTP_Download_PgLOB::open($db, 12345);
+ * $dl = &new HTTP_Download;
+ * $dl->setResource($lo);
+ * $dl->send()
+ *
+ *
+ * @access public
+ * @version $Revision$
+ */
+class HTTP_Download_PgLOB
+{
+ /**
+ * Set Connection
+ *
+ * @static
+ * @access public
+ * @return bool
+ * @param mixed $conn
+ */
+ function setConnection($conn)
+ {
+ if (is_a($conn, 'DB_Common')) {
+ $conn = $conn->dbh;
+ } elseif ( is_a($conn, 'MDB_Common') ||
+ is_a($conn, 'MDB2_Driver_Common')) {
+ $conn = $conn->connection;
+ }
+ if ($isResource = is_resource($conn)) {
+ $GLOBALS['_HTTP_Download_PgLOB_Connection'] = $conn;
+ }
+ return $isResource;
+ }
+
+ /**
+ * Get Connection
+ *
+ * @static
+ * @access public
+ * @return resource
+ */
+ function getConnection()
+ {
+ if (is_resource($GLOBALS['_HTTP_Download_PgLOB_Connection'])) {
+ return $GLOBALS['_HTTP_Download_PgLOB_Connection'];
+ }
+ return null;
+ }
+
+ /**
+ * Open
+ *
+ * @static
+ * @access public
+ * @return resource
+ * @param mixed $conn
+ * @param int $loid
+ * @param string $mode
+ */
+ function open($conn, $loid, $mode = 'rb')
+ {
+ HTTP_Download_PgLOB::setConnection($conn);
+ return fopen('pglob:///'. $loid, $mode);
+ }
+
+ /**#@+
+ * Stream Interface Implementation
+ * @internal
+ */
+ var $ID = 0;
+ var $size = 0;
+ var $conn = null;
+ var $handle = null;
+
+ function stream_open($path, $mode)
+ {
+ if (!$this->conn = HTTP_Download_PgLOB::getConnection()) {
+ return false;
+ }
+ if (!preg_match('/(\d+)/', $path, $matches)) {
+ return false;
+ }
+ $this->ID = $matches[1];
+
+ if (!pg_query($this->conn, 'BEGIN')) {
+ return false;
+ }
+
+ $this->handle = pg_lo_open($this->conn, $this->ID, $mode);
+ if (!is_resource($this->handle)) {
+ return false;
+ }
+
+ // fetch size of lob
+ pg_lo_seek($this->handle, 0, PGSQL_SEEK_END);
+ $this->size = (int) pg_lo_tell($this->handle);
+ pg_lo_seek($this->handle, 0, PGSQL_SEEK_SET);
+
+ return true;
+ }
+
+ function stream_read($length)
+ {
+ return pg_lo_read($this->handle, $length);
+ }
+
+ function stream_seek($offset, $whence = SEEK_SET)
+ {
+ return pg_lo_seek($this->handle, $offset, $whence);
+ }
+
+ function stream_tell()
+ {
+ return pg_lo_tell($this->handle);
+ }
+
+ function stream_eof()
+ {
+ return pg_lo_tell($this->handle) >= $this->size;
+ }
+
+ function stream_flush()
+ {
+ return true;
+ }
+
+ function stream_stat()
+ {
+ return array('size' => $this->size, 'ino' => $this->ID);
+ }
+
+ function stream_write($data)
+ {
+ return pg_lo_write($this->handle, $data);
+ }
+
+ function stream_close()
+ {
+ if (pg_lo_close($this->handle)) {
+ return pg_query($this->conn, 'COMMIT');
+ } else {
+ pg_query($this->conn ,'ROLLBACK');
+ return false;
+ }
+ }
+ /**#@-*/
+}
+
+?>
diff --git a/thirdparty/pear/HTTP/Header.php b/thirdparty/pear/HTTP/Header.php
index fd6c497..7ba3419 100644
--- a/thirdparty/pear/HTTP/Header.php
+++ b/thirdparty/pear/HTTP/Header.php
@@ -1,531 +1,531 @@
-
- * @author Davey Shafik
- * @author Michael Wallner
- * @copyright 2003-2005 The Authors
- * @license BSD, revised
- * @version CVS: $Id: Header.php,v 1.32 2005/11/08 19:06:10 mike Exp $
- * @link http://pear.php.net/package/HTTP_Header
- */
-
-/**
- * Requires HTTP
- */
-require_once 'HTTP.php';
-
-/**#@+
- * Information Codes
- */
-define('HTTP_HEADER_STATUS_100', '100 Continue');
-define('HTTP_HEADER_STATUS_101', '101 Switching Protocols');
-define('HTTP_HEADER_STATUS_102', '102 Processing');
-define('HTTP_HEADER_STATUS_INFORMATIONAL',1);
-/**#@-*/
-
-/**#+
- * Success Codes
- */
-define('HTTP_HEADER_STATUS_200', '200 OK');
-define('HTTP_HEADER_STATUS_201', '201 Created');
-define('HTTP_HEADER_STATUS_202', '202 Accepted');
-define('HTTP_HEADER_STATUS_203', '203 Non-Authoritative Information');
-define('HTTP_HEADER_STATUS_204', '204 No Content');
-define('HTTP_HEADER_STATUS_205', '205 Reset Content');
-define('HTTP_HEADER_STATUS_206', '206 Partial Content');
-define('HTTP_HEADER_STATUS_207', '207 Multi-Status');
-define('HTTP_HEADER_STATUS_SUCCESSFUL',2);
-/**#@-*/
-
-/**#@+
- * Redirection Codes
- */
-define('HTTP_HEADER_STATUS_300', '300 Multiple Choices');
-define('HTTP_HEADER_STATUS_301', '301 Moved Permanently');
-define('HTTP_HEADER_STATUS_302', '302 Found');
-define('HTTP_HEADER_STATUS_303', '303 See Other');
-define('HTTP_HEADER_STATUS_304', '304 Not Modified');
-define('HTTP_HEADER_STATUS_305', '305 Use Proxy');
-define('HTTP_HEADER_STATUS_306', '306 (Unused)');
-define('HTTP_HEADER_STATUS_307', '307 Temporary Redirect');
-define('HTTP_HEADER_STATUS_REDIRECT',3);
-/**#@-*/
-
-/**#@+
- * Error Codes
- */
-define('HTTP_HEADER_STATUS_400', '400 Bad Request');
-define('HTTP_HEADER_STATUS_401', '401 Unauthorized');
-define('HTTP_HEADER_STATUS_402', '402 Payment Granted');
-define('HTTP_HEADER_STATUS_403', '403 Forbidden');
-define('HTTP_HEADER_STATUS_404', '404 File Not Found');
-define('HTTP_HEADER_STATUS_405', '405 Method Not Allowed');
-define('HTTP_HEADER_STATUS_406', '406 Not Acceptable');
-define('HTTP_HEADER_STATUS_407', '407 Proxy Authentication Required');
-define('HTTP_HEADER_STATUS_408', '408 Request Time-out');
-define('HTTP_HEADER_STATUS_409', '409 Conflict');
-define('HTTP_HEADER_STATUS_410', '410 Gone');
-define('HTTP_HEADER_STATUS_411', '411 Length Required');
-define('HTTP_HEADER_STATUS_412', '412 Precondition Failed');
-define('HTTP_HEADER_STATUS_413', '413 Request Entity Too Large');
-define('HTTP_HEADER_STATUS_414', '414 Request-URI Too Large');
-define('HTTP_HEADER_STATUS_415', '415 Unsupported Media Type');
-define('HTTP_HEADER_STATUS_416', '416 Requested range not satisfiable');
-define('HTTP_HEADER_STATUS_417', '417 Expectation Failed');
-define('HTTP_HEADER_STATUS_422', '422 Unprocessable Entity');
-define('HTTP_HEADER_STATUS_423', '423 Locked');
-define('HTTP_HEADER_STATUS_424', '424 Failed Dependency');
-define('HTTP_HEADER_STATUS_CLIENT_ERROR',4);
-/**#@-*/
-
-/**#@+
- * Server Errors
- */
-define('HTTP_HEADER_STATUS_500', '500 Internal Server Error');
-define('HTTP_HEADER_STATUS_501', '501 Not Implemented');
-define('HTTP_HEADER_STATUS_502', '502 Bad Gateway');
-define('HTTP_HEADER_STATUS_503', '503 Service Unavailable');
-define('HTTP_HEADER_STATUS_504', '504 Gateway Time-out');
-define('HTTP_HEADER_STATUS_505', '505 HTTP Version not supported');
-define('HTTP_HEADER_STATUS_507', '507 Insufficient Storage');
-define('HTTP_HEADER_STATUS_SERVER_ERROR',5);
-/**#@-*/
-
-/**
- * HTTP_Header
- *
- * @package HTTP_Header
- * @category HTTP
- * @access public
- * @version $Revision: 1.32 $
- */
-class HTTP_Header extends HTTP
-{
- /**
- * Default Headers
- *
- * The values that are set as default, are the same as PHP sends by default.
- *
- * @var array
- * @access private
- */
- var $_headers = array(
- 'content-type' => 'text/html',
- 'pragma' => 'no-cache',
- 'cache-control' => 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
- );
-
- /**
- * HTTP version
- *
- * @var string
- * @access private
- */
- var $_httpVersion = '1.0';
-
- /**
- * Constructor
- *
- * Sets HTTP version.
- *
- * @access public
- * @return object HTTP_Header
- */
- function HTTP_Header()
- {
- if (isset($_SERVER['SERVER_PROTOCOL'])) {
- $this->setHttpVersion(substr($_SERVER['SERVER_PROTOCOL'], -3));
- }
- }
-
- /**
- * Set HTTP version
- *
- * @access public
- * @return bool Returns true on success or false if version doesn't
- * match 1.0 or 1.1 (note: 1 will result in 1.0)
- * @param mixed $version HTTP version, either 1.0 or 1.1
- */
- function setHttpVersion($version)
- {
- $version = round((float) $version, 1);
- if ($version < 1.0 || $version > 1.1) {
- return false;
- }
- $this->_httpVersion = sprintf('%0.1f', $version);
- return true;
- }
-
- /**
- * Get HTTP version
- *
- * @access public
- * @return string
- */
- function getHttpVersion()
- {
- return $this->_httpVersion;
- }
-
- /**
- * Set Header
- *
- * The default value for the Last-Modified header will be current
- * date and atime if $value is omitted.
- *
- * @access public
- * @return bool Returns true on success or false if $key was empty or
- * $value was not of an scalar type.
- * @param string $key The name of the header.
- * @param string $value The value of the header. (NULL to unset header)
- */
- function setHeader($key, $value = null)
- {
- if (empty($key) || (isset($value) && !is_scalar($value))) {
- return false;
- }
-
- $key = strToLower($key);
- if ($key == 'last-modified') {
- if (!isset($value)) {
- $value = HTTP::Date(time());
- } elseif (is_numeric($value)) {
- $value = HTTP::Date($value);
- }
- }
-
- if (isset($value)) {
- $this->_headers[$key] = $value;
- } else {
- unset($this->_headers[$key]);
- }
-
- return true;
- }
-
- /**
- * Get Header
- *
- * If $key is omitted, all stored headers will be returned.
- *
- * @access public
- * @return mixed Returns string value of the requested header,
- * array values of all headers or false if header $key
- * is not set.
- * @param string $key The name of the header to fetch.
- */
- function getHeader($key = null)
- {
- if (!isset($key)) {
- return $this->_headers;
- }
-
- $key = strToLower($key);
-
- if (!isset($this->_headers[$key])) {
- return false;
- }
-
- return $this->_headers[$key];
- }
-
- /**
- * Send Headers
- *
- * Send out the header that you set via setHeader().
- *
- * @access public
- * @return bool Returns true on success or false if headers are already
- * sent.
- * @param array $keys Headers to (not) send, see $include.
- * @param array $include If true only $keys matching headers will be
- * sent, if false only header not matching $keys will be
- * sent.
- */
- function sendHeaders($keys = array(), $include = true)
- {
- if (headers_sent()) {
- return false;
- }
-
- if (count($keys)) {
- array_change_key_case($keys, CASE_LOWER);
- foreach ($this->_headers as $key => $value) {
- if ($include ? in_array($key, $keys) : !in_array($key, $keys)) {
- header($key .': '. $value);
- }
- }
- } else {
- foreach ($this->_headers as $header => $value) {
- header($header .': '. $value);
- }
- }
- return true;
- }
-
- /**
- * Send Satus Code
- *
- * Send out the given HTTP-Status code. Use this for example when you
- * want to tell the client this page is cached, then you would call
- * sendStatusCode(304).
- *
- * @see HTTP_Header_Cache::exitIfCached()
- *
- * @access public
- * @return bool Returns true on success or false if headers are already
- * sent.
- * @param int $code The status code to send, i.e. 404, 304, 200, etc.
- */
- function sendStatusCode($code)
- {
- if (headers_sent()) {
- return false;
- }
-
- if ($code == (int) $code && defined('HTTP_HEADER_STATUS_'. $code)) {
- $code = constant('HTTP_HEADER_STATUS_'. $code);
- }
-
- if (strncasecmp(PHP_SAPI, 'cgi', 3)) {
- header('HTTP/'. $this->_httpVersion .' '. $code);
- } else {
- header('Status: '. $code);
- }
- return true;
- }
-
- /**
- * Date to Timestamp
- *
- * Converts dates like
- * Mon, 31 Mar 2003 15:26:34 GMT
- * Tue, 15 Nov 1994 12:45:26 GMT
- * into a timestamp, strtotime() didn't do it in older versions.
- *
- * @deprecated Use PHPs strtotime() instead.
- * @access public
- * @return mixed Returns int unix timestamp or false if the date doesn't
- * seem to be a valid GMT date.
- * @param string $date The GMT date.
- */
- function dateToTimestamp($date)
- {
- static $months = array(
- null => 0, 'Jan' => 1, 'Feb' => 2, 'Mar' => 3, 'Apr' => 4,
- 'May' => 5, 'Jun' => 6, 'Jul' => 7, 'Aug' => 8, 'Sep' => 9,
- 'Oct' => 10, 'Nov' => 11, 'Dec' => 12
- );
-
- if (-1 < $timestamp = strToTime($date)) {
- return $timestamp;
- }
-
- if (!preg_match('~[^,]*,\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+).*~',
- $date, $m)) {
- return false;
- }
-
- // [0] => Mon, 31 Mar 2003 15:42:55 GMT
- // [1] => 31 [2] => Mar [3] => 2003 [4] => 15 [5] => 42 [6] => 55
- return mktime($m[4], $m[5], $m[6], $months[$m[2]], $m[1], $m[3]);
- }
-
- /**
- * Redirect
- *
- * This function redirects the client. This is done by issuing a Location
- * header and exiting. Additionally to HTTP::redirect() you can also add
- * parameters to the url.
- *
- * If you dont need parameters to be added, simply use HTTP::redirect()
- * otherwise use HTTP_Header::redirect().
- *
- * @see HTTP::redirect()
- * @author Wolfram Kriesing
- * @access public
- * @return void
- * @param string $url The URL to redirect to, if none is given it
- * redirects to the current page.
- * @param array $param Array of query string parameters to add; usually
- * a set of key => value pairs; if an array entry consists
- * only of an value it is used as key and the respective
- * value is fetched from $GLOBALS[$value]
- * @param bool $session Whether the session name/id should be added
- */
- function redirect($url = null, $param = array(), $session = false)
- {
- if (!isset($url)) {
- $url = $_SERVER['PHP_SELF'];
- }
-
- $qs = array();
-
- if ($session) {
- $qs[] = session_name() .'='. session_id();
- }
-
- if (is_array($param) && count($param)) {
- if (count($param)) {
- foreach ($param as $key => $val) {
- if (is_string($key)) {
- $qs[] = urlencode($key) .'='. urlencode($val);
- } else {
- $qs[] = urlencode($val) .'='. urlencode(@$GLOBALS[$val]);
- }
- }
- }
- }
-
- if ($qstr = implode('&', $qs)) {
- $purl = parse_url($url);
- $url .= (isset($purl['query']) ? '&' : '?') . $qstr;
- }
-
- parent::redirect($url);
- }
-
- /**#@+
- * @author Davey Shafik
- * @param int $http_code HTTP Code to check
- * @access public
- */
-
- /**
- * Return HTTP Status Code Type
- *
- * @return int|false
- */
- function getStatusType($http_code)
- {
- if(is_int($http_code) && defined('HTTP_HEADER_STATUS_' .$http_code) || defined($http_code)) {
- $type = substr($http_code,0,1);
- switch ($type) {
- case HTTP_HEADER_STATUS_INFORMATIONAL:
- case HTTP_HEADER_STATUS_SUCCESSFUL:
- case HTTP_HEADER_STATUS_REDIRECT:
- case HTTP_HEADER_STATUS_CLIENT_ERROR:
- case HTTP_HEADER_STATUS_SERVER_ERROR:
- return $type;
- break;
- default:
- return false;
- break;
- }
- } else {
- return false;
- }
- }
-
- /**
- * Return Status Code Message
- *
- * @return string|false
- */
- function getStatusText($http_code)
- {
- if ($this->getStatusType($http_code)) {
- if (is_int($http_code) && defined('HTTP_HEADER_STATUS_' .$http_code)) {
- return substr(constant('HTTP_HEADER_STATUS_' .$http_code),4);
- } else {
- return substr($http_code,4);
- }
- } else {
- return false;
- }
- }
-
- /**
- * Checks if HTTP Status code is Information (1xx)
- *
- * @return boolean
- */
- function isInformational($http_code)
- {
- if ($status_type = $this->getStatusType($http_code)) {
- return $status_type{0} == HTTP_HEADER_STATUS_INFORMATIONAL;
- } else {
- return false;
- }
- }
-
- /**
- * Checks if HTTP Status code is Successful (2xx)
- *
- * @return boolean
- */
- function isSuccessful($http_code)
- {
- if ($status_type = $this->getStatusType($http_code)) {
- return $status_type{0} == HTTP_HEADER_STATUS_SUCCESSFUL;
- } else {
- return false;
- }
- }
-
- /**
- * Checks if HTTP Status code is a Redirect (3xx)
- *
- * @return boolean
- */
- function isRedirect($http_code)
- {
- if ($status_type = $this->getStatusType($http_code)) {
- return $status_type{0} == HTTP_HEADER_STATUS_REDIRECT;
- } else {
- return false;
- }
- }
-
- /**
- * Checks if HTTP Status code is a Client Error (4xx)
- *
- * @return boolean
- */
- function isClientError($http_code)
- {
- if ($status_type = $this->getStatusType($http_code)) {
- return $status_type{0} == HTTP_HEADER_STATUS_CLIENT_ERROR;
- } else {
- return false;
- }
- }
-
- /**
- * Checks if HTTP Status code is Server Error (5xx)
- *
- * @return boolean
- */
- function isServerError($http_code)
- {
- if ($status_type = $this->getStatusType($http_code)) {
- return $status_type{0} == HTTP_HEADER_STATUS_SERVER_ERROR;
- } else {
- return false;
- }
- }
-
- /**
- * Checks if HTTP Status code is Server OR Client Error (4xx or 5xx)
- *
- * @return boolean
- */
- function isError($http_code)
- {
- if ($status_type = $this->getStatusType($http_code)) {
- return (($status_type == HTTP_HEADER_STATUS_CLIENT_ERROR) || ($status_type == HTTP_HEADER_STATUS_SERVER_ERROR)) ? true : false;
- } else {
- return false;
- }
- }
- /**#@-*/
-}
-?>
+
+ * @author Davey Shafik
+ * @author Michael Wallner
+ * @copyright 2003-2005 The Authors
+ * @license BSD, revised
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTTP_Header
+ */
+
+/**
+ * Requires HTTP
+ */
+require_once 'HTTP.php';
+
+/**#@+
+ * Information Codes
+ */
+define('HTTP_HEADER_STATUS_100', '100 Continue');
+define('HTTP_HEADER_STATUS_101', '101 Switching Protocols');
+define('HTTP_HEADER_STATUS_102', '102 Processing');
+define('HTTP_HEADER_STATUS_INFORMATIONAL',1);
+/**#@-*/
+
+/**#+
+ * Success Codes
+ */
+define('HTTP_HEADER_STATUS_200', '200 OK');
+define('HTTP_HEADER_STATUS_201', '201 Created');
+define('HTTP_HEADER_STATUS_202', '202 Accepted');
+define('HTTP_HEADER_STATUS_203', '203 Non-Authoritative Information');
+define('HTTP_HEADER_STATUS_204', '204 No Content');
+define('HTTP_HEADER_STATUS_205', '205 Reset Content');
+define('HTTP_HEADER_STATUS_206', '206 Partial Content');
+define('HTTP_HEADER_STATUS_207', '207 Multi-Status');
+define('HTTP_HEADER_STATUS_SUCCESSFUL',2);
+/**#@-*/
+
+/**#@+
+ * Redirection Codes
+ */
+define('HTTP_HEADER_STATUS_300', '300 Multiple Choices');
+define('HTTP_HEADER_STATUS_301', '301 Moved Permanently');
+define('HTTP_HEADER_STATUS_302', '302 Found');
+define('HTTP_HEADER_STATUS_303', '303 See Other');
+define('HTTP_HEADER_STATUS_304', '304 Not Modified');
+define('HTTP_HEADER_STATUS_305', '305 Use Proxy');
+define('HTTP_HEADER_STATUS_306', '306 (Unused)');
+define('HTTP_HEADER_STATUS_307', '307 Temporary Redirect');
+define('HTTP_HEADER_STATUS_REDIRECT',3);
+/**#@-*/
+
+/**#@+
+ * Error Codes
+ */
+define('HTTP_HEADER_STATUS_400', '400 Bad Request');
+define('HTTP_HEADER_STATUS_401', '401 Unauthorized');
+define('HTTP_HEADER_STATUS_402', '402 Payment Granted');
+define('HTTP_HEADER_STATUS_403', '403 Forbidden');
+define('HTTP_HEADER_STATUS_404', '404 File Not Found');
+define('HTTP_HEADER_STATUS_405', '405 Method Not Allowed');
+define('HTTP_HEADER_STATUS_406', '406 Not Acceptable');
+define('HTTP_HEADER_STATUS_407', '407 Proxy Authentication Required');
+define('HTTP_HEADER_STATUS_408', '408 Request Time-out');
+define('HTTP_HEADER_STATUS_409', '409 Conflict');
+define('HTTP_HEADER_STATUS_410', '410 Gone');
+define('HTTP_HEADER_STATUS_411', '411 Length Required');
+define('HTTP_HEADER_STATUS_412', '412 Precondition Failed');
+define('HTTP_HEADER_STATUS_413', '413 Request Entity Too Large');
+define('HTTP_HEADER_STATUS_414', '414 Request-URI Too Large');
+define('HTTP_HEADER_STATUS_415', '415 Unsupported Media Type');
+define('HTTP_HEADER_STATUS_416', '416 Requested range not satisfiable');
+define('HTTP_HEADER_STATUS_417', '417 Expectation Failed');
+define('HTTP_HEADER_STATUS_422', '422 Unprocessable Entity');
+define('HTTP_HEADER_STATUS_423', '423 Locked');
+define('HTTP_HEADER_STATUS_424', '424 Failed Dependency');
+define('HTTP_HEADER_STATUS_CLIENT_ERROR',4);
+/**#@-*/
+
+/**#@+
+ * Server Errors
+ */
+define('HTTP_HEADER_STATUS_500', '500 Internal Server Error');
+define('HTTP_HEADER_STATUS_501', '501 Not Implemented');
+define('HTTP_HEADER_STATUS_502', '502 Bad Gateway');
+define('HTTP_HEADER_STATUS_503', '503 Service Unavailable');
+define('HTTP_HEADER_STATUS_504', '504 Gateway Time-out');
+define('HTTP_HEADER_STATUS_505', '505 HTTP Version not supported');
+define('HTTP_HEADER_STATUS_507', '507 Insufficient Storage');
+define('HTTP_HEADER_STATUS_SERVER_ERROR',5);
+/**#@-*/
+
+/**
+ * HTTP_Header
+ *
+ * @package HTTP_Header
+ * @category HTTP
+ * @access public
+ * @version $Revision$
+ */
+class HTTP_Header extends HTTP
+{
+ /**
+ * Default Headers
+ *
+ * The values that are set as default, are the same as PHP sends by default.
+ *
+ * @var array
+ * @access private
+ */
+ var $_headers = array(
+ 'content-type' => 'text/html',
+ 'pragma' => 'no-cache',
+ 'cache-control' => 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
+ );
+
+ /**
+ * HTTP version
+ *
+ * @var string
+ * @access private
+ */
+ var $_httpVersion = '1.0';
+
+ /**
+ * Constructor
+ *
+ * Sets HTTP version.
+ *
+ * @access public
+ * @return object HTTP_Header
+ */
+ function HTTP_Header()
+ {
+ if (isset($_SERVER['SERVER_PROTOCOL'])) {
+ $this->setHttpVersion(substr($_SERVER['SERVER_PROTOCOL'], -3));
+ }
+ }
+
+ /**
+ * Set HTTP version
+ *
+ * @access public
+ * @return bool Returns true on success or false if version doesn't
+ * match 1.0 or 1.1 (note: 1 will result in 1.0)
+ * @param mixed $version HTTP version, either 1.0 or 1.1
+ */
+ function setHttpVersion($version)
+ {
+ $version = round((float) $version, 1);
+ if ($version < 1.0 || $version > 1.1) {
+ return false;
+ }
+ $this->_httpVersion = sprintf('%0.1f', $version);
+ return true;
+ }
+
+ /**
+ * Get HTTP version
+ *
+ * @access public
+ * @return string
+ */
+ function getHttpVersion()
+ {
+ return $this->_httpVersion;
+ }
+
+ /**
+ * Set Header
+ *
+ * The default value for the Last-Modified header will be current
+ * date and atime if $value is omitted.
+ *
+ * @access public
+ * @return bool Returns true on success or false if $key was empty or
+ * $value was not of an scalar type.
+ * @param string $key The name of the header.
+ * @param string $value The value of the header. (NULL to unset header)
+ */
+ function setHeader($key, $value = null)
+ {
+ if (empty($key) || (isset($value) && !is_scalar($value))) {
+ return false;
+ }
+
+ $key = strToLower($key);
+ if ($key == 'last-modified') {
+ if (!isset($value)) {
+ $value = HTTP::Date(time());
+ } elseif (is_numeric($value)) {
+ $value = HTTP::Date($value);
+ }
+ }
+
+ if (isset($value)) {
+ $this->_headers[$key] = $value;
+ } else {
+ unset($this->_headers[$key]);
+ }
+
+ return true;
+ }
+
+ /**
+ * Get Header
+ *
+ * If $key is omitted, all stored headers will be returned.
+ *
+ * @access public
+ * @return mixed Returns string value of the requested header,
+ * array values of all headers or false if header $key
+ * is not set.
+ * @param string $key The name of the header to fetch.
+ */
+ function getHeader($key = null)
+ {
+ if (!isset($key)) {
+ return $this->_headers;
+ }
+
+ $key = strToLower($key);
+
+ if (!isset($this->_headers[$key])) {
+ return false;
+ }
+
+ return $this->_headers[$key];
+ }
+
+ /**
+ * Send Headers
+ *
+ * Send out the header that you set via setHeader().
+ *
+ * @access public
+ * @return bool Returns true on success or false if headers are already
+ * sent.
+ * @param array $keys Headers to (not) send, see $include.
+ * @param array $include If true only $keys matching headers will be
+ * sent, if false only header not matching $keys will be
+ * sent.
+ */
+ function sendHeaders($keys = array(), $include = true)
+ {
+ if (headers_sent()) {
+ return false;
+ }
+
+ if (count($keys)) {
+ array_change_key_case($keys, CASE_LOWER);
+ foreach ($this->_headers as $key => $value) {
+ if ($include ? in_array($key, $keys) : !in_array($key, $keys)) {
+ header($key .': '. $value);
+ }
+ }
+ } else {
+ foreach ($this->_headers as $header => $value) {
+ header($header .': '. $value);
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Send Satus Code
+ *
+ * Send out the given HTTP-Status code. Use this for example when you
+ * want to tell the client this page is cached, then you would call
+ * sendStatusCode(304).
+ *
+ * @see HTTP_Header_Cache::exitIfCached()
+ *
+ * @access public
+ * @return bool Returns true on success or false if headers are already
+ * sent.
+ * @param int $code The status code to send, i.e. 404, 304, 200, etc.
+ */
+ function sendStatusCode($code)
+ {
+ if (headers_sent()) {
+ return false;
+ }
+
+ if ($code == (int) $code && defined('HTTP_HEADER_STATUS_'. $code)) {
+ $code = constant('HTTP_HEADER_STATUS_'. $code);
+ }
+
+ if (strncasecmp(PHP_SAPI, 'cgi', 3)) {
+ header('HTTP/'. $this->_httpVersion .' '. $code);
+ } else {
+ header('Status: '. $code);
+ }
+ return true;
+ }
+
+ /**
+ * Date to Timestamp
+ *
+ * Converts dates like
+ * Mon, 31 Mar 2003 15:26:34 GMT
+ * Tue, 15 Nov 1994 12:45:26 GMT
+ * into a timestamp, strtotime() didn't do it in older versions.
+ *
+ * @deprecated Use PHPs strtotime() instead.
+ * @access public
+ * @return mixed Returns int unix timestamp or false if the date doesn't
+ * seem to be a valid GMT date.
+ * @param string $date The GMT date.
+ */
+ function dateToTimestamp($date)
+ {
+ static $months = array(
+ null => 0, 'Jan' => 1, 'Feb' => 2, 'Mar' => 3, 'Apr' => 4,
+ 'May' => 5, 'Jun' => 6, 'Jul' => 7, 'Aug' => 8, 'Sep' => 9,
+ 'Oct' => 10, 'Nov' => 11, 'Dec' => 12
+ );
+
+ if (-1 < $timestamp = strToTime($date)) {
+ return $timestamp;
+ }
+
+ if (!preg_match('~[^,]*,\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+).*~',
+ $date, $m)) {
+ return false;
+ }
+
+ // [0] => Mon, 31 Mar 2003 15:42:55 GMT
+ // [1] => 31 [2] => Mar [3] => 2003 [4] => 15 [5] => 42 [6] => 55
+ return mktime($m[4], $m[5], $m[6], $months[$m[2]], $m[1], $m[3]);
+ }
+
+ /**
+ * Redirect
+ *
+ * This function redirects the client. This is done by issuing a Location
+ * header and exiting. Additionally to HTTP::redirect() you can also add
+ * parameters to the url.
+ *
+ * If you dont need parameters to be added, simply use HTTP::redirect()
+ * otherwise use HTTP_Header::redirect().
+ *
+ * @see HTTP::redirect()
+ * @author Wolfram Kriesing
+ * @access public
+ * @return void
+ * @param string $url The URL to redirect to, if none is given it
+ * redirects to the current page.
+ * @param array $param Array of query string parameters to add; usually
+ * a set of key => value pairs; if an array entry consists
+ * only of an value it is used as key and the respective
+ * value is fetched from $GLOBALS[$value]
+ * @param bool $session Whether the session name/id should be added
+ */
+ function redirect($url = null, $param = array(), $session = false)
+ {
+ if (!isset($url)) {
+ $url = $_SERVER['PHP_SELF'];
+ }
+
+ $qs = array();
+
+ if ($session) {
+ $qs[] = session_name() .'='. session_id();
+ }
+
+ if (is_array($param) && count($param)) {
+ if (count($param)) {
+ foreach ($param as $key => $val) {
+ if (is_string($key)) {
+ $qs[] = urlencode($key) .'='. urlencode($val);
+ } else {
+ $qs[] = urlencode($val) .'='. urlencode(@$GLOBALS[$val]);
+ }
+ }
+ }
+ }
+
+ if ($qstr = implode('&', $qs)) {
+ $purl = parse_url($url);
+ $url .= (isset($purl['query']) ? '&' : '?') . $qstr;
+ }
+
+ parent::redirect($url);
+ }
+
+ /**#@+
+ * @author Davey Shafik
+ * @param int $http_code HTTP Code to check
+ * @access public
+ */
+
+ /**
+ * Return HTTP Status Code Type
+ *
+ * @return int|false
+ */
+ function getStatusType($http_code)
+ {
+ if(is_int($http_code) && defined('HTTP_HEADER_STATUS_' .$http_code) || defined($http_code)) {
+ $type = substr($http_code,0,1);
+ switch ($type) {
+ case HTTP_HEADER_STATUS_INFORMATIONAL:
+ case HTTP_HEADER_STATUS_SUCCESSFUL:
+ case HTTP_HEADER_STATUS_REDIRECT:
+ case HTTP_HEADER_STATUS_CLIENT_ERROR:
+ case HTTP_HEADER_STATUS_SERVER_ERROR:
+ return $type;
+ break;
+ default:
+ return false;
+ break;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Return Status Code Message
+ *
+ * @return string|false
+ */
+ function getStatusText($http_code)
+ {
+ if ($this->getStatusType($http_code)) {
+ if (is_int($http_code) && defined('HTTP_HEADER_STATUS_' .$http_code)) {
+ return substr(constant('HTTP_HEADER_STATUS_' .$http_code),4);
+ } else {
+ return substr($http_code,4);
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Checks if HTTP Status code is Information (1xx)
+ *
+ * @return boolean
+ */
+ function isInformational($http_code)
+ {
+ if ($status_type = $this->getStatusType($http_code)) {
+ return $status_type{0} == HTTP_HEADER_STATUS_INFORMATIONAL;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Checks if HTTP Status code is Successful (2xx)
+ *
+ * @return boolean
+ */
+ function isSuccessful($http_code)
+ {
+ if ($status_type = $this->getStatusType($http_code)) {
+ return $status_type{0} == HTTP_HEADER_STATUS_SUCCESSFUL;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Checks if HTTP Status code is a Redirect (3xx)
+ *
+ * @return boolean
+ */
+ function isRedirect($http_code)
+ {
+ if ($status_type = $this->getStatusType($http_code)) {
+ return $status_type{0} == HTTP_HEADER_STATUS_REDIRECT;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Checks if HTTP Status code is a Client Error (4xx)
+ *
+ * @return boolean
+ */
+ function isClientError($http_code)
+ {
+ if ($status_type = $this->getStatusType($http_code)) {
+ return $status_type{0} == HTTP_HEADER_STATUS_CLIENT_ERROR;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Checks if HTTP Status code is Server Error (5xx)
+ *
+ * @return boolean
+ */
+ function isServerError($http_code)
+ {
+ if ($status_type = $this->getStatusType($http_code)) {
+ return $status_type{0} == HTTP_HEADER_STATUS_SERVER_ERROR;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Checks if HTTP Status code is Server OR Client Error (4xx or 5xx)
+ *
+ * @return boolean
+ */
+ function isError($http_code)
+ {
+ if ($status_type = $this->getStatusType($http_code)) {
+ return (($status_type == HTTP_HEADER_STATUS_CLIENT_ERROR) || ($status_type == HTTP_HEADER_STATUS_SERVER_ERROR)) ? true : false;
+ } else {
+ return false;
+ }
+ }
+ /**#@-*/
+}
+?>
diff --git a/thirdparty/pear/HTTP/Header/Cache.php b/thirdparty/pear/HTTP/Header/Cache.php
index af26b76..58fb44a 100644
--- a/thirdparty/pear/HTTP/Header/Cache.php
+++ b/thirdparty/pear/HTTP/Header/Cache.php
@@ -1,238 +1,238 @@
-
- * @author Michael Wallner
- * @copyright 2003-2005 The Authors
- * @license BSD, revised
- * @version CVS: $Id: Cache.php,v 1.24 2005/11/08 19:06:14 mike Exp $
- * @link http://pear.php.net/package/HTTP_Header
- */
-
-/**
- * Requires HTTP_Header
- */
-require_once 'HTTP/Header.php';
-
-/**
- * HTTP_Header_Cache
- *
- * This package provides methods to easier handle caching of HTTP pages. That
- * means that the pages can be cached at the client (user agent or browser) and
- * your application only needs to send "hey client you already have the pages".
- *
- * Which is done by sending the HTTP-Status "304 Not Modified", so that your
- * application load and the network traffic can be reduced, since you only need
- * to send the complete page once. This is really an advantage e.g. for
- * generated style sheets, or simply pages that do only change rarely.
- *
- * Usage:
- *
- * require_once 'HTTP/Header/Cache.php';
- * $httpCache = new HTTP_Header_Cache(4, 'weeks');
- * $httpCache->sendHeaders();
- * // your code goes here
- *
- *
- * @package HTTP_Header
- * @category HTTP
- * @access public
- * @version $Revision: 1.24 $
- */
-class HTTP_Header_Cache extends HTTP_Header
-{
- /**
- * Constructor
- *
- * Set the amount of time to cache.
- *
- * @access public
- * @return object HTTP_Header_Cache
- * @param int $expires
- * @param string $unit
- */
- function HTTP_Header_Cache($expires = 0, $unit = 'seconds')
- {
- parent::HTTP_Header();
- $this->setHeader('Pragma', 'cache');
- $this->setHeader('Last-Modified', $this->getCacheStart());
- $this->setHeader('Cache-Control', 'private, must-revalidate, max-age=0');
-
- if ($expires) {
- if (!$this->isOlderThan($expires, $unit)) {
- $this->exitCached();
- }
- $this->setHeader('Last-Modified', time());
- }
- }
-
- /**
- * Get Cache Start
- *
- * Returns the unix timestamp of the If-Modified-Since HTTP header or the
- * current time if the header was not sent by the client.
- *
- * @access public
- * @return int unix timestamp
- */
- function getCacheStart()
- {
- if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && !$this->isPost()) {
- return strtotime(current($array = explode(';',
- $_SERVER['HTTP_IF_MODIFIED_SINCE'])));
- }
- return time();
- }
-
- /**
- * Is Older Than
- *
- * You can call it like this:
- *
- * $httpCache->isOlderThan(1, 'day');
- * $httpCache->isOlderThan(47, 'days');
- *
- * $httpCache->isOlderThan(1, 'week');
- * $httpCache->isOlderThan(3, 'weeks');
- *
- * $httpCache->isOlderThan(1, 'hour');
- * $httpCache->isOlderThan(5, 'hours');
- *
- * $httpCache->isOlderThan(1, 'minute');
- * $httpCache->isOlderThan(15, 'minutes');
- *
- * $httpCache->isOlderThan(1, 'second');
- * $httpCache->isOlderThan(15);
- *
- *
- * If you specify something greater than "weeks" as time untit, it just
- * works approximatly, because a month is taken to consist of 4.3 weeks.
- *
- * @access public
- * @return bool Returns true if requested page is older than specified.
- * @param int $time The amount of time.
- * @param string $unit The unit of the time amount - (year[s], month[s],
- * week[s], day[s], hour[s], minute[s], second[s]).
- */
- function isOlderThan($time = 0, $unit = 'seconds')
- {
- if (!isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || $this->isPost()) {
- return true;
- }
- if (!$time) {
- return false;
- }
-
- switch (strtolower($unit))
- {
- case 'year':
- case 'years':
- $time *= 12;
- case 'month':
- case 'months':
- $time *= 4.3;
- case 'week':
- case 'weeks':
- $time *= 7;
- case 'day':
- case 'days':
- $time *= 24;
- case 'hour':
- case 'hours':
- $time *= 60;
- case 'minute':
- case 'minutes':
- $time *= 60;
- }
-
- return (time() - $this->getCacheStart()) > $time;
- }
-
- /**
- * Is Cached
- *
- * Check whether we can consider to be cached on the client side.
- *
- * @access public
- * @return bool Whether the page/resource is considered to be cached.
- * @param int $lastModified Unix timestamp of last modification.
- */
- function isCached($lastModified = 0)
- {
- if ($this->isPost()) {
- return false;
- }
- if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && !$lastModified) {
- return true;
- }
- if (!$seconds = time() - $lastModified) {
- return false;
- }
- return !$this->isOlderThan($seconds);
- }
-
- /**
- * Is Post
- *
- * Check if request method is "POST".
- *
- * @access public
- * @return bool
- */
- function isPost()
- {
- return isset($_SERVER['REQUEST_METHOD']) and
- 'POST' == $_SERVER['REQUEST_METHOD'];
- }
-
- /**
- * Exit If Cached
- *
- * Exit with "HTTP 304 Not Modified" if we consider to be cached.
- *
- * @access public
- * @return void
- * @param int $lastModified Unix timestamp of last modification.
- */
- function exitIfCached($lastModified = 0)
- {
- if ($this->isCached($lastModified)) {
- $this->exitCached();
- }
- }
-
- /**
- * Exit Cached
- *
- * Exit with "HTTP 304 Not Modified".
- *
- * @access public
- * @return void
- */
- function exitCached()
- {
- $this->sendHeaders();
- $this->sendStatusCode(304);
- exit;
- }
-
- /**
- * Set Last Modified
- *
- * @access public
- * @return void
- * @param int $lastModified The unix timestamp of last modification.
- */
- function setLastModified($lastModified = null)
- {
- $this->setHeader('Last-Modified', $lastModified);
- }
-}
-?>
+
+ * @author Michael Wallner
+ * @copyright 2003-2005 The Authors
+ * @license BSD, revised
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTTP_Header
+ */
+
+/**
+ * Requires HTTP_Header
+ */
+require_once 'HTTP/Header.php';
+
+/**
+ * HTTP_Header_Cache
+ *
+ * This package provides methods to easier handle caching of HTTP pages. That
+ * means that the pages can be cached at the client (user agent or browser) and
+ * your application only needs to send "hey client you already have the pages".
+ *
+ * Which is done by sending the HTTP-Status "304 Not Modified", so that your
+ * application load and the network traffic can be reduced, since you only need
+ * to send the complete page once. This is really an advantage e.g. for
+ * generated style sheets, or simply pages that do only change rarely.
+ *
+ * Usage:
+ *
+ * require_once 'HTTP/Header/Cache.php';
+ * $httpCache = new HTTP_Header_Cache(4, 'weeks');
+ * $httpCache->sendHeaders();
+ * // your code goes here
+ *
+ *
+ * @package HTTP_Header
+ * @category HTTP
+ * @access public
+ * @version $Revision$
+ */
+class HTTP_Header_Cache extends HTTP_Header
+{
+ /**
+ * Constructor
+ *
+ * Set the amount of time to cache.
+ *
+ * @access public
+ * @return object HTTP_Header_Cache
+ * @param int $expires
+ * @param string $unit
+ */
+ function HTTP_Header_Cache($expires = 0, $unit = 'seconds')
+ {
+ parent::HTTP_Header();
+ $this->setHeader('Pragma', 'cache');
+ $this->setHeader('Last-Modified', $this->getCacheStart());
+ $this->setHeader('Cache-Control', 'private, must-revalidate, max-age=0');
+
+ if ($expires) {
+ if (!$this->isOlderThan($expires, $unit)) {
+ $this->exitCached();
+ }
+ $this->setHeader('Last-Modified', time());
+ }
+ }
+
+ /**
+ * Get Cache Start
+ *
+ * Returns the unix timestamp of the If-Modified-Since HTTP header or the
+ * current time if the header was not sent by the client.
+ *
+ * @access public
+ * @return int unix timestamp
+ */
+ function getCacheStart()
+ {
+ if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && !$this->isPost()) {
+ return strtotime(current($array = explode(';',
+ $_SERVER['HTTP_IF_MODIFIED_SINCE'])));
+ }
+ return time();
+ }
+
+ /**
+ * Is Older Than
+ *
+ * You can call it like this:
+ *
+ * $httpCache->isOlderThan(1, 'day');
+ * $httpCache->isOlderThan(47, 'days');
+ *
+ * $httpCache->isOlderThan(1, 'week');
+ * $httpCache->isOlderThan(3, 'weeks');
+ *
+ * $httpCache->isOlderThan(1, 'hour');
+ * $httpCache->isOlderThan(5, 'hours');
+ *
+ * $httpCache->isOlderThan(1, 'minute');
+ * $httpCache->isOlderThan(15, 'minutes');
+ *
+ * $httpCache->isOlderThan(1, 'second');
+ * $httpCache->isOlderThan(15);
+ *
+ *
+ * If you specify something greater than "weeks" as time untit, it just
+ * works approximatly, because a month is taken to consist of 4.3 weeks.
+ *
+ * @access public
+ * @return bool Returns true if requested page is older than specified.
+ * @param int $time The amount of time.
+ * @param string $unit The unit of the time amount - (year[s], month[s],
+ * week[s], day[s], hour[s], minute[s], second[s]).
+ */
+ function isOlderThan($time = 0, $unit = 'seconds')
+ {
+ if (!isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || $this->isPost()) {
+ return true;
+ }
+ if (!$time) {
+ return false;
+ }
+
+ switch (strtolower($unit))
+ {
+ case 'year':
+ case 'years':
+ $time *= 12;
+ case 'month':
+ case 'months':
+ $time *= 4.3;
+ case 'week':
+ case 'weeks':
+ $time *= 7;
+ case 'day':
+ case 'days':
+ $time *= 24;
+ case 'hour':
+ case 'hours':
+ $time *= 60;
+ case 'minute':
+ case 'minutes':
+ $time *= 60;
+ }
+
+ return (time() - $this->getCacheStart()) > $time;
+ }
+
+ /**
+ * Is Cached
+ *
+ * Check whether we can consider to be cached on the client side.
+ *
+ * @access public
+ * @return bool Whether the page/resource is considered to be cached.
+ * @param int $lastModified Unix timestamp of last modification.
+ */
+ function isCached($lastModified = 0)
+ {
+ if ($this->isPost()) {
+ return false;
+ }
+ if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && !$lastModified) {
+ return true;
+ }
+ if (!$seconds = time() - $lastModified) {
+ return false;
+ }
+ return !$this->isOlderThan($seconds);
+ }
+
+ /**
+ * Is Post
+ *
+ * Check if request method is "POST".
+ *
+ * @access public
+ * @return bool
+ */
+ function isPost()
+ {
+ return isset($_SERVER['REQUEST_METHOD']) and
+ 'POST' == $_SERVER['REQUEST_METHOD'];
+ }
+
+ /**
+ * Exit If Cached
+ *
+ * Exit with "HTTP 304 Not Modified" if we consider to be cached.
+ *
+ * @access public
+ * @return void
+ * @param int $lastModified Unix timestamp of last modification.
+ */
+ function exitIfCached($lastModified = 0)
+ {
+ if ($this->isCached($lastModified)) {
+ $this->exitCached();
+ }
+ }
+
+ /**
+ * Exit Cached
+ *
+ * Exit with "HTTP 304 Not Modified".
+ *
+ * @access public
+ * @return void
+ */
+ function exitCached()
+ {
+ $this->sendHeaders();
+ $this->sendStatusCode(304);
+ exit;
+ }
+
+ /**
+ * Set Last Modified
+ *
+ * @access public
+ * @return void
+ * @param int $lastModified The unix timestamp of last modification.
+ */
+ function setLastModified($lastModified = null)
+ {
+ $this->setHeader('Last-Modified', $lastModified);
+ }
+}
+?>
diff --git a/thirdparty/pear/HTTP/Request.php b/thirdparty/pear/HTTP/Request.php
index f7fa93e..5d48b39 100644
--- a/thirdparty/pear/HTTP/Request.php
+++ b/thirdparty/pear/HTTP/Request.php
@@ -32,7 +32,7 @@
// | Author: Richard Heyes |
// +-----------------------------------------------------------------------+
//
-// $Id: Request.php,v 1.43 2005/11/06 18:29:14 avb Exp $
+// $Id$
//
// HTTP_Request Class
//
diff --git a/thirdparty/pear/HTTP/Request/Listener.php b/thirdparty/pear/HTTP/Request/Listener.php
index 38b115a..4923419 100644
--- a/thirdparty/pear/HTTP/Request/Listener.php
+++ b/thirdparty/pear/HTTP/Request/Listener.php
@@ -32,7 +32,7 @@
// | Author: Alexey Borzov |
// +-----------------------------------------------------------------------+
//
-// $Id: Listener.php,v 1.2 2003/10/26 10:28:29 avb Exp $
+// $Id$
//
/**
@@ -42,7 +42,7 @@
*
* @package HTTP_Request
* @author Alexey Borzov
- * @version $Revision: 1.2 $
+ * @version $Revision$
*/
class HTTP_Request_Listener
{
diff --git a/thirdparty/pear/HTTP/Upload.php b/thirdparty/pear/HTTP/Upload.php
index 2737d39..d2390e0 100644
--- a/thirdparty/pear/HTTP/Upload.php
+++ b/thirdparty/pear/HTTP/Upload.php
@@ -1,856 +1,856 @@
- http://www.gnu.org/copyleft/lesser.txt
-// (c) 2001-2004 by Tomas Von Veschler Cox
-//
-// **********************************************
-//
-// $Id: Upload.php,v 1.42 2004/08/08 09:37:50 wenz Exp $
-
-/*
- * Pear File Uploader class. Easy and secure managment of files
- * submitted via HTML Forms.
- *
- * Leyend:
- * - you can add error msgs in your language in the HTTP_Upload_Error class
- *
- * TODO:
- * - try to think a way of having all the Error system in other
- * file and only include it when an error ocurrs
- *
- * -- Notes for users HTTP_Upload >= 0.9.0 --
- *
- * Error detection was enhanced, so you no longer need to
- * check for PEAR::isError() in $upload->getFiles() or call
- * $upload->isMissing(). Instead you'll
- * get the error when do a check for $file->isError().
- *
- * Example:
- *
- * $upload = new HTTP_Upload('en');
- * $file = $upload->getFiles('i_dont_exist_in_form_definition');
- * if ($file->isError()) {
- * die($file->getMessage());
- * }
- *
- * --
- *
- */
-
-require_once 'PEAR.php';
-
-/**
- * defines default chmod
- */
-define('HTTP_UPLOAD_DEFAULT_CHMOD', 0660);
-
-/**
- * Error Class for HTTP_Upload
- *
- * @author Tomas V.V.Cox
- * @see http://vulcanonet.com/soft/index.php?pack=uploader
- * @package HTTP_Upload
- * @category HTTP
- * @access public
- */
-class HTTP_Upload_Error extends PEAR
-{
- /**
- * Selected language for error messages
- * @var string
- */
- var $lang = 'en';
-
- /**
- * Whether HTML entities shall be encoded automatically
- * @var boolean
- */
- var $html = false;
-
- /**
- * Constructor
- *
- * Creates a new PEAR_Error
- *
- * @param string $lang The language selected for error code messages
- * @access public
- */
- function HTTP_Upload_Error($lang = null, $html = false)
- {
- $this->lang = ($lang !== null) ? $lang : $this->lang;
- $this->html = ($html !== false) ? $html : $this->html;
- $ini_size = preg_replace('/m/i', '000000', ini_get('upload_max_filesize'));
-
- if (function_exists('version_compare') &&
- version_compare(phpversion(), '4.1', 'ge')) {
- $maxsize = (isset($_POST['MAX_FILE_SIZE'])) ?
- $_POST['MAX_FILE_SIZE'] : null;
- } else {
- global $HTTP_POST_VARS;
- $maxsize = (isset($HTTP_POST_VARS['MAX_FILE_SIZE'])) ?
- $HTTP_POST_VARS['MAX_FILE_SIZE'] : null;
- }
-
- if (empty($maxsize) || ($maxsize > $ini_size)) {
- $maxsize = $ini_size;
- }
- // XXXXX Add here error messages in your language
- $this->error_codes = array(
- 'TOO_LARGE' => array(
- 'es' => "Fichero demasiado largo. El maximo permitido es: $maxsize bytes.",
- 'en' => "File size too large. The maximum permitted size is: $maxsize bytes.",
- 'de' => "Datei zu groß. Die zulässige Maximalgröße ist: $maxsize Bytes.",
- 'nl' => "Het bestand is te groot, de maximale grootte is: $maxsize bytes.",
- 'fr' => "Le fichier est trop gros. La taille maximum autorisée est: $maxsize bytes.",
- 'it' => "Il file é troppo grande. Il massimo permesso é: $maxsize bytes.",
- 'pt_BR' => "Arquivo muito grande. O tamanho máximo permitido é $maxsize bytes."
- ),
- 'MISSING_DIR' => array(
- 'es' => 'Falta directorio destino.',
- 'en' => 'Missing destination directory.',
- 'de' => 'Kein Zielverzeichnis definiert.',
- 'nl' => 'Geen bestemmings directory.',
- 'fr' => 'Le répertoire de destination n\'est pas défini.',
- 'it' => 'Manca la directory di destinazione.',
- 'pt_BR' => 'Ausência de diretório de destino.'
- ),
- 'IS_NOT_DIR' => array(
- 'es' => 'El directorio destino no existe o es un fichero regular.',
- 'en' => 'The destination directory doesn\'t exist or is a regular file.',
- 'de' => 'Das angebene Zielverzeichnis existiert nicht oder ist eine Datei.',
- 'nl' => 'De doeldirectory bestaat niet, of is een gewoon bestand.',
- 'fr' => 'Le répertoire de destination n\'existe pas ou il s\'agit d\'un fichier régulier.',
- 'it' => 'La directory di destinazione non esiste o é un file.',
- 'pt_BR' => 'O diretório de destino não existe ou é um arquivo.'
- ),
- 'NO_WRITE_PERMS' => array(
- 'es' => 'El directorio destino no tiene permisos de escritura.',
- 'en' => 'The destination directory doesn\'t have write perms.',
- 'de' => 'Fehlende Schreibrechte für das Zielverzeichnis.',
- 'nl' => 'Geen toestemming om te schrijven in de doeldirectory.',
- 'fr' => 'Le répertoire de destination n\'a pas les droits en écriture.',
- 'it' => 'Non si hanno i permessi di scrittura sulla directory di destinazione.',
- 'pt_BR' => 'O diretório de destino não possui permissão para escrita.'
- ),
- 'NO_USER_FILE' => array(
- 'es' => 'No se ha escogido fichero para el upload.',
- 'en' => 'You haven\'t selected any file for uploading.',
- 'de' => 'Es wurde keine Datei für den Upload ausgewählt.',
- 'nl' => 'Er is geen bestand opgegeven om te uploaden.',
- 'fr' => 'Vous n\'avez pas sélectionné de fichier à envoyer.',
- 'it' => 'Nessun file selezionato per l\'upload.',
- 'pt_BR' => 'Nenhum arquivo selecionado para upload.'
- ),
- 'BAD_FORM' => array(
- 'es' => 'El formulario no contiene method="post" enctype="multipart/form-data" requerido.',
- 'en' => 'The html form doesn\'t contain the required method="post" enctype="multipart/form-data".',
- 'de' => 'Das HTML-Formular enthält nicht die Angabe method="post" enctype="multipart/form-data" '.
- 'im >form<-Tag.',
- 'nl' => 'Het HTML-formulier bevat niet de volgende benodigde '.
- 'eigenschappen: method="post" enctype="multipart/form-data".',
- 'fr' => 'Le formulaire HTML ne contient pas les attributs requis : '.
- ' method="post" enctype="multipart/form-data".',
- 'it' => 'Il modulo HTML non contiene gli attributi richiesti: "'.
- ' method="post" enctype="multipart/form-data".',
- 'pt_BR' => 'O formulário HTML não possui o method="post" enctype="multipart/form-data" requerido.'
- ),
- 'E_FAIL_COPY' => array(
- 'es' => 'Fallo al copiar el fichero temporal.',
- 'en' => 'Failed to copy the temporary file.',
- 'de' => 'Temporäre Datei konnte nicht kopiert werden.',
- 'nl' => 'Het tijdelijke bestand kon niet gekopieerd worden.',
- 'fr' => 'L\'enregistrement du fichier temporaire a échoué.',
- 'it' => 'Copia del file temporaneo fallita.',
- 'pt_BR' => 'Falha ao copiar o arquivo temporário.'
- ),
- 'E_FAIL_MOVE' => array(
- 'es' => 'No puedo mover el fichero.',
- 'en' => 'Impossible to move the file.',
- 'de' => 'Datei kann nicht verschoben werden.',
- 'nl' => 'Het bestand kon niet verplaatst worden.',
- 'fr' => 'Impossible de déplacer le fichier.',
- 'pt_BR' => 'Não foi possível mover o arquivo.'
- ),
- 'FILE_EXISTS' => array(
- 'es' => 'El fichero destino ya existe.',
- 'en' => 'The destination file already exists.',
- 'de' => 'Die zu erzeugende Datei existiert bereits.',
- 'nl' => 'Het doelbestand bestaat al.',
- 'fr' => 'Le fichier de destination existe déjà.',
- 'it' => 'File destinazione già esistente.',
- 'pt_BR' => 'O arquivo de destino já existe.'
- ),
- 'CANNOT_OVERWRITE' => array(
- 'es' => 'El fichero destino ya existe y no se puede sobreescribir.',
- 'en' => 'The destination file already exists and could not be overwritten.',
- 'de' => 'Die zu erzeugende Datei existiert bereits und konnte nicht überschrieben werden.',
- 'nl' => 'Het doelbestand bestaat al, en kon niet worden overschreven.',
- 'fr' => 'Le fichier de destination existe déjà et ne peux pas être remplacé.',
- 'it' => 'File destinazione già esistente e non si può sovrascrivere.',
- 'pt_BR' => 'O arquivo de destino já existe e não pôde ser sobrescrito.'
- ),
- 'NOT_ALLOWED_EXTENSION' => array(
- 'es' => 'Extension de fichero no permitida.',
- 'en' => 'File extension not permitted.',
- 'de' => 'Unerlaubte Dateiendung.',
- 'nl' => 'Niet toegestane bestands-extensie.',
- 'fr' => 'Le fichier a une extension non autorisée.',
- 'it' => 'Estensione del File non permessa.',
- 'pt_BR' => 'Extensão de arquivo não permitida.'
- ),
- 'PARTIAL' => array(
- 'es' => 'El fichero fue parcialmente subido',
- 'en' => 'The file was only partially uploaded.',
- 'de' => 'Die Datei wurde unvollständig übertragen.',
- 'nl' => 'Het bestand is slechts gedeeltelijk geupload.',
- 'pt_BR' => 'O arquivo não foi enviado por completo.'
- ),
- 'ERROR' => array(
- 'es' => 'Error en subida:',
- 'en' => 'Upload error:',
- 'de' => 'Fehler beim Upload:',
- 'nl' => 'Upload fout:',
- 'pt_BR' => 'Erro de upload:'
- ),
- 'DEV_NO_DEF_FILE' => array(
- 'es' => 'No está definido en el formulario este nombre de fichero como <input type="file" name=?>.',
- 'en' => 'This filename is not defined in the form as <input type="file" name=?>.',
- 'de' => 'Dieser Dateiname ist im Formular nicht als <input type="file" name=?> definiert.',
- 'nl' => 'Deze bestandsnaam is niett gedefineerd in het formulier als <input type="file" name=?>.'
- )
- );
- }
-
- /**
- * returns the error code
- *
- * @param string $e_code type of error
- * @return string Error message
- */
- function errorCode($e_code)
- {
- if (!empty($this->error_codes[$e_code][$this->lang])) {
- $msg = $this->html ?
- html_entity_decode($this->error_codes[$e_code][$this->lang]) :
- $this->error_codes[$e_code][$this->lang];
- } else {
- $msg = $e_code;
- }
-
- if (!empty($this->error_codes['ERROR'][$this->lang])) {
- $error = $this->error_codes['ERROR'][$this->lang];
- } else {
- $error = $this->error_codes['ERROR']['en'];
- }
- return $error.' '.$msg;
- }
-
- /**
- * Overwrites the PEAR::raiseError method
- *
- * @param string $e_code type of error
- * @return object PEAR_Error a PEAR-Error object
- * @access public
- */
- function raiseError($e_code)
- {
- return PEAR::raiseError($this->errorCode($e_code), $e_code);
- }
-}
-
-/**
- * This class provides an advanced file uploader system
- * for file uploads made from html forms
-
- *
- * @author Tomas V.V.Cox
- * @see http://vulcanonet.com/soft/index.php?pack=uploader
- * @package HTTP_Upload
- * @category HTTP
- * @access public
- */
-class HTTP_Upload extends HTTP_Upload_Error
-{
- /**
- * Contains an array of "uploaded files" objects
- * @var array
- */
- var $files = array();
-
- /**
- * Contains the desired chmod for uploaded files
- * @var int
- * @access private
- */
- var $_chmod = HTTP_UPLOAD_DEFAULT_CHMOD;
-
- /**
- * Constructor
- *
- * @param string $lang Language to use for reporting errors
- * @see Upload_Error::error_codes
- * @access public
- */
- function HTTP_Upload($lang = null)
- {
- $this->HTTP_Upload_Error($lang);
- if (function_exists('version_compare') &&
- version_compare(phpversion(), '4.1', 'ge'))
- {
- $this->post_files = $_FILES;
- if (isset($_SERVER['CONTENT_TYPE'])) {
- $this->content_type = $_SERVER['CONTENT_TYPE'];
- }
- } else {
- global $HTTP_POST_FILES, $HTTP_SERVER_VARS;
- $this->post_files = $HTTP_POST_FILES;
- if (isset($HTTP_SERVER_VARS['CONTENT_TYPE'])) {
- $this->content_type = $HTTP_SERVER_VARS['CONTENT_TYPE'];
- }
- }
- }
-
- /**
- * Get files
- *
- * @param mixed $file If:
- * - not given, function will return array of upload_file objects
- * - is int, will return the $file position in upload_file objects array
- * - is string, will return the upload_file object corresponding
- * to $file name of the form. For ex:
- * if form is
- * to get this file use: $upload->getFiles('userfile')
- *
- * @return mixed array or object (see @param $file above) or Pear_Error
- * @access public
- */
- function &getFiles($file = null)
- {
- static $is_built = false;
- //build only once for multiple calls
- if (!$is_built) {
- $files = &$this->_buildFiles();
- if (PEAR::isError($files)) {
- // there was an error with the form.
- // Create a faked upload embedding the error
- $this->files['_error'] = &new HTTP_Upload_File(
- '_error', null,
- null, null,
- null, $files->getCode(),
- $this->lang, $this->_chmod);
- } else {
- $this->files = $files;
- }
- $is_built = true;
- }
- if ($file !== null) {
- if (is_int($file)) {
- $pos = 0;
- foreach ($this->files as $obj) {
- if ($pos == $file) {
- return $obj;
- }
- $pos++;
- }
- } elseif (is_string($file) && isset($this->files[$file])) {
- return $this->files[$file];
- }
- if (isset($this->files['_error'])) {
- return $this->files['_error'];
- } else {
- // developer didn't specify this name in the form
- // warn him about it with a faked upload
- return new HTTP_Upload_File(
- '_error', null,
- null, null,
- null, 'DEV_NO_DEF_FILE',
- $this->lang);
- }
- }
- return $this->files;
- }
-
- /**
- * Creates the list of the uploaded file
- *
- * @return array of HTTP_Upload_File objects for every file
- */
- function &_buildFiles()
- {
- // Form method check
- if (!isset($this->content_type) ||
- strpos($this->content_type, 'multipart/form-data') !== 0)
- {
- return $this->raiseError('BAD_FORM');
- }
- // In 4.1 $_FILES isn't initialized when no uploads
- // XXX (cox) afaik, in >= 4.1 and <= 4.3 only
- if (function_exists('version_compare') &&
- version_compare(phpversion(), '4.1', 'ge'))
- {
- $error = $this->isMissing();
- if (PEAR::isError($error)) {
- return $error;
- }
- }
-
- // map error codes from 4.2.0 $_FILES['userfile']['error']
- if (function_exists('version_compare') &&
- version_compare(phpversion(), '4.2.0', 'ge')) {
- $uploadError = array(
- 1 => 'TOO_LARGE',
- 2 => 'TOO_LARGE',
- 3 => 'PARTIAL',
- 4 => 'NO_USER_FILE'
- );
- }
-
-
- // Parse $_FILES (or $HTTP_POST_FILES)
- $files = array();
- foreach ($this->post_files as $userfile => $value) {
- if (is_array($value['name'])) {
- foreach ($value['name'] as $key => $val) {
- $err = $value['error'][$key];
- if (isset($err) && $err !== 0 && isset($uploadError[$err])) {
- $error = $uploadError[$err];
- } else {
- $error = null;
- }
- $name = basename($value['name'][$key]);
- $tmp_name = $value['tmp_name'][$key];
- $size = $value['size'][$key];
- $type = $value['type'][$key];
- $formname = $userfile . "[$key]";
- $files[$formname] = new HTTP_Upload_File($name, $tmp_name,
- $formname, $type, $size, $error, $this->lang, $this->_chmod);
- }
- // One file
- } else {
- $err = $value['error'];
- if (isset($err) && $err !== 0 && isset($uploadError[$err])) {
- $error = $uploadError[$err];
- } else {
- $error = null;
- }
- $name = basename($value['name']);
- $tmp_name = $value['tmp_name'];
- $size = $value['size'];
- $type = $value['type'];
- $formname = $userfile;
- $files[$formname] = new HTTP_Upload_File($name, $tmp_name,
- $formname, $type, $size, $error, $this->lang, $this->_chmod);
- }
- }
- return $files;
- }
-
- /**
- * Checks if the user submited or not some file
- *
- * @return mixed False when are files or PEAR_Error when no files
- * @access public
- * @see Read the note in the source code about this function
- */
- function isMissing()
- {
- if (count($this->post_files) < 1) {
- return $this->raiseError('NO_USER_FILE');
- }
- //we also check if at least one file has more than 0 bytes :)
- $files = array();
- $size = 0;
- foreach ($this->post_files as $userfile => $value) {
- if (is_array($value['name'])) {
- foreach ($value['name'] as $key => $val) {
- $size += $value['size'][$key];
- }
- } else { //one file
- $size = $value['size'];
- }
- }
- if ($size == 0) {
- $this->raiseError('NO_USER_FILE');
- }
- return false;
- }
-
- /**
- * Sets the chmod to be used for uploaded files
- *
- * @param int Desired mode
- */
- function setChmod($mode)
- {
- $this->_chmod = $mode;
- }
-}
-
-/**
- * This class provides functions to work with the uploaded file
- *
- * @author Tomas V.V.Cox
- * @see http://vulcanonet.com/soft/index.php?pack=uploader
- * @package HTTP_Upload
- * @category HTTP
- * @access public
- */
-class HTTP_Upload_File extends HTTP_Upload_Error
-{
- /**
- * If the random seed was initialized before or not
- * @var boolean;
- */
- var $_seeded = 0;
-
- /**
- * Assoc array with file properties
- * @var array
- */
- var $upload = array();
-
- /**
- * If user haven't selected a mode, by default 'safe' will be used
- * @var boolean
- */
- var $mode_name_selected = false;
-
- /**
- * It's a common security risk in pages who has the upload dir
- * under the document root (remember the hack of the Apache web?)
- *
- * @var array
- * @access private
- * @see HTTP_Upload_File::setValidExtensions()
- */
- var $_extensions_check = array('php', 'phtm', 'phtml', 'php3', 'inc');
-
- /**
- * @see HTTP_Upload_File::setValidExtensions()
- * @var string
- * @access private
- */
- var $_extensions_mode = 'deny';
-
- /**
- * Contains the desired chmod for uploaded files
- * @var int
- * @access private
- */
- var $_chmod = HTTP_UPLOAD_DEFAULT_CHMOD;
-
- /**
- * Constructor
- *
- * @param string $name destination file name
- * @param string $tmp temp file name
- * @param string $formname name of the form
- * @param string $type Mime type of the file
- * @param string $size size of the file
- * @param string $error error on upload
- * @param string $lang used language for errormessages
- * @access public
- */
- function HTTP_Upload_File($name = null, $tmp = null, $formname = null,
- $type = null, $size = null, $error = null,
- $lang = null, $chmod = HTTP_UPLOAD_DEFAULT_CHMOD)
- {
- $this->HTTP_Upload_Error($lang);
- $ext = null;
-
- if (empty($name) || $size == 0) {
- $error = 'NO_USER_FILE';
- } elseif ($tmp == 'none') {
- $error = 'TOO_LARGE';
- } else {
- // strpos needed to detect files without extension
- if (($pos = strrpos($name, '.')) !== false) {
- $ext = substr($name, $pos + 1);
- }
- }
-
- if (function_exists('version_compare') &&
- version_compare(phpversion(), '4.1', 'ge')) {
- if (isset($_POST['MAX_FILE_SIZE']) &&
- $size > $_POST['MAX_FILE_SIZE']) {
- $error = 'TOO_LARGE';
- }
- } else {
- global $HTTP_POST_VARS;
- if (isset($HTTP_POST_VARS['MAX_FILE_SIZE']) &&
- $size > $HTTP_POST_VARS['MAX_FILE_SIZE']) {
- $error = 'TOO_LARGE';
- }
- }
-
- $this->upload = array(
- 'real' => $name,
- 'name' => $name,
- 'form_name' => $formname,
- 'ext' => $ext,
- 'tmp_name' => $tmp,
- 'size' => $size,
- 'type' => $type,
- 'error' => $error
- );
-
- $this->_chmod = $chmod;
- }
-
- /**
- * Sets the name of the destination file
- *
- * @param string $mode A valid mode: 'uniq', 'safe' or 'real' or a file name
- * @param string $prepend A string to prepend to the name
- * @param string $append A string to append to the name
- *
- * @return string The modified name of the destination file
- * @access public
- */
- function setName($mode, $prepend = null, $append = null)
- {
- switch ($mode) {
- case 'uniq':
- $name = $this->nameToUniq();
- $this->upload['ext'] = $this->nameToSafe($this->upload['ext'], 10);
- $name .= '.' . $this->upload['ext'];
- break;
- case 'safe':
- $name = $this->nameToSafe($this->upload['real']);
- if (($pos = strrpos($name, '.')) !== false) {
- $this->upload['ext'] = substr($name, $pos + 1);
- } else {
- $this->upload['ext'] = '';
- }
- break;
- case 'real':
- $name = $this->upload['real'];
- break;
- default:
- $name = $mode;
- }
- $this->upload['name'] = $prepend . $name . $append;
- $this->mode_name_selected = true;
- return $this->upload['name'];
- }
-
- /**
- * Unique file names in the form: 9022210413b75410c28bef.html
- * @see HTTP_Upload_File::setName()
- */
- function nameToUniq()
- {
- if (! $this->_seeded) {
- srand((double) microtime() * 1000000);
- $this->_seeded = 1;
- }
- $uniq = uniqid(rand());
- return $uniq;
- }
-
- /**
- * Format a file name to be safe
- *
- * @param string $file The string file name
- * @param int $maxlen Maximun permited string lenght
- * @return string Formatted file name
- * @see HTTP_Upload_File::setName()
- */
- function nameToSafe($name, $maxlen=250)
- {
- $noalpha = 'ÁÉÍÓÚÝáéíóúýÂÊÎÔÛâêîôûÀÈÌÒÙàèìòùÄËÏÖÜäëïöüÿÃãÕõÅåÑñÇç@°ºª';
- $alpha = 'AEIOUYaeiouyAEIOUaeiouAEIOUaeiouAEIOUaeiouyAaOoAaNnCcaooa';
-
- $name = substr($name, 0, $maxlen);
- $name = strtr($name, $noalpha, $alpha);
- // not permitted chars are replaced with "_"
- return preg_replace('/[^a-zA-Z0-9,._\+\()\-]/', '_', $name);
- }
-
- /**
- * The upload was valid
- *
- * @return bool If the file was submitted correctly
- * @access public
- */
- function isValid()
- {
- if ($this->upload['error'] === null) {
- return true;
- }
- return false;
- }
-
- /**
- * User haven't submit a file
- *
- * @return bool If the user submitted a file or not
- * @access public
- */
- function isMissing()
- {
- if ($this->upload['error'] == 'NO_USER_FILE') {
- return true;
- }
- return false;
- }
-
- /**
- * Some error occured during upload (most common due a file size problem,
- * like max size exceeded or 0 bytes long).
- * @return bool If there were errors submitting the file (probably
- * because the file excess the max permitted file size)
- * @access public
- */
- function isError()
- {
- if (in_array($this->upload['error'], array('TOO_LARGE', 'BAD_FORM','DEV_NO_DEF_FILE'))) {
- return true;
- }
- return false;
- }
-
- /**
- * Moves the uploaded file to its destination directory.
- *
- * @param string $dir_dest Destination directory
- * @param bool $overwrite Overwrite if destination file exists?
- * @return mixed True on success or Pear_Error object on error
- * @access public
- */
- function moveTo($dir_dest, $overwrite = true)
- {
- if (!$this->isValid()) {
- return $this->raiseError($this->upload['error']);
- }
-
- //Valid extensions check
- if (!$this->_evalValidExtensions()) {
- return $this->raiseError('NOT_ALLOWED_EXTENSION');
- }
-
- $err_code = $this->_chk_dir_dest($dir_dest);
- if ($err_code !== false) {
- return $this->raiseError($err_code);
- }
- // Use 'safe' mode by default if no other was selected
- if (!$this->mode_name_selected) {
- $this->setName('safe');
- }
-
- $name_dest = $dir_dest . DIRECTORY_SEPARATOR . $this->upload['name'];
-
- if (@is_file($name_dest)) {
- if ($overwrite !== true) {
- return $this->raiseError('FILE_EXISTS');
- } elseif (!is_writable($name_dest)) {
- return $this->raiseError('CANNOT_OVERWRITE');
- }
- }
-
- // copy the file and let php clean the tmp
- if (!@move_uploaded_file($this->upload['tmp_name'], $name_dest)) {
- return $this->raiseError('E_FAIL_MOVE');
- }
- @chmod($name_dest, $this->_chmod);
- return $this->getProp('name');
- }
-
- /**
- * Check for a valid destination dir
- *
- * @param string $dir_dest Destination dir
- * @return mixed False on no errors or error code on error
- */
- function _chk_dir_dest($dir_dest)
- {
- if (!$dir_dest) {
- return 'MISSING_DIR';
- }
- if (!@is_dir ($dir_dest)) {
- return 'IS_NOT_DIR';
- }
- if (!is_writeable ($dir_dest)) {
- return 'NO_WRITE_PERMS';
- }
- return false;
- }
- /**
- * Retrive properties of the uploaded file
- * @param string $name The property name. When null an assoc array with
- * all the properties will be returned
- * @return mixed A string or array
- * @see HTTP_Upload_File::HTTP_Upload_File()
- * @access public
- */
- function getProp($name = null)
- {
- if ($name === null) {
- return $this->upload;
- }
- return $this->upload[$name];
- }
-
- /**
- * Returns a error message, if a error occured
- * (deprecated) Use getMessage() instead
- * @return string a Error message
- * @access public
- */
- function errorMsg()
- {
- return $this->errorCode($this->upload['error']);
- }
-
- /**
- * Returns a error message, if a error occured
- * @return string a Error message
- * @access public
- */
- function getMessage()
- {
- return $this->errorCode($this->upload['error']);
- }
-
- /**
- * Function to restrict the valid extensions on file uploads
- *
- * @param array $exts File extensions to validate
- * @param string $mode The type of validation:
- * 1) 'deny' Will deny only the supplied extensions
- * 2) 'accept' Will accept only the supplied extensions
- * as valid
- * @access public
- */
- function setValidExtensions($exts, $mode = 'deny')
- {
- $this->_extensions_check = $exts;
- $this->_extensions_mode = $mode;
- }
-
- /**
- * Evaluates the validity of the extensions set by setValidExtensions
- *
- * @return bool False on non valid extension, true if they are valid
- * @access private
- */
- function _evalValidExtensions()
- {
- $exts = $this->_extensions_check;
- settype($exts, 'array');
- if ($this->_extensions_mode == 'deny') {
- if (in_array($this->getProp('ext'), $exts)) {
- return false;
- }
- // mode == 'accept'
- } else {
- if (!in_array($this->getProp('ext'), $exts)) {
- return false;
- }
- }
- return true;
- }
-}
+ http://www.gnu.org/copyleft/lesser.txt
+// (c) 2001-2004 by Tomas Von Veschler Cox
+//
+// **********************************************
+//
+// $Id$
+
+/*
+ * Pear File Uploader class. Easy and secure managment of files
+ * submitted via HTML Forms.
+ *
+ * Leyend:
+ * - you can add error msgs in your language in the HTTP_Upload_Error class
+ *
+ * TODO:
+ * - try to think a way of having all the Error system in other
+ * file and only include it when an error ocurrs
+ *
+ * -- Notes for users HTTP_Upload >= 0.9.0 --
+ *
+ * Error detection was enhanced, so you no longer need to
+ * check for PEAR::isError() in $upload->getFiles() or call
+ * $upload->isMissing(). Instead you'll
+ * get the error when do a check for $file->isError().
+ *
+ * Example:
+ *
+ * $upload = new HTTP_Upload('en');
+ * $file = $upload->getFiles('i_dont_exist_in_form_definition');
+ * if ($file->isError()) {
+ * die($file->getMessage());
+ * }
+ *
+ * --
+ *
+ */
+
+require_once 'PEAR.php';
+
+/**
+ * defines default chmod
+ */
+define('HTTP_UPLOAD_DEFAULT_CHMOD', 0660);
+
+/**
+ * Error Class for HTTP_Upload
+ *
+ * @author Tomas V.V.Cox
+ * @see http://vulcanonet.com/soft/index.php?pack=uploader
+ * @package HTTP_Upload
+ * @category HTTP
+ * @access public
+ */
+class HTTP_Upload_Error extends PEAR
+{
+ /**
+ * Selected language for error messages
+ * @var string
+ */
+ var $lang = 'en';
+
+ /**
+ * Whether HTML entities shall be encoded automatically
+ * @var boolean
+ */
+ var $html = false;
+
+ /**
+ * Constructor
+ *
+ * Creates a new PEAR_Error
+ *
+ * @param string $lang The language selected for error code messages
+ * @access public
+ */
+ function HTTP_Upload_Error($lang = null, $html = false)
+ {
+ $this->lang = ($lang !== null) ? $lang : $this->lang;
+ $this->html = ($html !== false) ? $html : $this->html;
+ $ini_size = preg_replace('/m/i', '000000', ini_get('upload_max_filesize'));
+
+ if (function_exists('version_compare') &&
+ version_compare(phpversion(), '4.1', 'ge')) {
+ $maxsize = (isset($_POST['MAX_FILE_SIZE'])) ?
+ $_POST['MAX_FILE_SIZE'] : null;
+ } else {
+ global $HTTP_POST_VARS;
+ $maxsize = (isset($HTTP_POST_VARS['MAX_FILE_SIZE'])) ?
+ $HTTP_POST_VARS['MAX_FILE_SIZE'] : null;
+ }
+
+ if (empty($maxsize) || ($maxsize > $ini_size)) {
+ $maxsize = $ini_size;
+ }
+ // XXXXX Add here error messages in your language
+ $this->error_codes = array(
+ 'TOO_LARGE' => array(
+ 'es' => "Fichero demasiado largo. El maximo permitido es: $maxsize bytes.",
+ 'en' => "File size too large. The maximum permitted size is: $maxsize bytes.",
+ 'de' => "Datei zu groß. Die zulässige Maximalgröße ist: $maxsize Bytes.",
+ 'nl' => "Het bestand is te groot, de maximale grootte is: $maxsize bytes.",
+ 'fr' => "Le fichier est trop gros. La taille maximum autorisée est: $maxsize bytes.",
+ 'it' => "Il file é troppo grande. Il massimo permesso é: $maxsize bytes.",
+ 'pt_BR' => "Arquivo muito grande. O tamanho máximo permitido é $maxsize bytes."
+ ),
+ 'MISSING_DIR' => array(
+ 'es' => 'Falta directorio destino.',
+ 'en' => 'Missing destination directory.',
+ 'de' => 'Kein Zielverzeichnis definiert.',
+ 'nl' => 'Geen bestemmings directory.',
+ 'fr' => 'Le répertoire de destination n\'est pas défini.',
+ 'it' => 'Manca la directory di destinazione.',
+ 'pt_BR' => 'Ausência de diretório de destino.'
+ ),
+ 'IS_NOT_DIR' => array(
+ 'es' => 'El directorio destino no existe o es un fichero regular.',
+ 'en' => 'The destination directory doesn\'t exist or is a regular file.',
+ 'de' => 'Das angebene Zielverzeichnis existiert nicht oder ist eine Datei.',
+ 'nl' => 'De doeldirectory bestaat niet, of is een gewoon bestand.',
+ 'fr' => 'Le répertoire de destination n\'existe pas ou il s\'agit d\'un fichier régulier.',
+ 'it' => 'La directory di destinazione non esiste o é un file.',
+ 'pt_BR' => 'O diretório de destino não existe ou é um arquivo.'
+ ),
+ 'NO_WRITE_PERMS' => array(
+ 'es' => 'El directorio destino no tiene permisos de escritura.',
+ 'en' => 'The destination directory doesn\'t have write perms.',
+ 'de' => 'Fehlende Schreibrechte für das Zielverzeichnis.',
+ 'nl' => 'Geen toestemming om te schrijven in de doeldirectory.',
+ 'fr' => 'Le répertoire de destination n\'a pas les droits en écriture.',
+ 'it' => 'Non si hanno i permessi di scrittura sulla directory di destinazione.',
+ 'pt_BR' => 'O diretório de destino não possui permissão para escrita.'
+ ),
+ 'NO_USER_FILE' => array(
+ 'es' => 'No se ha escogido fichero para el upload.',
+ 'en' => 'You haven\'t selected any file for uploading.',
+ 'de' => 'Es wurde keine Datei für den Upload ausgewählt.',
+ 'nl' => 'Er is geen bestand opgegeven om te uploaden.',
+ 'fr' => 'Vous n\'avez pas sélectionné de fichier à envoyer.',
+ 'it' => 'Nessun file selezionato per l\'upload.',
+ 'pt_BR' => 'Nenhum arquivo selecionado para upload.'
+ ),
+ 'BAD_FORM' => array(
+ 'es' => 'El formulario no contiene method="post" enctype="multipart/form-data" requerido.',
+ 'en' => 'The html form doesn\'t contain the required method="post" enctype="multipart/form-data".',
+ 'de' => 'Das HTML-Formular enthält nicht die Angabe method="post" enctype="multipart/form-data" '.
+ 'im >form<-Tag.',
+ 'nl' => 'Het HTML-formulier bevat niet de volgende benodigde '.
+ 'eigenschappen: method="post" enctype="multipart/form-data".',
+ 'fr' => 'Le formulaire HTML ne contient pas les attributs requis : '.
+ ' method="post" enctype="multipart/form-data".',
+ 'it' => 'Il modulo HTML non contiene gli attributi richiesti: "'.
+ ' method="post" enctype="multipart/form-data".',
+ 'pt_BR' => 'O formulário HTML não possui o method="post" enctype="multipart/form-data" requerido.'
+ ),
+ 'E_FAIL_COPY' => array(
+ 'es' => 'Fallo al copiar el fichero temporal.',
+ 'en' => 'Failed to copy the temporary file.',
+ 'de' => 'Temporäre Datei konnte nicht kopiert werden.',
+ 'nl' => 'Het tijdelijke bestand kon niet gekopieerd worden.',
+ 'fr' => 'L\'enregistrement du fichier temporaire a échoué.',
+ 'it' => 'Copia del file temporaneo fallita.',
+ 'pt_BR' => 'Falha ao copiar o arquivo temporário.'
+ ),
+ 'E_FAIL_MOVE' => array(
+ 'es' => 'No puedo mover el fichero.',
+ 'en' => 'Impossible to move the file.',
+ 'de' => 'Datei kann nicht verschoben werden.',
+ 'nl' => 'Het bestand kon niet verplaatst worden.',
+ 'fr' => 'Impossible de déplacer le fichier.',
+ 'pt_BR' => 'Não foi possível mover o arquivo.'
+ ),
+ 'FILE_EXISTS' => array(
+ 'es' => 'El fichero destino ya existe.',
+ 'en' => 'The destination file already exists.',
+ 'de' => 'Die zu erzeugende Datei existiert bereits.',
+ 'nl' => 'Het doelbestand bestaat al.',
+ 'fr' => 'Le fichier de destination existe déjà.',
+ 'it' => 'File destinazione già esistente.',
+ 'pt_BR' => 'O arquivo de destino já existe.'
+ ),
+ 'CANNOT_OVERWRITE' => array(
+ 'es' => 'El fichero destino ya existe y no se puede sobreescribir.',
+ 'en' => 'The destination file already exists and could not be overwritten.',
+ 'de' => 'Die zu erzeugende Datei existiert bereits und konnte nicht überschrieben werden.',
+ 'nl' => 'Het doelbestand bestaat al, en kon niet worden overschreven.',
+ 'fr' => 'Le fichier de destination existe déjà et ne peux pas être remplacé.',
+ 'it' => 'File destinazione già esistente e non si può sovrascrivere.',
+ 'pt_BR' => 'O arquivo de destino já existe e não pôde ser sobrescrito.'
+ ),
+ 'NOT_ALLOWED_EXTENSION' => array(
+ 'es' => 'Extension de fichero no permitida.',
+ 'en' => 'File extension not permitted.',
+ 'de' => 'Unerlaubte Dateiendung.',
+ 'nl' => 'Niet toegestane bestands-extensie.',
+ 'fr' => 'Le fichier a une extension non autorisée.',
+ 'it' => 'Estensione del File non permessa.',
+ 'pt_BR' => 'Extensão de arquivo não permitida.'
+ ),
+ 'PARTIAL' => array(
+ 'es' => 'El fichero fue parcialmente subido',
+ 'en' => 'The file was only partially uploaded.',
+ 'de' => 'Die Datei wurde unvollständig übertragen.',
+ 'nl' => 'Het bestand is slechts gedeeltelijk geupload.',
+ 'pt_BR' => 'O arquivo não foi enviado por completo.'
+ ),
+ 'ERROR' => array(
+ 'es' => 'Error en subida:',
+ 'en' => 'Upload error:',
+ 'de' => 'Fehler beim Upload:',
+ 'nl' => 'Upload fout:',
+ 'pt_BR' => 'Erro de upload:'
+ ),
+ 'DEV_NO_DEF_FILE' => array(
+ 'es' => 'No está definido en el formulario este nombre de fichero como <input type="file" name=?>.',
+ 'en' => 'This filename is not defined in the form as <input type="file" name=?>.',
+ 'de' => 'Dieser Dateiname ist im Formular nicht als <input type="file" name=?> definiert.',
+ 'nl' => 'Deze bestandsnaam is niett gedefineerd in het formulier als <input type="file" name=?>.'
+ )
+ );
+ }
+
+ /**
+ * returns the error code
+ *
+ * @param string $e_code type of error
+ * @return string Error message
+ */
+ function errorCode($e_code)
+ {
+ if (!empty($this->error_codes[$e_code][$this->lang])) {
+ $msg = $this->html ?
+ html_entity_decode($this->error_codes[$e_code][$this->lang]) :
+ $this->error_codes[$e_code][$this->lang];
+ } else {
+ $msg = $e_code;
+ }
+
+ if (!empty($this->error_codes['ERROR'][$this->lang])) {
+ $error = $this->error_codes['ERROR'][$this->lang];
+ } else {
+ $error = $this->error_codes['ERROR']['en'];
+ }
+ return $error.' '.$msg;
+ }
+
+ /**
+ * Overwrites the PEAR::raiseError method
+ *
+ * @param string $e_code type of error
+ * @return object PEAR_Error a PEAR-Error object
+ * @access public
+ */
+ function raiseError($e_code)
+ {
+ return PEAR::raiseError($this->errorCode($e_code), $e_code);
+ }
+}
+
+/**
+ * This class provides an advanced file uploader system
+ * for file uploads made from html forms
+
+ *
+ * @author Tomas V.V.Cox
+ * @see http://vulcanonet.com/soft/index.php?pack=uploader
+ * @package HTTP_Upload
+ * @category HTTP
+ * @access public
+ */
+class HTTP_Upload extends HTTP_Upload_Error
+{
+ /**
+ * Contains an array of "uploaded files" objects
+ * @var array
+ */
+ var $files = array();
+
+ /**
+ * Contains the desired chmod for uploaded files
+ * @var int
+ * @access private
+ */
+ var $_chmod = HTTP_UPLOAD_DEFAULT_CHMOD;
+
+ /**
+ * Constructor
+ *
+ * @param string $lang Language to use for reporting errors
+ * @see Upload_Error::error_codes
+ * @access public
+ */
+ function HTTP_Upload($lang = null)
+ {
+ $this->HTTP_Upload_Error($lang);
+ if (function_exists('version_compare') &&
+ version_compare(phpversion(), '4.1', 'ge'))
+ {
+ $this->post_files = $_FILES;
+ if (isset($_SERVER['CONTENT_TYPE'])) {
+ $this->content_type = $_SERVER['CONTENT_TYPE'];
+ }
+ } else {
+ global $HTTP_POST_FILES, $HTTP_SERVER_VARS;
+ $this->post_files = $HTTP_POST_FILES;
+ if (isset($HTTP_SERVER_VARS['CONTENT_TYPE'])) {
+ $this->content_type = $HTTP_SERVER_VARS['CONTENT_TYPE'];
+ }
+ }
+ }
+
+ /**
+ * Get files
+ *
+ * @param mixed $file If:
+ * - not given, function will return array of upload_file objects
+ * - is int, will return the $file position in upload_file objects array
+ * - is string, will return the upload_file object corresponding
+ * to $file name of the form. For ex:
+ * if form is
+ * to get this file use: $upload->getFiles('userfile')
+ *
+ * @return mixed array or object (see @param $file above) or Pear_Error
+ * @access public
+ */
+ function &getFiles($file = null)
+ {
+ static $is_built = false;
+ //build only once for multiple calls
+ if (!$is_built) {
+ $files = &$this->_buildFiles();
+ if (PEAR::isError($files)) {
+ // there was an error with the form.
+ // Create a faked upload embedding the error
+ $this->files['_error'] = &new HTTP_Upload_File(
+ '_error', null,
+ null, null,
+ null, $files->getCode(),
+ $this->lang, $this->_chmod);
+ } else {
+ $this->files = $files;
+ }
+ $is_built = true;
+ }
+ if ($file !== null) {
+ if (is_int($file)) {
+ $pos = 0;
+ foreach ($this->files as $obj) {
+ if ($pos == $file) {
+ return $obj;
+ }
+ $pos++;
+ }
+ } elseif (is_string($file) && isset($this->files[$file])) {
+ return $this->files[$file];
+ }
+ if (isset($this->files['_error'])) {
+ return $this->files['_error'];
+ } else {
+ // developer didn't specify this name in the form
+ // warn him about it with a faked upload
+ return new HTTP_Upload_File(
+ '_error', null,
+ null, null,
+ null, 'DEV_NO_DEF_FILE',
+ $this->lang);
+ }
+ }
+ return $this->files;
+ }
+
+ /**
+ * Creates the list of the uploaded file
+ *
+ * @return array of HTTP_Upload_File objects for every file
+ */
+ function &_buildFiles()
+ {
+ // Form method check
+ if (!isset($this->content_type) ||
+ strpos($this->content_type, 'multipart/form-data') !== 0)
+ {
+ return $this->raiseError('BAD_FORM');
+ }
+ // In 4.1 $_FILES isn't initialized when no uploads
+ // XXX (cox) afaik, in >= 4.1 and <= 4.3 only
+ if (function_exists('version_compare') &&
+ version_compare(phpversion(), '4.1', 'ge'))
+ {
+ $error = $this->isMissing();
+ if (PEAR::isError($error)) {
+ return $error;
+ }
+ }
+
+ // map error codes from 4.2.0 $_FILES['userfile']['error']
+ if (function_exists('version_compare') &&
+ version_compare(phpversion(), '4.2.0', 'ge')) {
+ $uploadError = array(
+ 1 => 'TOO_LARGE',
+ 2 => 'TOO_LARGE',
+ 3 => 'PARTIAL',
+ 4 => 'NO_USER_FILE'
+ );
+ }
+
+
+ // Parse $_FILES (or $HTTP_POST_FILES)
+ $files = array();
+ foreach ($this->post_files as $userfile => $value) {
+ if (is_array($value['name'])) {
+ foreach ($value['name'] as $key => $val) {
+ $err = $value['error'][$key];
+ if (isset($err) && $err !== 0 && isset($uploadError[$err])) {
+ $error = $uploadError[$err];
+ } else {
+ $error = null;
+ }
+ $name = basename($value['name'][$key]);
+ $tmp_name = $value['tmp_name'][$key];
+ $size = $value['size'][$key];
+ $type = $value['type'][$key];
+ $formname = $userfile . "[$key]";
+ $files[$formname] = new HTTP_Upload_File($name, $tmp_name,
+ $formname, $type, $size, $error, $this->lang, $this->_chmod);
+ }
+ // One file
+ } else {
+ $err = $value['error'];
+ if (isset($err) && $err !== 0 && isset($uploadError[$err])) {
+ $error = $uploadError[$err];
+ } else {
+ $error = null;
+ }
+ $name = basename($value['name']);
+ $tmp_name = $value['tmp_name'];
+ $size = $value['size'];
+ $type = $value['type'];
+ $formname = $userfile;
+ $files[$formname] = new HTTP_Upload_File($name, $tmp_name,
+ $formname, $type, $size, $error, $this->lang, $this->_chmod);
+ }
+ }
+ return $files;
+ }
+
+ /**
+ * Checks if the user submited or not some file
+ *
+ * @return mixed False when are files or PEAR_Error when no files
+ * @access public
+ * @see Read the note in the source code about this function
+ */
+ function isMissing()
+ {
+ if (count($this->post_files) < 1) {
+ return $this->raiseError('NO_USER_FILE');
+ }
+ //we also check if at least one file has more than 0 bytes :)
+ $files = array();
+ $size = 0;
+ foreach ($this->post_files as $userfile => $value) {
+ if (is_array($value['name'])) {
+ foreach ($value['name'] as $key => $val) {
+ $size += $value['size'][$key];
+ }
+ } else { //one file
+ $size = $value['size'];
+ }
+ }
+ if ($size == 0) {
+ $this->raiseError('NO_USER_FILE');
+ }
+ return false;
+ }
+
+ /**
+ * Sets the chmod to be used for uploaded files
+ *
+ * @param int Desired mode
+ */
+ function setChmod($mode)
+ {
+ $this->_chmod = $mode;
+ }
+}
+
+/**
+ * This class provides functions to work with the uploaded file
+ *
+ * @author Tomas V.V.Cox
+ * @see http://vulcanonet.com/soft/index.php?pack=uploader
+ * @package HTTP_Upload
+ * @category HTTP
+ * @access public
+ */
+class HTTP_Upload_File extends HTTP_Upload_Error
+{
+ /**
+ * If the random seed was initialized before or not
+ * @var boolean;
+ */
+ var $_seeded = 0;
+
+ /**
+ * Assoc array with file properties
+ * @var array
+ */
+ var $upload = array();
+
+ /**
+ * If user haven't selected a mode, by default 'safe' will be used
+ * @var boolean
+ */
+ var $mode_name_selected = false;
+
+ /**
+ * It's a common security risk in pages who has the upload dir
+ * under the document root (remember the hack of the Apache web?)
+ *
+ * @var array
+ * @access private
+ * @see HTTP_Upload_File::setValidExtensions()
+ */
+ var $_extensions_check = array('php', 'phtm', 'phtml', 'php3', 'inc');
+
+ /**
+ * @see HTTP_Upload_File::setValidExtensions()
+ * @var string
+ * @access private
+ */
+ var $_extensions_mode = 'deny';
+
+ /**
+ * Contains the desired chmod for uploaded files
+ * @var int
+ * @access private
+ */
+ var $_chmod = HTTP_UPLOAD_DEFAULT_CHMOD;
+
+ /**
+ * Constructor
+ *
+ * @param string $name destination file name
+ * @param string $tmp temp file name
+ * @param string $formname name of the form
+ * @param string $type Mime type of the file
+ * @param string $size size of the file
+ * @param string $error error on upload
+ * @param string $lang used language for errormessages
+ * @access public
+ */
+ function HTTP_Upload_File($name = null, $tmp = null, $formname = null,
+ $type = null, $size = null, $error = null,
+ $lang = null, $chmod = HTTP_UPLOAD_DEFAULT_CHMOD)
+ {
+ $this->HTTP_Upload_Error($lang);
+ $ext = null;
+
+ if (empty($name) || $size == 0) {
+ $error = 'NO_USER_FILE';
+ } elseif ($tmp == 'none') {
+ $error = 'TOO_LARGE';
+ } else {
+ // strpos needed to detect files without extension
+ if (($pos = strrpos($name, '.')) !== false) {
+ $ext = substr($name, $pos + 1);
+ }
+ }
+
+ if (function_exists('version_compare') &&
+ version_compare(phpversion(), '4.1', 'ge')) {
+ if (isset($_POST['MAX_FILE_SIZE']) &&
+ $size > $_POST['MAX_FILE_SIZE']) {
+ $error = 'TOO_LARGE';
+ }
+ } else {
+ global $HTTP_POST_VARS;
+ if (isset($HTTP_POST_VARS['MAX_FILE_SIZE']) &&
+ $size > $HTTP_POST_VARS['MAX_FILE_SIZE']) {
+ $error = 'TOO_LARGE';
+ }
+ }
+
+ $this->upload = array(
+ 'real' => $name,
+ 'name' => $name,
+ 'form_name' => $formname,
+ 'ext' => $ext,
+ 'tmp_name' => $tmp,
+ 'size' => $size,
+ 'type' => $type,
+ 'error' => $error
+ );
+
+ $this->_chmod = $chmod;
+ }
+
+ /**
+ * Sets the name of the destination file
+ *
+ * @param string $mode A valid mode: 'uniq', 'safe' or 'real' or a file name
+ * @param string $prepend A string to prepend to the name
+ * @param string $append A string to append to the name
+ *
+ * @return string The modified name of the destination file
+ * @access public
+ */
+ function setName($mode, $prepend = null, $append = null)
+ {
+ switch ($mode) {
+ case 'uniq':
+ $name = $this->nameToUniq();
+ $this->upload['ext'] = $this->nameToSafe($this->upload['ext'], 10);
+ $name .= '.' . $this->upload['ext'];
+ break;
+ case 'safe':
+ $name = $this->nameToSafe($this->upload['real']);
+ if (($pos = strrpos($name, '.')) !== false) {
+ $this->upload['ext'] = substr($name, $pos + 1);
+ } else {
+ $this->upload['ext'] = '';
+ }
+ break;
+ case 'real':
+ $name = $this->upload['real'];
+ break;
+ default:
+ $name = $mode;
+ }
+ $this->upload['name'] = $prepend . $name . $append;
+ $this->mode_name_selected = true;
+ return $this->upload['name'];
+ }
+
+ /**
+ * Unique file names in the form: 9022210413b75410c28bef.html
+ * @see HTTP_Upload_File::setName()
+ */
+ function nameToUniq()
+ {
+ if (! $this->_seeded) {
+ srand((double) microtime() * 1000000);
+ $this->_seeded = 1;
+ }
+ $uniq = uniqid(rand());
+ return $uniq;
+ }
+
+ /**
+ * Format a file name to be safe
+ *
+ * @param string $file The string file name
+ * @param int $maxlen Maximun permited string lenght
+ * @return string Formatted file name
+ * @see HTTP_Upload_File::setName()
+ */
+ function nameToSafe($name, $maxlen=250)
+ {
+ $noalpha = 'ÁÉÍÓÚÝáéíóúýÂÊÎÔÛâêîôûÀÈÌÒÙàèìòùÄËÏÖÜäëïöüÿÃãÕõÅåÑñÇç@°ºª';
+ $alpha = 'AEIOUYaeiouyAEIOUaeiouAEIOUaeiouAEIOUaeiouyAaOoAaNnCcaooa';
+
+ $name = substr($name, 0, $maxlen);
+ $name = strtr($name, $noalpha, $alpha);
+ // not permitted chars are replaced with "_"
+ return preg_replace('/[^a-zA-Z0-9,._\+\()\-]/', '_', $name);
+ }
+
+ /**
+ * The upload was valid
+ *
+ * @return bool If the file was submitted correctly
+ * @access public
+ */
+ function isValid()
+ {
+ if ($this->upload['error'] === null) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * User haven't submit a file
+ *
+ * @return bool If the user submitted a file or not
+ * @access public
+ */
+ function isMissing()
+ {
+ if ($this->upload['error'] == 'NO_USER_FILE') {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Some error occured during upload (most common due a file size problem,
+ * like max size exceeded or 0 bytes long).
+ * @return bool If there were errors submitting the file (probably
+ * because the file excess the max permitted file size)
+ * @access public
+ */
+ function isError()
+ {
+ if (in_array($this->upload['error'], array('TOO_LARGE', 'BAD_FORM','DEV_NO_DEF_FILE'))) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Moves the uploaded file to its destination directory.
+ *
+ * @param string $dir_dest Destination directory
+ * @param bool $overwrite Overwrite if destination file exists?
+ * @return mixed True on success or Pear_Error object on error
+ * @access public
+ */
+ function moveTo($dir_dest, $overwrite = true)
+ {
+ if (!$this->isValid()) {
+ return $this->raiseError($this->upload['error']);
+ }
+
+ //Valid extensions check
+ if (!$this->_evalValidExtensions()) {
+ return $this->raiseError('NOT_ALLOWED_EXTENSION');
+ }
+
+ $err_code = $this->_chk_dir_dest($dir_dest);
+ if ($err_code !== false) {
+ return $this->raiseError($err_code);
+ }
+ // Use 'safe' mode by default if no other was selected
+ if (!$this->mode_name_selected) {
+ $this->setName('safe');
+ }
+
+ $name_dest = $dir_dest . DIRECTORY_SEPARATOR . $this->upload['name'];
+
+ if (@is_file($name_dest)) {
+ if ($overwrite !== true) {
+ return $this->raiseError('FILE_EXISTS');
+ } elseif (!is_writable($name_dest)) {
+ return $this->raiseError('CANNOT_OVERWRITE');
+ }
+ }
+
+ // copy the file and let php clean the tmp
+ if (!@move_uploaded_file($this->upload['tmp_name'], $name_dest)) {
+ return $this->raiseError('E_FAIL_MOVE');
+ }
+ @chmod($name_dest, $this->_chmod);
+ return $this->getProp('name');
+ }
+
+ /**
+ * Check for a valid destination dir
+ *
+ * @param string $dir_dest Destination dir
+ * @return mixed False on no errors or error code on error
+ */
+ function _chk_dir_dest($dir_dest)
+ {
+ if (!$dir_dest) {
+ return 'MISSING_DIR';
+ }
+ if (!@is_dir ($dir_dest)) {
+ return 'IS_NOT_DIR';
+ }
+ if (!is_writeable ($dir_dest)) {
+ return 'NO_WRITE_PERMS';
+ }
+ return false;
+ }
+ /**
+ * Retrive properties of the uploaded file
+ * @param string $name The property name. When null an assoc array with
+ * all the properties will be returned
+ * @return mixed A string or array
+ * @see HTTP_Upload_File::HTTP_Upload_File()
+ * @access public
+ */
+ function getProp($name = null)
+ {
+ if ($name === null) {
+ return $this->upload;
+ }
+ return $this->upload[$name];
+ }
+
+ /**
+ * Returns a error message, if a error occured
+ * (deprecated) Use getMessage() instead
+ * @return string a Error message
+ * @access public
+ */
+ function errorMsg()
+ {
+ return $this->errorCode($this->upload['error']);
+ }
+
+ /**
+ * Returns a error message, if a error occured
+ * @return string a Error message
+ * @access public
+ */
+ function getMessage()
+ {
+ return $this->errorCode($this->upload['error']);
+ }
+
+ /**
+ * Function to restrict the valid extensions on file uploads
+ *
+ * @param array $exts File extensions to validate
+ * @param string $mode The type of validation:
+ * 1) 'deny' Will deny only the supplied extensions
+ * 2) 'accept' Will accept only the supplied extensions
+ * as valid
+ * @access public
+ */
+ function setValidExtensions($exts, $mode = 'deny')
+ {
+ $this->_extensions_check = $exts;
+ $this->_extensions_mode = $mode;
+ }
+
+ /**
+ * Evaluates the validity of the extensions set by setValidExtensions
+ *
+ * @return bool False on non valid extension, true if they are valid
+ * @access private
+ */
+ function _evalValidExtensions()
+ {
+ $exts = $this->_extensions_check;
+ settype($exts, 'array');
+ if ($this->_extensions_mode == 'deny') {
+ if (in_array($this->getProp('ext'), $exts)) {
+ return false;
+ }
+ // mode == 'accept'
+ } else {
+ if (!in_array($this->getProp('ext'), $exts)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
?>
\ No newline at end of file
diff --git a/thirdparty/pear/HTTP/WebDAV/Server.php b/thirdparty/pear/HTTP/WebDAV/Server.php
index 258120e..8e200c9 100755
--- a/thirdparty/pear/HTTP/WebDAV/Server.php
+++ b/thirdparty/pear/HTTP/WebDAV/Server.php
@@ -17,7 +17,7 @@
// | Christian Stocker |
// +----------------------------------------------------------------------+
//
-// $Id: Server.php,v 1.36 2005/09/24 20:08:57 hholzgra Exp $
+// $Id$
//
require_once "HTTP/WebDAV/Tools/_parse_propfind.php";
require_once "HTTP/WebDAV/Tools/_parse_proppatch.php";
diff --git a/thirdparty/pear/HTTP/WebDAV/Tools/_parse_lockinfo.php b/thirdparty/pear/HTTP/WebDAV/Tools/_parse_lockinfo.php
index 3b32e2f..4a08100 100644
--- a/thirdparty/pear/HTTP/WebDAV/Tools/_parse_lockinfo.php
+++ b/thirdparty/pear/HTTP/WebDAV/Tools/_parse_lockinfo.php
@@ -17,7 +17,7 @@
// | Christian Stocker |
// +----------------------------------------------------------------------+
//
-// $Id: _parse_lockinfo.php,v 1.2 2004/01/05 12:32:40 hholzgra Exp $
+// $Id$
//
/**
diff --git a/thirdparty/pear/HTTP/WebDAV/Tools/_parse_propfind.php b/thirdparty/pear/HTTP/WebDAV/Tools/_parse_propfind.php
index 15234cb..ea16cd7 100644
--- a/thirdparty/pear/HTTP/WebDAV/Tools/_parse_propfind.php
+++ b/thirdparty/pear/HTTP/WebDAV/Tools/_parse_propfind.php
@@ -17,7 +17,7 @@
// | Christian Stocker |
// +----------------------------------------------------------------------+
//
-// $Id: _parse_propfind.php,v 1.2 2004/01/05 12:33:22 hholzgra Exp $
+// $Id$
//
/**
diff --git a/thirdparty/pear/HTTP/WebDAV/Tools/_parse_proppatch.php b/thirdparty/pear/HTTP/WebDAV/Tools/_parse_proppatch.php
index 9836ab2..006efb5 100644
--- a/thirdparty/pear/HTTP/WebDAV/Tools/_parse_proppatch.php
+++ b/thirdparty/pear/HTTP/WebDAV/Tools/_parse_proppatch.php
@@ -17,7 +17,7 @@
// | Christian Stocker |
// +----------------------------------------------------------------------+
//
-// $Id: _parse_proppatch.php,v 1.3 2004/01/05 12:41:34 hholzgra Exp $
+// $Id$
//
/**
diff --git a/thirdparty/pear/JSON.php b/thirdparty/pear/JSON.php
index 0cddbdd..8283e7e 100644
--- a/thirdparty/pear/JSON.php
+++ b/thirdparty/pear/JSON.php
@@ -51,7 +51,7 @@
* @author Matt Knapp
* @author Brett Stimmerman
* @copyright 2005 Michal Migurski
- * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
+ * @version CVS: $Id$
* @license http://www.opensource.org/licenses/bsd-license.php
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
*/
diff --git a/thirdparty/pear/Net/CheckIP.php b/thirdparty/pear/Net/CheckIP.php
index b0fbc73..99e348b 100644
--- a/thirdparty/pear/Net/CheckIP.php
+++ b/thirdparty/pear/Net/CheckIP.php
@@ -17,7 +17,7 @@
// | Guido Haeger |
// +----------------------------------------------------------------------+
//
-// $Id: CheckIP.php,v 1.5 2002/08/17 09:41:24 mj Exp $
+// $Id$
/**
* Class to validate the syntax of IPv4 adresses
diff --git a/thirdparty/pear/Net/Curl.php b/thirdparty/pear/Net/Curl.php
index d8c65d0..2aa0240 100644
--- a/thirdparty/pear/Net/Curl.php
+++ b/thirdparty/pear/Net/Curl.php
@@ -18,7 +18,7 @@
* @author Joe Stump
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Revision: 1.11 $
+ * @version CVS: $Revision$
* @link http://pear.php.net/package/Net_Curl
*/
diff --git a/thirdparty/pear/Net/DIME.php b/thirdparty/pear/Net/DIME.php
index 6c54208..fc69af5 100644
--- a/thirdparty/pear/Net/DIME.php
+++ b/thirdparty/pear/Net/DIME.php
@@ -1,629 +1,629 @@
- |
-// | Ralf Hofmann |
-// +----------------------------------------------------------------------+
-//
-// $Id: DIME.php,v 1.5 2002/09/29 01:55:16 shane Exp $
-//
-
-require_once 'PEAR.php';
-/**
- *
- * DIME Encoding/Decoding
- *
- * What is it?
- * This class enables you to manipulate and build
- * a DIME encapsulated message.
- *
- * http://www.ietf.org/internet-drafts/draft-nielsen-dime-02.txt
- *
- * 09/18/02 Ralf - A huge number of changes to be compliant
- * with the DIME Specification Release 17 June 2002
- *
- * TODO: lots of stuff needs to be tested.
- * Definitily have to go through DIME spec and
- * make things work right, most importantly, sec 3.3
- * make examples, document
- *
- * see test/dime_mesage_test.php for example of usage
- *
- * @author Shane Caraveo ,
- * Ralf Hofmann
- * @version $Revision: 1.5 $
- * @package Net_DIME
- */
-define('NET_DIME_TYPE_UNCHANGED',0x00);
-define('NET_DIME_TYPE_MEDIA',0x01);
-define('NET_DIME_TYPE_URI',0x02);
-define('NET_DIME_TYPE_UNKNOWN',0x03);
-define('NET_DIME_TYPE_NONE',0x04);
-
-define('NET_DIME_VERSION',0x0001);
-
-define('NET_DIME_RECORD_HEADER',12);
-
-define('NET_DIME_FLAGS', 0);
-define('NET_DIME_OPTS_LEN', 1);
-define('NET_DIME_ID_LEN', 2);
-define('NET_DIME_TYPE_LEN', 3);
-define('NET_DIME_DATA_LEN', 4);
-define('NET_DIME_OPTS', 5);
-define('NET_DIME_ID', 6);
-define('NET_DIME_TYPE', 7);
-define('NET_DIME_DATA', 8);
-
-class Net_DIME_Record extends PEAR
-{
- // these are used to hold the padded length
- var $OPTS_LENGTH = 0;
- var $ID_LENGTH = 0;
- var $TYPE_LENGTH = 0;
- var $DATA_LENGTH = 0;
- var $_haveOpts = FALSE;
- var $_haveID = FALSE;
- var $_haveType = FALSE;
- var $_haveData = FALSE;
- var $debug = FALSE;
- var $padstr = "\0";
- /**
- * Elements
- * [NET_DIME_FLAGS], 16 bits: VERSION:MB:ME:CF:TYPE_T
- * [NET_DIME_OPTS_LEN], 16 bits: OPTIONS_LENGTH
- * [NET_DIME_ID_LEN], 16 bits: ID_LENGTH
- * [NET_DIME_TYPE_LEN], 16 bits: TYPE_LENGTH
- * [NET_DIME_DATA_LEN], 32 bits: DATA_LENGTH
- * [NET_DIME_OPTS] : OPTIONS
- * [NET_DIME_ID] : ID
- * [NET_DIME_TYPE] : TYPE
- * [NET_DIME_DATA] : DATA
- */
- var $Elements = array(NET_DIME_FLAGS => 0, NET_DIME_OPTS_LEN => 0,
- NET_DIME_ID_LEN => 0, NET_DIME_TYPE_LEN => 0,
- NET_DIME_DATA_LEN => 0,
- NET_DIME_OPTS => '',
- NET_DIME_ID => '',
- NET_DIME_TYPE => '',
- NET_DIME_DATA => '');
-
- function Net_DIME_Record($debug = FALSE)
- {
- $this->debug = $debug;
- if ($debug) $this->padstr = '*';
- }
-
- function setMB()
- {
- $this->Elements[NET_DIME_FLAGS] |= 0x0400;
- }
-
- function setME()
- {
- $this->Elements[NET_DIME_FLAGS] |= 0x0200;
- }
-
- function setCF()
- {
- $this->Elements[NET_DIME_FLAGS] |= 0x0100;
- }
-
- function isChunk()
- {
- return $this->Elements[NET_DIME_FLAGS] & 0x0100;
- }
-
- function isEnd()
- {
- return $this->Elements[NET_DIME_FLAGS] & 0x0200;
- }
-
- function isStart()
- {
- return $this->Elements[NET_DIME_FLAGS] & 0x0400;
- }
-
- function getID()
- {
- return $this->Elements[NET_DIME_ID];
- }
-
- function getType()
- {
- return $this->Elements[NET_DIME_TYPE];
- }
-
- function getData()
- {
- return $this->Elements[NET_DIME_DATA];
- }
-
- function getDataLength()
- {
- return $this->Elements[NET_DIME_DATA_LEN];
- }
-
- function setType($typestring, $type=NET_DIME_TYPE_UNKNOWN)
- {
- $typelen = strlen($typestring) & 0xFFFF;
- $type = $type << 4;
- $this->Elements[NET_DIME_FLAGS] = ($this->Elements[NET_DIME_FLAGS] & 0xFF0F) | $type;
- $this->Elements[NET_DIME_TYPE_LEN] = $typelen;
- $this->TYPE_LENGTH = $this->_getPadLength($typelen);
- $this->Elements[NET_DIME_TYPE] = $typestring;
- }
-
- function generateID()
- {
- $id = md5(time());
- $this->setID($id);
- return $id;
- }
-
- function setID($id)
- {
- $idlen = strlen($id) & 0xFFFF;
- $this->Elements[NET_DIME_ID_LEN] = $idlen;
- $this->ID_LENGTH = $this->_getPadLength($idlen);
- $this->Elements[NET_DIME_ID] = $id;
- }
-
- function setData($data, $size=0)
- {
- $datalen = $size?$size:strlen($data);
- $this->Elements[NET_DIME_DATA_LEN] = $datalen;
- $this->DATA_LENGTH = $this->_getPadLength($datalen);
- $this->Elements[NET_DIME_DATA] = $data;
- }
-
- function encode()
- {
- // insert version
- $this->Elements[NET_DIME_FLAGS] = ($this->Elements[NET_DIME_FLAGS] & 0x07FF) | (NET_DIME_VERSION << 11);
-
- // the real dime encoding
- $format = '%c%c%c%c%c%c%c%c%c%c%c%c'.
- '%'.$this->OPTS_LENGTH.'s'.
- '%'.$this->ID_LENGTH.'s'.
- '%'.$this->TYPE_LENGTH.'s'.
- '%'.$this->DATA_LENGTH.'s';
- return sprintf($format,
- ($this->Elements[NET_DIME_FLAGS]&0x0000FF00)>>8,
- ($this->Elements[NET_DIME_FLAGS]&0x000000FF),
- ($this->Elements[NET_DIME_OPTS_LEN]&0x0000FF00)>>8,
- ($this->Elements[NET_DIME_OPTS_LEN]&0x000000FF),
- ($this->Elements[NET_DIME_ID_LEN]&0x0000FF00)>>8,
- ($this->Elements[NET_DIME_ID_LEN]&0x000000FF),
- ($this->Elements[NET_DIME_TYPE_LEN]&0x0000FF00)>>8,
- ($this->Elements[NET_DIME_TYPE_LEN]&0x000000FF),
- ($this->Elements[NET_DIME_DATA_LEN]&0xFF000000)>>24,
- ($this->Elements[NET_DIME_DATA_LEN]&0x00FF0000)>>16,
- ($this->Elements[NET_DIME_DATA_LEN]&0x0000FF00)>>8,
- ($this->Elements[NET_DIME_DATA_LEN]&0x000000FF),
- str_pad($this->Elements[NET_DIME_OPTS], $this->OPTS_LENGTH, $this->padstr),
- str_pad($this->Elements[NET_DIME_ID], $this->ID_LENGTH, $this->padstr),
- str_pad($this->Elements[NET_DIME_TYPE], $this->TYPE_LENGTH, $this->padstr),
- str_pad($this->Elements[NET_DIME_DATA], $this->DATA_LENGTH, $this->padstr));
- }
-
- function _getPadLength($len)
- {
- $pad = 0;
- if ($len) {
- $pad = $len % 4;
- if ($pad) $pad = 4 - $pad;
- }
- return $len + $pad;
- }
-
- function decode(&$data)
- {
- // REAL DIME decoding
- $this->Elements[NET_DIME_FLAGS] = (hexdec(bin2hex($data[0]))<<8) + hexdec(bin2hex($data[1]));
- $this->Elements[NET_DIME_OPTS_LEN] = (hexdec(bin2hex($data[2]))<<8) + hexdec(bin2hex($data[3]));
- $this->Elements[NET_DIME_ID_LEN] = (hexdec(bin2hex($data[4]))<<8) + hexdec(bin2hex($data[5]));
- $this->Elements[NET_DIME_TYPE_LEN] = (hexdec(bin2hex($data[6]))<<8) + hexdec(bin2hex($data[7]));
- $this->Elements[NET_DIME_DATA_LEN] = (hexdec(bin2hex($data[8]))<<24) +
- (hexdec(bin2hex($data[9]))<<16) +
- (hexdec(bin2hex($data[10]))<<8) +
- hexdec(bin2hex($data[11]));
- $p = 12;
-
- $version = (($this->Elements[NET_DIME_FLAGS]>>11) & 0x001F);
-
- if ($version == NET_DIME_VERSION)
- {
- $this->OPTS_LENGTH = $this->_getPadLength($this->Elements[NET_DIME_OPTS_LEN]);
- $this->ID_LENGTH = $this->_getPadLength($this->Elements[NET_DIME_ID_LEN]);
- $this->TYPE_LENGTH = $this->_getPadLength($this->Elements[NET_DIME_TYPE_LEN]);
- $this->DATA_LENGTH = $this->_getPadLength($this->Elements[NET_DIME_DATA_LEN]);
-
- $datalen = strlen($data);
- $this->Elements[NET_DIME_OPTS] = substr($data,$p,$this->Elements[NET_DIME_OPTS_LEN]);
- $this->_haveOpts = (strlen($this->Elements[NET_DIME_OPTS]) == $this->Elements[NET_DIME_OPTS_LEN]);
- if ($this->_haveOpts) {
- $p += $this->OPTS_LENGTH;
- $this->Elements[NET_DIME_ID] = substr($data,$p,$this->Elements[NET_DIME_ID_LEN]);
- $this->_haveID = (strlen($this->Elements[NET_DIME_ID]) == $this->Elements[NET_DIME_ID_LEN]);
- if ($this->_haveID) {
- $p += $this->ID_LENGTH;
- $this->Elements[NET_DIME_TYPE] = substr($data,$p,$this->Elements[NET_DIME_TYPE_LEN]);
- $this->_haveType = (strlen($this->Elements[NET_DIME_TYPE]) == $this->Elements[NET_DIME_TYPE_LEN]);
- if ($this->_haveType) {
- $p += $this->TYPE_LENGTH;
- $this->Elements[NET_DIME_DATA] = substr($data,$p,$this->Elements[NET_DIME_DATA_LEN]);
- $this->_haveData = (strlen($this->Elements[NET_DIME_DATA]) == $this->Elements[NET_DIME_DATA_LEN]);
- if ($this->_haveData) {
- $p += $this->DATA_LENGTH;
- } else {
- $p += strlen($this->Elements[NET_DIME_DATA]);
- }
- } else {
- $p += strlen($this->Elements[NET_DIME_TYPE]);
- }
- } else {
- $p += strlen($this->Elements[NET_DIME_ID]);
- }
- } else {
- $p += strlen($this->Elements[NET_DIME_OPTS]);
- }
- }
- return substr($data, $p);
- }
-
- function addData(&$data)
- {
- $datalen = strlen($data);
- $p = 0;
- if (!$this->_haveOpts) {
- $have = strlen($this->Elements[NET_DIME_OPTS]);
- $this->Elements[NET_DIME_OPTS] .= substr($data,$p,$this->Elements[NET_DIME_OPTS_LEN]-$have);
- $this->_haveOpts = (strlen($this->Elements[NET_DIME_OPTS]) == $this->Elements[DIME_OTPS_LEN]);
- if (!$this->_haveOpts) return NULL;
- $p += $this->OPTS_LENGTH-$have;
- }
- if (!$this->_haveID) {
- $have = strlen($this->Elements[NET_DIME_ID]);
- $this->Elements[NET_DIME_ID] .= substr($data,$p,$this->Elements[NET_DIME_ID_LEN]-$have);
- $this->_haveID = (strlen($this->Elements[NET_DIME_ID]) == $this->Elements[NET_DIME_ID_LEN]);
- if (!$this->_haveID) return NULL;
- $p += $this->ID_LENGTH-$have;
- }
- if (!$this->_haveType && $p < $datalen) {
- $have = strlen($this->Elements[NET_DIME_TYPE]);
- $this->Elements[NET_DIME_TYPE] .= substr($data,$p,$this->Elements[NET_DIME_TYPE_LEN]-$have);
- $this->_haveType = (strlen($this->Elements[NET_DIME_TYPE]) == $this->Elements[NET_DIME_TYPE_LEN]);
- if (!$this->_haveType) return NULL;
- $p += $this->TYPE_LENGTH-$have;
- }
- if (!$this->_haveData && $p < $datalen) {
- $have = strlen($this->Elements[NET_DIME_DATA]);
- $this->Elements[NET_DIME_DATA] .= substr($data,$p,$this->Elements[NET_DIME_DATA_LEN]-$have);
- $this->_haveData = (strlen($this->Elements[NET_DIME_DATA]) == $this->Elements[NET_DIME_DATA_LEN]);
- if (!$this->_haveData) return NULL;
- $p += $this->DATA_LENGTH-$have;
- }
- return substr($data,$p);
- }
-}
-
-
-class Net_DIME_Message extends PEAR
-{
-
- var $record_size = 4096;
- #var $records =array();
- var $parts = array();
- var $currentPart = -1;
- var $stream = NULL;
- var $_currentRecord;
- var $_proc = array();
- var $type;
- var $typestr;
- var $mb = 1;
- var $me = 0;
- var $cf = 0;
- var $id = NULL;
- var $debug = FALSE;
- /**
- * constructor
- *
- * this currently takes a file pointer as provided
- * by fopen
- *
- * TODO: integrate with the php streams stuff
- */
- function Net_DIME_Message($stream=NULL, $record_size = 4096, $debug = FALSE)
- {
- $this->stream = $stream;
- $this->record_size = $record_size;
- $this->debug = $debug;
- }
-
- function _makeRecord(&$data, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
- {
- $record = new Net_DIME_Record($this->debug);
- if ($this->mb) {
- $record->setMB();
- // all subsequent records are not message begin!
- $this->mb = 0;
- }
- if ($this->me) $record->setME();
- if ($this->cf) $record->setCF();
- $record->setData($data);
- $record->setType($typestr,$type);
- if ($id) $record->setID($id);
- #if ($this->debug) {
- # print str_replace('\0','*',$record->encode());
- #}
- return $record->encode();
- }
-
- function startChunk(&$data, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
- {
- $this->me = 0;
- $this->cf = 1;
- $this->type = $type;
- $this->typestr = $typestr;
- if ($id) {
- $this->id = $id;
- } else {
- $this->id = md5(time());
- }
- return $this->_makeRecord($data, $this->typestr, $this->id, $this->type);
- }
-
- function doChunk(&$data)
- {
- $this->me = 0;
- $this->cf = 1;
- return $this->_makeRecord($data, NULL, NULL, NET_DIME_TYPE_UNCHANGED);
- }
-
- function endChunk()
- {
- $this->cf = 0;
- $data = NULL;
- $rec = $this->_makeRecord($data, NULL, NULL, NET_DIME_TYPE_UNCHANGED);
- $this->id = 0;
- $this->cf = 0;
- $this->id = 0;
- $this->type = NET_DIME_TYPE_UNKNOWN;
- $this->typestr = NULL;
- return $rec;
- }
-
- function endMessage()
- {
- $this->me = 1;
- $data = NULL;
- $rec = $this->_makeRecord($data, NULL, NULL, NET_DIME_TYPE_NONE);
- $this->me = 0;
- $this->mb = 1;
- $this->id = 0;
- return $rec;
- }
-
- /**
- * sendRecord
- *
- * given a chunk of data, it creates DIME records
- * and writes them to the stream
- *
- */
- function sendData(&$data, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
- {
- $len = strlen($data);
- if ($len > $this->record_size) {
- $chunk = substr($data, 0, $this->record_size);
- $p = $this->record_size;
- $rec = $this->startChunk($chunk,$typestr,$id,$type);
- fwrite($this->stream, $rec);
- while ($p < $len) {
- $chunk = substr($data, $p, $this->record_size);
- $p += $this->record_size;
- $rec = $this->doChunk($chunk);
- fwrite($this->stream, $rec);
- }
- $rec = $this->endChunk();
- fwrite($this->stream, $rec);
- return;
- }
- $rec = $this->_makeRecord($data, $typestr,$id,$type);
- fwrite($this->stream, $rec);
- }
-
- function sendEndMessage()
- {
- $rec = $this->endMessage();
- fwrite($this->stream, $rec);
- }
-
- /**
- * sendFile
- *
- * given a filename, it reads the file,
- * creates records and writes them to the stream
- *
- */
- function sendFile($filename, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
- {
- $f = fopen($filename, "rb");
- if ($f) {
- if ($data = fread($f, $this->record_size)) {
- $this->startChunk($data,$typestr,$id,$type);
- }
- while ($data = fread($f, $this->record_size)) {
- $this->doChunk($data,$typestr,$id,$type);
- }
- $this->endChunk();
- fclose($f);
- }
- }
-
- /**
- * encodeData
- *
- * given data, encode it in DIME
- *
- */
- function encodeData($data, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
- {
- $len = strlen($data);
- $resp = '';
- if ($len > $this->record_size) {
- $chunk = substr($data, 0, $this->record_size);
- $p = $this->record_size;
- $resp .= $this->startChunk($chunk,$typestr,$id,$type);
- while ($p < $len) {
- $chunk = substr($data, $p, $this->record_size);
- $p += $this->record_size;
- $resp .= $this->doChunk($chunk);
- }
- $resp .= $this->endChunk();
- } else {
- $resp .= $this->_makeRecord($data, $typestr,$id,$type);
- }
- return $resp;
- }
-
- /**
- * sendFile
- *
- * given a filename, it reads the file,
- * creates records and writes them to the stream
- *
- */
- function encodeFile($filename, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
- {
- $f = fopen($filename, "rb");
- if ($f) {
- if ($data = fread($f, $this->record_size)) {
- $resp = $this->startChunk($data,$typestr,$id,$type);
- }
- while ($data = fread($f, $this->record_size)) {
- $resp = $this->doChunk($data,$typestr,$id,$type);
- }
- $resp = $this->endChunk();
- fclose($f);
- }
- return $resp;
- }
-
- /**
- * _processData
- *
- * creates Net_DIME_Records from provided data
- *
- */
- function _processData(&$data)
- {
- $leftover = NULL;
- if (!$this->_currentRecord) {
- $this->_currentRecord = new Net_DIME_Record($this->debug);
- $data = $this->_currentRecord->decode($data);
- } else {
- $data = $this->_currentRecord->addData($data);
- }
-
- if ($this->_currentRecord->_haveData) {
- if (count($this->parts)==0 && !$this->_currentRecord->isStart()) {
- // raise an error!
- return PEAR::raiseError('First Message is not a DIME begin record!');
- }
-
- if ($this->_currentRecord->isEnd() && $this->_currentRecord->getDataLength()==0) {
- return NULL;
- }
-
- if ($this->currentPart < 0 && !$this->_currentRecord->isChunk()) {
- $this->parts[] = array();
- $this->currentPart = count($this->parts)-1;
- $this->parts[$this->currentPart]['id'] = $this->_currentRecord->getID();
- $this->parts[$this->currentPart]['type'] = $this->_currentRecord->getType();
- $this->parts[$this->currentPart]['data'] = $this->_currentRecord->getData();
- $this->currentPart = -1;
- } else {
- if ($this->currentPart < 0) {
- $this->parts[] = array();
- $this->currentPart = count($this->parts)-1;
- $this->parts[$this->currentPart]['id'] = $this->_currentRecord->getID();
- $this->parts[$this->currentPart]['type'] = $this->_currentRecord->getType();
- $this->parts[$this->currentPart]['data'] = $this->_currentRecord->getData();
- } else {
- $this->parts[$this->currentPart]['data'] .= $this->_currentRecord->getData();
- if (!$this->_currentRecord->isChunk()) {
- // we reached the end of the chunk
- $this->currentPart = -1;
- }
- }
- }
- #$this->records[] = $this->_currentRecord;
- if (!$this->_currentRecord->isEnd()) $this->_currentRecord = NULL;
- }
- return NULL;
- }
-
- /**
- * decodeData
- *
- * decodes a DIME encrypted string of data
- *
- */
- function decodeData(&$data) {
- while (strlen($data) >= NET_DIME_RECORD_HEADER) {
- $err = $this->_processData($data);
- if (PEAR::isError($err)) {
- return $err;
- }
- }
- }
-
- /**
- * read
- *
- * reads the stream and creates
- * an array of records
- *
- * it can accept the start of a previously read buffer
- * this is usefull in situations where you need to read
- * headers before discovering that the data is DIME encoded
- * such as in the case of reading an HTTP response.
- */
- function read($buf=NULL)
- {
- while ($data = fread($this->stream, 8192)) {
- if ($buf) {
- $data = $buf.$data;
- $buf = NULL;
- }
- if ($this->debug)
- echo "read: ".strlen($data)." bytes\n";
- $err = $this->decodeData($data);
- if (PEAR::isError($err)) {
- return $err;
- }
-
- // store any leftover data to be used again
- // should be < NET_DIME_RECORD_HEADER bytes
- $buf = $data;
- }
- if (!$this->_currentRecord || !$this->_currentRecord->isEnd()) {
- return PEAR::raiseError('reached stream end without end record');
- }
- return NULL;
- }
-}
+ |
+// | Ralf Hofmann |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+//
+
+require_once 'PEAR.php';
+/**
+ *
+ * DIME Encoding/Decoding
+ *
+ * What is it?
+ * This class enables you to manipulate and build
+ * a DIME encapsulated message.
+ *
+ * http://www.ietf.org/internet-drafts/draft-nielsen-dime-02.txt
+ *
+ * 09/18/02 Ralf - A huge number of changes to be compliant
+ * with the DIME Specification Release 17 June 2002
+ *
+ * TODO: lots of stuff needs to be tested.
+ * Definitily have to go through DIME spec and
+ * make things work right, most importantly, sec 3.3
+ * make examples, document
+ *
+ * see test/dime_mesage_test.php for example of usage
+ *
+ * @author Shane Caraveo ,
+ * Ralf Hofmann
+ * @version $Revision$
+ * @package Net_DIME
+ */
+define('NET_DIME_TYPE_UNCHANGED',0x00);
+define('NET_DIME_TYPE_MEDIA',0x01);
+define('NET_DIME_TYPE_URI',0x02);
+define('NET_DIME_TYPE_UNKNOWN',0x03);
+define('NET_DIME_TYPE_NONE',0x04);
+
+define('NET_DIME_VERSION',0x0001);
+
+define('NET_DIME_RECORD_HEADER',12);
+
+define('NET_DIME_FLAGS', 0);
+define('NET_DIME_OPTS_LEN', 1);
+define('NET_DIME_ID_LEN', 2);
+define('NET_DIME_TYPE_LEN', 3);
+define('NET_DIME_DATA_LEN', 4);
+define('NET_DIME_OPTS', 5);
+define('NET_DIME_ID', 6);
+define('NET_DIME_TYPE', 7);
+define('NET_DIME_DATA', 8);
+
+class Net_DIME_Record extends PEAR
+{
+ // these are used to hold the padded length
+ var $OPTS_LENGTH = 0;
+ var $ID_LENGTH = 0;
+ var $TYPE_LENGTH = 0;
+ var $DATA_LENGTH = 0;
+ var $_haveOpts = FALSE;
+ var $_haveID = FALSE;
+ var $_haveType = FALSE;
+ var $_haveData = FALSE;
+ var $debug = FALSE;
+ var $padstr = "\0";
+ /**
+ * Elements
+ * [NET_DIME_FLAGS], 16 bits: VERSION:MB:ME:CF:TYPE_T
+ * [NET_DIME_OPTS_LEN], 16 bits: OPTIONS_LENGTH
+ * [NET_DIME_ID_LEN], 16 bits: ID_LENGTH
+ * [NET_DIME_TYPE_LEN], 16 bits: TYPE_LENGTH
+ * [NET_DIME_DATA_LEN], 32 bits: DATA_LENGTH
+ * [NET_DIME_OPTS] : OPTIONS
+ * [NET_DIME_ID] : ID
+ * [NET_DIME_TYPE] : TYPE
+ * [NET_DIME_DATA] : DATA
+ */
+ var $Elements = array(NET_DIME_FLAGS => 0, NET_DIME_OPTS_LEN => 0,
+ NET_DIME_ID_LEN => 0, NET_DIME_TYPE_LEN => 0,
+ NET_DIME_DATA_LEN => 0,
+ NET_DIME_OPTS => '',
+ NET_DIME_ID => '',
+ NET_DIME_TYPE => '',
+ NET_DIME_DATA => '');
+
+ function Net_DIME_Record($debug = FALSE)
+ {
+ $this->debug = $debug;
+ if ($debug) $this->padstr = '*';
+ }
+
+ function setMB()
+ {
+ $this->Elements[NET_DIME_FLAGS] |= 0x0400;
+ }
+
+ function setME()
+ {
+ $this->Elements[NET_DIME_FLAGS] |= 0x0200;
+ }
+
+ function setCF()
+ {
+ $this->Elements[NET_DIME_FLAGS] |= 0x0100;
+ }
+
+ function isChunk()
+ {
+ return $this->Elements[NET_DIME_FLAGS] & 0x0100;
+ }
+
+ function isEnd()
+ {
+ return $this->Elements[NET_DIME_FLAGS] & 0x0200;
+ }
+
+ function isStart()
+ {
+ return $this->Elements[NET_DIME_FLAGS] & 0x0400;
+ }
+
+ function getID()
+ {
+ return $this->Elements[NET_DIME_ID];
+ }
+
+ function getType()
+ {
+ return $this->Elements[NET_DIME_TYPE];
+ }
+
+ function getData()
+ {
+ return $this->Elements[NET_DIME_DATA];
+ }
+
+ function getDataLength()
+ {
+ return $this->Elements[NET_DIME_DATA_LEN];
+ }
+
+ function setType($typestring, $type=NET_DIME_TYPE_UNKNOWN)
+ {
+ $typelen = strlen($typestring) & 0xFFFF;
+ $type = $type << 4;
+ $this->Elements[NET_DIME_FLAGS] = ($this->Elements[NET_DIME_FLAGS] & 0xFF0F) | $type;
+ $this->Elements[NET_DIME_TYPE_LEN] = $typelen;
+ $this->TYPE_LENGTH = $this->_getPadLength($typelen);
+ $this->Elements[NET_DIME_TYPE] = $typestring;
+ }
+
+ function generateID()
+ {
+ $id = md5(time());
+ $this->setID($id);
+ return $id;
+ }
+
+ function setID($id)
+ {
+ $idlen = strlen($id) & 0xFFFF;
+ $this->Elements[NET_DIME_ID_LEN] = $idlen;
+ $this->ID_LENGTH = $this->_getPadLength($idlen);
+ $this->Elements[NET_DIME_ID] = $id;
+ }
+
+ function setData($data, $size=0)
+ {
+ $datalen = $size?$size:strlen($data);
+ $this->Elements[NET_DIME_DATA_LEN] = $datalen;
+ $this->DATA_LENGTH = $this->_getPadLength($datalen);
+ $this->Elements[NET_DIME_DATA] = $data;
+ }
+
+ function encode()
+ {
+ // insert version
+ $this->Elements[NET_DIME_FLAGS] = ($this->Elements[NET_DIME_FLAGS] & 0x07FF) | (NET_DIME_VERSION << 11);
+
+ // the real dime encoding
+ $format = '%c%c%c%c%c%c%c%c%c%c%c%c'.
+ '%'.$this->OPTS_LENGTH.'s'.
+ '%'.$this->ID_LENGTH.'s'.
+ '%'.$this->TYPE_LENGTH.'s'.
+ '%'.$this->DATA_LENGTH.'s';
+ return sprintf($format,
+ ($this->Elements[NET_DIME_FLAGS]&0x0000FF00)>>8,
+ ($this->Elements[NET_DIME_FLAGS]&0x000000FF),
+ ($this->Elements[NET_DIME_OPTS_LEN]&0x0000FF00)>>8,
+ ($this->Elements[NET_DIME_OPTS_LEN]&0x000000FF),
+ ($this->Elements[NET_DIME_ID_LEN]&0x0000FF00)>>8,
+ ($this->Elements[NET_DIME_ID_LEN]&0x000000FF),
+ ($this->Elements[NET_DIME_TYPE_LEN]&0x0000FF00)>>8,
+ ($this->Elements[NET_DIME_TYPE_LEN]&0x000000FF),
+ ($this->Elements[NET_DIME_DATA_LEN]&0xFF000000)>>24,
+ ($this->Elements[NET_DIME_DATA_LEN]&0x00FF0000)>>16,
+ ($this->Elements[NET_DIME_DATA_LEN]&0x0000FF00)>>8,
+ ($this->Elements[NET_DIME_DATA_LEN]&0x000000FF),
+ str_pad($this->Elements[NET_DIME_OPTS], $this->OPTS_LENGTH, $this->padstr),
+ str_pad($this->Elements[NET_DIME_ID], $this->ID_LENGTH, $this->padstr),
+ str_pad($this->Elements[NET_DIME_TYPE], $this->TYPE_LENGTH, $this->padstr),
+ str_pad($this->Elements[NET_DIME_DATA], $this->DATA_LENGTH, $this->padstr));
+ }
+
+ function _getPadLength($len)
+ {
+ $pad = 0;
+ if ($len) {
+ $pad = $len % 4;
+ if ($pad) $pad = 4 - $pad;
+ }
+ return $len + $pad;
+ }
+
+ function decode(&$data)
+ {
+ // REAL DIME decoding
+ $this->Elements[NET_DIME_FLAGS] = (hexdec(bin2hex($data[0]))<<8) + hexdec(bin2hex($data[1]));
+ $this->Elements[NET_DIME_OPTS_LEN] = (hexdec(bin2hex($data[2]))<<8) + hexdec(bin2hex($data[3]));
+ $this->Elements[NET_DIME_ID_LEN] = (hexdec(bin2hex($data[4]))<<8) + hexdec(bin2hex($data[5]));
+ $this->Elements[NET_DIME_TYPE_LEN] = (hexdec(bin2hex($data[6]))<<8) + hexdec(bin2hex($data[7]));
+ $this->Elements[NET_DIME_DATA_LEN] = (hexdec(bin2hex($data[8]))<<24) +
+ (hexdec(bin2hex($data[9]))<<16) +
+ (hexdec(bin2hex($data[10]))<<8) +
+ hexdec(bin2hex($data[11]));
+ $p = 12;
+
+ $version = (($this->Elements[NET_DIME_FLAGS]>>11) & 0x001F);
+
+ if ($version == NET_DIME_VERSION)
+ {
+ $this->OPTS_LENGTH = $this->_getPadLength($this->Elements[NET_DIME_OPTS_LEN]);
+ $this->ID_LENGTH = $this->_getPadLength($this->Elements[NET_DIME_ID_LEN]);
+ $this->TYPE_LENGTH = $this->_getPadLength($this->Elements[NET_DIME_TYPE_LEN]);
+ $this->DATA_LENGTH = $this->_getPadLength($this->Elements[NET_DIME_DATA_LEN]);
+
+ $datalen = strlen($data);
+ $this->Elements[NET_DIME_OPTS] = substr($data,$p,$this->Elements[NET_DIME_OPTS_LEN]);
+ $this->_haveOpts = (strlen($this->Elements[NET_DIME_OPTS]) == $this->Elements[NET_DIME_OPTS_LEN]);
+ if ($this->_haveOpts) {
+ $p += $this->OPTS_LENGTH;
+ $this->Elements[NET_DIME_ID] = substr($data,$p,$this->Elements[NET_DIME_ID_LEN]);
+ $this->_haveID = (strlen($this->Elements[NET_DIME_ID]) == $this->Elements[NET_DIME_ID_LEN]);
+ if ($this->_haveID) {
+ $p += $this->ID_LENGTH;
+ $this->Elements[NET_DIME_TYPE] = substr($data,$p,$this->Elements[NET_DIME_TYPE_LEN]);
+ $this->_haveType = (strlen($this->Elements[NET_DIME_TYPE]) == $this->Elements[NET_DIME_TYPE_LEN]);
+ if ($this->_haveType) {
+ $p += $this->TYPE_LENGTH;
+ $this->Elements[NET_DIME_DATA] = substr($data,$p,$this->Elements[NET_DIME_DATA_LEN]);
+ $this->_haveData = (strlen($this->Elements[NET_DIME_DATA]) == $this->Elements[NET_DIME_DATA_LEN]);
+ if ($this->_haveData) {
+ $p += $this->DATA_LENGTH;
+ } else {
+ $p += strlen($this->Elements[NET_DIME_DATA]);
+ }
+ } else {
+ $p += strlen($this->Elements[NET_DIME_TYPE]);
+ }
+ } else {
+ $p += strlen($this->Elements[NET_DIME_ID]);
+ }
+ } else {
+ $p += strlen($this->Elements[NET_DIME_OPTS]);
+ }
+ }
+ return substr($data, $p);
+ }
+
+ function addData(&$data)
+ {
+ $datalen = strlen($data);
+ $p = 0;
+ if (!$this->_haveOpts) {
+ $have = strlen($this->Elements[NET_DIME_OPTS]);
+ $this->Elements[NET_DIME_OPTS] .= substr($data,$p,$this->Elements[NET_DIME_OPTS_LEN]-$have);
+ $this->_haveOpts = (strlen($this->Elements[NET_DIME_OPTS]) == $this->Elements[DIME_OTPS_LEN]);
+ if (!$this->_haveOpts) return NULL;
+ $p += $this->OPTS_LENGTH-$have;
+ }
+ if (!$this->_haveID) {
+ $have = strlen($this->Elements[NET_DIME_ID]);
+ $this->Elements[NET_DIME_ID] .= substr($data,$p,$this->Elements[NET_DIME_ID_LEN]-$have);
+ $this->_haveID = (strlen($this->Elements[NET_DIME_ID]) == $this->Elements[NET_DIME_ID_LEN]);
+ if (!$this->_haveID) return NULL;
+ $p += $this->ID_LENGTH-$have;
+ }
+ if (!$this->_haveType && $p < $datalen) {
+ $have = strlen($this->Elements[NET_DIME_TYPE]);
+ $this->Elements[NET_DIME_TYPE] .= substr($data,$p,$this->Elements[NET_DIME_TYPE_LEN]-$have);
+ $this->_haveType = (strlen($this->Elements[NET_DIME_TYPE]) == $this->Elements[NET_DIME_TYPE_LEN]);
+ if (!$this->_haveType) return NULL;
+ $p += $this->TYPE_LENGTH-$have;
+ }
+ if (!$this->_haveData && $p < $datalen) {
+ $have = strlen($this->Elements[NET_DIME_DATA]);
+ $this->Elements[NET_DIME_DATA] .= substr($data,$p,$this->Elements[NET_DIME_DATA_LEN]-$have);
+ $this->_haveData = (strlen($this->Elements[NET_DIME_DATA]) == $this->Elements[NET_DIME_DATA_LEN]);
+ if (!$this->_haveData) return NULL;
+ $p += $this->DATA_LENGTH-$have;
+ }
+ return substr($data,$p);
+ }
+}
+
+
+class Net_DIME_Message extends PEAR
+{
+
+ var $record_size = 4096;
+ #var $records =array();
+ var $parts = array();
+ var $currentPart = -1;
+ var $stream = NULL;
+ var $_currentRecord;
+ var $_proc = array();
+ var $type;
+ var $typestr;
+ var $mb = 1;
+ var $me = 0;
+ var $cf = 0;
+ var $id = NULL;
+ var $debug = FALSE;
+ /**
+ * constructor
+ *
+ * this currently takes a file pointer as provided
+ * by fopen
+ *
+ * TODO: integrate with the php streams stuff
+ */
+ function Net_DIME_Message($stream=NULL, $record_size = 4096, $debug = FALSE)
+ {
+ $this->stream = $stream;
+ $this->record_size = $record_size;
+ $this->debug = $debug;
+ }
+
+ function _makeRecord(&$data, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
+ {
+ $record = new Net_DIME_Record($this->debug);
+ if ($this->mb) {
+ $record->setMB();
+ // all subsequent records are not message begin!
+ $this->mb = 0;
+ }
+ if ($this->me) $record->setME();
+ if ($this->cf) $record->setCF();
+ $record->setData($data);
+ $record->setType($typestr,$type);
+ if ($id) $record->setID($id);
+ #if ($this->debug) {
+ # print str_replace('\0','*',$record->encode());
+ #}
+ return $record->encode();
+ }
+
+ function startChunk(&$data, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
+ {
+ $this->me = 0;
+ $this->cf = 1;
+ $this->type = $type;
+ $this->typestr = $typestr;
+ if ($id) {
+ $this->id = $id;
+ } else {
+ $this->id = md5(time());
+ }
+ return $this->_makeRecord($data, $this->typestr, $this->id, $this->type);
+ }
+
+ function doChunk(&$data)
+ {
+ $this->me = 0;
+ $this->cf = 1;
+ return $this->_makeRecord($data, NULL, NULL, NET_DIME_TYPE_UNCHANGED);
+ }
+
+ function endChunk()
+ {
+ $this->cf = 0;
+ $data = NULL;
+ $rec = $this->_makeRecord($data, NULL, NULL, NET_DIME_TYPE_UNCHANGED);
+ $this->id = 0;
+ $this->cf = 0;
+ $this->id = 0;
+ $this->type = NET_DIME_TYPE_UNKNOWN;
+ $this->typestr = NULL;
+ return $rec;
+ }
+
+ function endMessage()
+ {
+ $this->me = 1;
+ $data = NULL;
+ $rec = $this->_makeRecord($data, NULL, NULL, NET_DIME_TYPE_NONE);
+ $this->me = 0;
+ $this->mb = 1;
+ $this->id = 0;
+ return $rec;
+ }
+
+ /**
+ * sendRecord
+ *
+ * given a chunk of data, it creates DIME records
+ * and writes them to the stream
+ *
+ */
+ function sendData(&$data, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
+ {
+ $len = strlen($data);
+ if ($len > $this->record_size) {
+ $chunk = substr($data, 0, $this->record_size);
+ $p = $this->record_size;
+ $rec = $this->startChunk($chunk,$typestr,$id,$type);
+ fwrite($this->stream, $rec);
+ while ($p < $len) {
+ $chunk = substr($data, $p, $this->record_size);
+ $p += $this->record_size;
+ $rec = $this->doChunk($chunk);
+ fwrite($this->stream, $rec);
+ }
+ $rec = $this->endChunk();
+ fwrite($this->stream, $rec);
+ return;
+ }
+ $rec = $this->_makeRecord($data, $typestr,$id,$type);
+ fwrite($this->stream, $rec);
+ }
+
+ function sendEndMessage()
+ {
+ $rec = $this->endMessage();
+ fwrite($this->stream, $rec);
+ }
+
+ /**
+ * sendFile
+ *
+ * given a filename, it reads the file,
+ * creates records and writes them to the stream
+ *
+ */
+ function sendFile($filename, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
+ {
+ $f = fopen($filename, "rb");
+ if ($f) {
+ if ($data = fread($f, $this->record_size)) {
+ $this->startChunk($data,$typestr,$id,$type);
+ }
+ while ($data = fread($f, $this->record_size)) {
+ $this->doChunk($data,$typestr,$id,$type);
+ }
+ $this->endChunk();
+ fclose($f);
+ }
+ }
+
+ /**
+ * encodeData
+ *
+ * given data, encode it in DIME
+ *
+ */
+ function encodeData($data, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
+ {
+ $len = strlen($data);
+ $resp = '';
+ if ($len > $this->record_size) {
+ $chunk = substr($data, 0, $this->record_size);
+ $p = $this->record_size;
+ $resp .= $this->startChunk($chunk,$typestr,$id,$type);
+ while ($p < $len) {
+ $chunk = substr($data, $p, $this->record_size);
+ $p += $this->record_size;
+ $resp .= $this->doChunk($chunk);
+ }
+ $resp .= $this->endChunk();
+ } else {
+ $resp .= $this->_makeRecord($data, $typestr,$id,$type);
+ }
+ return $resp;
+ }
+
+ /**
+ * sendFile
+ *
+ * given a filename, it reads the file,
+ * creates records and writes them to the stream
+ *
+ */
+ function encodeFile($filename, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
+ {
+ $f = fopen($filename, "rb");
+ if ($f) {
+ if ($data = fread($f, $this->record_size)) {
+ $resp = $this->startChunk($data,$typestr,$id,$type);
+ }
+ while ($data = fread($f, $this->record_size)) {
+ $resp = $this->doChunk($data,$typestr,$id,$type);
+ }
+ $resp = $this->endChunk();
+ fclose($f);
+ }
+ return $resp;
+ }
+
+ /**
+ * _processData
+ *
+ * creates Net_DIME_Records from provided data
+ *
+ */
+ function _processData(&$data)
+ {
+ $leftover = NULL;
+ if (!$this->_currentRecord) {
+ $this->_currentRecord = new Net_DIME_Record($this->debug);
+ $data = $this->_currentRecord->decode($data);
+ } else {
+ $data = $this->_currentRecord->addData($data);
+ }
+
+ if ($this->_currentRecord->_haveData) {
+ if (count($this->parts)==0 && !$this->_currentRecord->isStart()) {
+ // raise an error!
+ return PEAR::raiseError('First Message is not a DIME begin record!');
+ }
+
+ if ($this->_currentRecord->isEnd() && $this->_currentRecord->getDataLength()==0) {
+ return NULL;
+ }
+
+ if ($this->currentPart < 0 && !$this->_currentRecord->isChunk()) {
+ $this->parts[] = array();
+ $this->currentPart = count($this->parts)-1;
+ $this->parts[$this->currentPart]['id'] = $this->_currentRecord->getID();
+ $this->parts[$this->currentPart]['type'] = $this->_currentRecord->getType();
+ $this->parts[$this->currentPart]['data'] = $this->_currentRecord->getData();
+ $this->currentPart = -1;
+ } else {
+ if ($this->currentPart < 0) {
+ $this->parts[] = array();
+ $this->currentPart = count($this->parts)-1;
+ $this->parts[$this->currentPart]['id'] = $this->_currentRecord->getID();
+ $this->parts[$this->currentPart]['type'] = $this->_currentRecord->getType();
+ $this->parts[$this->currentPart]['data'] = $this->_currentRecord->getData();
+ } else {
+ $this->parts[$this->currentPart]['data'] .= $this->_currentRecord->getData();
+ if (!$this->_currentRecord->isChunk()) {
+ // we reached the end of the chunk
+ $this->currentPart = -1;
+ }
+ }
+ }
+ #$this->records[] = $this->_currentRecord;
+ if (!$this->_currentRecord->isEnd()) $this->_currentRecord = NULL;
+ }
+ return NULL;
+ }
+
+ /**
+ * decodeData
+ *
+ * decodes a DIME encrypted string of data
+ *
+ */
+ function decodeData(&$data) {
+ while (strlen($data) >= NET_DIME_RECORD_HEADER) {
+ $err = $this->_processData($data);
+ if (PEAR::isError($err)) {
+ return $err;
+ }
+ }
+ }
+
+ /**
+ * read
+ *
+ * reads the stream and creates
+ * an array of records
+ *
+ * it can accept the start of a previously read buffer
+ * this is usefull in situations where you need to read
+ * headers before discovering that the data is DIME encoded
+ * such as in the case of reading an HTTP response.
+ */
+ function read($buf=NULL)
+ {
+ while ($data = fread($this->stream, 8192)) {
+ if ($buf) {
+ $data = $buf.$data;
+ $buf = NULL;
+ }
+ if ($this->debug)
+ echo "read: ".strlen($data)." bytes\n";
+ $err = $this->decodeData($data);
+ if (PEAR::isError($err)) {
+ return $err;
+ }
+
+ // store any leftover data to be used again
+ // should be < NET_DIME_RECORD_HEADER bytes
+ $buf = $data;
+ }
+ if (!$this->_currentRecord || !$this->_currentRecord->isEnd()) {
+ return PEAR::raiseError('reached stream end without end record');
+ }
+ return NULL;
+ }
+}
?>
\ No newline at end of file
diff --git a/thirdparty/pear/Net/Dict.php b/thirdparty/pear/Net/Dict.php
index 0acc797..cf7c4ce 100644
--- a/thirdparty/pear/Net/Dict.php
+++ b/thirdparty/pear/Net/Dict.php
@@ -20,7 +20,7 @@
// | Authors: Chandrashekhar Bhosle |
// +----------------------------------------------------------------------+
//
-// $Id: Dict.php,v 1.3 2002/10/06 04:55:33 cnb Exp $
+// $Id$
// }}}
// {{{ includes
diff --git a/thirdparty/pear/Net/Dig.php b/thirdparty/pear/Net/Dig.php
index 662399b..2721b8d 100644
--- a/thirdparty/pear/Net/Dig.php
+++ b/thirdparty/pear/Net/Dig.php
@@ -16,7 +16,7 @@
// | Author: Colin Viebrock |
// +----------------------------------------------------------------------+
//
-// $Id: Dig.php,v 1.1 2002/04/25 14:57:23 cmv Exp $
+// $Id$
//
// A nice friendly OO interface to dig
//
diff --git a/thirdparty/pear/Net/Finger.php b/thirdparty/pear/Net/Finger.php
index fd6f365..ea61dd9 100644
--- a/thirdparty/pear/Net/Finger.php
+++ b/thirdparty/pear/Net/Finger.php
@@ -16,7 +16,7 @@
// | Authors: Sebastian Nohn |
// +----------------------------------------------------------------------+
//
-// $Id: Finger.php,v 1.5 2003/01/04 11:55:46 mj Exp $
+// $Id$
//
require_once 'PEAR.php';
@@ -27,7 +27,7 @@ require_once 'Net/Socket.php';
*
* Provides functions useful for Finger-Queries.
*
- * @version $Revision: 1.5 $
+ * @version $Revision$
* @author Sebastian Nohn
* @package Net
*/
diff --git a/thirdparty/pear/Net/Geo.php b/thirdparty/pear/Net/Geo.php
index 1bc3bad..6d19a7c 100644
--- a/thirdparty/pear/Net/Geo.php
+++ b/thirdparty/pear/Net/Geo.php
@@ -17,7 +17,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: Geo.php,v 1.7 2004/02/18 22:59:20 lsmith Exp $
+// $Id$
require_once 'PEAR.php';
require_once 'Cache/Function.php';
diff --git a/thirdparty/pear/Net/IPv4.php b/thirdparty/pear/Net/IPv4.php
index 68de17e..ba62a8d 100644
--- a/thirdparty/pear/Net/IPv4.php
+++ b/thirdparty/pear/Net/IPv4.php
@@ -17,7 +17,7 @@
* @author Florian Anderiasch
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
-* @version CVS: $Id: IPv4.php,v 1.11 2005/11/29 12:56:35 fa Exp $
+* @version CVS: $Id$
* @link http://pear.php.net/package/Net_IPv4
*/
diff --git a/thirdparty/pear/Net/IPv6.php b/thirdparty/pear/Net/IPv6.php
index 296abe6..c624028 100644
--- a/thirdparty/pear/Net/IPv6.php
+++ b/thirdparty/pear/Net/IPv6.php
@@ -1,218 +1,218 @@
- |
-// +----------------------------------------------------------------------+
-//
-// $Id: IPv6.php,v 1.12 2005/09/01 12:42:00 alexmerz Exp $
-
-/**
-* Class to validate and to work with IPv6
-*
-* @author Alexander Merz
-* @author elfrink at introweb dot nl
-* @package Net_IPv6
-* @version $Id: IPv6.php,v 1.12 2005/09/01 12:42:00 alexmerz Exp $
-* @access public
-*/
-class Net_IPv6 {
-
- // {{{ Uncompress()
-
- /**
- * Uncompresses an IPv6 adress
- *
- * RFC 2373 allows you to compress zeros in an adress to '::'. This
- * function expects an valid IPv6 adress and expands the '::' to
- * the required zeros.
- *
- * Example: FF01::101 -> FF01:0:0:0:0:0:0:101
- * ::1 -> 0:0:0:0:0:0:0:1
- *
- * @access public
- * @see Compress()
- * @static
- * @param string $ip a valid IPv6-adress (hex format)
- * @return string the uncompressed IPv6-adress (hex format)
- */
- function Uncompress($ip) {
- $uip = $ip;
- $c1 = -1;
- $c2 = -1;
- if (false !== strpos($ip, '::') ) {
- list($ip1, $ip2) = explode('::', $ip);
- if(""==$ip1) {
- $c1 = -1;
- } else {
- $pos = 0;
- if(0 < ($pos = substr_count($ip1, ':'))) {
- $c1 = $pos;
- } else {
- $c1 = 0;
- }
- }
- if(""==$ip2) {
- $c2 = -1;
- } else {
- $pos = 0;
- if(0 < ($pos = substr_count($ip2, ':'))) {
- $c2 = $pos;
- } else {
- $c2 = 0;
- }
- }
- if(strstr($ip2, '.')) {
- $c2++;
- }
- if(-1 == $c1 && -1 == $c2) { // ::
- $uip = "0:0:0:0:0:0:0:0";
- } else if(-1==$c1) { // ::xxx
- $fill = str_repeat('0:', 7-$c2);
- $uip = str_replace('::', $fill, $uip);
- } else if(-1==$c2) { // xxx::
- $fill = str_repeat(':0', 7-$c1);
- $uip = str_replace('::', $fill, $uip);
- } else { // xxx::xxx
- $fill = str_repeat(':0:', 6-$c2-$c1);
- $uip = str_replace('::', $fill, $uip);
- $uip = str_replace('::', ':', $uip);
- }
- }
- return $uip;
- }
-
- // }}}
- // {{{ Compress()
-
- /**
- * Compresses an IPv6 adress
- *
- * RFC 2373 allows you to compress zeros in an adress to '::'. This
- * function expects an valid IPv6 adress and compresses successive zeros
- * to '::'
- *
- * Example: FF01:0:0:0:0:0:0:101 -> FF01::101
- * 0:0:0:0:0:0:0:1 -> ::1
- *
- * @access public
- * @see Uncompress()
- * @static
- * @param string $ip a valid IPv6-adress (hex format)
- * @return string the compressed IPv6-adress (hex format)
- * @author elfrink at introweb dot nl
- */
- function Compress($ip) {
- $cip = $ip;
-
- if (!strstr($ip, '::')) {
- $ipp = explode(':',$ip);
- for($i=0; $i0) {
- $match = '';
- foreach($zeros[0] as $zero) {
- if (strlen($zero) > strlen($match))
- $match = $zero;
- }
- $cip = preg_replace('/' . $match . '/', ':', $cip, 1);
- }
- $cip = preg_replace('/((^:)|(:$))/', '' ,$cip);
- $cip = preg_replace('/((^:)|(:$))/', '::' ,$cip);
- }
- return $cip;
- }
-
- // }}}
- // {{{ SplitV64()
-
- /**
- * Splits an IPv6 adress into the IPv6 and a possible IPv4 part
- *
- * RFC 2373 allows you to note the last two parts of an IPv6 adress as
- * an IPv4 compatible adress
- *
- * Example: 0:0:0:0:0:0:13.1.68.3
- * 0:0:0:0:0:FFFF:129.144.52.38
- *
- * @access public
- * @static
- * @param string $ip a valid IPv6-adress (hex format)
- * @return array [0] contains the IPv6 part, [1] the IPv4 part (hex format)
- */
- function SplitV64($ip) {
- $ip = Net_IPv6::Uncompress($ip);
- if (strstr($ip, '.')) {
- $pos = strrpos($ip, ':');
- $ip{$pos} = '_';
- $ipPart = explode('_', $ip);
- return $ipPart;
- } else {
- return array($ip, "");
- }
- }
-
- // }}}
- // {{{ checkIPv6
-
- /**
- * Checks an IPv6 adress
- *
- * Checks if the given IP is IPv6-compatible
- *
- * @access public
- * @static
- * @param string $ip a valid IPv6-adress
- * @return boolean true if $ip is an IPv6 adress
- */
- function checkIPv6($ip) {
-
- $ipPart = Net_IPv6::SplitV64($ip);
- $count = 0;
- if (!empty($ipPart[0])) {
- $ipv6 =explode(':', $ipPart[0]);
- for ($i = 0; $i < count($ipv6); $i++) {
- $dec = hexdec($ipv6[$i]);
- $hex = strtoupper(preg_replace("/^[0]{1,3}(.*[0-9a-fA-F])$/", "\\1", $ipv6[$i]));
- if ($ipv6[$i] >= 0 && $dec <= 65535 && $hex == strtoupper(dechex($dec))) {
- $count++;
- }
- }
- if (8 == $count) {
- return true;
- } elseif (6 == $count and !empty($ipPart[1])) {
- $ipv4 = explode('.',$ipPart[1]);
- $count = 0;
- for ($i = 0; $i < count($ipv4); $i++) {
- if ($ipv4[$i] >= 0 && (integer)$ipv4[$i] <= 255 && preg_match("/^\d{1,3}$/", $ipv4[$i])) {
- $count++;
- }
- }
- if (4 == $count) {
- return true;
- }
- } else {
- return false;
- }
-
- } else {
- return false;
- }
- }
- // }}}
-}
-?>
+ |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+
+/**
+* Class to validate and to work with IPv6
+*
+* @author Alexander Merz
+* @author elfrink at introweb dot nl
+* @package Net_IPv6
+* @version $Id$
+* @access public
+*/
+class Net_IPv6 {
+
+ // {{{ Uncompress()
+
+ /**
+ * Uncompresses an IPv6 adress
+ *
+ * RFC 2373 allows you to compress zeros in an adress to '::'. This
+ * function expects an valid IPv6 adress and expands the '::' to
+ * the required zeros.
+ *
+ * Example: FF01::101 -> FF01:0:0:0:0:0:0:101
+ * ::1 -> 0:0:0:0:0:0:0:1
+ *
+ * @access public
+ * @see Compress()
+ * @static
+ * @param string $ip a valid IPv6-adress (hex format)
+ * @return string the uncompressed IPv6-adress (hex format)
+ */
+ function Uncompress($ip) {
+ $uip = $ip;
+ $c1 = -1;
+ $c2 = -1;
+ if (false !== strpos($ip, '::') ) {
+ list($ip1, $ip2) = explode('::', $ip);
+ if(""==$ip1) {
+ $c1 = -1;
+ } else {
+ $pos = 0;
+ if(0 < ($pos = substr_count($ip1, ':'))) {
+ $c1 = $pos;
+ } else {
+ $c1 = 0;
+ }
+ }
+ if(""==$ip2) {
+ $c2 = -1;
+ } else {
+ $pos = 0;
+ if(0 < ($pos = substr_count($ip2, ':'))) {
+ $c2 = $pos;
+ } else {
+ $c2 = 0;
+ }
+ }
+ if(strstr($ip2, '.')) {
+ $c2++;
+ }
+ if(-1 == $c1 && -1 == $c2) { // ::
+ $uip = "0:0:0:0:0:0:0:0";
+ } else if(-1==$c1) { // ::xxx
+ $fill = str_repeat('0:', 7-$c2);
+ $uip = str_replace('::', $fill, $uip);
+ } else if(-1==$c2) { // xxx::
+ $fill = str_repeat(':0', 7-$c1);
+ $uip = str_replace('::', $fill, $uip);
+ } else { // xxx::xxx
+ $fill = str_repeat(':0:', 6-$c2-$c1);
+ $uip = str_replace('::', $fill, $uip);
+ $uip = str_replace('::', ':', $uip);
+ }
+ }
+ return $uip;
+ }
+
+ // }}}
+ // {{{ Compress()
+
+ /**
+ * Compresses an IPv6 adress
+ *
+ * RFC 2373 allows you to compress zeros in an adress to '::'. This
+ * function expects an valid IPv6 adress and compresses successive zeros
+ * to '::'
+ *
+ * Example: FF01:0:0:0:0:0:0:101 -> FF01::101
+ * 0:0:0:0:0:0:0:1 -> ::1
+ *
+ * @access public
+ * @see Uncompress()
+ * @static
+ * @param string $ip a valid IPv6-adress (hex format)
+ * @return string the compressed IPv6-adress (hex format)
+ * @author elfrink at introweb dot nl
+ */
+ function Compress($ip) {
+ $cip = $ip;
+
+ if (!strstr($ip, '::')) {
+ $ipp = explode(':',$ip);
+ for($i=0; $i0) {
+ $match = '';
+ foreach($zeros[0] as $zero) {
+ if (strlen($zero) > strlen($match))
+ $match = $zero;
+ }
+ $cip = preg_replace('/' . $match . '/', ':', $cip, 1);
+ }
+ $cip = preg_replace('/((^:)|(:$))/', '' ,$cip);
+ $cip = preg_replace('/((^:)|(:$))/', '::' ,$cip);
+ }
+ return $cip;
+ }
+
+ // }}}
+ // {{{ SplitV64()
+
+ /**
+ * Splits an IPv6 adress into the IPv6 and a possible IPv4 part
+ *
+ * RFC 2373 allows you to note the last two parts of an IPv6 adress as
+ * an IPv4 compatible adress
+ *
+ * Example: 0:0:0:0:0:0:13.1.68.3
+ * 0:0:0:0:0:FFFF:129.144.52.38
+ *
+ * @access public
+ * @static
+ * @param string $ip a valid IPv6-adress (hex format)
+ * @return array [0] contains the IPv6 part, [1] the IPv4 part (hex format)
+ */
+ function SplitV64($ip) {
+ $ip = Net_IPv6::Uncompress($ip);
+ if (strstr($ip, '.')) {
+ $pos = strrpos($ip, ':');
+ $ip{$pos} = '_';
+ $ipPart = explode('_', $ip);
+ return $ipPart;
+ } else {
+ return array($ip, "");
+ }
+ }
+
+ // }}}
+ // {{{ checkIPv6
+
+ /**
+ * Checks an IPv6 adress
+ *
+ * Checks if the given IP is IPv6-compatible
+ *
+ * @access public
+ * @static
+ * @param string $ip a valid IPv6-adress
+ * @return boolean true if $ip is an IPv6 adress
+ */
+ function checkIPv6($ip) {
+
+ $ipPart = Net_IPv6::SplitV64($ip);
+ $count = 0;
+ if (!empty($ipPart[0])) {
+ $ipv6 =explode(':', $ipPart[0]);
+ for ($i = 0; $i < count($ipv6); $i++) {
+ $dec = hexdec($ipv6[$i]);
+ $hex = strtoupper(preg_replace("/^[0]{1,3}(.*[0-9a-fA-F])$/", "\\1", $ipv6[$i]));
+ if ($ipv6[$i] >= 0 && $dec <= 65535 && $hex == strtoupper(dechex($dec))) {
+ $count++;
+ }
+ }
+ if (8 == $count) {
+ return true;
+ } elseif (6 == $count and !empty($ipPart[1])) {
+ $ipv4 = explode('.',$ipPart[1]);
+ $count = 0;
+ for ($i = 0; $i < count($ipv4); $i++) {
+ if ($ipv4[$i] >= 0 && (integer)$ipv4[$i] <= 255 && preg_match("/^\d{1,3}$/", $ipv4[$i])) {
+ $count++;
+ }
+ }
+ if (4 == $count) {
+ return true;
+ }
+ } else {
+ return false;
+ }
+
+ } else {
+ return false;
+ }
+ }
+ // }}}
+}
+?>
diff --git a/thirdparty/pear/Net/Ident.php b/thirdparty/pear/Net/Ident.php
index df5c4f5..c5dc283 100644
--- a/thirdparty/pear/Net/Ident.php
+++ b/thirdparty/pear/Net/Ident.php
@@ -18,7 +18,7 @@
// | Original author: Gavin Brown |
// +----------------------------------------------------------------------+
//
-// $Id: Ident.php,v 1.7 2005/03/07 11:23:26 nepto Exp $
+// $Id$
//
// Identification Protocol implementation
//
diff --git a/thirdparty/pear/Net/POP3.php b/thirdparty/pear/Net/POP3.php
index 316a142..b73f842 100644
--- a/thirdparty/pear/Net/POP3.php
+++ b/thirdparty/pear/Net/POP3.php
@@ -33,7 +33,7 @@
// | Co-Author: Damian Fernandez Sosa |
// +-----------------------------------------------------------------------+
//
-// $Id: POP3.php,v 1.2 2004/12/05 16:34:39 damian Exp $
+// $Id$
require_once('Net/Socket.php');
diff --git a/thirdparty/pear/Net/Ping.php b/thirdparty/pear/Net/Ping.php
index 21f9fda..8446cf5 100644
--- a/thirdparty/pear/Net/Ping.php
+++ b/thirdparty/pear/Net/Ping.php
@@ -19,7 +19,7 @@
// | Kai Schröder |
// +----------------------------------------------------------------------+
//
-// $Id: Ping.php,v 1.36 2004/02/08 23:17:22 jan Exp $
+// $Id$
require_once "PEAR.php";
require_once "OS/Guess.php";
@@ -65,7 +65,7 @@ define('NET_PING_RESULT_UNSUPPORTED_BACKEND', 4);
* ?>
*
* @author Jan Lehnardt
-* @version $Revision: 1.36 $
+* @version $Revision$
* @package Net
* @access public
*/
@@ -524,7 +524,7 @@ class Net_Ping
* Container class for Net_Ping results
*
* @author Jan Lehnardt
-* @version $Revision: 1.36 $
+* @version $Revision$
* @package Net
* @access private
*/
diff --git a/thirdparty/pear/Net/SMTP.php b/thirdparty/pear/Net/SMTP.php
index 049a92f..4a29f4d 100644
--- a/thirdparty/pear/Net/SMTP.php
+++ b/thirdparty/pear/Net/SMTP.php
@@ -18,7 +18,7 @@
// | Damian Alejandro Fernandez Sosa |
// +----------------------------------------------------------------------+
//
-// $Id: SMTP.php,v 1.54 2005/08/16 03:44:15 jon Exp $
+// $Id$
require_once 'PEAR.php';
require_once 'Net/Socket.php';
diff --git a/thirdparty/pear/Net/SmartIRC.php b/thirdparty/pear/Net/SmartIRC.php
index e0167a8..95e2b50 100644
--- a/thirdparty/pear/Net/SmartIRC.php
+++ b/thirdparty/pear/Net/SmartIRC.php
@@ -1,9 +1,9 @@
|
// +----------------------------------------------------------------------+
//
-// $Id: Socket.php,v 1.24 2005/02/03 20:40:16 chagenbu Exp $
+// $Id$
require_once 'PEAR.php';
diff --git a/thirdparty/pear/Net/Whois.php b/thirdparty/pear/Net/Whois.php
index aac9997..5550f91 100644
--- a/thirdparty/pear/Net/Whois.php
+++ b/thirdparty/pear/Net/Whois.php
@@ -18,7 +18,7 @@
// | Author: Seamus Venasse |
// +----------------------------------------------------------------------+
//
-// $Id: Whois.php,v 1.11 2003/01/04 11:55:54 mj Exp $
+// $Id$
//
// Whois Class
//
diff --git a/thirdparty/pear/SOAP/Type/hexBinary.php b/thirdparty/pear/SOAP/Type/hexBinary.php
index 150e45d..6acdc21 100644
--- a/thirdparty/pear/SOAP/Type/hexBinary.php
+++ b/thirdparty/pear/SOAP/Type/hexBinary.php
@@ -17,7 +17,7 @@
// | Authors: Dietrich Ayala Original Author |
// +----------------------------------------------------------------------+
//
-// $Id: hexBinary.php,v 1.6 2005/03/10 23:16:39 yunosh Exp $
+// $Id$
//
class SOAP_Type_hexBinary
{
diff --git a/thirdparty/pear/SOAP/example/com_client.php b/thirdparty/pear/SOAP/example/com_client.php
index d511f0a..3f33daf 100644
--- a/thirdparty/pear/SOAP/example/com_client.php
+++ b/thirdparty/pear/SOAP/example/com_client.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo |
// +----------------------------------------------------------------------+
//
-// $Id: com_client.php,v 1.3 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
// SOAPStruct is defined in the following file
require_once 'example_types.php';
diff --git a/thirdparty/pear/SOAP/example/disco_server.php b/thirdparty/pear/SOAP/example/disco_server.php
index 6dc8581..21a9018 100644
--- a/thirdparty/pear/SOAP/example/disco_server.php
+++ b/thirdparty/pear/SOAP/example/disco_server.php
@@ -16,7 +16,7 @@
// | Author: Dmitri Vinogradov |
// +----------------------------------------------------------------------+
//
-// $Id: disco_server.php,v 1.5 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
/*
This example shows how to mark up a server object so that
diff --git a/thirdparty/pear/SOAP/example/email_client.php b/thirdparty/pear/SOAP/example/email_client.php
index 40d0d18..797906f 100644
--- a/thirdparty/pear/SOAP/example/email_client.php
+++ b/thirdparty/pear/SOAP/example/email_client.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo Port to PEAR and more |
// +----------------------------------------------------------------------+
//
-// $Id: email_client.php,v 1.4 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
/*
diff --git a/thirdparty/pear/SOAP/example/email_gateway.php b/thirdparty/pear/SOAP/example/email_gateway.php
index 2e14a85..42701ed 100644
--- a/thirdparty/pear/SOAP/example/email_gateway.php
+++ b/thirdparty/pear/SOAP/example/email_gateway.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo Port to PEAR and more |
// +----------------------------------------------------------------------+
//
-// $Id: email_gateway.php,v 1.5 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
/*
diff --git a/thirdparty/pear/SOAP/example/email_pop_gateway.php b/thirdparty/pear/SOAP/example/email_pop_gateway.php
index a998466..bd9ff38 100644
--- a/thirdparty/pear/SOAP/example/email_pop_gateway.php
+++ b/thirdparty/pear/SOAP/example/email_pop_gateway.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo Port to PEAR and more |
// +----------------------------------------------------------------------+
//
-// $Id: email_pop_gateway.php,v 1.6 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
/* include the Email server class, which knows how to
diff --git a/thirdparty/pear/SOAP/example/email_pop_server.php b/thirdparty/pear/SOAP/example/email_pop_server.php
index 2a12b56..be47873 100644
--- a/thirdparty/pear/SOAP/example/email_pop_server.php
+++ b/thirdparty/pear/SOAP/example/email_pop_server.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo Port to PEAR and more |
// +----------------------------------------------------------------------+
//
-// $Id: email_pop_server.php,v 1.6 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
/* include the Email server class, which knows how to
diff --git a/thirdparty/pear/SOAP/example/email_server.php b/thirdparty/pear/SOAP/example/email_server.php
index f4477c4..cad3dea 100644
--- a/thirdparty/pear/SOAP/example/email_server.php
+++ b/thirdparty/pear/SOAP/example/email_server.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo Port to PEAR and more |
// +----------------------------------------------------------------------+
//
-// $Id: email_server.php,v 1.5 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
/*
diff --git a/thirdparty/pear/SOAP/example/example_server.php b/thirdparty/pear/SOAP/example/example_server.php
index 7e59d49..376b324 100644
--- a/thirdparty/pear/SOAP/example/example_server.php
+++ b/thirdparty/pear/SOAP/example/example_server.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo |
// +----------------------------------------------------------------------+
//
-// $Id: example_server.php,v 1.5 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
// first, include the SOAP/Server class
diff --git a/thirdparty/pear/SOAP/example/server.php b/thirdparty/pear/SOAP/example/server.php
index 1990072..543bff3 100644
--- a/thirdparty/pear/SOAP/example/server.php
+++ b/thirdparty/pear/SOAP/example/server.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo |
// +----------------------------------------------------------------------+
//
-// $Id: server.php,v 1.10 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
// first, include the SOAP/Server class
diff --git a/thirdparty/pear/SOAP/example/server2.php b/thirdparty/pear/SOAP/example/server2.php
index 2d64446..3d945b5 100644
--- a/thirdparty/pear/SOAP/example/server2.php
+++ b/thirdparty/pear/SOAP/example/server2.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo |
// +----------------------------------------------------------------------+
//
-// $Id: server2.php,v 1.3 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
// first, include the SOAP/Server class
diff --git a/thirdparty/pear/SOAP/example/smtp.php b/thirdparty/pear/SOAP/example/smtp.php
index a7814da..7a2695e 100644
--- a/thirdparty/pear/SOAP/example/smtp.php
+++ b/thirdparty/pear/SOAP/example/smtp.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo |
// +----------------------------------------------------------------------+
//
-// $Id: smtp.php,v 1.5 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
// include soap client class
include("SOAP/Client.php");
diff --git a/thirdparty/pear/SOAP/example/stockquote.php b/thirdparty/pear/SOAP/example/stockquote.php
index 0305032..04749bc 100644
--- a/thirdparty/pear/SOAP/example/stockquote.php
+++ b/thirdparty/pear/SOAP/example/stockquote.php
@@ -18,7 +18,7 @@
// | Authors: Dietrich Ayala Original Author |
// +----------------------------------------------------------------------+
//
-// $Id: stockquote.php,v 1.7 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
// include soap client class
include("SOAP/Client.php");
diff --git a/thirdparty/pear/SOAP/example/tcp_client.php b/thirdparty/pear/SOAP/example/tcp_client.php
index b3f04d7..f583f7f 100644
--- a/thirdparty/pear/SOAP/example/tcp_client.php
+++ b/thirdparty/pear/SOAP/example/tcp_client.php
@@ -16,7 +16,7 @@
// | Authors: Shane Hanna |
// +----------------------------------------------------------------------+
//
-// $Id: tcp_client.php,v 1.3 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
require_once('SOAP/Client.php');
diff --git a/thirdparty/pear/SOAP/example/tcp_server.php b/thirdparty/pear/SOAP/example/tcp_server.php
index 41c8468..e1ceda9 100644
--- a/thirdparty/pear/SOAP/example/tcp_server.php
+++ b/thirdparty/pear/SOAP/example/tcp_server.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo |
// +----------------------------------------------------------------------+
//
-// $Id: tcp_server.php,v 1.4 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
// first, include the SOAP/Server class
diff --git a/thirdparty/pear/SOAP/example/wsdl_client.php b/thirdparty/pear/SOAP/example/wsdl_client.php
index dc63a76..4af4bf4 100644
--- a/thirdparty/pear/SOAP/example/wsdl_client.php
+++ b/thirdparty/pear/SOAP/example/wsdl_client.php
@@ -16,7 +16,7 @@
// | Authors: Shane Caraveo |
// +----------------------------------------------------------------------+
//
-// $Id: wsdl_client.php,v 1.3 2005/03/10 23:16:40 yunosh Exp $
+// $Id$
//
include("SOAP/Client.php");
diff --git a/thirdparty/pear/System.php b/thirdparty/pear/System.php
index dc3acee..7289016 100644
--- a/thirdparty/pear/System.php
+++ b/thirdparty/pear/System.php
@@ -16,7 +16,7 @@
// | Authors: Tomas V.V.Cox |
// +----------------------------------------------------------------------+
//
-// $Id: System.php,v 1.36 2004/06/15 16:33:46 pajoye Exp $
+// $Id$
//
require_once 'PEAR.php';
@@ -48,7 +48,7 @@ $GLOBALS['_System_temp_files'] = array();
*
* @package System
* @author Tomas V.V.Cox
-* @version $Revision: 1.36 $
+* @version $Revision$
* @access public
* @see http://pear.php.net/manual/
*/
diff --git a/thirdparty/simpletest/simpletest/exceptions.php b/thirdparty/simpletest/simpletest/exceptions.php
index 2cde258..a2bf0af 100644
--- a/thirdparty/simpletest/simpletest/exceptions.php
+++ b/thirdparty/simpletest/simpletest/exceptions.php
@@ -3,7 +3,7 @@
* base include file for SimpleTest
* @package SimpleTest
* @subpackage UnitTester
- * @version $Id: exceptions.php,v 1.12 2006/11/09 23:14:48 lastcraft Exp $
+ * @version $Id$
*/
/**#@+
diff --git a/thirdpartyjs/curvycorners/lgpl.txt b/thirdpartyjs/curvycorners/lgpl.txt
index 259cffb..f8e41e9 100644
--- a/thirdpartyjs/curvycorners/lgpl.txt
+++ b/thirdpartyjs/curvycorners/lgpl.txt
@@ -1,502 +1,502 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- , 1 April 1990
- Ty Coon, President of Vice
-
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
That's all there is to it!
\ No newline at end of file
diff --git a/thirdpartyjs/yui/animation/README b/thirdpartyjs/yui/animation/README
index e0f9951..22cc72b 100644
--- a/thirdpartyjs/yui/animation/README
+++ b/thirdpartyjs/yui/animation/README
@@ -1,34 +1,34 @@
-Animation Release Notes
-
-*** version 0.12.0 ***
-
-* added boolean finish argument to Anim.stop()
-
-*** version 0.11.3 ***
-
-* no changes
-
-*** version 0.11.1 ***
-
-* changed "prototype" shorthand to "proto" (workaround firefox < 1.5 scoping
-bug)
-
-*** version 0.11.0 ***
-
-* ColorAnim subclass added
-* Motion and Scroll now inherit from ColorAnim
-* getDefaultUnit method added
-* defaultUnit and defaultUnits deprecated
-* getDefault and setDefault methods deprecated
-
-*** version 0.10.0 ***
-
-* Scroll now handles relative ("by") animation correctly
-
-* Now converts "auto" values of "from" to appropriate initial values
-
-*** version 0.9.0 ***
-
-* Initial release
-
-
+Animation Release Notes
+
+*** version 0.12.0 ***
+
+* added boolean finish argument to Anim.stop()
+
+*** version 0.11.3 ***
+
+* no changes
+
+*** version 0.11.1 ***
+
+* changed "prototype" shorthand to "proto" (workaround firefox < 1.5 scoping
+bug)
+
+*** version 0.11.0 ***
+
+* ColorAnim subclass added
+* Motion and Scroll now inherit from ColorAnim
+* getDefaultUnit method added
+* defaultUnit and defaultUnits deprecated
+* getDefault and setDefault methods deprecated
+
+*** version 0.10.0 ***
+
+* Scroll now handles relative ("by") animation correctly
+
+* Now converts "auto" values of "from" to appropriate initial values
+
+*** version 0.9.0 ***
+
+* Initial release
+
+
diff --git a/thirdpartyjs/yui/animation/animation-debug.js b/thirdpartyjs/yui/animation/animation-debug.js
index 1a4c89c..60cd905 100644
--- a/thirdpartyjs/yui/animation/animation-debug.js
+++ b/thirdpartyjs/yui/animation/animation-debug.js
@@ -1,1276 +1,1276 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-/**
- * The animation module provides allows effects to be added to HTMLElements.
- * @module animation
- */
-
-/**
- *
- * Base animation class that provides the interface for building animated effects.
- * Usage: var myAnim = new YAHOO.util.Anim(el, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut);
- * @class Anim
- * @namespace YAHOO.util
- * @requires YAHOO.util.AnimMgr
- * @requires YAHOO.util.Easing
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @constructor
- * @param {String | HTMLElement} el Reference to the element that will be animated
- * @param {Object} attributes The attribute(s) to be animated.
- * Each attribute is an object with at minimum a "to" or "by" member defined.
- * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
- * All attribute names use camelCase.
- * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
- * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
- */
-
-YAHOO.util.Anim = function(el, attributes, duration, method) {
- if (el) {
- this.init(el, attributes, duration, method);
- }
-};
-
-YAHOO.util.Anim.prototype = {
- /**
- * Provides a readable name for the Anim instance.
- * @method toString
- * @return {String}
- */
- toString: function() {
- var el = this.getEl();
- var id = el.id || el.tagName;
- return ("Anim " + id);
- },
-
- patterns: { // cached for performance
- noNegatives: /width|height|opacity|padding/i, // keep at zero or above
- offsetAttribute: /^((width|height)|(top|left))$/, // use offsetValue as default
- defaultUnit: /width|height|top$|bottom$|left$|right$/i, // use 'px' by default
- offsetUnit: /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i // IE may return these, so convert these to offset
- },
-
- /**
- * Returns the value computed by the animation's "method".
- * @method doMethod
- * @param {String} attr The name of the attribute.
- * @param {Number} start The value this attribute should start from for this animation.
- * @param {Number} end The value this attribute should end at for this animation.
- * @return {Number} The Value to be applied to the attribute.
- */
- doMethod: function(attr, start, end) {
- return this.method(this.currentFrame, start, end - start, this.totalFrames);
- },
-
- /**
- * Applies a value to an attribute.
- * @method setAttribute
- * @param {String} attr The name of the attribute.
- * @param {Number} val The value to be applied to the attribute.
- * @param {String} unit The unit ('px', '%', etc.) of the value.
- */
- setAttribute: function(attr, val, unit) {
- if ( this.patterns.noNegatives.test(attr) ) {
- val = (val > 0) ? val : 0;
- }
-
- YAHOO.util.Dom.setStyle(this.getEl(), attr, val + unit);
- },
-
- /**
- * Returns current value of the attribute.
- * @method getAttribute
- * @param {String} attr The name of the attribute.
- * @return {Number} val The current value of the attribute.
- */
- getAttribute: function(attr) {
- var el = this.getEl();
- var val = YAHOO.util.Dom.getStyle(el, attr);
-
- if (val !== 'auto' && !this.patterns.offsetUnit.test(val)) {
- return parseFloat(val);
- }
-
- var a = this.patterns.offsetAttribute.exec(attr) || [];
- var pos = !!( a[3] ); // top or left
- var box = !!( a[2] ); // width or height
-
- // use offsets for width/height and abs pos top/left
- if ( box || (YAHOO.util.Dom.getStyle(el, 'position') == 'absolute' && pos) ) {
- val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)];
- } else { // default to zero for other 'auto'
- val = 0;
- }
-
- return val;
- },
-
- /**
- * Returns the unit to use when none is supplied.
- * @method getDefaultUnit
- * @param {attr} attr The name of the attribute.
- * @return {String} The default unit to be used.
- */
- getDefaultUnit: function(attr) {
- if ( this.patterns.defaultUnit.test(attr) ) {
- return 'px';
- }
-
- return '';
- },
-
- /**
- * Sets the actual values to be used during the animation.
- * @method setRuntimeAttribute
- * Should only be needed for subclass use.
- * @param {Object} attr The attribute object
- * @private
- */
- setRuntimeAttribute: function(attr) {
- var start;
- var end;
- var attributes = this.attributes;
-
- this.runtimeAttributes[attr] = {};
-
- var isset = function(prop) {
- return (typeof prop !== 'undefined');
- };
-
- if ( !isset(attributes[attr]['to']) && !isset(attributes[attr]['by']) ) {
- return false; // note return; nothing to animate to
- }
-
- start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr);
-
- // To beats by, per SMIL 2.1 spec
- if ( isset(attributes[attr]['to']) ) {
- end = attributes[attr]['to'];
- } else if ( isset(attributes[attr]['by']) ) {
- if (start.constructor == Array) {
- end = [];
- for (var i = 0, len = start.length; i < len; ++i) {
- end[i] = start[i] + attributes[attr]['by'][i];
- }
- } else {
- end = start + attributes[attr]['by'];
- }
- }
-
- this.runtimeAttributes[attr].start = start;
- this.runtimeAttributes[attr].end = end;
-
- // set units if needed
- this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ? attributes[attr]['unit'] : this.getDefaultUnit(attr);
- },
-
- /**
- * Constructor for Anim instance.
- * @method init
- * @param {String | HTMLElement} el Reference to the element that will be animated
- * @param {Object} attributes The attribute(s) to be animated.
- * Each attribute is an object with at minimum a "to" or "by" member defined.
- * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
- * All attribute names use camelCase.
- * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
- * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
- */
- init: function(el, attributes, duration, method) {
- /**
- * Whether or not the animation is running.
- * @property isAnimated
- * @private
- * @type Boolean
- */
- var isAnimated = false;
-
- /**
- * A Date object that is created when the animation begins.
- * @property startTime
- * @private
- * @type Date
- */
- var startTime = null;
-
- /**
- * The number of frames this animation was able to execute.
- * @property actualFrames
- * @private
- * @type Int
- */
- var actualFrames = 0;
-
- /**
- * The element to be animated.
- * @property el
- * @private
- * @type HTMLElement
- */
- el = YAHOO.util.Dom.get(el);
-
- /**
- * The collection of attributes to be animated.
- * Each attribute must have at least a "to" or "by" defined in order to animate.
- * If "to" is supplied, the animation will end with the attribute at that value.
- * If "by" is supplied, the animation will end at that value plus its starting value.
- * If both are supplied, "to" is used, and "by" is ignored.
- * Optional additional member include "from" (the value the attribute should start animating from, defaults to current value), and "unit" (the units to apply to the values).
- * @property attributes
- * @type Object
- */
- this.attributes = attributes || {};
-
- /**
- * The length of the animation. Defaults to "1" (second).
- * @property duration
- * @type Number
- */
- this.duration = duration || 1;
-
- /**
- * The method that will provide values to the attribute(s) during the animation.
- * Defaults to "YAHOO.util.Easing.easeNone".
- * @property method
- * @type Function
- */
- this.method = method || YAHOO.util.Easing.easeNone;
-
- /**
- * Whether or not the duration should be treated as seconds.
- * Defaults to true.
- * @property useSeconds
- * @type Boolean
- */
- this.useSeconds = true; // default to seconds
-
- /**
- * The location of the current animation on the timeline.
- * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.
- * @property currentFrame
- * @type Int
- */
- this.currentFrame = 0;
-
- /**
- * The total number of frames to be executed.
- * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.
- * @property totalFrames
- * @type Int
- */
- this.totalFrames = YAHOO.util.AnimMgr.fps;
-
-
- /**
- * Returns a reference to the animated element.
- * @method getEl
- * @return {HTMLElement}
- */
- this.getEl = function() { return el; };
-
- /**
- * Checks whether the element is currently animated.
- * @method isAnimated
- * @return {Boolean} current value of isAnimated.
- */
- this.isAnimated = function() {
- return isAnimated;
- };
-
- /**
- * Returns the animation start time.
- * @method getStartTime
- * @return {Date} current value of startTime.
- */
- this.getStartTime = function() {
- return startTime;
- };
-
- this.runtimeAttributes = {};
-
- var logger = {};
- logger.log = function() {YAHOO.log.apply(window, arguments)};
-
- logger.log('creating new instance of ' + this);
-
- /**
- * Starts the animation by registering it with the animation manager.
- * @method animate
- */
- this.animate = function() {
- if ( this.isAnimated() ) { return false; }
-
- this.currentFrame = 0;
-
- this.totalFrames = ( this.useSeconds ) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration;
-
- YAHOO.util.AnimMgr.registerElement(this);
- };
-
- /**
- * Stops the animation. Normally called by AnimMgr when animation completes.
- * @method stop
- * @param {Boolean} finish (optional) If true, animation will jump to final frame.
- */
- this.stop = function(finish) {
- if (finish) {
- this.currentFrame = this.totalFrames;
- this._onTween.fire();
- }
- YAHOO.util.AnimMgr.stop(this);
- };
-
- var onStart = function() {
- this.onStart.fire();
-
- this.runtimeAttributes = {};
- for (var attr in this.attributes) {
- this.setRuntimeAttribute(attr);
- }
-
- isAnimated = true;
- actualFrames = 0;
- startTime = new Date();
- };
-
- /**
- * Feeds the starting and ending values for each animated attribute to doMethod once per frame, then applies the resulting value to the attribute(s).
- * @private
- */
-
- var onTween = function() {
- var data = {
- duration: new Date() - this.getStartTime(),
- currentFrame: this.currentFrame
- };
-
- data.toString = function() {
- return (
- 'duration: ' + data.duration +
- ', currentFrame: ' + data.currentFrame
- );
- };
-
- this.onTween.fire(data);
-
- var runtimeAttributes = this.runtimeAttributes;
-
- for (var attr in runtimeAttributes) {
- this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit);
- }
-
- actualFrames += 1;
- };
-
- var onComplete = function() {
- var actual_duration = (new Date() - startTime) / 1000 ;
-
- var data = {
- duration: actual_duration,
- frames: actualFrames,
- fps: actualFrames / actual_duration
- };
-
- data.toString = function() {
- return (
- 'duration: ' + data.duration +
- ', frames: ' + data.frames +
- ', fps: ' + data.fps
- );
- };
-
- isAnimated = false;
- actualFrames = 0;
- this.onComplete.fire(data);
- };
-
- /**
- * Custom event that fires after onStart, useful in subclassing
- * @private
- */
- this._onStart = new YAHOO.util.CustomEvent('_start', this, true);
-
- /**
- * Custom event that fires when animation begins
- * Listen via subscribe method (e.g. myAnim.onStart.subscribe(someFunction)
- * @event onStart
- */
- this.onStart = new YAHOO.util.CustomEvent('start', this);
-
- /**
- * Custom event that fires between each frame
- * Listen via subscribe method (e.g. myAnim.onTween.subscribe(someFunction)
- * @event onTween
- */
- this.onTween = new YAHOO.util.CustomEvent('tween', this);
-
- /**
- * Custom event that fires after onTween
- * @private
- */
- this._onTween = new YAHOO.util.CustomEvent('_tween', this, true);
-
- /**
- * Custom event that fires when animation ends
- * Listen via subscribe method (e.g. myAnim.onComplete.subscribe(someFunction)
- * @event onComplete
- */
- this.onComplete = new YAHOO.util.CustomEvent('complete', this);
- /**
- * Custom event that fires after onComplete
- * @private
- */
- this._onComplete = new YAHOO.util.CustomEvent('_complete', this, true);
-
- this._onStart.subscribe(onStart);
- this._onTween.subscribe(onTween);
- this._onComplete.subscribe(onComplete);
- }
-};
-
-/**
- * Handles animation queueing and threading.
- * Used by Anim and subclasses.
- * @class AnimMgr
- * @namespace YAHOO.util
- */
-YAHOO.util.AnimMgr = new function() {
- /**
- * Reference to the animation Interval.
- * @property thread
- * @private
- * @type Int
- */
- var thread = null;
-
- /**
- * The current queue of registered animation objects.
- * @property queue
- * @private
- * @type Array
- */
- var queue = [];
-
- /**
- * The number of active animations.
- * @property tweenCount
- * @private
- * @type Int
- */
- var tweenCount = 0;
-
- /**
- * Base frame rate (frames per second).
- * Arbitrarily high for better x-browser calibration (slower browsers drop more frames).
- * @property fps
- * @type Int
- *
- */
- this.fps = 200;
-
- /**
- * Interval delay in milliseconds, defaults to fastest possible.
- * @property delay
- * @type Int
- *
- */
- this.delay = 1;
-
- /**
- * Adds an animation instance to the animation queue.
- * All animation instances must be registered in order to animate.
- * @method registerElement
- * @param {object} tween The Anim instance to be be registered
- */
- this.registerElement = function(tween) {
- queue[queue.length] = tween;
- tweenCount += 1;
- tween._onStart.fire();
- this.start();
- };
-
- /**
- * removes an animation instance from the animation queue.
- * All animation instances must be registered in order to animate.
- * @method unRegister
- * @param {object} tween The Anim instance to be be registered
- * @param {Int} index The index of the Anim instance
- * @private
- */
- this.unRegister = function(tween, index) {
- tween._onComplete.fire();
- index = index || getIndex(tween);
- if (index != -1) { queue.splice(index, 1); }
-
- tweenCount -= 1;
- if (tweenCount <= 0) { this.stop(); }
- };
-
- /**
- * Starts the animation thread.
- * Only one thread can run at a time.
- * @method start
- */
- this.start = function() {
- if (thread === null) { thread = setInterval(this.run, this.delay); }
- };
-
- /**
- * Stops the animation thread or a specific animation instance.
- * @method stop
- * @param {object} tween A specific Anim instance to stop (optional)
- * If no instance given, Manager stops thread and all animations.
- */
- this.stop = function(tween) {
- if (!tween) {
- clearInterval(thread);
- for (var i = 0, len = queue.length; i < len; ++i) {
- if (queue[i].isAnimated()) {
- this.unRegister(tween, i);
- }
- }
- queue = [];
- thread = null;
- tweenCount = 0;
- }
- else {
- this.unRegister(tween);
- }
- };
-
- /**
- * Called per Interval to handle each animation frame.
- * @method run
- */
- this.run = function() {
- for (var i = 0, len = queue.length; i < len; ++i) {
- var tween = queue[i];
- if ( !tween || !tween.isAnimated() ) { continue; }
-
- if (tween.currentFrame < tween.totalFrames || tween.totalFrames === null)
- {
- tween.currentFrame += 1;
-
- if (tween.useSeconds) {
- correctFrame(tween);
- }
- tween._onTween.fire();
- }
- else { YAHOO.util.AnimMgr.stop(tween, i); }
- }
- };
-
- var getIndex = function(anim) {
- for (var i = 0, len = queue.length; i < len; ++i) {
- if (queue[i] == anim) {
- return i; // note return;
- }
- }
- return -1;
- };
-
- /**
- * On the fly frame correction to keep animation on time.
- * @method correctFrame
- * @private
- * @param {Object} tween The Anim instance being corrected.
- */
- var correctFrame = function(tween) {
- var frames = tween.totalFrames;
- var frame = tween.currentFrame;
- var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames);
- var elapsed = (new Date() - tween.getStartTime());
- var tweak = 0;
-
- if (elapsed < tween.duration * 1000) { // check if falling behind
- tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);
- } else { // went over duration, so jump to end
- tweak = frames - (frame + 1);
- }
- if (tweak > 0 && isFinite(tweak)) { // adjust if needed
- if (tween.currentFrame + tweak >= frames) {// dont go past last frame
- tweak = frames - (frame + 1);
- }
-
- tween.currentFrame += tweak;
- }
- };
-};
-/**
- * Used to calculate Bezier splines for any number of control points.
- * @class Bezier
- * @namespace YAHOO.util
- *
- */
-YAHOO.util.Bezier = new function()
-{
- /**
- * Get the current position of the animated element based on t.
- * Each point is an array of "x" and "y" values (0 = x, 1 = y)
- * At least 2 points are required (start and end).
- * First point is start. Last point is end.
- * Additional control points are optional.
- * @method getPosition
- * @param {Array} points An array containing Bezier points
- * @param {Number} t A number between 0 and 1 which is the basis for determining current position
- * @return {Array} An array containing int x and y member data
- */
- this.getPosition = function(points, t)
- {
- var n = points.length;
- var tmp = [];
-
- for (var i = 0; i < n; ++i){
- tmp[i] = [points[i][0], points[i][1]]; // save input
- }
-
- for (var j = 1; j < n; ++j) {
- for (i = 0; i < n - j; ++i) {
- tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];
- tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
- }
- }
-
- return [ tmp[0][0], tmp[0][1] ];
-
- };
-};
-/**
- * Anim subclass for color transitions.
- * Usage: var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut); Color values can be specified with either 112233, #112233,
- * [255,255,255], or rgb(255,255,255)
- * @class ColorAnim
- * @namespace YAHOO.util
- * @requires YAHOO.util.Anim
- * @requires YAHOO.util.AnimMgr
- * @requires YAHOO.util.Easing
- * @requires YAHOO.util.Bezier
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @constructor
- * @extends YAHOO.util.Anim
- * @param {HTMLElement | String} el Reference to the element that will be animated
- * @param {Object} attributes The attribute(s) to be animated.
- * Each attribute is an object with at minimum a "to" or "by" member defined.
- * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
- * All attribute names use camelCase.
- * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
- * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
- */
-(function() {
- YAHOO.util.ColorAnim = function(el, attributes, duration, method) {
- YAHOO.util.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
- };
-
- YAHOO.extend(YAHOO.util.ColorAnim, YAHOO.util.Anim);
-
- // shorthand
- var Y = YAHOO.util;
- var superclass = Y.ColorAnim.superclass;
- var proto = Y.ColorAnim.prototype;
-
- proto.toString = function() {
- var el = this.getEl();
- var id = el.id || el.tagName;
- return ("ColorAnim " + id);
- };
-
- proto.patterns.color = /color$/i;
- proto.patterns.rgb = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;
- proto.patterns.hex = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;
- proto.patterns.hex3 = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;
- proto.patterns.transparent = /^transparent|rgba\(0, 0, 0, 0\)$/; // need rgba for safari
-
- /**
- * Attempts to parse the given string and return a 3-tuple.
- * @method parseColor
- * @param {String} s The string to parse.
- * @return {Array} The 3-tuple of rgb values.
- */
- proto.parseColor = function(s) {
- if (s.length == 3) { return s; }
-
- var c = this.patterns.hex.exec(s);
- if (c && c.length == 4) {
- return [ parseInt(c[1], 16), parseInt(c[2], 16), parseInt(c[3], 16) ];
- }
-
- c = this.patterns.rgb.exec(s);
- if (c && c.length == 4) {
- return [ parseInt(c[1], 10), parseInt(c[2], 10), parseInt(c[3], 10) ];
- }
-
- c = this.patterns.hex3.exec(s);
- if (c && c.length == 4) {
- return [ parseInt(c[1] + c[1], 16), parseInt(c[2] + c[2], 16), parseInt(c[3] + c[3], 16) ];
- }
-
- return null;
- };
-
- proto.getAttribute = function(attr) {
- var el = this.getEl();
- if ( this.patterns.color.test(attr) ) {
- var val = YAHOO.util.Dom.getStyle(el, attr);
-
- if (this.patterns.transparent.test(val)) { // bgcolor default
- var parent = el.parentNode; // try and get from an ancestor
- val = Y.Dom.getStyle(parent, attr);
-
- while (parent && this.patterns.transparent.test(val)) {
- parent = parent.parentNode;
- val = Y.Dom.getStyle(parent, attr);
- if (parent.tagName.toUpperCase() == 'HTML') {
- val = '#fff';
- }
- }
- }
- } else {
- val = superclass.getAttribute.call(this, attr);
- }
-
- return val;
- };
-
- proto.doMethod = function(attr, start, end) {
- var val;
-
- if ( this.patterns.color.test(attr) ) {
- val = [];
- for (var i = 0, len = start.length; i < len; ++i) {
- val[i] = superclass.doMethod.call(this, attr, start[i], end[i]);
- }
-
- val = 'rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';
- }
- else {
- val = superclass.doMethod.call(this, attr, start, end);
- }
-
- return val;
- };
-
- proto.setRuntimeAttribute = function(attr) {
- superclass.setRuntimeAttribute.call(this, attr);
-
- if ( this.patterns.color.test(attr) ) {
- var attributes = this.attributes;
- var start = this.parseColor(this.runtimeAttributes[attr].start);
- var end = this.parseColor(this.runtimeAttributes[attr].end);
- // fix colors if going "by"
- if ( typeof attributes[attr]['to'] === 'undefined' && typeof attributes[attr]['by'] !== 'undefined' ) {
- end = this.parseColor(attributes[attr].by);
-
- for (var i = 0, len = start.length; i < len; ++i) {
- end[i] = start[i] + end[i];
- }
- }
-
- this.runtimeAttributes[attr].start = start;
- this.runtimeAttributes[attr].end = end;
- }
- };
-})();/*
-TERMS OF USE - EASING EQUATIONS
-Open source under the BSD License.
-Copyright 2001 Robert Penner All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/**
- * Singleton that determines how an animation proceeds from start to end.
- * @class Easing
- * @namespace YAHOO.util
-*/
-
-YAHOO.util.Easing = {
-
- /**
- * Uniform speed between points.
- * @method easeNone
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeNone: function (t, b, c, d) {
- return c*t/d + b;
- },
-
- /**
- * Begins slowly and accelerates towards end. (quadratic)
- * @method easeIn
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeIn: function (t, b, c, d) {
- return c*(t/=d)*t + b;
- },
-
- /**
- * Begins quickly and decelerates towards end. (quadratic)
- * @method easeOut
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeOut: function (t, b, c, d) {
- return -c *(t/=d)*(t-2) + b;
- },
-
- /**
- * Begins slowly and decelerates towards end. (quadratic)
- * @method easeBoth
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeBoth: function (t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t + b;
- return -c/2 * ((--t)*(t-2) - 1) + b;
- },
-
- /**
- * Begins slowly and accelerates towards end. (quartic)
- * @method easeInStrong
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeInStrong: function (t, b, c, d) {
- return c*(t/=d)*t*t*t + b;
- },
-
- /**
- * Begins quickly and decelerates towards end. (quartic)
- * @method easeOutStrong
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeOutStrong: function (t, b, c, d) {
- return -c * ((t=t/d-1)*t*t*t - 1) + b;
- },
-
- /**
- * Begins slowly and decelerates towards end. (quartic)
- * @method easeBothStrong
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeBothStrong: function (t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
- return -c/2 * ((t-=2)*t*t*t - 2) + b;
- },
-
- /**
- * Snap in elastic effect.
- * @method elasticIn
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} p Period (optional)
- * @return {Number} The computed value for the current animation frame
- */
-
- elasticIn: function (t, b, c, d, a, p) {
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
- if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
- },
-
- /**
- * Snap out elastic effect.
- * @method elasticOut
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} p Period (optional)
- * @return {Number} The computed value for the current animation frame
- */
- elasticOut: function (t, b, c, d, a, p) {
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
- if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
- },
-
- /**
- * Snap both elastic effect.
- * @method elasticBoth
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} p Period (optional)
- * @return {Number} The computed value for the current animation frame
- */
- elasticBoth: function (t, b, c, d, a, p) {
- if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
- if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
- return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
- },
-
-
- /**
- * Backtracks slightly, then reverses direction and moves to end.
- * @method backIn
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} s Overshoot (optional)
- * @return {Number} The computed value for the current animation frame
- */
- backIn: function (t, b, c, d, s) {
- if (typeof s == 'undefined') s = 1.70158;
- return c*(t/=d)*t*((s+1)*t - s) + b;
- },
-
- /**
- * Overshoots end, then reverses and comes back to end.
- * @method backOut
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} s Overshoot (optional)
- * @return {Number} The computed value for the current animation frame
- */
- backOut: function (t, b, c, d, s) {
- if (typeof s == 'undefined') s = 1.70158;
- return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
- },
-
- /**
- * Backtracks slightly, then reverses direction, overshoots end,
- * then reverses and comes back to end.
- * @method backBoth
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} s Overshoot (optional)
- * @return {Number} The computed value for the current animation frame
- */
- backBoth: function (t, b, c, d, s) {
- if (typeof s == 'undefined') s = 1.70158;
- if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
- return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
- },
-
- /**
- * Bounce off of start.
- * @method bounceIn
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- bounceIn: function (t, b, c, d) {
- return c - YAHOO.util.Easing.bounceOut(d-t, 0, c, d) + b;
- },
-
- /**
- * Bounces off end.
- * @method bounceOut
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- bounceOut: function (t, b, c, d) {
- if ((t/=d) < (1/2.75)) {
- return c*(7.5625*t*t) + b;
- } else if (t < (2/2.75)) {
- return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
- } else if (t < (2.5/2.75)) {
- return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
- } else {
- return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
- }
- },
-
- /**
- * Bounces off start and end.
- * @method bounceBoth
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- bounceBoth: function (t, b, c, d) {
- if (t < d/2) return YAHOO.util.Easing.bounceIn(t*2, 0, c, d) * .5 + b;
- return YAHOO.util.Easing.bounceOut(t*2-d, 0, c, d) * .5 + c*.5 + b;
- }
-};
-
-/**
- * Anim subclass for moving elements along a path defined by the "points"
- * member of "attributes". All "points" are arrays with x, y coordinates.
- * Usage: var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);
- * @class Motion
- * @namespace YAHOO.util
- * @requires YAHOO.util.Anim
- * @requires YAHOO.util.AnimMgr
- * @requires YAHOO.util.Easing
- * @requires YAHOO.util.Bezier
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @constructor
- * @extends YAHOO.util.Anim
- * @param {String | HTMLElement} el Reference to the element that will be animated
- * @param {Object} attributes The attribute(s) to be animated.
- * Each attribute is an object with at minimum a "to" or "by" member defined.
- * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
- * All attribute names use camelCase.
- * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
- * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
- */
-(function() {
- YAHOO.util.Motion = function(el, attributes, duration, method) {
- if (el) { // dont break existing subclasses not using YAHOO.extend
- YAHOO.util.Motion.superclass.constructor.call(this, el, attributes, duration, method);
- }
- };
-
- YAHOO.extend(YAHOO.util.Motion, YAHOO.util.ColorAnim);
-
- // shorthand
- var Y = YAHOO.util;
- var superclass = Y.Motion.superclass;
- var proto = Y.Motion.prototype;
-
- proto.toString = function() {
- var el = this.getEl();
- var id = el.id || el.tagName;
- return ("Motion " + id);
- };
-
- proto.patterns.points = /^points$/i;
-
- proto.setAttribute = function(attr, val, unit) {
- if ( this.patterns.points.test(attr) ) {
- unit = unit || 'px';
- superclass.setAttribute.call(this, 'left', val[0], unit);
- superclass.setAttribute.call(this, 'top', val[1], unit);
- } else {
- superclass.setAttribute.call(this, attr, val, unit);
- }
- };
-
- proto.getAttribute = function(attr) {
- if ( this.patterns.points.test(attr) ) {
- var val = [
- superclass.getAttribute.call(this, 'left'),
- superclass.getAttribute.call(this, 'top')
- ];
- } else {
- val = superclass.getAttribute.call(this, attr);
- }
-
- return val;
- };
-
- proto.doMethod = function(attr, start, end) {
- var val = null;
-
- if ( this.patterns.points.test(attr) ) {
- var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100;
- val = Y.Bezier.getPosition(this.runtimeAttributes[attr], t);
- } else {
- val = superclass.doMethod.call(this, attr, start, end);
- }
- return val;
- };
-
- proto.setRuntimeAttribute = function(attr) {
- if ( this.patterns.points.test(attr) ) {
- var el = this.getEl();
- var attributes = this.attributes;
- var start;
- var control = attributes['points']['control'] || [];
- var end;
- var i, len;
-
- if (control.length > 0 && !(control[0] instanceof Array) ) { // could be single point or array of points
- control = [control];
- } else { // break reference to attributes.points.control
- var tmp = [];
- for (i = 0, len = control.length; i< len; ++i) {
- tmp[i] = control[i];
- }
- control = tmp;
- }
-
- if (Y.Dom.getStyle(el, 'position') == 'static') { // default to relative
- Y.Dom.setStyle(el, 'position', 'relative');
- }
-
- if ( isset(attributes['points']['from']) ) {
- Y.Dom.setXY(el, attributes['points']['from']); // set position to from point
- }
- else { Y.Dom.setXY( el, Y.Dom.getXY(el) ); } // set it to current position
-
- start = this.getAttribute('points'); // get actual top & left
-
- // TO beats BY, per SMIL 2.1 spec
- if ( isset(attributes['points']['to']) ) {
- end = translateValues.call(this, attributes['points']['to'], start);
-
- var pageXY = Y.Dom.getXY(this.getEl());
- for (i = 0, len = control.length; i < len; ++i) {
- control[i] = translateValues.call(this, control[i], start);
- }
-
-
- } else if ( isset(attributes['points']['by']) ) {
- end = [ start[0] + attributes['points']['by'][0], start[1] + attributes['points']['by'][1] ];
-
- for (i = 0, len = control.length; i < len; ++i) {
- control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ];
- }
- }
-
- this.runtimeAttributes[attr] = [start];
-
- if (control.length > 0) {
- this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control);
- }
-
- this.runtimeAttributes[attr][this.runtimeAttributes[attr].length] = end;
- }
- else {
- superclass.setRuntimeAttribute.call(this, attr);
- }
- };
-
- var translateValues = function(val, start) {
- var pageXY = Y.Dom.getXY(this.getEl());
- val = [ val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1] ];
-
- return val;
- };
-
- var isset = function(prop) {
- return (typeof prop !== 'undefined');
- };
-})();
-/**
- * Anim subclass for scrolling elements to a position defined by the "scroll"
- * member of "attributes". All "scroll" members are arrays with x, y scroll positions.
- * Usage: var myAnim = new YAHOO.util.Scroll(el, { scroll: { to: [0, 800] } }, 1, YAHOO.util.Easing.easeOut);
- * @class Scroll
- * @namespace YAHOO.util
- * @requires YAHOO.util.Anim
- * @requires YAHOO.util.AnimMgr
- * @requires YAHOO.util.Easing
- * @requires YAHOO.util.Bezier
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @extends YAHOO.util.Anim
- * @constructor
- * @param {String or HTMLElement} el Reference to the element that will be animated
- * @param {Object} attributes The attribute(s) to be animated.
- * Each attribute is an object with at minimum a "to" or "by" member defined.
- * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
- * All attribute names use camelCase.
- * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
- * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
- */
-(function() {
- YAHOO.util.Scroll = function(el, attributes, duration, method) {
- if (el) { // dont break existing subclasses not using YAHOO.extend
- YAHOO.util.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
- }
- };
-
- YAHOO.extend(YAHOO.util.Scroll, YAHOO.util.ColorAnim);
-
- // shorthand
- var Y = YAHOO.util;
- var superclass = Y.Scroll.superclass;
- var proto = Y.Scroll.prototype;
-
- proto.toString = function() {
- var el = this.getEl();
- var id = el.id || el.tagName;
- return ("Scroll " + id);
- };
-
- proto.doMethod = function(attr, start, end) {
- var val = null;
-
- if (attr == 'scroll') {
- val = [
- this.method(this.currentFrame, start[0], end[0] - start[0], this.totalFrames),
- this.method(this.currentFrame, start[1], end[1] - start[1], this.totalFrames)
- ];
-
- } else {
- val = superclass.doMethod.call(this, attr, start, end);
- }
- return val;
- };
-
- proto.getAttribute = function(attr) {
- var val = null;
- var el = this.getEl();
-
- if (attr == 'scroll') {
- val = [ el.scrollLeft, el.scrollTop ];
- } else {
- val = superclass.getAttribute.call(this, attr);
- }
-
- return val;
- };
-
- proto.setAttribute = function(attr, val, unit) {
- var el = this.getEl();
-
- if (attr == 'scroll') {
- el.scrollLeft = val[0];
- el.scrollTop = val[1];
- } else {
- superclass.setAttribute.call(this, attr, val, unit);
- }
- };
-})();
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+ * The animation module provides allows effects to be added to HTMLElements.
+ * @module animation
+ */
+
+/**
+ *
+ * Base animation class that provides the interface for building animated effects.
+ * Usage: var myAnim = new YAHOO.util.Anim(el, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut);
+ * @class Anim
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @requires YAHOO.util.CustomEvent
+ * @constructor
+ * @param {String | HTMLElement} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.
+ * Each attribute is an object with at minimum a "to" or "by" member defined.
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
+ */
+
+YAHOO.util.Anim = function(el, attributes, duration, method) {
+ if (el) {
+ this.init(el, attributes, duration, method);
+ }
+};
+
+YAHOO.util.Anim.prototype = {
+ /**
+ * Provides a readable name for the Anim instance.
+ * @method toString
+ * @return {String}
+ */
+ toString: function() {
+ var el = this.getEl();
+ var id = el.id || el.tagName;
+ return ("Anim " + id);
+ },
+
+ patterns: { // cached for performance
+ noNegatives: /width|height|opacity|padding/i, // keep at zero or above
+ offsetAttribute: /^((width|height)|(top|left))$/, // use offsetValue as default
+ defaultUnit: /width|height|top$|bottom$|left$|right$/i, // use 'px' by default
+ offsetUnit: /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i // IE may return these, so convert these to offset
+ },
+
+ /**
+ * Returns the value computed by the animation's "method".
+ * @method doMethod
+ * @param {String} attr The name of the attribute.
+ * @param {Number} start The value this attribute should start from for this animation.
+ * @param {Number} end The value this attribute should end at for this animation.
+ * @return {Number} The Value to be applied to the attribute.
+ */
+ doMethod: function(attr, start, end) {
+ return this.method(this.currentFrame, start, end - start, this.totalFrames);
+ },
+
+ /**
+ * Applies a value to an attribute.
+ * @method setAttribute
+ * @param {String} attr The name of the attribute.
+ * @param {Number} val The value to be applied to the attribute.
+ * @param {String} unit The unit ('px', '%', etc.) of the value.
+ */
+ setAttribute: function(attr, val, unit) {
+ if ( this.patterns.noNegatives.test(attr) ) {
+ val = (val > 0) ? val : 0;
+ }
+
+ YAHOO.util.Dom.setStyle(this.getEl(), attr, val + unit);
+ },
+
+ /**
+ * Returns current value of the attribute.
+ * @method getAttribute
+ * @param {String} attr The name of the attribute.
+ * @return {Number} val The current value of the attribute.
+ */
+ getAttribute: function(attr) {
+ var el = this.getEl();
+ var val = YAHOO.util.Dom.getStyle(el, attr);
+
+ if (val !== 'auto' && !this.patterns.offsetUnit.test(val)) {
+ return parseFloat(val);
+ }
+
+ var a = this.patterns.offsetAttribute.exec(attr) || [];
+ var pos = !!( a[3] ); // top or left
+ var box = !!( a[2] ); // width or height
+
+ // use offsets for width/height and abs pos top/left
+ if ( box || (YAHOO.util.Dom.getStyle(el, 'position') == 'absolute' && pos) ) {
+ val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)];
+ } else { // default to zero for other 'auto'
+ val = 0;
+ }
+
+ return val;
+ },
+
+ /**
+ * Returns the unit to use when none is supplied.
+ * @method getDefaultUnit
+ * @param {attr} attr The name of the attribute.
+ * @return {String} The default unit to be used.
+ */
+ getDefaultUnit: function(attr) {
+ if ( this.patterns.defaultUnit.test(attr) ) {
+ return 'px';
+ }
+
+ return '';
+ },
+
+ /**
+ * Sets the actual values to be used during the animation.
+ * @method setRuntimeAttribute
+ * Should only be needed for subclass use.
+ * @param {Object} attr The attribute object
+ * @private
+ */
+ setRuntimeAttribute: function(attr) {
+ var start;
+ var end;
+ var attributes = this.attributes;
+
+ this.runtimeAttributes[attr] = {};
+
+ var isset = function(prop) {
+ return (typeof prop !== 'undefined');
+ };
+
+ if ( !isset(attributes[attr]['to']) && !isset(attributes[attr]['by']) ) {
+ return false; // note return; nothing to animate to
+ }
+
+ start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr);
+
+ // To beats by, per SMIL 2.1 spec
+ if ( isset(attributes[attr]['to']) ) {
+ end = attributes[attr]['to'];
+ } else if ( isset(attributes[attr]['by']) ) {
+ if (start.constructor == Array) {
+ end = [];
+ for (var i = 0, len = start.length; i < len; ++i) {
+ end[i] = start[i] + attributes[attr]['by'][i];
+ }
+ } else {
+ end = start + attributes[attr]['by'];
+ }
+ }
+
+ this.runtimeAttributes[attr].start = start;
+ this.runtimeAttributes[attr].end = end;
+
+ // set units if needed
+ this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ? attributes[attr]['unit'] : this.getDefaultUnit(attr);
+ },
+
+ /**
+ * Constructor for Anim instance.
+ * @method init
+ * @param {String | HTMLElement} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.
+ * Each attribute is an object with at minimum a "to" or "by" member defined.
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
+ */
+ init: function(el, attributes, duration, method) {
+ /**
+ * Whether or not the animation is running.
+ * @property isAnimated
+ * @private
+ * @type Boolean
+ */
+ var isAnimated = false;
+
+ /**
+ * A Date object that is created when the animation begins.
+ * @property startTime
+ * @private
+ * @type Date
+ */
+ var startTime = null;
+
+ /**
+ * The number of frames this animation was able to execute.
+ * @property actualFrames
+ * @private
+ * @type Int
+ */
+ var actualFrames = 0;
+
+ /**
+ * The element to be animated.
+ * @property el
+ * @private
+ * @type HTMLElement
+ */
+ el = YAHOO.util.Dom.get(el);
+
+ /**
+ * The collection of attributes to be animated.
+ * Each attribute must have at least a "to" or "by" defined in order to animate.
+ * If "to" is supplied, the animation will end with the attribute at that value.
+ * If "by" is supplied, the animation will end at that value plus its starting value.
+ * If both are supplied, "to" is used, and "by" is ignored.
+ * Optional additional member include "from" (the value the attribute should start animating from, defaults to current value), and "unit" (the units to apply to the values).
+ * @property attributes
+ * @type Object
+ */
+ this.attributes = attributes || {};
+
+ /**
+ * The length of the animation. Defaults to "1" (second).
+ * @property duration
+ * @type Number
+ */
+ this.duration = duration || 1;
+
+ /**
+ * The method that will provide values to the attribute(s) during the animation.
+ * Defaults to "YAHOO.util.Easing.easeNone".
+ * @property method
+ * @type Function
+ */
+ this.method = method || YAHOO.util.Easing.easeNone;
+
+ /**
+ * Whether or not the duration should be treated as seconds.
+ * Defaults to true.
+ * @property useSeconds
+ * @type Boolean
+ */
+ this.useSeconds = true; // default to seconds
+
+ /**
+ * The location of the current animation on the timeline.
+ * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.
+ * @property currentFrame
+ * @type Int
+ */
+ this.currentFrame = 0;
+
+ /**
+ * The total number of frames to be executed.
+ * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.
+ * @property totalFrames
+ * @type Int
+ */
+ this.totalFrames = YAHOO.util.AnimMgr.fps;
+
+
+ /**
+ * Returns a reference to the animated element.
+ * @method getEl
+ * @return {HTMLElement}
+ */
+ this.getEl = function() { return el; };
+
+ /**
+ * Checks whether the element is currently animated.
+ * @method isAnimated
+ * @return {Boolean} current value of isAnimated.
+ */
+ this.isAnimated = function() {
+ return isAnimated;
+ };
+
+ /**
+ * Returns the animation start time.
+ * @method getStartTime
+ * @return {Date} current value of startTime.
+ */
+ this.getStartTime = function() {
+ return startTime;
+ };
+
+ this.runtimeAttributes = {};
+
+ var logger = {};
+ logger.log = function() {YAHOO.log.apply(window, arguments)};
+
+ logger.log('creating new instance of ' + this);
+
+ /**
+ * Starts the animation by registering it with the animation manager.
+ * @method animate
+ */
+ this.animate = function() {
+ if ( this.isAnimated() ) { return false; }
+
+ this.currentFrame = 0;
+
+ this.totalFrames = ( this.useSeconds ) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration;
+
+ YAHOO.util.AnimMgr.registerElement(this);
+ };
+
+ /**
+ * Stops the animation. Normally called by AnimMgr when animation completes.
+ * @method stop
+ * @param {Boolean} finish (optional) If true, animation will jump to final frame.
+ */
+ this.stop = function(finish) {
+ if (finish) {
+ this.currentFrame = this.totalFrames;
+ this._onTween.fire();
+ }
+ YAHOO.util.AnimMgr.stop(this);
+ };
+
+ var onStart = function() {
+ this.onStart.fire();
+
+ this.runtimeAttributes = {};
+ for (var attr in this.attributes) {
+ this.setRuntimeAttribute(attr);
+ }
+
+ isAnimated = true;
+ actualFrames = 0;
+ startTime = new Date();
+ };
+
+ /**
+ * Feeds the starting and ending values for each animated attribute to doMethod once per frame, then applies the resulting value to the attribute(s).
+ * @private
+ */
+
+ var onTween = function() {
+ var data = {
+ duration: new Date() - this.getStartTime(),
+ currentFrame: this.currentFrame
+ };
+
+ data.toString = function() {
+ return (
+ 'duration: ' + data.duration +
+ ', currentFrame: ' + data.currentFrame
+ );
+ };
+
+ this.onTween.fire(data);
+
+ var runtimeAttributes = this.runtimeAttributes;
+
+ for (var attr in runtimeAttributes) {
+ this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit);
+ }
+
+ actualFrames += 1;
+ };
+
+ var onComplete = function() {
+ var actual_duration = (new Date() - startTime) / 1000 ;
+
+ var data = {
+ duration: actual_duration,
+ frames: actualFrames,
+ fps: actualFrames / actual_duration
+ };
+
+ data.toString = function() {
+ return (
+ 'duration: ' + data.duration +
+ ', frames: ' + data.frames +
+ ', fps: ' + data.fps
+ );
+ };
+
+ isAnimated = false;
+ actualFrames = 0;
+ this.onComplete.fire(data);
+ };
+
+ /**
+ * Custom event that fires after onStart, useful in subclassing
+ * @private
+ */
+ this._onStart = new YAHOO.util.CustomEvent('_start', this, true);
+
+ /**
+ * Custom event that fires when animation begins
+ * Listen via subscribe method (e.g. myAnim.onStart.subscribe(someFunction)
+ * @event onStart
+ */
+ this.onStart = new YAHOO.util.CustomEvent('start', this);
+
+ /**
+ * Custom event that fires between each frame
+ * Listen via subscribe method (e.g. myAnim.onTween.subscribe(someFunction)
+ * @event onTween
+ */
+ this.onTween = new YAHOO.util.CustomEvent('tween', this);
+
+ /**
+ * Custom event that fires after onTween
+ * @private
+ */
+ this._onTween = new YAHOO.util.CustomEvent('_tween', this, true);
+
+ /**
+ * Custom event that fires when animation ends
+ * Listen via subscribe method (e.g. myAnim.onComplete.subscribe(someFunction)
+ * @event onComplete
+ */
+ this.onComplete = new YAHOO.util.CustomEvent('complete', this);
+ /**
+ * Custom event that fires after onComplete
+ * @private
+ */
+ this._onComplete = new YAHOO.util.CustomEvent('_complete', this, true);
+
+ this._onStart.subscribe(onStart);
+ this._onTween.subscribe(onTween);
+ this._onComplete.subscribe(onComplete);
+ }
+};
+
+/**
+ * Handles animation queueing and threading.
+ * Used by Anim and subclasses.
+ * @class AnimMgr
+ * @namespace YAHOO.util
+ */
+YAHOO.util.AnimMgr = new function() {
+ /**
+ * Reference to the animation Interval.
+ * @property thread
+ * @private
+ * @type Int
+ */
+ var thread = null;
+
+ /**
+ * The current queue of registered animation objects.
+ * @property queue
+ * @private
+ * @type Array
+ */
+ var queue = [];
+
+ /**
+ * The number of active animations.
+ * @property tweenCount
+ * @private
+ * @type Int
+ */
+ var tweenCount = 0;
+
+ /**
+ * Base frame rate (frames per second).
+ * Arbitrarily high for better x-browser calibration (slower browsers drop more frames).
+ * @property fps
+ * @type Int
+ *
+ */
+ this.fps = 200;
+
+ /**
+ * Interval delay in milliseconds, defaults to fastest possible.
+ * @property delay
+ * @type Int
+ *
+ */
+ this.delay = 1;
+
+ /**
+ * Adds an animation instance to the animation queue.
+ * All animation instances must be registered in order to animate.
+ * @method registerElement
+ * @param {object} tween The Anim instance to be be registered
+ */
+ this.registerElement = function(tween) {
+ queue[queue.length] = tween;
+ tweenCount += 1;
+ tween._onStart.fire();
+ this.start();
+ };
+
+ /**
+ * removes an animation instance from the animation queue.
+ * All animation instances must be registered in order to animate.
+ * @method unRegister
+ * @param {object} tween The Anim instance to be be registered
+ * @param {Int} index The index of the Anim instance
+ * @private
+ */
+ this.unRegister = function(tween, index) {
+ tween._onComplete.fire();
+ index = index || getIndex(tween);
+ if (index != -1) { queue.splice(index, 1); }
+
+ tweenCount -= 1;
+ if (tweenCount <= 0) { this.stop(); }
+ };
+
+ /**
+ * Starts the animation thread.
+ * Only one thread can run at a time.
+ * @method start
+ */
+ this.start = function() {
+ if (thread === null) { thread = setInterval(this.run, this.delay); }
+ };
+
+ /**
+ * Stops the animation thread or a specific animation instance.
+ * @method stop
+ * @param {object} tween A specific Anim instance to stop (optional)
+ * If no instance given, Manager stops thread and all animations.
+ */
+ this.stop = function(tween) {
+ if (!tween) {
+ clearInterval(thread);
+ for (var i = 0, len = queue.length; i < len; ++i) {
+ if (queue[i].isAnimated()) {
+ this.unRegister(tween, i);
+ }
+ }
+ queue = [];
+ thread = null;
+ tweenCount = 0;
+ }
+ else {
+ this.unRegister(tween);
+ }
+ };
+
+ /**
+ * Called per Interval to handle each animation frame.
+ * @method run
+ */
+ this.run = function() {
+ for (var i = 0, len = queue.length; i < len; ++i) {
+ var tween = queue[i];
+ if ( !tween || !tween.isAnimated() ) { continue; }
+
+ if (tween.currentFrame < tween.totalFrames || tween.totalFrames === null)
+ {
+ tween.currentFrame += 1;
+
+ if (tween.useSeconds) {
+ correctFrame(tween);
+ }
+ tween._onTween.fire();
+ }
+ else { YAHOO.util.AnimMgr.stop(tween, i); }
+ }
+ };
+
+ var getIndex = function(anim) {
+ for (var i = 0, len = queue.length; i < len; ++i) {
+ if (queue[i] == anim) {
+ return i; // note return;
+ }
+ }
+ return -1;
+ };
+
+ /**
+ * On the fly frame correction to keep animation on time.
+ * @method correctFrame
+ * @private
+ * @param {Object} tween The Anim instance being corrected.
+ */
+ var correctFrame = function(tween) {
+ var frames = tween.totalFrames;
+ var frame = tween.currentFrame;
+ var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames);
+ var elapsed = (new Date() - tween.getStartTime());
+ var tweak = 0;
+
+ if (elapsed < tween.duration * 1000) { // check if falling behind
+ tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);
+ } else { // went over duration, so jump to end
+ tweak = frames - (frame + 1);
+ }
+ if (tweak > 0 && isFinite(tweak)) { // adjust if needed
+ if (tween.currentFrame + tweak >= frames) {// dont go past last frame
+ tweak = frames - (frame + 1);
+ }
+
+ tween.currentFrame += tweak;
+ }
+ };
+};
+/**
+ * Used to calculate Bezier splines for any number of control points.
+ * @class Bezier
+ * @namespace YAHOO.util
+ *
+ */
+YAHOO.util.Bezier = new function()
+{
+ /**
+ * Get the current position of the animated element based on t.
+ * Each point is an array of "x" and "y" values (0 = x, 1 = y)
+ * At least 2 points are required (start and end).
+ * First point is start. Last point is end.
+ * Additional control points are optional.
+ * @method getPosition
+ * @param {Array} points An array containing Bezier points
+ * @param {Number} t A number between 0 and 1 which is the basis for determining current position
+ * @return {Array} An array containing int x and y member data
+ */
+ this.getPosition = function(points, t)
+ {
+ var n = points.length;
+ var tmp = [];
+
+ for (var i = 0; i < n; ++i){
+ tmp[i] = [points[i][0], points[i][1]]; // save input
+ }
+
+ for (var j = 1; j < n; ++j) {
+ for (i = 0; i < n - j; ++i) {
+ tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];
+ tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
+ }
+ }
+
+ return [ tmp[0][0], tmp[0][1] ];
+
+ };
+};
+/**
+ * Anim subclass for color transitions.
+ * Usage: var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut); Color values can be specified with either 112233, #112233,
+ * [255,255,255], or rgb(255,255,255)
+ * @class ColorAnim
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.Anim
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Bezier
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @constructor
+ * @extends YAHOO.util.Anim
+ * @param {HTMLElement | String} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.
+ * Each attribute is an object with at minimum a "to" or "by" member defined.
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
+ */
+(function() {
+ YAHOO.util.ColorAnim = function(el, attributes, duration, method) {
+ YAHOO.util.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
+ };
+
+ YAHOO.extend(YAHOO.util.ColorAnim, YAHOO.util.Anim);
+
+ // shorthand
+ var Y = YAHOO.util;
+ var superclass = Y.ColorAnim.superclass;
+ var proto = Y.ColorAnim.prototype;
+
+ proto.toString = function() {
+ var el = this.getEl();
+ var id = el.id || el.tagName;
+ return ("ColorAnim " + id);
+ };
+
+ proto.patterns.color = /color$/i;
+ proto.patterns.rgb = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;
+ proto.patterns.hex = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;
+ proto.patterns.hex3 = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;
+ proto.patterns.transparent = /^transparent|rgba\(0, 0, 0, 0\)$/; // need rgba for safari
+
+ /**
+ * Attempts to parse the given string and return a 3-tuple.
+ * @method parseColor
+ * @param {String} s The string to parse.
+ * @return {Array} The 3-tuple of rgb values.
+ */
+ proto.parseColor = function(s) {
+ if (s.length == 3) { return s; }
+
+ var c = this.patterns.hex.exec(s);
+ if (c && c.length == 4) {
+ return [ parseInt(c[1], 16), parseInt(c[2], 16), parseInt(c[3], 16) ];
+ }
+
+ c = this.patterns.rgb.exec(s);
+ if (c && c.length == 4) {
+ return [ parseInt(c[1], 10), parseInt(c[2], 10), parseInt(c[3], 10) ];
+ }
+
+ c = this.patterns.hex3.exec(s);
+ if (c && c.length == 4) {
+ return [ parseInt(c[1] + c[1], 16), parseInt(c[2] + c[2], 16), parseInt(c[3] + c[3], 16) ];
+ }
+
+ return null;
+ };
+
+ proto.getAttribute = function(attr) {
+ var el = this.getEl();
+ if ( this.patterns.color.test(attr) ) {
+ var val = YAHOO.util.Dom.getStyle(el, attr);
+
+ if (this.patterns.transparent.test(val)) { // bgcolor default
+ var parent = el.parentNode; // try and get from an ancestor
+ val = Y.Dom.getStyle(parent, attr);
+
+ while (parent && this.patterns.transparent.test(val)) {
+ parent = parent.parentNode;
+ val = Y.Dom.getStyle(parent, attr);
+ if (parent.tagName.toUpperCase() == 'HTML') {
+ val = '#fff';
+ }
+ }
+ }
+ } else {
+ val = superclass.getAttribute.call(this, attr);
+ }
+
+ return val;
+ };
+
+ proto.doMethod = function(attr, start, end) {
+ var val;
+
+ if ( this.patterns.color.test(attr) ) {
+ val = [];
+ for (var i = 0, len = start.length; i < len; ++i) {
+ val[i] = superclass.doMethod.call(this, attr, start[i], end[i]);
+ }
+
+ val = 'rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';
+ }
+ else {
+ val = superclass.doMethod.call(this, attr, start, end);
+ }
+
+ return val;
+ };
+
+ proto.setRuntimeAttribute = function(attr) {
+ superclass.setRuntimeAttribute.call(this, attr);
+
+ if ( this.patterns.color.test(attr) ) {
+ var attributes = this.attributes;
+ var start = this.parseColor(this.runtimeAttributes[attr].start);
+ var end = this.parseColor(this.runtimeAttributes[attr].end);
+ // fix colors if going "by"
+ if ( typeof attributes[attr]['to'] === 'undefined' && typeof attributes[attr]['by'] !== 'undefined' ) {
+ end = this.parseColor(attributes[attr].by);
+
+ for (var i = 0, len = start.length; i < len; ++i) {
+ end[i] = start[i] + end[i];
+ }
+ }
+
+ this.runtimeAttributes[attr].start = start;
+ this.runtimeAttributes[attr].end = end;
+ }
+ };
+})();/*
+TERMS OF USE - EASING EQUATIONS
+Open source under the BSD License.
+Copyright 2001 Robert Penner All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/**
+ * Singleton that determines how an animation proceeds from start to end.
+ * @class Easing
+ * @namespace YAHOO.util
+*/
+
+YAHOO.util.Easing = {
+
+ /**
+ * Uniform speed between points.
+ * @method easeNone
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeNone: function (t, b, c, d) {
+ return c*t/d + b;
+ },
+
+ /**
+ * Begins slowly and accelerates towards end. (quadratic)
+ * @method easeIn
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeIn: function (t, b, c, d) {
+ return c*(t/=d)*t + b;
+ },
+
+ /**
+ * Begins quickly and decelerates towards end. (quadratic)
+ * @method easeOut
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeOut: function (t, b, c, d) {
+ return -c *(t/=d)*(t-2) + b;
+ },
+
+ /**
+ * Begins slowly and decelerates towards end. (quadratic)
+ * @method easeBoth
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeBoth: function (t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t + b;
+ return -c/2 * ((--t)*(t-2) - 1) + b;
+ },
+
+ /**
+ * Begins slowly and accelerates towards end. (quartic)
+ * @method easeInStrong
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeInStrong: function (t, b, c, d) {
+ return c*(t/=d)*t*t*t + b;
+ },
+
+ /**
+ * Begins quickly and decelerates towards end. (quartic)
+ * @method easeOutStrong
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeOutStrong: function (t, b, c, d) {
+ return -c * ((t=t/d-1)*t*t*t - 1) + b;
+ },
+
+ /**
+ * Begins slowly and decelerates towards end. (quartic)
+ * @method easeBothStrong
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeBothStrong: function (t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
+ return -c/2 * ((t-=2)*t*t*t - 2) + b;
+ },
+
+ /**
+ * Snap in elastic effect.
+ * @method elasticIn
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} p Period (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+
+ elasticIn: function (t, b, c, d, a, p) {
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ },
+
+ /**
+ * Snap out elastic effect.
+ * @method elasticOut
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} p Period (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+ elasticOut: function (t, b, c, d, a, p) {
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
+ },
+
+ /**
+ * Snap both elastic effect.
+ * @method elasticBoth
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} p Period (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+ elasticBoth: function (t, b, c, d, a, p) {
+ if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
+ if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
+ },
+
+
+ /**
+ * Backtracks slightly, then reverses direction and moves to end.
+ * @method backIn
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} s Overshoot (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+ backIn: function (t, b, c, d, s) {
+ if (typeof s == 'undefined') s = 1.70158;
+ return c*(t/=d)*t*((s+1)*t - s) + b;
+ },
+
+ /**
+ * Overshoots end, then reverses and comes back to end.
+ * @method backOut
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} s Overshoot (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+ backOut: function (t, b, c, d, s) {
+ if (typeof s == 'undefined') s = 1.70158;
+ return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
+ },
+
+ /**
+ * Backtracks slightly, then reverses direction, overshoots end,
+ * then reverses and comes back to end.
+ * @method backBoth
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} s Overshoot (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+ backBoth: function (t, b, c, d, s) {
+ if (typeof s == 'undefined') s = 1.70158;
+ if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
+ return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
+ },
+
+ /**
+ * Bounce off of start.
+ * @method bounceIn
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ bounceIn: function (t, b, c, d) {
+ return c - YAHOO.util.Easing.bounceOut(d-t, 0, c, d) + b;
+ },
+
+ /**
+ * Bounces off end.
+ * @method bounceOut
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ bounceOut: function (t, b, c, d) {
+ if ((t/=d) < (1/2.75)) {
+ return c*(7.5625*t*t) + b;
+ } else if (t < (2/2.75)) {
+ return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
+ } else if (t < (2.5/2.75)) {
+ return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
+ } else {
+ return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
+ }
+ },
+
+ /**
+ * Bounces off start and end.
+ * @method bounceBoth
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ bounceBoth: function (t, b, c, d) {
+ if (t < d/2) return YAHOO.util.Easing.bounceIn(t*2, 0, c, d) * .5 + b;
+ return YAHOO.util.Easing.bounceOut(t*2-d, 0, c, d) * .5 + c*.5 + b;
+ }
+};
+
+/**
+ * Anim subclass for moving elements along a path defined by the "points"
+ * member of "attributes". All "points" are arrays with x, y coordinates.
+ * Usage: var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);
+ * @class Motion
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.Anim
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Bezier
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @requires YAHOO.util.CustomEvent
+ * @constructor
+ * @extends YAHOO.util.Anim
+ * @param {String | HTMLElement} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.
+ * Each attribute is an object with at minimum a "to" or "by" member defined.
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
+ */
+(function() {
+ YAHOO.util.Motion = function(el, attributes, duration, method) {
+ if (el) { // dont break existing subclasses not using YAHOO.extend
+ YAHOO.util.Motion.superclass.constructor.call(this, el, attributes, duration, method);
+ }
+ };
+
+ YAHOO.extend(YAHOO.util.Motion, YAHOO.util.ColorAnim);
+
+ // shorthand
+ var Y = YAHOO.util;
+ var superclass = Y.Motion.superclass;
+ var proto = Y.Motion.prototype;
+
+ proto.toString = function() {
+ var el = this.getEl();
+ var id = el.id || el.tagName;
+ return ("Motion " + id);
+ };
+
+ proto.patterns.points = /^points$/i;
+
+ proto.setAttribute = function(attr, val, unit) {
+ if ( this.patterns.points.test(attr) ) {
+ unit = unit || 'px';
+ superclass.setAttribute.call(this, 'left', val[0], unit);
+ superclass.setAttribute.call(this, 'top', val[1], unit);
+ } else {
+ superclass.setAttribute.call(this, attr, val, unit);
+ }
+ };
+
+ proto.getAttribute = function(attr) {
+ if ( this.patterns.points.test(attr) ) {
+ var val = [
+ superclass.getAttribute.call(this, 'left'),
+ superclass.getAttribute.call(this, 'top')
+ ];
+ } else {
+ val = superclass.getAttribute.call(this, attr);
+ }
+
+ return val;
+ };
+
+ proto.doMethod = function(attr, start, end) {
+ var val = null;
+
+ if ( this.patterns.points.test(attr) ) {
+ var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100;
+ val = Y.Bezier.getPosition(this.runtimeAttributes[attr], t);
+ } else {
+ val = superclass.doMethod.call(this, attr, start, end);
+ }
+ return val;
+ };
+
+ proto.setRuntimeAttribute = function(attr) {
+ if ( this.patterns.points.test(attr) ) {
+ var el = this.getEl();
+ var attributes = this.attributes;
+ var start;
+ var control = attributes['points']['control'] || [];
+ var end;
+ var i, len;
+
+ if (control.length > 0 && !(control[0] instanceof Array) ) { // could be single point or array of points
+ control = [control];
+ } else { // break reference to attributes.points.control
+ var tmp = [];
+ for (i = 0, len = control.length; i< len; ++i) {
+ tmp[i] = control[i];
+ }
+ control = tmp;
+ }
+
+ if (Y.Dom.getStyle(el, 'position') == 'static') { // default to relative
+ Y.Dom.setStyle(el, 'position', 'relative');
+ }
+
+ if ( isset(attributes['points']['from']) ) {
+ Y.Dom.setXY(el, attributes['points']['from']); // set position to from point
+ }
+ else { Y.Dom.setXY( el, Y.Dom.getXY(el) ); } // set it to current position
+
+ start = this.getAttribute('points'); // get actual top & left
+
+ // TO beats BY, per SMIL 2.1 spec
+ if ( isset(attributes['points']['to']) ) {
+ end = translateValues.call(this, attributes['points']['to'], start);
+
+ var pageXY = Y.Dom.getXY(this.getEl());
+ for (i = 0, len = control.length; i < len; ++i) {
+ control[i] = translateValues.call(this, control[i], start);
+ }
+
+
+ } else if ( isset(attributes['points']['by']) ) {
+ end = [ start[0] + attributes['points']['by'][0], start[1] + attributes['points']['by'][1] ];
+
+ for (i = 0, len = control.length; i < len; ++i) {
+ control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ];
+ }
+ }
+
+ this.runtimeAttributes[attr] = [start];
+
+ if (control.length > 0) {
+ this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control);
+ }
+
+ this.runtimeAttributes[attr][this.runtimeAttributes[attr].length] = end;
+ }
+ else {
+ superclass.setRuntimeAttribute.call(this, attr);
+ }
+ };
+
+ var translateValues = function(val, start) {
+ var pageXY = Y.Dom.getXY(this.getEl());
+ val = [ val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1] ];
+
+ return val;
+ };
+
+ var isset = function(prop) {
+ return (typeof prop !== 'undefined');
+ };
+})();
+/**
+ * Anim subclass for scrolling elements to a position defined by the "scroll"
+ * member of "attributes". All "scroll" members are arrays with x, y scroll positions.
+ * Usage: var myAnim = new YAHOO.util.Scroll(el, { scroll: { to: [0, 800] } }, 1, YAHOO.util.Easing.easeOut);
+ * @class Scroll
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.Anim
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Bezier
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @requires YAHOO.util.CustomEvent
+ * @extends YAHOO.util.Anim
+ * @constructor
+ * @param {String or HTMLElement} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.
+ * Each attribute is an object with at minimum a "to" or "by" member defined.
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
+ */
+(function() {
+ YAHOO.util.Scroll = function(el, attributes, duration, method) {
+ if (el) { // dont break existing subclasses not using YAHOO.extend
+ YAHOO.util.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
+ }
+ };
+
+ YAHOO.extend(YAHOO.util.Scroll, YAHOO.util.ColorAnim);
+
+ // shorthand
+ var Y = YAHOO.util;
+ var superclass = Y.Scroll.superclass;
+ var proto = Y.Scroll.prototype;
+
+ proto.toString = function() {
+ var el = this.getEl();
+ var id = el.id || el.tagName;
+ return ("Scroll " + id);
+ };
+
+ proto.doMethod = function(attr, start, end) {
+ var val = null;
+
+ if (attr == 'scroll') {
+ val = [
+ this.method(this.currentFrame, start[0], end[0] - start[0], this.totalFrames),
+ this.method(this.currentFrame, start[1], end[1] - start[1], this.totalFrames)
+ ];
+
+ } else {
+ val = superclass.doMethod.call(this, attr, start, end);
+ }
+ return val;
+ };
+
+ proto.getAttribute = function(attr) {
+ var val = null;
+ var el = this.getEl();
+
+ if (attr == 'scroll') {
+ val = [ el.scrollLeft, el.scrollTop ];
+ } else {
+ val = superclass.getAttribute.call(this, attr);
+ }
+
+ return val;
+ };
+
+ proto.setAttribute = function(attr, val, unit) {
+ var el = this.getEl();
+
+ if (attr == 'scroll') {
+ el.scrollLeft = val[0];
+ el.scrollTop = val[1];
+ } else {
+ superclass.setAttribute.call(this, attr, val, unit);
+ }
+ };
+})();
diff --git a/thirdpartyjs/yui/animation/animation.js b/thirdpartyjs/yui/animation/animation.js
index 333f946..7c0165c 100644
--- a/thirdpartyjs/yui/animation/animation.js
+++ b/thirdpartyjs/yui/animation/animation.js
@@ -1,1272 +1,1272 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-/**
- * The animation module provides allows effects to be added to HTMLElements.
- * @module animation
- */
-
-/**
- *
- * Base animation class that provides the interface for building animated effects.
- * Usage: var myAnim = new YAHOO.util.Anim(el, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut);
- * @class Anim
- * @namespace YAHOO.util
- * @requires YAHOO.util.AnimMgr
- * @requires YAHOO.util.Easing
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @constructor
- * @param {String | HTMLElement} el Reference to the element that will be animated
- * @param {Object} attributes The attribute(s) to be animated.
- * Each attribute is an object with at minimum a "to" or "by" member defined.
- * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
- * All attribute names use camelCase.
- * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
- * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
- */
-
-YAHOO.util.Anim = function(el, attributes, duration, method) {
- if (el) {
- this.init(el, attributes, duration, method);
- }
-};
-
-YAHOO.util.Anim.prototype = {
- /**
- * Provides a readable name for the Anim instance.
- * @method toString
- * @return {String}
- */
- toString: function() {
- var el = this.getEl();
- var id = el.id || el.tagName;
- return ("Anim " + id);
- },
-
- patterns: { // cached for performance
- noNegatives: /width|height|opacity|padding/i, // keep at zero or above
- offsetAttribute: /^((width|height)|(top|left))$/, // use offsetValue as default
- defaultUnit: /width|height|top$|bottom$|left$|right$/i, // use 'px' by default
- offsetUnit: /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i // IE may return these, so convert these to offset
- },
-
- /**
- * Returns the value computed by the animation's "method".
- * @method doMethod
- * @param {String} attr The name of the attribute.
- * @param {Number} start The value this attribute should start from for this animation.
- * @param {Number} end The value this attribute should end at for this animation.
- * @return {Number} The Value to be applied to the attribute.
- */
- doMethod: function(attr, start, end) {
- return this.method(this.currentFrame, start, end - start, this.totalFrames);
- },
-
- /**
- * Applies a value to an attribute.
- * @method setAttribute
- * @param {String} attr The name of the attribute.
- * @param {Number} val The value to be applied to the attribute.
- * @param {String} unit The unit ('px', '%', etc.) of the value.
- */
- setAttribute: function(attr, val, unit) {
- if ( this.patterns.noNegatives.test(attr) ) {
- val = (val > 0) ? val : 0;
- }
-
- YAHOO.util.Dom.setStyle(this.getEl(), attr, val + unit);
- },
-
- /**
- * Returns current value of the attribute.
- * @method getAttribute
- * @param {String} attr The name of the attribute.
- * @return {Number} val The current value of the attribute.
- */
- getAttribute: function(attr) {
- var el = this.getEl();
- var val = YAHOO.util.Dom.getStyle(el, attr);
-
- if (val !== 'auto' && !this.patterns.offsetUnit.test(val)) {
- return parseFloat(val);
- }
-
- var a = this.patterns.offsetAttribute.exec(attr) || [];
- var pos = !!( a[3] ); // top or left
- var box = !!( a[2] ); // width or height
-
- // use offsets for width/height and abs pos top/left
- if ( box || (YAHOO.util.Dom.getStyle(el, 'position') == 'absolute' && pos) ) {
- val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)];
- } else { // default to zero for other 'auto'
- val = 0;
- }
-
- return val;
- },
-
- /**
- * Returns the unit to use when none is supplied.
- * @method getDefaultUnit
- * @param {attr} attr The name of the attribute.
- * @return {String} The default unit to be used.
- */
- getDefaultUnit: function(attr) {
- if ( this.patterns.defaultUnit.test(attr) ) {
- return 'px';
- }
-
- return '';
- },
-
- /**
- * Sets the actual values to be used during the animation.
- * @method setRuntimeAttribute
- * Should only be needed for subclass use.
- * @param {Object} attr The attribute object
- * @private
- */
- setRuntimeAttribute: function(attr) {
- var start;
- var end;
- var attributes = this.attributes;
-
- this.runtimeAttributes[attr] = {};
-
- var isset = function(prop) {
- return (typeof prop !== 'undefined');
- };
-
- if ( !isset(attributes[attr]['to']) && !isset(attributes[attr]['by']) ) {
- return false; // note return; nothing to animate to
- }
-
- start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr);
-
- // To beats by, per SMIL 2.1 spec
- if ( isset(attributes[attr]['to']) ) {
- end = attributes[attr]['to'];
- } else if ( isset(attributes[attr]['by']) ) {
- if (start.constructor == Array) {
- end = [];
- for (var i = 0, len = start.length; i < len; ++i) {
- end[i] = start[i] + attributes[attr]['by'][i];
- }
- } else {
- end = start + attributes[attr]['by'];
- }
- }
-
- this.runtimeAttributes[attr].start = start;
- this.runtimeAttributes[attr].end = end;
-
- // set units if needed
- this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ? attributes[attr]['unit'] : this.getDefaultUnit(attr);
- },
-
- /**
- * Constructor for Anim instance.
- * @method init
- * @param {String | HTMLElement} el Reference to the element that will be animated
- * @param {Object} attributes The attribute(s) to be animated.
- * Each attribute is an object with at minimum a "to" or "by" member defined.
- * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
- * All attribute names use camelCase.
- * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
- * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
- */
- init: function(el, attributes, duration, method) {
- /**
- * Whether or not the animation is running.
- * @property isAnimated
- * @private
- * @type Boolean
- */
- var isAnimated = false;
-
- /**
- * A Date object that is created when the animation begins.
- * @property startTime
- * @private
- * @type Date
- */
- var startTime = null;
-
- /**
- * The number of frames this animation was able to execute.
- * @property actualFrames
- * @private
- * @type Int
- */
- var actualFrames = 0;
-
- /**
- * The element to be animated.
- * @property el
- * @private
- * @type HTMLElement
- */
- el = YAHOO.util.Dom.get(el);
-
- /**
- * The collection of attributes to be animated.
- * Each attribute must have at least a "to" or "by" defined in order to animate.
- * If "to" is supplied, the animation will end with the attribute at that value.
- * If "by" is supplied, the animation will end at that value plus its starting value.
- * If both are supplied, "to" is used, and "by" is ignored.
- * Optional additional member include "from" (the value the attribute should start animating from, defaults to current value), and "unit" (the units to apply to the values).
- * @property attributes
- * @type Object
- */
- this.attributes = attributes || {};
-
- /**
- * The length of the animation. Defaults to "1" (second).
- * @property duration
- * @type Number
- */
- this.duration = duration || 1;
-
- /**
- * The method that will provide values to the attribute(s) during the animation.
- * Defaults to "YAHOO.util.Easing.easeNone".
- * @property method
- * @type Function
- */
- this.method = method || YAHOO.util.Easing.easeNone;
-
- /**
- * Whether or not the duration should be treated as seconds.
- * Defaults to true.
- * @property useSeconds
- * @type Boolean
- */
- this.useSeconds = true; // default to seconds
-
- /**
- * The location of the current animation on the timeline.
- * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.
- * @property currentFrame
- * @type Int
- */
- this.currentFrame = 0;
-
- /**
- * The total number of frames to be executed.
- * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.
- * @property totalFrames
- * @type Int
- */
- this.totalFrames = YAHOO.util.AnimMgr.fps;
-
-
- /**
- * Returns a reference to the animated element.
- * @method getEl
- * @return {HTMLElement}
- */
- this.getEl = function() { return el; };
-
- /**
- * Checks whether the element is currently animated.
- * @method isAnimated
- * @return {Boolean} current value of isAnimated.
- */
- this.isAnimated = function() {
- return isAnimated;
- };
-
- /**
- * Returns the animation start time.
- * @method getStartTime
- * @return {Date} current value of startTime.
- */
- this.getStartTime = function() {
- return startTime;
- };
-
- this.runtimeAttributes = {};
-
-
-
- /**
- * Starts the animation by registering it with the animation manager.
- * @method animate
- */
- this.animate = function() {
- if ( this.isAnimated() ) { return false; }
-
- this.currentFrame = 0;
-
- this.totalFrames = ( this.useSeconds ) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration;
-
- YAHOO.util.AnimMgr.registerElement(this);
- };
-
- /**
- * Stops the animation. Normally called by AnimMgr when animation completes.
- * @method stop
- * @param {Boolean} finish (optional) If true, animation will jump to final frame.
- */
- this.stop = function(finish) {
- if (finish) {
- this.currentFrame = this.totalFrames;
- this._onTween.fire();
- }
- YAHOO.util.AnimMgr.stop(this);
- };
-
- var onStart = function() {
- this.onStart.fire();
-
- this.runtimeAttributes = {};
- for (var attr in this.attributes) {
- this.setRuntimeAttribute(attr);
- }
-
- isAnimated = true;
- actualFrames = 0;
- startTime = new Date();
- };
-
- /**
- * Feeds the starting and ending values for each animated attribute to doMethod once per frame, then applies the resulting value to the attribute(s).
- * @private
- */
-
- var onTween = function() {
- var data = {
- duration: new Date() - this.getStartTime(),
- currentFrame: this.currentFrame
- };
-
- data.toString = function() {
- return (
- 'duration: ' + data.duration +
- ', currentFrame: ' + data.currentFrame
- );
- };
-
- this.onTween.fire(data);
-
- var runtimeAttributes = this.runtimeAttributes;
-
- for (var attr in runtimeAttributes) {
- this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit);
- }
-
- actualFrames += 1;
- };
-
- var onComplete = function() {
- var actual_duration = (new Date() - startTime) / 1000 ;
-
- var data = {
- duration: actual_duration,
- frames: actualFrames,
- fps: actualFrames / actual_duration
- };
-
- data.toString = function() {
- return (
- 'duration: ' + data.duration +
- ', frames: ' + data.frames +
- ', fps: ' + data.fps
- );
- };
-
- isAnimated = false;
- actualFrames = 0;
- this.onComplete.fire(data);
- };
-
- /**
- * Custom event that fires after onStart, useful in subclassing
- * @private
- */
- this._onStart = new YAHOO.util.CustomEvent('_start', this, true);
-
- /**
- * Custom event that fires when animation begins
- * Listen via subscribe method (e.g. myAnim.onStart.subscribe(someFunction)
- * @event onStart
- */
- this.onStart = new YAHOO.util.CustomEvent('start', this);
-
- /**
- * Custom event that fires between each frame
- * Listen via subscribe method (e.g. myAnim.onTween.subscribe(someFunction)
- * @event onTween
- */
- this.onTween = new YAHOO.util.CustomEvent('tween', this);
-
- /**
- * Custom event that fires after onTween
- * @private
- */
- this._onTween = new YAHOO.util.CustomEvent('_tween', this, true);
-
- /**
- * Custom event that fires when animation ends
- * Listen via subscribe method (e.g. myAnim.onComplete.subscribe(someFunction)
- * @event onComplete
- */
- this.onComplete = new YAHOO.util.CustomEvent('complete', this);
- /**
- * Custom event that fires after onComplete
- * @private
- */
- this._onComplete = new YAHOO.util.CustomEvent('_complete', this, true);
-
- this._onStart.subscribe(onStart);
- this._onTween.subscribe(onTween);
- this._onComplete.subscribe(onComplete);
- }
-};
-
-/**
- * Handles animation queueing and threading.
- * Used by Anim and subclasses.
- * @class AnimMgr
- * @namespace YAHOO.util
- */
-YAHOO.util.AnimMgr = new function() {
- /**
- * Reference to the animation Interval.
- * @property thread
- * @private
- * @type Int
- */
- var thread = null;
-
- /**
- * The current queue of registered animation objects.
- * @property queue
- * @private
- * @type Array
- */
- var queue = [];
-
- /**
- * The number of active animations.
- * @property tweenCount
- * @private
- * @type Int
- */
- var tweenCount = 0;
-
- /**
- * Base frame rate (frames per second).
- * Arbitrarily high for better x-browser calibration (slower browsers drop more frames).
- * @property fps
- * @type Int
- *
- */
- this.fps = 200;
-
- /**
- * Interval delay in milliseconds, defaults to fastest possible.
- * @property delay
- * @type Int
- *
- */
- this.delay = 1;
-
- /**
- * Adds an animation instance to the animation queue.
- * All animation instances must be registered in order to animate.
- * @method registerElement
- * @param {object} tween The Anim instance to be be registered
- */
- this.registerElement = function(tween) {
- queue[queue.length] = tween;
- tweenCount += 1;
- tween._onStart.fire();
- this.start();
- };
-
- /**
- * removes an animation instance from the animation queue.
- * All animation instances must be registered in order to animate.
- * @method unRegister
- * @param {object} tween The Anim instance to be be registered
- * @param {Int} index The index of the Anim instance
- * @private
- */
- this.unRegister = function(tween, index) {
- tween._onComplete.fire();
- index = index || getIndex(tween);
- if (index != -1) { queue.splice(index, 1); }
-
- tweenCount -= 1;
- if (tweenCount <= 0) { this.stop(); }
- };
-
- /**
- * Starts the animation thread.
- * Only one thread can run at a time.
- * @method start
- */
- this.start = function() {
- if (thread === null) { thread = setInterval(this.run, this.delay); }
- };
-
- /**
- * Stops the animation thread or a specific animation instance.
- * @method stop
- * @param {object} tween A specific Anim instance to stop (optional)
- * If no instance given, Manager stops thread and all animations.
- */
- this.stop = function(tween) {
- if (!tween) {
- clearInterval(thread);
- for (var i = 0, len = queue.length; i < len; ++i) {
- if (queue[i].isAnimated()) {
- this.unRegister(tween, i);
- }
- }
- queue = [];
- thread = null;
- tweenCount = 0;
- }
- else {
- this.unRegister(tween);
- }
- };
-
- /**
- * Called per Interval to handle each animation frame.
- * @method run
- */
- this.run = function() {
- for (var i = 0, len = queue.length; i < len; ++i) {
- var tween = queue[i];
- if ( !tween || !tween.isAnimated() ) { continue; }
-
- if (tween.currentFrame < tween.totalFrames || tween.totalFrames === null)
- {
- tween.currentFrame += 1;
-
- if (tween.useSeconds) {
- correctFrame(tween);
- }
- tween._onTween.fire();
- }
- else { YAHOO.util.AnimMgr.stop(tween, i); }
- }
- };
-
- var getIndex = function(anim) {
- for (var i = 0, len = queue.length; i < len; ++i) {
- if (queue[i] == anim) {
- return i; // note return;
- }
- }
- return -1;
- };
-
- /**
- * On the fly frame correction to keep animation on time.
- * @method correctFrame
- * @private
- * @param {Object} tween The Anim instance being corrected.
- */
- var correctFrame = function(tween) {
- var frames = tween.totalFrames;
- var frame = tween.currentFrame;
- var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames);
- var elapsed = (new Date() - tween.getStartTime());
- var tweak = 0;
-
- if (elapsed < tween.duration * 1000) { // check if falling behind
- tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);
- } else { // went over duration, so jump to end
- tweak = frames - (frame + 1);
- }
- if (tweak > 0 && isFinite(tweak)) { // adjust if needed
- if (tween.currentFrame + tweak >= frames) {// dont go past last frame
- tweak = frames - (frame + 1);
- }
-
- tween.currentFrame += tweak;
- }
- };
-};
-/**
- * Used to calculate Bezier splines for any number of control points.
- * @class Bezier
- * @namespace YAHOO.util
- *
- */
-YAHOO.util.Bezier = new function()
-{
- /**
- * Get the current position of the animated element based on t.
- * Each point is an array of "x" and "y" values (0 = x, 1 = y)
- * At least 2 points are required (start and end).
- * First point is start. Last point is end.
- * Additional control points are optional.
- * @method getPosition
- * @param {Array} points An array containing Bezier points
- * @param {Number} t A number between 0 and 1 which is the basis for determining current position
- * @return {Array} An array containing int x and y member data
- */
- this.getPosition = function(points, t)
- {
- var n = points.length;
- var tmp = [];
-
- for (var i = 0; i < n; ++i){
- tmp[i] = [points[i][0], points[i][1]]; // save input
- }
-
- for (var j = 1; j < n; ++j) {
- for (i = 0; i < n - j; ++i) {
- tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];
- tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
- }
- }
-
- return [ tmp[0][0], tmp[0][1] ];
-
- };
-};
-/**
- * Anim subclass for color transitions.
- * Usage: var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut); Color values can be specified with either 112233, #112233,
- * [255,255,255], or rgb(255,255,255)
- * @class ColorAnim
- * @namespace YAHOO.util
- * @requires YAHOO.util.Anim
- * @requires YAHOO.util.AnimMgr
- * @requires YAHOO.util.Easing
- * @requires YAHOO.util.Bezier
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @constructor
- * @extends YAHOO.util.Anim
- * @param {HTMLElement | String} el Reference to the element that will be animated
- * @param {Object} attributes The attribute(s) to be animated.
- * Each attribute is an object with at minimum a "to" or "by" member defined.
- * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
- * All attribute names use camelCase.
- * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
- * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
- */
-(function() {
- YAHOO.util.ColorAnim = function(el, attributes, duration, method) {
- YAHOO.util.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
- };
-
- YAHOO.extend(YAHOO.util.ColorAnim, YAHOO.util.Anim);
-
- // shorthand
- var Y = YAHOO.util;
- var superclass = Y.ColorAnim.superclass;
- var proto = Y.ColorAnim.prototype;
-
- proto.toString = function() {
- var el = this.getEl();
- var id = el.id || el.tagName;
- return ("ColorAnim " + id);
- };
-
- proto.patterns.color = /color$/i;
- proto.patterns.rgb = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;
- proto.patterns.hex = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;
- proto.patterns.hex3 = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;
- proto.patterns.transparent = /^transparent|rgba\(0, 0, 0, 0\)$/; // need rgba for safari
-
- /**
- * Attempts to parse the given string and return a 3-tuple.
- * @method parseColor
- * @param {String} s The string to parse.
- * @return {Array} The 3-tuple of rgb values.
- */
- proto.parseColor = function(s) {
- if (s.length == 3) { return s; }
-
- var c = this.patterns.hex.exec(s);
- if (c && c.length == 4) {
- return [ parseInt(c[1], 16), parseInt(c[2], 16), parseInt(c[3], 16) ];
- }
-
- c = this.patterns.rgb.exec(s);
- if (c && c.length == 4) {
- return [ parseInt(c[1], 10), parseInt(c[2], 10), parseInt(c[3], 10) ];
- }
-
- c = this.patterns.hex3.exec(s);
- if (c && c.length == 4) {
- return [ parseInt(c[1] + c[1], 16), parseInt(c[2] + c[2], 16), parseInt(c[3] + c[3], 16) ];
- }
-
- return null;
- };
-
- proto.getAttribute = function(attr) {
- var el = this.getEl();
- if ( this.patterns.color.test(attr) ) {
- var val = YAHOO.util.Dom.getStyle(el, attr);
-
- if (this.patterns.transparent.test(val)) { // bgcolor default
- var parent = el.parentNode; // try and get from an ancestor
- val = Y.Dom.getStyle(parent, attr);
-
- while (parent && this.patterns.transparent.test(val)) {
- parent = parent.parentNode;
- val = Y.Dom.getStyle(parent, attr);
- if (parent.tagName.toUpperCase() == 'HTML') {
- val = '#fff';
- }
- }
- }
- } else {
- val = superclass.getAttribute.call(this, attr);
- }
-
- return val;
- };
-
- proto.doMethod = function(attr, start, end) {
- var val;
-
- if ( this.patterns.color.test(attr) ) {
- val = [];
- for (var i = 0, len = start.length; i < len; ++i) {
- val[i] = superclass.doMethod.call(this, attr, start[i], end[i]);
- }
-
- val = 'rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';
- }
- else {
- val = superclass.doMethod.call(this, attr, start, end);
- }
-
- return val;
- };
-
- proto.setRuntimeAttribute = function(attr) {
- superclass.setRuntimeAttribute.call(this, attr);
-
- if ( this.patterns.color.test(attr) ) {
- var attributes = this.attributes;
- var start = this.parseColor(this.runtimeAttributes[attr].start);
- var end = this.parseColor(this.runtimeAttributes[attr].end);
- // fix colors if going "by"
- if ( typeof attributes[attr]['to'] === 'undefined' && typeof attributes[attr]['by'] !== 'undefined' ) {
- end = this.parseColor(attributes[attr].by);
-
- for (var i = 0, len = start.length; i < len; ++i) {
- end[i] = start[i] + end[i];
- }
- }
-
- this.runtimeAttributes[attr].start = start;
- this.runtimeAttributes[attr].end = end;
- }
- };
-})();/*
-TERMS OF USE - EASING EQUATIONS
-Open source under the BSD License.
-Copyright 2001 Robert Penner All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/**
- * Singleton that determines how an animation proceeds from start to end.
- * @class Easing
- * @namespace YAHOO.util
-*/
-
-YAHOO.util.Easing = {
-
- /**
- * Uniform speed between points.
- * @method easeNone
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeNone: function (t, b, c, d) {
- return c*t/d + b;
- },
-
- /**
- * Begins slowly and accelerates towards end. (quadratic)
- * @method easeIn
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeIn: function (t, b, c, d) {
- return c*(t/=d)*t + b;
- },
-
- /**
- * Begins quickly and decelerates towards end. (quadratic)
- * @method easeOut
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeOut: function (t, b, c, d) {
- return -c *(t/=d)*(t-2) + b;
- },
-
- /**
- * Begins slowly and decelerates towards end. (quadratic)
- * @method easeBoth
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeBoth: function (t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t + b;
- return -c/2 * ((--t)*(t-2) - 1) + b;
- },
-
- /**
- * Begins slowly and accelerates towards end. (quartic)
- * @method easeInStrong
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeInStrong: function (t, b, c, d) {
- return c*(t/=d)*t*t*t + b;
- },
-
- /**
- * Begins quickly and decelerates towards end. (quartic)
- * @method easeOutStrong
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeOutStrong: function (t, b, c, d) {
- return -c * ((t=t/d-1)*t*t*t - 1) + b;
- },
-
- /**
- * Begins slowly and decelerates towards end. (quartic)
- * @method easeBothStrong
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- easeBothStrong: function (t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
- return -c/2 * ((t-=2)*t*t*t - 2) + b;
- },
-
- /**
- * Snap in elastic effect.
- * @method elasticIn
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} p Period (optional)
- * @return {Number} The computed value for the current animation frame
- */
-
- elasticIn: function (t, b, c, d, a, p) {
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
- if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
- },
-
- /**
- * Snap out elastic effect.
- * @method elasticOut
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} p Period (optional)
- * @return {Number} The computed value for the current animation frame
- */
- elasticOut: function (t, b, c, d, a, p) {
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
- if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
- },
-
- /**
- * Snap both elastic effect.
- * @method elasticBoth
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} p Period (optional)
- * @return {Number} The computed value for the current animation frame
- */
- elasticBoth: function (t, b, c, d, a, p) {
- if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
- if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
- return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
- },
-
- /**
- * Backtracks slightly, then reverses direction and moves to end.
- * @method backIn
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} s Overshoot (optional)
- * @return {Number} The computed value for the current animation frame
- */
- backIn: function (t, b, c, d, s) {
- if (typeof s == 'undefined') s = 1.70158;
- return c*(t/=d)*t*((s+1)*t - s) + b;
- },
-
- /**
- * Overshoots end, then reverses and comes back to end.
- * @method backOut
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} s Overshoot (optional)
- * @return {Number} The computed value for the current animation frame
- */
- backOut: function (t, b, c, d, s) {
- if (typeof s == 'undefined') s = 1.70158;
- return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
- },
-
- /**
- * Backtracks slightly, then reverses direction, overshoots end,
- * then reverses and comes back to end.
- * @method backBoth
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @param {Number} s Overshoot (optional)
- * @return {Number} The computed value for the current animation frame
- */
- backBoth: function (t, b, c, d, s) {
- if (typeof s == 'undefined') s = 1.70158;
- if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
- return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
- },
-
- /**
- * Bounce off of start.
- * @method bounceIn
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- bounceIn: function (t, b, c, d) {
- return c - YAHOO.util.Easing.bounceOut(d-t, 0, c, d) + b;
- },
-
- /**
- * Bounces off end.
- * @method bounceOut
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- bounceOut: function (t, b, c, d) {
- if ((t/=d) < (1/2.75)) {
- return c*(7.5625*t*t) + b;
- } else if (t < (2/2.75)) {
- return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
- } else if (t < (2.5/2.75)) {
- return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
- } else {
- return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
- }
- },
-
- /**
- * Bounces off start and end.
- * @method bounceBoth
- * @param {Number} t Time value used to compute current value
- * @param {Number} b Starting value
- * @param {Number} c Delta between start and end values
- * @param {Number} d Total length of animation
- * @return {Number} The computed value for the current animation frame
- */
- bounceBoth: function (t, b, c, d) {
- if (t < d/2) return YAHOO.util.Easing.bounceIn(t*2, 0, c, d) * .5 + b;
- return YAHOO.util.Easing.bounceOut(t*2-d, 0, c, d) * .5 + c*.5 + b;
- }
-};
-
-/**
- * Anim subclass for moving elements along a path defined by the "points"
- * member of "attributes". All "points" are arrays with x, y coordinates.
- * Usage: var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);
- * @class Motion
- * @namespace YAHOO.util
- * @requires YAHOO.util.Anim
- * @requires YAHOO.util.AnimMgr
- * @requires YAHOO.util.Easing
- * @requires YAHOO.util.Bezier
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @constructor
- * @extends YAHOO.util.Anim
- * @param {String | HTMLElement} el Reference to the element that will be animated
- * @param {Object} attributes The attribute(s) to be animated.
- * Each attribute is an object with at minimum a "to" or "by" member defined.
- * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
- * All attribute names use camelCase.
- * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
- * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
- */
-(function() {
- YAHOO.util.Motion = function(el, attributes, duration, method) {
- if (el) { // dont break existing subclasses not using YAHOO.extend
- YAHOO.util.Motion.superclass.constructor.call(this, el, attributes, duration, method);
- }
- };
-
- YAHOO.extend(YAHOO.util.Motion, YAHOO.util.ColorAnim);
-
- // shorthand
- var Y = YAHOO.util;
- var superclass = Y.Motion.superclass;
- var proto = Y.Motion.prototype;
-
- proto.toString = function() {
- var el = this.getEl();
- var id = el.id || el.tagName;
- return ("Motion " + id);
- };
-
- proto.patterns.points = /^points$/i;
-
- proto.setAttribute = function(attr, val, unit) {
- if ( this.patterns.points.test(attr) ) {
- unit = unit || 'px';
- superclass.setAttribute.call(this, 'left', val[0], unit);
- superclass.setAttribute.call(this, 'top', val[1], unit);
- } else {
- superclass.setAttribute.call(this, attr, val, unit);
- }
- };
-
- proto.getAttribute = function(attr) {
- if ( this.patterns.points.test(attr) ) {
- var val = [
- superclass.getAttribute.call(this, 'left'),
- superclass.getAttribute.call(this, 'top')
- ];
- } else {
- val = superclass.getAttribute.call(this, attr);
- }
-
- return val;
- };
-
- proto.doMethod = function(attr, start, end) {
- var val = null;
-
- if ( this.patterns.points.test(attr) ) {
- var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100;
- val = Y.Bezier.getPosition(this.runtimeAttributes[attr], t);
- } else {
- val = superclass.doMethod.call(this, attr, start, end);
- }
- return val;
- };
-
- proto.setRuntimeAttribute = function(attr) {
- if ( this.patterns.points.test(attr) ) {
- var el = this.getEl();
- var attributes = this.attributes;
- var start;
- var control = attributes['points']['control'] || [];
- var end;
- var i, len;
-
- if (control.length > 0 && !(control[0] instanceof Array) ) { // could be single point or array of points
- control = [control];
- } else { // break reference to attributes.points.control
- var tmp = [];
- for (i = 0, len = control.length; i< len; ++i) {
- tmp[i] = control[i];
- }
- control = tmp;
- }
-
- if (Y.Dom.getStyle(el, 'position') == 'static') { // default to relative
- Y.Dom.setStyle(el, 'position', 'relative');
- }
-
- if ( isset(attributes['points']['from']) ) {
- Y.Dom.setXY(el, attributes['points']['from']); // set position to from point
- }
- else { Y.Dom.setXY( el, Y.Dom.getXY(el) ); } // set it to current position
-
- start = this.getAttribute('points'); // get actual top & left
-
- // TO beats BY, per SMIL 2.1 spec
- if ( isset(attributes['points']['to']) ) {
- end = translateValues.call(this, attributes['points']['to'], start);
-
- var pageXY = Y.Dom.getXY(this.getEl());
- for (i = 0, len = control.length; i < len; ++i) {
- control[i] = translateValues.call(this, control[i], start);
- }
-
-
- } else if ( isset(attributes['points']['by']) ) {
- end = [ start[0] + attributes['points']['by'][0], start[1] + attributes['points']['by'][1] ];
-
- for (i = 0, len = control.length; i < len; ++i) {
- control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ];
- }
- }
-
- this.runtimeAttributes[attr] = [start];
-
- if (control.length > 0) {
- this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control);
- }
-
- this.runtimeAttributes[attr][this.runtimeAttributes[attr].length] = end;
- }
- else {
- superclass.setRuntimeAttribute.call(this, attr);
- }
- };
-
- var translateValues = function(val, start) {
- var pageXY = Y.Dom.getXY(this.getEl());
- val = [ val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1] ];
-
- return val;
- };
-
- var isset = function(prop) {
- return (typeof prop !== 'undefined');
- };
-})();
-/**
- * Anim subclass for scrolling elements to a position defined by the "scroll"
- * member of "attributes". All "scroll" members are arrays with x, y scroll positions.
- * Usage: var myAnim = new YAHOO.util.Scroll(el, { scroll: { to: [0, 800] } }, 1, YAHOO.util.Easing.easeOut);
- * @class Scroll
- * @namespace YAHOO.util
- * @requires YAHOO.util.Anim
- * @requires YAHOO.util.AnimMgr
- * @requires YAHOO.util.Easing
- * @requires YAHOO.util.Bezier
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @extends YAHOO.util.Anim
- * @constructor
- * @param {String or HTMLElement} el Reference to the element that will be animated
- * @param {Object} attributes The attribute(s) to be animated.
- * Each attribute is an object with at minimum a "to" or "by" member defined.
- * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
- * All attribute names use camelCase.
- * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
- * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
- */
-(function() {
- YAHOO.util.Scroll = function(el, attributes, duration, method) {
- if (el) { // dont break existing subclasses not using YAHOO.extend
- YAHOO.util.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
- }
- };
-
- YAHOO.extend(YAHOO.util.Scroll, YAHOO.util.ColorAnim);
-
- // shorthand
- var Y = YAHOO.util;
- var superclass = Y.Scroll.superclass;
- var proto = Y.Scroll.prototype;
-
- proto.toString = function() {
- var el = this.getEl();
- var id = el.id || el.tagName;
- return ("Scroll " + id);
- };
-
- proto.doMethod = function(attr, start, end) {
- var val = null;
-
- if (attr == 'scroll') {
- val = [
- this.method(this.currentFrame, start[0], end[0] - start[0], this.totalFrames),
- this.method(this.currentFrame, start[1], end[1] - start[1], this.totalFrames)
- ];
-
- } else {
- val = superclass.doMethod.call(this, attr, start, end);
- }
- return val;
- };
-
- proto.getAttribute = function(attr) {
- var val = null;
- var el = this.getEl();
-
- if (attr == 'scroll') {
- val = [ el.scrollLeft, el.scrollTop ];
- } else {
- val = superclass.getAttribute.call(this, attr);
- }
-
- return val;
- };
-
- proto.setAttribute = function(attr, val, unit) {
- var el = this.getEl();
-
- if (attr == 'scroll') {
- el.scrollLeft = val[0];
- el.scrollTop = val[1];
- } else {
- superclass.setAttribute.call(this, attr, val, unit);
- }
- };
-})();
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+ * The animation module provides allows effects to be added to HTMLElements.
+ * @module animation
+ */
+
+/**
+ *
+ * Base animation class that provides the interface for building animated effects.
+ * Usage: var myAnim = new YAHOO.util.Anim(el, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut);
+ * @class Anim
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @requires YAHOO.util.CustomEvent
+ * @constructor
+ * @param {String | HTMLElement} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.
+ * Each attribute is an object with at minimum a "to" or "by" member defined.
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
+ */
+
+YAHOO.util.Anim = function(el, attributes, duration, method) {
+ if (el) {
+ this.init(el, attributes, duration, method);
+ }
+};
+
+YAHOO.util.Anim.prototype = {
+ /**
+ * Provides a readable name for the Anim instance.
+ * @method toString
+ * @return {String}
+ */
+ toString: function() {
+ var el = this.getEl();
+ var id = el.id || el.tagName;
+ return ("Anim " + id);
+ },
+
+ patterns: { // cached for performance
+ noNegatives: /width|height|opacity|padding/i, // keep at zero or above
+ offsetAttribute: /^((width|height)|(top|left))$/, // use offsetValue as default
+ defaultUnit: /width|height|top$|bottom$|left$|right$/i, // use 'px' by default
+ offsetUnit: /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i // IE may return these, so convert these to offset
+ },
+
+ /**
+ * Returns the value computed by the animation's "method".
+ * @method doMethod
+ * @param {String} attr The name of the attribute.
+ * @param {Number} start The value this attribute should start from for this animation.
+ * @param {Number} end The value this attribute should end at for this animation.
+ * @return {Number} The Value to be applied to the attribute.
+ */
+ doMethod: function(attr, start, end) {
+ return this.method(this.currentFrame, start, end - start, this.totalFrames);
+ },
+
+ /**
+ * Applies a value to an attribute.
+ * @method setAttribute
+ * @param {String} attr The name of the attribute.
+ * @param {Number} val The value to be applied to the attribute.
+ * @param {String} unit The unit ('px', '%', etc.) of the value.
+ */
+ setAttribute: function(attr, val, unit) {
+ if ( this.patterns.noNegatives.test(attr) ) {
+ val = (val > 0) ? val : 0;
+ }
+
+ YAHOO.util.Dom.setStyle(this.getEl(), attr, val + unit);
+ },
+
+ /**
+ * Returns current value of the attribute.
+ * @method getAttribute
+ * @param {String} attr The name of the attribute.
+ * @return {Number} val The current value of the attribute.
+ */
+ getAttribute: function(attr) {
+ var el = this.getEl();
+ var val = YAHOO.util.Dom.getStyle(el, attr);
+
+ if (val !== 'auto' && !this.patterns.offsetUnit.test(val)) {
+ return parseFloat(val);
+ }
+
+ var a = this.patterns.offsetAttribute.exec(attr) || [];
+ var pos = !!( a[3] ); // top or left
+ var box = !!( a[2] ); // width or height
+
+ // use offsets for width/height and abs pos top/left
+ if ( box || (YAHOO.util.Dom.getStyle(el, 'position') == 'absolute' && pos) ) {
+ val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)];
+ } else { // default to zero for other 'auto'
+ val = 0;
+ }
+
+ return val;
+ },
+
+ /**
+ * Returns the unit to use when none is supplied.
+ * @method getDefaultUnit
+ * @param {attr} attr The name of the attribute.
+ * @return {String} The default unit to be used.
+ */
+ getDefaultUnit: function(attr) {
+ if ( this.patterns.defaultUnit.test(attr) ) {
+ return 'px';
+ }
+
+ return '';
+ },
+
+ /**
+ * Sets the actual values to be used during the animation.
+ * @method setRuntimeAttribute
+ * Should only be needed for subclass use.
+ * @param {Object} attr The attribute object
+ * @private
+ */
+ setRuntimeAttribute: function(attr) {
+ var start;
+ var end;
+ var attributes = this.attributes;
+
+ this.runtimeAttributes[attr] = {};
+
+ var isset = function(prop) {
+ return (typeof prop !== 'undefined');
+ };
+
+ if ( !isset(attributes[attr]['to']) && !isset(attributes[attr]['by']) ) {
+ return false; // note return; nothing to animate to
+ }
+
+ start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr);
+
+ // To beats by, per SMIL 2.1 spec
+ if ( isset(attributes[attr]['to']) ) {
+ end = attributes[attr]['to'];
+ } else if ( isset(attributes[attr]['by']) ) {
+ if (start.constructor == Array) {
+ end = [];
+ for (var i = 0, len = start.length; i < len; ++i) {
+ end[i] = start[i] + attributes[attr]['by'][i];
+ }
+ } else {
+ end = start + attributes[attr]['by'];
+ }
+ }
+
+ this.runtimeAttributes[attr].start = start;
+ this.runtimeAttributes[attr].end = end;
+
+ // set units if needed
+ this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ? attributes[attr]['unit'] : this.getDefaultUnit(attr);
+ },
+
+ /**
+ * Constructor for Anim instance.
+ * @method init
+ * @param {String | HTMLElement} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.
+ * Each attribute is an object with at minimum a "to" or "by" member defined.
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
+ */
+ init: function(el, attributes, duration, method) {
+ /**
+ * Whether or not the animation is running.
+ * @property isAnimated
+ * @private
+ * @type Boolean
+ */
+ var isAnimated = false;
+
+ /**
+ * A Date object that is created when the animation begins.
+ * @property startTime
+ * @private
+ * @type Date
+ */
+ var startTime = null;
+
+ /**
+ * The number of frames this animation was able to execute.
+ * @property actualFrames
+ * @private
+ * @type Int
+ */
+ var actualFrames = 0;
+
+ /**
+ * The element to be animated.
+ * @property el
+ * @private
+ * @type HTMLElement
+ */
+ el = YAHOO.util.Dom.get(el);
+
+ /**
+ * The collection of attributes to be animated.
+ * Each attribute must have at least a "to" or "by" defined in order to animate.
+ * If "to" is supplied, the animation will end with the attribute at that value.
+ * If "by" is supplied, the animation will end at that value plus its starting value.
+ * If both are supplied, "to" is used, and "by" is ignored.
+ * Optional additional member include "from" (the value the attribute should start animating from, defaults to current value), and "unit" (the units to apply to the values).
+ * @property attributes
+ * @type Object
+ */
+ this.attributes = attributes || {};
+
+ /**
+ * The length of the animation. Defaults to "1" (second).
+ * @property duration
+ * @type Number
+ */
+ this.duration = duration || 1;
+
+ /**
+ * The method that will provide values to the attribute(s) during the animation.
+ * Defaults to "YAHOO.util.Easing.easeNone".
+ * @property method
+ * @type Function
+ */
+ this.method = method || YAHOO.util.Easing.easeNone;
+
+ /**
+ * Whether or not the duration should be treated as seconds.
+ * Defaults to true.
+ * @property useSeconds
+ * @type Boolean
+ */
+ this.useSeconds = true; // default to seconds
+
+ /**
+ * The location of the current animation on the timeline.
+ * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.
+ * @property currentFrame
+ * @type Int
+ */
+ this.currentFrame = 0;
+
+ /**
+ * The total number of frames to be executed.
+ * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.
+ * @property totalFrames
+ * @type Int
+ */
+ this.totalFrames = YAHOO.util.AnimMgr.fps;
+
+
+ /**
+ * Returns a reference to the animated element.
+ * @method getEl
+ * @return {HTMLElement}
+ */
+ this.getEl = function() { return el; };
+
+ /**
+ * Checks whether the element is currently animated.
+ * @method isAnimated
+ * @return {Boolean} current value of isAnimated.
+ */
+ this.isAnimated = function() {
+ return isAnimated;
+ };
+
+ /**
+ * Returns the animation start time.
+ * @method getStartTime
+ * @return {Date} current value of startTime.
+ */
+ this.getStartTime = function() {
+ return startTime;
+ };
+
+ this.runtimeAttributes = {};
+
+
+
+ /**
+ * Starts the animation by registering it with the animation manager.
+ * @method animate
+ */
+ this.animate = function() {
+ if ( this.isAnimated() ) { return false; }
+
+ this.currentFrame = 0;
+
+ this.totalFrames = ( this.useSeconds ) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration;
+
+ YAHOO.util.AnimMgr.registerElement(this);
+ };
+
+ /**
+ * Stops the animation. Normally called by AnimMgr when animation completes.
+ * @method stop
+ * @param {Boolean} finish (optional) If true, animation will jump to final frame.
+ */
+ this.stop = function(finish) {
+ if (finish) {
+ this.currentFrame = this.totalFrames;
+ this._onTween.fire();
+ }
+ YAHOO.util.AnimMgr.stop(this);
+ };
+
+ var onStart = function() {
+ this.onStart.fire();
+
+ this.runtimeAttributes = {};
+ for (var attr in this.attributes) {
+ this.setRuntimeAttribute(attr);
+ }
+
+ isAnimated = true;
+ actualFrames = 0;
+ startTime = new Date();
+ };
+
+ /**
+ * Feeds the starting and ending values for each animated attribute to doMethod once per frame, then applies the resulting value to the attribute(s).
+ * @private
+ */
+
+ var onTween = function() {
+ var data = {
+ duration: new Date() - this.getStartTime(),
+ currentFrame: this.currentFrame
+ };
+
+ data.toString = function() {
+ return (
+ 'duration: ' + data.duration +
+ ', currentFrame: ' + data.currentFrame
+ );
+ };
+
+ this.onTween.fire(data);
+
+ var runtimeAttributes = this.runtimeAttributes;
+
+ for (var attr in runtimeAttributes) {
+ this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit);
+ }
+
+ actualFrames += 1;
+ };
+
+ var onComplete = function() {
+ var actual_duration = (new Date() - startTime) / 1000 ;
+
+ var data = {
+ duration: actual_duration,
+ frames: actualFrames,
+ fps: actualFrames / actual_duration
+ };
+
+ data.toString = function() {
+ return (
+ 'duration: ' + data.duration +
+ ', frames: ' + data.frames +
+ ', fps: ' + data.fps
+ );
+ };
+
+ isAnimated = false;
+ actualFrames = 0;
+ this.onComplete.fire(data);
+ };
+
+ /**
+ * Custom event that fires after onStart, useful in subclassing
+ * @private
+ */
+ this._onStart = new YAHOO.util.CustomEvent('_start', this, true);
+
+ /**
+ * Custom event that fires when animation begins
+ * Listen via subscribe method (e.g. myAnim.onStart.subscribe(someFunction)
+ * @event onStart
+ */
+ this.onStart = new YAHOO.util.CustomEvent('start', this);
+
+ /**
+ * Custom event that fires between each frame
+ * Listen via subscribe method (e.g. myAnim.onTween.subscribe(someFunction)
+ * @event onTween
+ */
+ this.onTween = new YAHOO.util.CustomEvent('tween', this);
+
+ /**
+ * Custom event that fires after onTween
+ * @private
+ */
+ this._onTween = new YAHOO.util.CustomEvent('_tween', this, true);
+
+ /**
+ * Custom event that fires when animation ends
+ * Listen via subscribe method (e.g. myAnim.onComplete.subscribe(someFunction)
+ * @event onComplete
+ */
+ this.onComplete = new YAHOO.util.CustomEvent('complete', this);
+ /**
+ * Custom event that fires after onComplete
+ * @private
+ */
+ this._onComplete = new YAHOO.util.CustomEvent('_complete', this, true);
+
+ this._onStart.subscribe(onStart);
+ this._onTween.subscribe(onTween);
+ this._onComplete.subscribe(onComplete);
+ }
+};
+
+/**
+ * Handles animation queueing and threading.
+ * Used by Anim and subclasses.
+ * @class AnimMgr
+ * @namespace YAHOO.util
+ */
+YAHOO.util.AnimMgr = new function() {
+ /**
+ * Reference to the animation Interval.
+ * @property thread
+ * @private
+ * @type Int
+ */
+ var thread = null;
+
+ /**
+ * The current queue of registered animation objects.
+ * @property queue
+ * @private
+ * @type Array
+ */
+ var queue = [];
+
+ /**
+ * The number of active animations.
+ * @property tweenCount
+ * @private
+ * @type Int
+ */
+ var tweenCount = 0;
+
+ /**
+ * Base frame rate (frames per second).
+ * Arbitrarily high for better x-browser calibration (slower browsers drop more frames).
+ * @property fps
+ * @type Int
+ *
+ */
+ this.fps = 200;
+
+ /**
+ * Interval delay in milliseconds, defaults to fastest possible.
+ * @property delay
+ * @type Int
+ *
+ */
+ this.delay = 1;
+
+ /**
+ * Adds an animation instance to the animation queue.
+ * All animation instances must be registered in order to animate.
+ * @method registerElement
+ * @param {object} tween The Anim instance to be be registered
+ */
+ this.registerElement = function(tween) {
+ queue[queue.length] = tween;
+ tweenCount += 1;
+ tween._onStart.fire();
+ this.start();
+ };
+
+ /**
+ * removes an animation instance from the animation queue.
+ * All animation instances must be registered in order to animate.
+ * @method unRegister
+ * @param {object} tween The Anim instance to be be registered
+ * @param {Int} index The index of the Anim instance
+ * @private
+ */
+ this.unRegister = function(tween, index) {
+ tween._onComplete.fire();
+ index = index || getIndex(tween);
+ if (index != -1) { queue.splice(index, 1); }
+
+ tweenCount -= 1;
+ if (tweenCount <= 0) { this.stop(); }
+ };
+
+ /**
+ * Starts the animation thread.
+ * Only one thread can run at a time.
+ * @method start
+ */
+ this.start = function() {
+ if (thread === null) { thread = setInterval(this.run, this.delay); }
+ };
+
+ /**
+ * Stops the animation thread or a specific animation instance.
+ * @method stop
+ * @param {object} tween A specific Anim instance to stop (optional)
+ * If no instance given, Manager stops thread and all animations.
+ */
+ this.stop = function(tween) {
+ if (!tween) {
+ clearInterval(thread);
+ for (var i = 0, len = queue.length; i < len; ++i) {
+ if (queue[i].isAnimated()) {
+ this.unRegister(tween, i);
+ }
+ }
+ queue = [];
+ thread = null;
+ tweenCount = 0;
+ }
+ else {
+ this.unRegister(tween);
+ }
+ };
+
+ /**
+ * Called per Interval to handle each animation frame.
+ * @method run
+ */
+ this.run = function() {
+ for (var i = 0, len = queue.length; i < len; ++i) {
+ var tween = queue[i];
+ if ( !tween || !tween.isAnimated() ) { continue; }
+
+ if (tween.currentFrame < tween.totalFrames || tween.totalFrames === null)
+ {
+ tween.currentFrame += 1;
+
+ if (tween.useSeconds) {
+ correctFrame(tween);
+ }
+ tween._onTween.fire();
+ }
+ else { YAHOO.util.AnimMgr.stop(tween, i); }
+ }
+ };
+
+ var getIndex = function(anim) {
+ for (var i = 0, len = queue.length; i < len; ++i) {
+ if (queue[i] == anim) {
+ return i; // note return;
+ }
+ }
+ return -1;
+ };
+
+ /**
+ * On the fly frame correction to keep animation on time.
+ * @method correctFrame
+ * @private
+ * @param {Object} tween The Anim instance being corrected.
+ */
+ var correctFrame = function(tween) {
+ var frames = tween.totalFrames;
+ var frame = tween.currentFrame;
+ var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames);
+ var elapsed = (new Date() - tween.getStartTime());
+ var tweak = 0;
+
+ if (elapsed < tween.duration * 1000) { // check if falling behind
+ tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);
+ } else { // went over duration, so jump to end
+ tweak = frames - (frame + 1);
+ }
+ if (tweak > 0 && isFinite(tweak)) { // adjust if needed
+ if (tween.currentFrame + tweak >= frames) {// dont go past last frame
+ tweak = frames - (frame + 1);
+ }
+
+ tween.currentFrame += tweak;
+ }
+ };
+};
+/**
+ * Used to calculate Bezier splines for any number of control points.
+ * @class Bezier
+ * @namespace YAHOO.util
+ *
+ */
+YAHOO.util.Bezier = new function()
+{
+ /**
+ * Get the current position of the animated element based on t.
+ * Each point is an array of "x" and "y" values (0 = x, 1 = y)
+ * At least 2 points are required (start and end).
+ * First point is start. Last point is end.
+ * Additional control points are optional.
+ * @method getPosition
+ * @param {Array} points An array containing Bezier points
+ * @param {Number} t A number between 0 and 1 which is the basis for determining current position
+ * @return {Array} An array containing int x and y member data
+ */
+ this.getPosition = function(points, t)
+ {
+ var n = points.length;
+ var tmp = [];
+
+ for (var i = 0; i < n; ++i){
+ tmp[i] = [points[i][0], points[i][1]]; // save input
+ }
+
+ for (var j = 1; j < n; ++j) {
+ for (i = 0; i < n - j; ++i) {
+ tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];
+ tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
+ }
+ }
+
+ return [ tmp[0][0], tmp[0][1] ];
+
+ };
+};
+/**
+ * Anim subclass for color transitions.
+ * Usage: var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut); Color values can be specified with either 112233, #112233,
+ * [255,255,255], or rgb(255,255,255)
+ * @class ColorAnim
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.Anim
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Bezier
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @constructor
+ * @extends YAHOO.util.Anim
+ * @param {HTMLElement | String} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.
+ * Each attribute is an object with at minimum a "to" or "by" member defined.
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
+ */
+(function() {
+ YAHOO.util.ColorAnim = function(el, attributes, duration, method) {
+ YAHOO.util.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
+ };
+
+ YAHOO.extend(YAHOO.util.ColorAnim, YAHOO.util.Anim);
+
+ // shorthand
+ var Y = YAHOO.util;
+ var superclass = Y.ColorAnim.superclass;
+ var proto = Y.ColorAnim.prototype;
+
+ proto.toString = function() {
+ var el = this.getEl();
+ var id = el.id || el.tagName;
+ return ("ColorAnim " + id);
+ };
+
+ proto.patterns.color = /color$/i;
+ proto.patterns.rgb = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;
+ proto.patterns.hex = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;
+ proto.patterns.hex3 = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;
+ proto.patterns.transparent = /^transparent|rgba\(0, 0, 0, 0\)$/; // need rgba for safari
+
+ /**
+ * Attempts to parse the given string and return a 3-tuple.
+ * @method parseColor
+ * @param {String} s The string to parse.
+ * @return {Array} The 3-tuple of rgb values.
+ */
+ proto.parseColor = function(s) {
+ if (s.length == 3) { return s; }
+
+ var c = this.patterns.hex.exec(s);
+ if (c && c.length == 4) {
+ return [ parseInt(c[1], 16), parseInt(c[2], 16), parseInt(c[3], 16) ];
+ }
+
+ c = this.patterns.rgb.exec(s);
+ if (c && c.length == 4) {
+ return [ parseInt(c[1], 10), parseInt(c[2], 10), parseInt(c[3], 10) ];
+ }
+
+ c = this.patterns.hex3.exec(s);
+ if (c && c.length == 4) {
+ return [ parseInt(c[1] + c[1], 16), parseInt(c[2] + c[2], 16), parseInt(c[3] + c[3], 16) ];
+ }
+
+ return null;
+ };
+
+ proto.getAttribute = function(attr) {
+ var el = this.getEl();
+ if ( this.patterns.color.test(attr) ) {
+ var val = YAHOO.util.Dom.getStyle(el, attr);
+
+ if (this.patterns.transparent.test(val)) { // bgcolor default
+ var parent = el.parentNode; // try and get from an ancestor
+ val = Y.Dom.getStyle(parent, attr);
+
+ while (parent && this.patterns.transparent.test(val)) {
+ parent = parent.parentNode;
+ val = Y.Dom.getStyle(parent, attr);
+ if (parent.tagName.toUpperCase() == 'HTML') {
+ val = '#fff';
+ }
+ }
+ }
+ } else {
+ val = superclass.getAttribute.call(this, attr);
+ }
+
+ return val;
+ };
+
+ proto.doMethod = function(attr, start, end) {
+ var val;
+
+ if ( this.patterns.color.test(attr) ) {
+ val = [];
+ for (var i = 0, len = start.length; i < len; ++i) {
+ val[i] = superclass.doMethod.call(this, attr, start[i], end[i]);
+ }
+
+ val = 'rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';
+ }
+ else {
+ val = superclass.doMethod.call(this, attr, start, end);
+ }
+
+ return val;
+ };
+
+ proto.setRuntimeAttribute = function(attr) {
+ superclass.setRuntimeAttribute.call(this, attr);
+
+ if ( this.patterns.color.test(attr) ) {
+ var attributes = this.attributes;
+ var start = this.parseColor(this.runtimeAttributes[attr].start);
+ var end = this.parseColor(this.runtimeAttributes[attr].end);
+ // fix colors if going "by"
+ if ( typeof attributes[attr]['to'] === 'undefined' && typeof attributes[attr]['by'] !== 'undefined' ) {
+ end = this.parseColor(attributes[attr].by);
+
+ for (var i = 0, len = start.length; i < len; ++i) {
+ end[i] = start[i] + end[i];
+ }
+ }
+
+ this.runtimeAttributes[attr].start = start;
+ this.runtimeAttributes[attr].end = end;
+ }
+ };
+})();/*
+TERMS OF USE - EASING EQUATIONS
+Open source under the BSD License.
+Copyright 2001 Robert Penner All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/**
+ * Singleton that determines how an animation proceeds from start to end.
+ * @class Easing
+ * @namespace YAHOO.util
+*/
+
+YAHOO.util.Easing = {
+
+ /**
+ * Uniform speed between points.
+ * @method easeNone
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeNone: function (t, b, c, d) {
+ return c*t/d + b;
+ },
+
+ /**
+ * Begins slowly and accelerates towards end. (quadratic)
+ * @method easeIn
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeIn: function (t, b, c, d) {
+ return c*(t/=d)*t + b;
+ },
+
+ /**
+ * Begins quickly and decelerates towards end. (quadratic)
+ * @method easeOut
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeOut: function (t, b, c, d) {
+ return -c *(t/=d)*(t-2) + b;
+ },
+
+ /**
+ * Begins slowly and decelerates towards end. (quadratic)
+ * @method easeBoth
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeBoth: function (t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t + b;
+ return -c/2 * ((--t)*(t-2) - 1) + b;
+ },
+
+ /**
+ * Begins slowly and accelerates towards end. (quartic)
+ * @method easeInStrong
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeInStrong: function (t, b, c, d) {
+ return c*(t/=d)*t*t*t + b;
+ },
+
+ /**
+ * Begins quickly and decelerates towards end. (quartic)
+ * @method easeOutStrong
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeOutStrong: function (t, b, c, d) {
+ return -c * ((t=t/d-1)*t*t*t - 1) + b;
+ },
+
+ /**
+ * Begins slowly and decelerates towards end. (quartic)
+ * @method easeBothStrong
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ easeBothStrong: function (t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
+ return -c/2 * ((t-=2)*t*t*t - 2) + b;
+ },
+
+ /**
+ * Snap in elastic effect.
+ * @method elasticIn
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} p Period (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+
+ elasticIn: function (t, b, c, d, a, p) {
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ },
+
+ /**
+ * Snap out elastic effect.
+ * @method elasticOut
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} p Period (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+ elasticOut: function (t, b, c, d, a, p) {
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
+ },
+
+ /**
+ * Snap both elastic effect.
+ * @method elasticBoth
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} p Period (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+ elasticBoth: function (t, b, c, d, a, p) {
+ if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
+ if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
+ },
+
+ /**
+ * Backtracks slightly, then reverses direction and moves to end.
+ * @method backIn
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} s Overshoot (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+ backIn: function (t, b, c, d, s) {
+ if (typeof s == 'undefined') s = 1.70158;
+ return c*(t/=d)*t*((s+1)*t - s) + b;
+ },
+
+ /**
+ * Overshoots end, then reverses and comes back to end.
+ * @method backOut
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} s Overshoot (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+ backOut: function (t, b, c, d, s) {
+ if (typeof s == 'undefined') s = 1.70158;
+ return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
+ },
+
+ /**
+ * Backtracks slightly, then reverses direction, overshoots end,
+ * then reverses and comes back to end.
+ * @method backBoth
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @param {Number} s Overshoot (optional)
+ * @return {Number} The computed value for the current animation frame
+ */
+ backBoth: function (t, b, c, d, s) {
+ if (typeof s == 'undefined') s = 1.70158;
+ if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
+ return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
+ },
+
+ /**
+ * Bounce off of start.
+ * @method bounceIn
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ bounceIn: function (t, b, c, d) {
+ return c - YAHOO.util.Easing.bounceOut(d-t, 0, c, d) + b;
+ },
+
+ /**
+ * Bounces off end.
+ * @method bounceOut
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ bounceOut: function (t, b, c, d) {
+ if ((t/=d) < (1/2.75)) {
+ return c*(7.5625*t*t) + b;
+ } else if (t < (2/2.75)) {
+ return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
+ } else if (t < (2.5/2.75)) {
+ return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
+ } else {
+ return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
+ }
+ },
+
+ /**
+ * Bounces off start and end.
+ * @method bounceBoth
+ * @param {Number} t Time value used to compute current value
+ * @param {Number} b Starting value
+ * @param {Number} c Delta between start and end values
+ * @param {Number} d Total length of animation
+ * @return {Number} The computed value for the current animation frame
+ */
+ bounceBoth: function (t, b, c, d) {
+ if (t < d/2) return YAHOO.util.Easing.bounceIn(t*2, 0, c, d) * .5 + b;
+ return YAHOO.util.Easing.bounceOut(t*2-d, 0, c, d) * .5 + c*.5 + b;
+ }
+};
+
+/**
+ * Anim subclass for moving elements along a path defined by the "points"
+ * member of "attributes". All "points" are arrays with x, y coordinates.
+ * Usage: var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);
+ * @class Motion
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.Anim
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Bezier
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @requires YAHOO.util.CustomEvent
+ * @constructor
+ * @extends YAHOO.util.Anim
+ * @param {String | HTMLElement} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.
+ * Each attribute is an object with at minimum a "to" or "by" member defined.
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
+ */
+(function() {
+ YAHOO.util.Motion = function(el, attributes, duration, method) {
+ if (el) { // dont break existing subclasses not using YAHOO.extend
+ YAHOO.util.Motion.superclass.constructor.call(this, el, attributes, duration, method);
+ }
+ };
+
+ YAHOO.extend(YAHOO.util.Motion, YAHOO.util.ColorAnim);
+
+ // shorthand
+ var Y = YAHOO.util;
+ var superclass = Y.Motion.superclass;
+ var proto = Y.Motion.prototype;
+
+ proto.toString = function() {
+ var el = this.getEl();
+ var id = el.id || el.tagName;
+ return ("Motion " + id);
+ };
+
+ proto.patterns.points = /^points$/i;
+
+ proto.setAttribute = function(attr, val, unit) {
+ if ( this.patterns.points.test(attr) ) {
+ unit = unit || 'px';
+ superclass.setAttribute.call(this, 'left', val[0], unit);
+ superclass.setAttribute.call(this, 'top', val[1], unit);
+ } else {
+ superclass.setAttribute.call(this, attr, val, unit);
+ }
+ };
+
+ proto.getAttribute = function(attr) {
+ if ( this.patterns.points.test(attr) ) {
+ var val = [
+ superclass.getAttribute.call(this, 'left'),
+ superclass.getAttribute.call(this, 'top')
+ ];
+ } else {
+ val = superclass.getAttribute.call(this, attr);
+ }
+
+ return val;
+ };
+
+ proto.doMethod = function(attr, start, end) {
+ var val = null;
+
+ if ( this.patterns.points.test(attr) ) {
+ var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100;
+ val = Y.Bezier.getPosition(this.runtimeAttributes[attr], t);
+ } else {
+ val = superclass.doMethod.call(this, attr, start, end);
+ }
+ return val;
+ };
+
+ proto.setRuntimeAttribute = function(attr) {
+ if ( this.patterns.points.test(attr) ) {
+ var el = this.getEl();
+ var attributes = this.attributes;
+ var start;
+ var control = attributes['points']['control'] || [];
+ var end;
+ var i, len;
+
+ if (control.length > 0 && !(control[0] instanceof Array) ) { // could be single point or array of points
+ control = [control];
+ } else { // break reference to attributes.points.control
+ var tmp = [];
+ for (i = 0, len = control.length; i< len; ++i) {
+ tmp[i] = control[i];
+ }
+ control = tmp;
+ }
+
+ if (Y.Dom.getStyle(el, 'position') == 'static') { // default to relative
+ Y.Dom.setStyle(el, 'position', 'relative');
+ }
+
+ if ( isset(attributes['points']['from']) ) {
+ Y.Dom.setXY(el, attributes['points']['from']); // set position to from point
+ }
+ else { Y.Dom.setXY( el, Y.Dom.getXY(el) ); } // set it to current position
+
+ start = this.getAttribute('points'); // get actual top & left
+
+ // TO beats BY, per SMIL 2.1 spec
+ if ( isset(attributes['points']['to']) ) {
+ end = translateValues.call(this, attributes['points']['to'], start);
+
+ var pageXY = Y.Dom.getXY(this.getEl());
+ for (i = 0, len = control.length; i < len; ++i) {
+ control[i] = translateValues.call(this, control[i], start);
+ }
+
+
+ } else if ( isset(attributes['points']['by']) ) {
+ end = [ start[0] + attributes['points']['by'][0], start[1] + attributes['points']['by'][1] ];
+
+ for (i = 0, len = control.length; i < len; ++i) {
+ control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ];
+ }
+ }
+
+ this.runtimeAttributes[attr] = [start];
+
+ if (control.length > 0) {
+ this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control);
+ }
+
+ this.runtimeAttributes[attr][this.runtimeAttributes[attr].length] = end;
+ }
+ else {
+ superclass.setRuntimeAttribute.call(this, attr);
+ }
+ };
+
+ var translateValues = function(val, start) {
+ var pageXY = Y.Dom.getXY(this.getEl());
+ val = [ val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1] ];
+
+ return val;
+ };
+
+ var isset = function(prop) {
+ return (typeof prop !== 'undefined');
+ };
+})();
+/**
+ * Anim subclass for scrolling elements to a position defined by the "scroll"
+ * member of "attributes". All "scroll" members are arrays with x, y scroll positions.
+ * Usage: var myAnim = new YAHOO.util.Scroll(el, { scroll: { to: [0, 800] } }, 1, YAHOO.util.Easing.easeOut);
+ * @class Scroll
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.Anim
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Bezier
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @requires YAHOO.util.CustomEvent
+ * @extends YAHOO.util.Anim
+ * @constructor
+ * @param {String or HTMLElement} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.
+ * Each attribute is an object with at minimum a "to" or "by" member defined.
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
+ */
+(function() {
+ YAHOO.util.Scroll = function(el, attributes, duration, method) {
+ if (el) { // dont break existing subclasses not using YAHOO.extend
+ YAHOO.util.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
+ }
+ };
+
+ YAHOO.extend(YAHOO.util.Scroll, YAHOO.util.ColorAnim);
+
+ // shorthand
+ var Y = YAHOO.util;
+ var superclass = Y.Scroll.superclass;
+ var proto = Y.Scroll.prototype;
+
+ proto.toString = function() {
+ var el = this.getEl();
+ var id = el.id || el.tagName;
+ return ("Scroll " + id);
+ };
+
+ proto.doMethod = function(attr, start, end) {
+ var val = null;
+
+ if (attr == 'scroll') {
+ val = [
+ this.method(this.currentFrame, start[0], end[0] - start[0], this.totalFrames),
+ this.method(this.currentFrame, start[1], end[1] - start[1], this.totalFrames)
+ ];
+
+ } else {
+ val = superclass.doMethod.call(this, attr, start, end);
+ }
+ return val;
+ };
+
+ proto.getAttribute = function(attr) {
+ var val = null;
+ var el = this.getEl();
+
+ if (attr == 'scroll') {
+ val = [ el.scrollLeft, el.scrollTop ];
+ } else {
+ val = superclass.getAttribute.call(this, attr);
+ }
+
+ return val;
+ };
+
+ proto.setAttribute = function(attr, val, unit) {
+ var el = this.getEl();
+
+ if (attr == 'scroll') {
+ el.scrollLeft = val[0];
+ el.scrollTop = val[1];
+ } else {
+ superclass.setAttribute.call(this, attr, val, unit);
+ }
+ };
+})();
diff --git a/thirdpartyjs/yui/autocomplete/README b/thirdpartyjs/yui/autocomplete/README
index 4470be2..88671a7 100644
--- a/thirdpartyjs/yui/autocomplete/README
+++ b/thirdpartyjs/yui/autocomplete/README
@@ -1,59 +1,59 @@
-AutoComplete Release Notes
-
-*** version 0.12.0 ***
-
-* The following constants must be defined as static class properties and are no longer
-available as instance properties:
-
-YAHOO.widget.DataSource.ERROR_DATANULL
-YAHOO.widget.DataSource.ERROR_DATAPARSE
-YAHOO.widget.DS_XHR.TYPE_JSON
-YAHOO.widget.DS_XHR.TYPE_XML
-YAHOO.widget.DS_XHR.TYPE_FLAT
-YAHOO.widget.DS_XHR.ERROR_DATAXHR
-
-* The property minQueryLength now supports zero and negative number values for
-DS_JSFunction and DS_XHR objects, to enable null or empty string queries and to disable
-AutoComplete functionality altogether, respectively.
-
-* Enabling the alwaysShowContainer feature will no longer send containerExpandEvent or
-containerCollapseEvent.
-
-
-
-**** version 0.11.3 ***
-
-* The iFrameSrc property has been deprecated. Implementers no longer need to
-specify an https URL to avoid IE security warnings when working with sites over
-SSL.
-
-
-
-*** version 0.11.0 ***
-
-* The method getListIds() has been deprecated for getListItems(), which returns
-an array of DOM references.
-
-* All classnames have been prefixed with "yui-ac-".
-
-* Container elements should no longer have CSS property "display" set to "none".
-
-* The useIFrame property can now be set after instantiation.
-
-* On some browsers, the unmatchedItemSelectEvent may not be fired properly when
-delimiter characters are defined.
-
-* On some browsers, defining delimiter characters while enabling forceSelection
-may result in unexpected behavior.
-
-
-
-*** version 0.10.0 ***
-
-* Initial release
-
-* In order to enable the useIFrame property, it should be set in the
-constructor.
-
-* On some browsers, defining delimiter characters while enabling forceSelection
-may result in unexpected behavior.
+AutoComplete Release Notes
+
+*** version 0.12.0 ***
+
+* The following constants must be defined as static class properties and are no longer
+available as instance properties:
+
+YAHOO.widget.DataSource.ERROR_DATANULL
+YAHOO.widget.DataSource.ERROR_DATAPARSE
+YAHOO.widget.DS_XHR.TYPE_JSON
+YAHOO.widget.DS_XHR.TYPE_XML
+YAHOO.widget.DS_XHR.TYPE_FLAT
+YAHOO.widget.DS_XHR.ERROR_DATAXHR
+
+* The property minQueryLength now supports zero and negative number values for
+DS_JSFunction and DS_XHR objects, to enable null or empty string queries and to disable
+AutoComplete functionality altogether, respectively.
+
+* Enabling the alwaysShowContainer feature will no longer send containerExpandEvent or
+containerCollapseEvent.
+
+
+
+**** version 0.11.3 ***
+
+* The iFrameSrc property has been deprecated. Implementers no longer need to
+specify an https URL to avoid IE security warnings when working with sites over
+SSL.
+
+
+
+*** version 0.11.0 ***
+
+* The method getListIds() has been deprecated for getListItems(), which returns
+an array of DOM references.
+
+* All classnames have been prefixed with "yui-ac-".
+
+* Container elements should no longer have CSS property "display" set to "none".
+
+* The useIFrame property can now be set after instantiation.
+
+* On some browsers, the unmatchedItemSelectEvent may not be fired properly when
+delimiter characters are defined.
+
+* On some browsers, defining delimiter characters while enabling forceSelection
+may result in unexpected behavior.
+
+
+
+*** version 0.10.0 ***
+
+* Initial release
+
+* In order to enable the useIFrame property, it should be set in the
+constructor.
+
+* On some browsers, defining delimiter characters while enabling forceSelection
+may result in unexpected behavior.
diff --git a/thirdpartyjs/yui/calendar/README b/thirdpartyjs/yui/calendar/README
index de02c14..d40d6ac 100644
--- a/thirdpartyjs/yui/calendar/README
+++ b/thirdpartyjs/yui/calendar/README
@@ -1,107 +1,107 @@
-Calendar Release Notes
-
-*** version 0.12 ***
-
- - New documentation format implemented
- - Calendar2up and Calendar_Core are now deprecated. Now, Calendar alone
- represents the single Calendar instance, and CalendarGroup represents an
- n-up instance, defaulting to 2up
- - Added semantic style classes to Calendar elements to allow for custom
- styling solely using CSS.
- - Remapped all configuration properties to use the Config object
- (familiar to those who use the Container collection of controls).
- Property names are the same as their previous counterparts, but wrapped
- into Calendar.cfg, allowing for runtime reconfiguration of most
- properties.
- - Added "title" property for setting the Calendar title
- - Added "close" property for enabling and disabling the close icon
- - Added "iframe" property for enabling an iframe shim in Internet
- Explorer 6 and below to fix the select bleed-through bug
- - pageDate moved to property: "pagedate"
- - selectedDates moved to property: "selected"
- - minDate moved to property : "mindate", which accepts a JavaScript Date
- object like its predecessor, but also supports string dates
- - maxDate moved to property : "maxdate", which accepts a JavaScript Date
- object like its predecessor, but also supports string dates
- - Moved style declarations to initStyles function
- - Optimized event handling in
- doSelectCell/doCellMouseOver/doCellMouseOut by only attaching the
- listener to the outer Calendar container, and only reacting to events on
- cells with the "selectable" CSS class.
- - Added domEventMap field for applying DOM event listeners to cells
- containing specific class and tag combinations.
- - Moved all cell DOM event attachment to applyListeners function
- - Added getDateByCellId / getDateFieldsByCellId helper functions
- - Corrected DateMath.getWeekNumber to comply with ISO week number
- handling
- - Separated renderCellDefault style portions into styleCellDefault
- function for easy extension
- - Deprecated onBeforeSelect. Created beforeSelectEvent which
- automatically subscribes to its deprecated predecessor.
- - Deprecated onSelect. Created selectEvent, which automatically
- subscribes to its deprecated predecessor.
- - Deprecated onBeforeDeselect. Created beforeSelectEvent which
- automatically subscribes to its deprecated predecessor.
- - Deprecated onDeselect. Created beforeDeselectEvent, which
- automatically subscribes to its deprecated predecessor.
- - Deprecated onChangePage. Created changePageEvent, which automatically
- subscribes to its deprecated predecessor.
- - Deprecated onRender. Created renderEvent, which automatically
- subscribes to its deprecated predecessor.
- - Deprecated onReset. Created resetEvent, which automatically subscribes
- to its deprecated predecessor.
- - Deprecated onClear. Created clearEvent, which automatically subscribes
- to its deprecated predecessor.
- - Corrected setMonth documentation to refer to 0-11 indexed months.
- - Added show and hide methods to Calendar for setting the Calendar's
- display property.
- - Optimized internal render classes to use innerHTML and string buffers
- - Removed wireCustomEvents function
- - Removed wireDefaultEvents function
- - Removed doNextMonth / doPreviousMonth
- - Removed all buildShell (header, body, footer) functions, since the
- Calendar shell is now built dynamically on each render
- - Wired all CalendarGroup events and configuration properties to be
- properly delegated to Calendar
- - Augmented CalendarGroup with all built-in renderers, label functions,
- hide, show, and initStyles, creating API transparency between Calendar
- and CalendarGroup.
- - Made all tagName, createElement, and entity references XHTML compliant
- - Fixed Daylight Saving Time bug for Brazilian time zone
-
-*** version 0.11.3 ***
-
- - Calendar_Core: Added arguments for selected/deselected dates to
- onSelect/onDeselect
- - CalendarGroup: Fixed bug where selected dates passed to constructor
- were not represented in selectedDates
- - Calendar2up: Now displays correctly in Opera 9
-
-*** version 0.11.0 ***
-
- - DateMath: DateMath.add now properly adds weeks
- - DateMath: between() function added
- - DateMath: getWeekNumber() fixed to take starting day of week into
- account
- - All references to Calendar's built in CSS class handlers are removed,
- replaced with calls to Dom utility (addClass, removeClass)
- - Several CSS class constants now have clearer names
- - All CSS classes are now properly namespaced to avoid CSS conflicts
- - Fixed table:hover bug in CSS
- - Calendar no longer requires the container ID and variable name to
- match in order for month navigation to function properly
- - Calendar month navigation arrows are now represented as background
- images
-
-*** version 0.10.0 ***
-
- - Major performance improvements from attaching DOM events to associated
- table cells only once, when the Calendar shell is built
- - DOM events for mouseover/mouseout are now fired for all browsers (not
- just Internet Explorer)
- - Reset functionality bug fixed for 2-up Calendar view
-
-*** version 0.9.0 ***
-
-* Initial release
-
+Calendar Release Notes
+
+*** version 0.12 ***
+
+ - New documentation format implemented
+ - Calendar2up and Calendar_Core are now deprecated. Now, Calendar alone
+ represents the single Calendar instance, and CalendarGroup represents an
+ n-up instance, defaulting to 2up
+ - Added semantic style classes to Calendar elements to allow for custom
+ styling solely using CSS.
+ - Remapped all configuration properties to use the Config object
+ (familiar to those who use the Container collection of controls).
+ Property names are the same as their previous counterparts, but wrapped
+ into Calendar.cfg, allowing for runtime reconfiguration of most
+ properties.
+ - Added "title" property for setting the Calendar title
+ - Added "close" property for enabling and disabling the close icon
+ - Added "iframe" property for enabling an iframe shim in Internet
+ Explorer 6 and below to fix the select bleed-through bug
+ - pageDate moved to property: "pagedate"
+ - selectedDates moved to property: "selected"
+ - minDate moved to property : "mindate", which accepts a JavaScript Date
+ object like its predecessor, but also supports string dates
+ - maxDate moved to property : "maxdate", which accepts a JavaScript Date
+ object like its predecessor, but also supports string dates
+ - Moved style declarations to initStyles function
+ - Optimized event handling in
+ doSelectCell/doCellMouseOver/doCellMouseOut by only attaching the
+ listener to the outer Calendar container, and only reacting to events on
+ cells with the "selectable" CSS class.
+ - Added domEventMap field for applying DOM event listeners to cells
+ containing specific class and tag combinations.
+ - Moved all cell DOM event attachment to applyListeners function
+ - Added getDateByCellId / getDateFieldsByCellId helper functions
+ - Corrected DateMath.getWeekNumber to comply with ISO week number
+ handling
+ - Separated renderCellDefault style portions into styleCellDefault
+ function for easy extension
+ - Deprecated onBeforeSelect. Created beforeSelectEvent which
+ automatically subscribes to its deprecated predecessor.
+ - Deprecated onSelect. Created selectEvent, which automatically
+ subscribes to its deprecated predecessor.
+ - Deprecated onBeforeDeselect. Created beforeSelectEvent which
+ automatically subscribes to its deprecated predecessor.
+ - Deprecated onDeselect. Created beforeDeselectEvent, which
+ automatically subscribes to its deprecated predecessor.
+ - Deprecated onChangePage. Created changePageEvent, which automatically
+ subscribes to its deprecated predecessor.
+ - Deprecated onRender. Created renderEvent, which automatically
+ subscribes to its deprecated predecessor.
+ - Deprecated onReset. Created resetEvent, which automatically subscribes
+ to its deprecated predecessor.
+ - Deprecated onClear. Created clearEvent, which automatically subscribes
+ to its deprecated predecessor.
+ - Corrected setMonth documentation to refer to 0-11 indexed months.
+ - Added show and hide methods to Calendar for setting the Calendar's
+ display property.
+ - Optimized internal render classes to use innerHTML and string buffers
+ - Removed wireCustomEvents function
+ - Removed wireDefaultEvents function
+ - Removed doNextMonth / doPreviousMonth
+ - Removed all buildShell (header, body, footer) functions, since the
+ Calendar shell is now built dynamically on each render
+ - Wired all CalendarGroup events and configuration properties to be
+ properly delegated to Calendar
+ - Augmented CalendarGroup with all built-in renderers, label functions,
+ hide, show, and initStyles, creating API transparency between Calendar
+ and CalendarGroup.
+ - Made all tagName, createElement, and entity references XHTML compliant
+ - Fixed Daylight Saving Time bug for Brazilian time zone
+
+*** version 0.11.3 ***
+
+ - Calendar_Core: Added arguments for selected/deselected dates to
+ onSelect/onDeselect
+ - CalendarGroup: Fixed bug where selected dates passed to constructor
+ were not represented in selectedDates
+ - Calendar2up: Now displays correctly in Opera 9
+
+*** version 0.11.0 ***
+
+ - DateMath: DateMath.add now properly adds weeks
+ - DateMath: between() function added
+ - DateMath: getWeekNumber() fixed to take starting day of week into
+ account
+ - All references to Calendar's built in CSS class handlers are removed,
+ replaced with calls to Dom utility (addClass, removeClass)
+ - Several CSS class constants now have clearer names
+ - All CSS classes are now properly namespaced to avoid CSS conflicts
+ - Fixed table:hover bug in CSS
+ - Calendar no longer requires the container ID and variable name to
+ match in order for month navigation to function properly
+ - Calendar month navigation arrows are now represented as background
+ images
+
+*** version 0.10.0 ***
+
+ - Major performance improvements from attaching DOM events to associated
+ table cells only once, when the Calendar shell is built
+ - DOM events for mouseover/mouseout are now fired for all browsers (not
+ just Internet Explorer)
+ - Reset functionality bug fixed for 2-up Calendar view
+
+*** version 0.9.0 ***
+
+* Initial release
+
diff --git a/thirdpartyjs/yui/calendar/assets/calendar.css b/thirdpartyjs/yui/calendar/assets/calendar.css
index 0723f94..b97a705 100644
--- a/thirdpartyjs/yui/calendar/assets/calendar.css
+++ b/thirdpartyjs/yui/calendar/assets/calendar.css
@@ -1,191 +1,191 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-Version 0.12
-*/
-
-.yui-calcontainer {
- position:relative;
- padding:5px;
- background-color:#F7F9FB;
- border:1px solid #7B9EBD;
- float:left;
- overflow:hidden;
-}
-
-.yui-calcontainer iframe {
- position:absolute;
- border:none;
- margin:0;padding:0;
- left:-1px;
- top:-1px;
- z-index:0;
- width:50em;
- height:50em;
-}
-
-.yui-calcontainer.multi {
- padding:0;
-}
-
-.yui-calcontainer.multi .groupcal {
- padding:5px;
- background-color:transparent;
- z-index:1;
- float:left;
- position:relative;
- border:none;
-}
-
-.yui-calcontainer .title {
- font:100% sans-serif;
- color:#000;
- font-weight:bold;
- margin-bottom:5px;
- height:25px;
- position:absolute;
- top:3px;left:5px;
- z-index:1;
-}
-
-.yui-calcontainer .close-icon {
- position:absolute;
- right:3px;
- top:3px;
- border:none;
- z-index:1;
-}
-
-/* Calendar element styles */
-
-.yui-calendar {
- font:100% sans-serif;
- text-align:center;
- border-spacing:0;
- border-collapse:separate;
- position:relative;
-}
-
-.yui-calcontainer.withtitle {
- padding-top:1.5em;
-}
-
-.yui-calendar .calnavleft {
- position:absolute;
- background-repeat:no-repeat;
- cursor:pointer;
- top:2px;
- bottom:0;
- width:9px;
- height:12px;
- left:2px;
- z-index:1;
-}
-
-.yui-calendar .calnavright {
- position:absolute;
- background-repeat:no-repeat;
- cursor:pointer;
- top:2px;
- bottom:0;
- width:9px;
- height:12px;
- right:2px;
- z-index:1;
-}
-
-.yui-calendar td.calcell {
- padding:.1em .2em;
- border:1px solid #E0E0E0;
- text-align:center;
-}
-
-.yui-calendar td.calcell a {
- color:#003DB8;
- text-decoration:none;
-}
-
-.yui-calendar td.calcell.today {
- border:1px solid #000;
-}
-
-.yui-calendar td.calcell.oom {
- cursor:default;
- color:#999;
- background-color:#EEE;
- border:1px solid #E0E0E0;
-}
-
-.yui-calendar td.calcell.selected {
- color:#003DB8;
- background-color:#FFF19F;
- border:1px solid #FF9900;
-}
-
-.yui-calendar td.calcell.calcellhover {
- cursor:pointer;
- color:#FFF;
- background-color:#FF9900;
- border:1px solid #FF9900;
-}
-
-.yui-calendar td.calcell.calcellhover a {
- color:#FFF;
-}
-
-.yui-calendar td.calcell.restricted {
- text-decoration:line-through;
-}
-
-.yui-calendar td.calcell.previous {
- color:#CCC;
-}
-
-.yui-calendar td.calcell.highlight1 { background-color:#CCFF99; }
-.yui-calendar td.calcell.highlight2 { background-color:#99CCFF; }
-.yui-calendar td.calcell.highlight3 { background-color:#FFCCCC; }
-.yui-calendar td.calcell.highlight4 { background-color:#CCFF99; }
-
-.yui-calendar .calhead {
- border:1px solid #E0E0E0;
- vertical-align:middle;
- background-color:#FFF;
-}
-
-.yui-calendar .calheader {
- position:relative;
- width:100%;
- text-align:center;
-}
-
-.yui-calendar .calheader img {
- border:none;
-}
-
-.yui-calendar .calweekdaycell {
- color:#666;
- font-weight:normal;
- text-align:center;
- width:1.5em;
-}
-
-.yui-calendar .calfoot {
- background-color:#EEE;
-}
-
-.yui-calendar .calrowhead, .yui-calendar .calrowfoot {
- color:#666;
- font-size:9px;
- font-style:italic;
- font-weight:normal;
- width:15px;
-}
-
-.yui-calendar .calrowhead {
- border-right-width:2px;
-}
-
-/*Specific changes for calendar running under fonts/reset */
-.yui-calendar a:hover {background:inherit;}
-p#clear {clear:left; padding-top:10px;}
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+Version 0.12
+*/
+
+.yui-calcontainer {
+ position:relative;
+ padding:5px;
+ background-color:#F7F9FB;
+ border:1px solid #7B9EBD;
+ float:left;
+ overflow:hidden;
+}
+
+.yui-calcontainer iframe {
+ position:absolute;
+ border:none;
+ margin:0;padding:0;
+ left:-1px;
+ top:-1px;
+ z-index:0;
+ width:50em;
+ height:50em;
+}
+
+.yui-calcontainer.multi {
+ padding:0;
+}
+
+.yui-calcontainer.multi .groupcal {
+ padding:5px;
+ background-color:transparent;
+ z-index:1;
+ float:left;
+ position:relative;
+ border:none;
+}
+
+.yui-calcontainer .title {
+ font:100% sans-serif;
+ color:#000;
+ font-weight:bold;
+ margin-bottom:5px;
+ height:25px;
+ position:absolute;
+ top:3px;left:5px;
+ z-index:1;
+}
+
+.yui-calcontainer .close-icon {
+ position:absolute;
+ right:3px;
+ top:3px;
+ border:none;
+ z-index:1;
+}
+
+/* Calendar element styles */
+
+.yui-calendar {
+ font:100% sans-serif;
+ text-align:center;
+ border-spacing:0;
+ border-collapse:separate;
+ position:relative;
+}
+
+.yui-calcontainer.withtitle {
+ padding-top:1.5em;
+}
+
+.yui-calendar .calnavleft {
+ position:absolute;
+ background-repeat:no-repeat;
+ cursor:pointer;
+ top:2px;
+ bottom:0;
+ width:9px;
+ height:12px;
+ left:2px;
+ z-index:1;
+}
+
+.yui-calendar .calnavright {
+ position:absolute;
+ background-repeat:no-repeat;
+ cursor:pointer;
+ top:2px;
+ bottom:0;
+ width:9px;
+ height:12px;
+ right:2px;
+ z-index:1;
+}
+
+.yui-calendar td.calcell {
+ padding:.1em .2em;
+ border:1px solid #E0E0E0;
+ text-align:center;
+}
+
+.yui-calendar td.calcell a {
+ color:#003DB8;
+ text-decoration:none;
+}
+
+.yui-calendar td.calcell.today {
+ border:1px solid #000;
+}
+
+.yui-calendar td.calcell.oom {
+ cursor:default;
+ color:#999;
+ background-color:#EEE;
+ border:1px solid #E0E0E0;
+}
+
+.yui-calendar td.calcell.selected {
+ color:#003DB8;
+ background-color:#FFF19F;
+ border:1px solid #FF9900;
+}
+
+.yui-calendar td.calcell.calcellhover {
+ cursor:pointer;
+ color:#FFF;
+ background-color:#FF9900;
+ border:1px solid #FF9900;
+}
+
+.yui-calendar td.calcell.calcellhover a {
+ color:#FFF;
+}
+
+.yui-calendar td.calcell.restricted {
+ text-decoration:line-through;
+}
+
+.yui-calendar td.calcell.previous {
+ color:#CCC;
+}
+
+.yui-calendar td.calcell.highlight1 { background-color:#CCFF99; }
+.yui-calendar td.calcell.highlight2 { background-color:#99CCFF; }
+.yui-calendar td.calcell.highlight3 { background-color:#FFCCCC; }
+.yui-calendar td.calcell.highlight4 { background-color:#CCFF99; }
+
+.yui-calendar .calhead {
+ border:1px solid #E0E0E0;
+ vertical-align:middle;
+ background-color:#FFF;
+}
+
+.yui-calendar .calheader {
+ position:relative;
+ width:100%;
+ text-align:center;
+}
+
+.yui-calendar .calheader img {
+ border:none;
+}
+
+.yui-calendar .calweekdaycell {
+ color:#666;
+ font-weight:normal;
+ text-align:center;
+ width:1.5em;
+}
+
+.yui-calendar .calfoot {
+ background-color:#EEE;
+}
+
+.yui-calendar .calrowhead, .yui-calendar .calrowfoot {
+ color:#666;
+ font-size:9px;
+ font-style:italic;
+ font-weight:normal;
+ width:15px;
+}
+
+.yui-calendar .calrowhead {
+ border-right-width:2px;
+}
+
+/*Specific changes for calendar running under fonts/reset */
+.yui-calendar a:hover {background:inherit;}
+p#clear {clear:left; padding-top:10px;}
diff --git a/thirdpartyjs/yui/calendar/calendar-debug.js b/thirdpartyjs/yui/calendar/calendar-debug.js
index 3396980..8908d0e 100644
--- a/thirdpartyjs/yui/calendar/calendar-debug.js
+++ b/thirdpartyjs/yui/calendar/calendar-debug.js
@@ -1,4277 +1,4277 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version 0.12.0
-*/
-
-/**
-* Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.
-* @class YAHOO.util.Config
-* @constructor
-* @param {Object} owner The owner Object to which this Config Object belongs
-*/
-YAHOO.util.Config = function(owner) {
- if (owner) {
- this.init(owner);
- } else {
- YAHOO.log("No owner specified for Config object", "error");
- }
-};
-
-YAHOO.util.Config.prototype = {
-
- /**
- * Object reference to the owner of this Config Object
- * @property owner
- * @type Object
- */
- owner : null,
-
- /**
- * Boolean flag that specifies whether a queue is currently being executed
- * @property queueInProgress
- * @type Boolean
- */
- queueInProgress : false,
-
-
- /**
- * Validates that the value passed in is a Boolean.
- * @method checkBoolean
- * @param {Object} val The value to validate
- * @return {Boolean} true, if the value is valid
- */
- checkBoolean: function(val) {
- if (typeof val == 'boolean') {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Validates that the value passed in is a number.
- * @method checkNumber
- * @param {Object} val The value to validate
- * @return {Boolean} true, if the value is valid
- */
- checkNumber: function(val) {
- if (isNaN(val)) {
- return false;
- } else {
- return true;
- }
- }
-};
-
-
-/**
-* Initializes the configuration Object and all of its local members.
-* @method init
-* @param {Object} owner The owner Object to which this Config Object belongs
-*/
-YAHOO.util.Config.prototype.init = function(owner) {
-
- this.owner = owner;
-
- /**
- * Object reference to the owner of this Config Object
- * @event configChangedEvent
- */
- this.configChangedEvent = new YAHOO.util.CustomEvent("configChanged");
- this.queueInProgress = false;
-
- /* Private Members */
-
- /**
- * Maintains the local collection of configuration property objects and their specified values
- * @property config
- * @private
- * @type Object
- */
- var config = {};
-
- /**
- * Maintains the local collection of configuration property objects as they were initially applied.
- * This object is used when resetting a property.
- * @property initialConfig
- * @private
- * @type Object
- */
- var initialConfig = {};
-
- /**
- * Maintains the local, normalized CustomEvent queue
- * @property eventQueue
- * @private
- * @type Object
- */
- var eventQueue = [];
-
- /**
- * Fires a configuration property event using the specified value.
- * @method fireEvent
- * @private
- * @param {String} key The configuration property's name
- * @param {value} Object The value of the correct type for the property
- */
- var fireEvent = function( key, value ) {
- YAHOO.log("Firing Config event: " + key + "=" + value, "info");
-
- key = key.toLowerCase();
-
- var property = config[key];
-
- if (typeof property != 'undefined' && property.event) {
- property.event.fire(value);
- }
- };
- /* End Private Members */
-
- /**
- * Adds a property to the Config Object's private config hash.
- * @method addProperty
- * @param {String} key The configuration property's name
- * @param {Object} propertyObject The Object containing all of this property's arguments
- */
- this.addProperty = function( key, propertyObject ) {
- key = key.toLowerCase();
-
- YAHOO.log("Added property: " + key, "info");
-
- config[key] = propertyObject;
-
- propertyObject.event = new YAHOO.util.CustomEvent(key);
- propertyObject.key = key;
-
- if (propertyObject.handler) {
- propertyObject.event.subscribe(propertyObject.handler, this.owner, true);
- }
-
- this.setProperty(key, propertyObject.value, true);
-
- if (! propertyObject.suppressEvent) {
- this.queueProperty(key, propertyObject.value);
- }
- };
-
- /**
- * Returns a key-value configuration map of the values currently set in the Config Object.
- * @method getConfig
- * @return {Object} The current config, represented in a key-value map
- */
- this.getConfig = function() {
- var cfg = {};
-
- for (var prop in config) {
- var property = config[prop];
- if (typeof property != 'undefined' && property.event) {
- cfg[prop] = property.value;
- }
- }
-
- return cfg;
- };
-
- /**
- * Returns the value of specified property.
- * @method getProperty
- * @param {String} key The name of the property
- * @return {Object} The value of the specified property
- */
- this.getProperty = function(key) {
- key = key.toLowerCase();
-
- var property = config[key];
- if (typeof property != 'undefined' && property.event) {
- return property.value;
- } else {
- return undefined;
- }
- };
-
- /**
- * Resets the specified property's value to its initial value.
- * @method resetProperty
- * @param {String} key The name of the property
- * @return {Boolean} True is the property was reset, false if not
- */
- this.resetProperty = function(key) {
- key = key.toLowerCase();
-
- var property = config[key];
- if (typeof property != 'undefined' && property.event) {
- if (initialConfig[key] && initialConfig[key] != 'undefined') {
- this.setProperty(key, initialConfig[key]);
- }
- return true;
- } else {
- return false;
- }
- };
-
- /**
- * Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.
- * @method setProperty
- * @param {String} key The name of the property
- * @param {String} value The value to set the property to
- * @param {Boolean} silent Whether the value should be set silently, without firing the property event.
- * @return {Boolean} True, if the set was successful, false if it failed.
- */
- this.setProperty = function(key, value, silent) {
- key = key.toLowerCase();
-
- YAHOO.log("setProperty: " + key + "=" + value, "info");
-
- if (this.queueInProgress && ! silent) {
- this.queueProperty(key,value); // Currently running through a queue...
- return true;
- } else {
- var property = config[key];
- if (typeof property != 'undefined' && property.event) {
- if (property.validator && ! property.validator(value)) { // validator
- return false;
- } else {
- property.value = value;
- if (! silent) {
- fireEvent(key, value);
- this.configChangedEvent.fire([key, value]);
- }
- return true;
- }
- } else {
- return false;
- }
- }
- };
-
- /**
- * Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is
- * moved from its current position to the end of the queue.
- * @method queueProperty
- * @param {String} key The name of the property
- * @param {String} value The value to set the property to
- * @return {Boolean} true, if the set was successful, false if it failed.
- */
- this.queueProperty = function(key, value) {
- key = key.toLowerCase();
-
- YAHOO.log("queueProperty: " + key + "=" + value, "info");
-
- var property = config[key];
-
- if (typeof property != 'undefined' && property.event) {
- if (typeof value != 'undefined' && property.validator && ! property.validator(value)) { // validator
- return false;
- } else {
-
- if (typeof value != 'undefined') {
- property.value = value;
- } else {
- value = property.value;
- }
-
- var foundDuplicate = false;
-
- for (var i=0;i 11) {
- while (newMonth > 11) {
- newMonth -= 12;
- years += 1;
- }
- }
-
- d.setMonth(newMonth);
- d.setFullYear(date.getFullYear() + years);
- break;
- case this.DAY:
- d.setDate(date.getDate() + amount);
- break;
- case this.YEAR:
- d.setFullYear(date.getFullYear() + amount);
- break;
- case this.WEEK:
- d.setDate(date.getDate() + (amount * 7));
- break;
- }
- return d;
- },
-
- /**
- * Subtracts the specified amount of time from the this instance.
- * @method subtract
- * @param {Date} date The JavaScript Date object to perform subtraction on
- * @param {Number} field The this field constant to be used for performing subtraction.
- * @param {Number} amount The number of units (measured in the field constant) to subtract from the date.
- * @return {Date} The resulting Date object
- */
- subtract : function(date, field, amount) {
- return this.add(date, field, (amount*-1));
- },
-
- /**
- * Determines whether a given date is before another date on the calendar.
- * @method before
- * @param {Date} date The Date object to compare with the compare argument
- * @param {Date} compareTo The Date object to use for the comparison
- * @return {Boolean} true if the date occurs before the compared date; false if not.
- */
- before : function(date, compareTo) {
- var ms = compareTo.getTime();
- if (date.getTime() < ms) {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Determines whether a given date is after another date on the calendar.
- * @method after
- * @param {Date} date The Date object to compare with the compare argument
- * @param {Date} compareTo The Date object to use for the comparison
- * @return {Boolean} true if the date occurs after the compared date; false if not.
- */
- after : function(date, compareTo) {
- var ms = compareTo.getTime();
- if (date.getTime() > ms) {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Determines whether a given date is between two other dates on the calendar.
- * @method between
- * @param {Date} date The date to check for
- * @param {Date} dateBegin The start of the range
- * @param {Date} dateEnd The end of the range
- * @return {Boolean} true if the date occurs between the compared dates; false if not.
- */
- between : function(date, dateBegin, dateEnd) {
- if (this.after(date, dateBegin) && this.before(date, dateEnd)) {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Retrieves a JavaScript Date object representing January 1 of any given year.
- * @method getJan1
- * @param {Number} calendarYear The calendar year for which to retrieve January 1
- * @return {Date} January 1 of the calendar year specified.
- */
- getJan1 : function(calendarYear) {
- return new Date(calendarYear,0,1);
- },
-
- /**
- * Calculates the number of days the specified date is from January 1 of the specified calendar year.
- * Passing January 1 to this function would return an offset value of zero.
- * @method getDayOffset
- * @param {Date} date The JavaScript date for which to find the offset
- * @param {Number} calendarYear The calendar year to use for determining the offset
- * @return {Number} The number of days since January 1 of the given year
- */
- getDayOffset : function(date, calendarYear) {
- var beginYear = this.getJan1(calendarYear); // Find the start of the year. This will be in week 1.
-
- // Find the number of days the passed in date is away from the calendar year start
- var dayOffset = Math.ceil((date.getTime()-beginYear.getTime()) / this.ONE_DAY_MS);
- return dayOffset;
- },
-
- /**
- * Calculates the week number for the given date. This function assumes that week 1 is the
- * week in which January 1 appears, regardless of whether the week consists of a full 7 days.
- * The calendar year can be specified to help find what a the week number would be for a given
- * date if the date overlaps years. For instance, a week may be considered week 1 of 2005, or
- * week 53 of 2004. Specifying the optional calendarYear allows one to make this distinction
- * easily.
- * @method getWeekNumber
- * @param {Date} date The JavaScript date for which to find the week number
- * @param {Number} calendarYear OPTIONAL - The calendar year to use for determining the week number. Default is
- * the calendar year of parameter "date".
- * @param {Number} weekStartsOn OPTIONAL - The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).
- * @return {Number} The week number of the given date.
- */
- getWeekNumber : function(date, calendarYear) {
- date = this.clearTime(date);
- var nearestThurs = new Date(date.getTime() + (4 * this.ONE_DAY_MS) - ((date.getDay()) * this.ONE_DAY_MS));
-
- var jan1 = new Date(nearestThurs.getFullYear(),0,1);
- var dayOfYear = ((nearestThurs.getTime() - jan1.getTime()) / this.ONE_DAY_MS) - 1;
-
- var weekNum = Math.ceil((dayOfYear)/ 7);
- return weekNum;
- },
-
- /**
- * Determines if a given week overlaps two different years.
- * @method isYearOverlapWeek
- * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
- * @return {Boolean} true if the date overlaps two different years.
- */
- isYearOverlapWeek : function(weekBeginDate) {
- var overlaps = false;
- var nextWeek = this.add(weekBeginDate, this.DAY, 6);
- if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {
- overlaps = true;
- }
- return overlaps;
- },
-
- /**
- * Determines if a given week overlaps two different months.
- * @method isMonthOverlapWeek
- * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
- * @return {Boolean} true if the date overlaps two different months.
- */
- isMonthOverlapWeek : function(weekBeginDate) {
- var overlaps = false;
- var nextWeek = this.add(weekBeginDate, this.DAY, 6);
- if (nextWeek.getMonth() != weekBeginDate.getMonth()) {
- overlaps = true;
- }
- return overlaps;
- },
-
- /**
- * Gets the first day of a month containing a given date.
- * @method findMonthStart
- * @param {Date} date The JavaScript Date used to calculate the month start
- * @return {Date} The JavaScript Date representing the first day of the month
- */
- findMonthStart : function(date) {
- var start = new Date(date.getFullYear(), date.getMonth(), 1);
- return start;
- },
-
- /**
- * Gets the last day of a month containing a given date.
- * @method findMonthEnd
- * @param {Date} date The JavaScript Date used to calculate the month end
- * @return {Date} The JavaScript Date representing the last day of the month
- */
- findMonthEnd : function(date) {
- var start = this.findMonthStart(date);
- var nextMonth = this.add(start, this.MONTH, 1);
- var end = this.subtract(nextMonth, this.DAY, 1);
- return end;
- },
-
- /**
- * Clears the time fields from a given date, effectively setting the time to midnight.
- * @method clearTime
- * @param {Date} date The JavaScript Date for which the time fields will be cleared
- * @return {Date} The JavaScript Date cleared of all time fields
- */
- clearTime : function(date) {
- date.setHours(12,0,0,0);
- return date;
- }
-};
-
-/**
-* The Calendar component is a UI control that enables users to choose one or more dates from a graphical calendar presented in a one-month ("one-up") or two-month ("two-up") interface. Calendars are generated entirely via script and can be navigated without any page refreshes.
-* @module Calendar
-* @title Calendar Widget
-* @namespace YAHOO.widget
-* @requires yahoo,dom,event
-*/
-
-/**
-* Calendar is the base class for the Calendar widget. In its most basic
-* implementation, it has the ability to render a calendar widget on the page
-* that can be manipulated to select a single date, move back and forth between
-* months and years.
-* To construct the placeholder for the calendar widget, the code is as
-* follows:
-*
-*
-*
-* Note that the table can be replaced with any kind of element.
-*
-* @namespace YAHOO.widget
-* @class Calendar
-* @constructor
-* @param {String} id The id of the table element that will represent the calendar widget
-* @param {String} containerId The id of the container div element that will wrap the calendar table
-* @param {Object} config The configuration object containing the Calendar's arguments
-*/
-YAHOO.widget.Calendar = function(id, containerId, config) {
- this.init(id, containerId, config);
-};
-
-/**
-* The path to be used for images loaded for the Calendar
-* @property YAHOO.widget.Calendar.IMG_ROOT
-* @static
-* @type String
-*/
-YAHOO.widget.Calendar.IMG_ROOT = (window.location.href.toLowerCase().indexOf("https") === 0 ? "https://a248.e.akamai.net/sec.yimg.com/i/" : "http://us.i1.yimg.com/us.yimg.com/i/");
-
-/**
-* Type constant used for renderers to represent an individual date (M/D/Y)
-* @property YAHOO.widget.Calendar.DATE
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.DATE = "D";
-
-/**
-* Type constant used for renderers to represent an individual date across any year (M/D)
-* @property YAHOO.widget.Calendar.MONTH_DAY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.MONTH_DAY = "MD";
-
-/**
-* Type constant used for renderers to represent a weekday
-* @property YAHOO.widget.Calendar.WEEKDAY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.WEEKDAY = "WD";
-
-/**
-* Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)
-* @property YAHOO.widget.Calendar.RANGE
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.RANGE = "R";
-
-/**
-* Type constant used for renderers to represent a month across any year
-* @property YAHOO.widget.Calendar.MONTH
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.MONTH = "M";
-
-/**
-* Constant that represents the total number of date cells that are displayed in a given month
-* @property YAHOO.widget.Calendar.DISPLAY_DAYS
-* @static
-* @final
-* @type Number
-*/
-YAHOO.widget.Calendar.DISPLAY_DAYS = 42;
-
-/**
-* Constant used for halting the execution of the remainder of the render stack
-* @property YAHOO.widget.Calendar.STOP_RENDER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.STOP_RENDER = "S";
-
-YAHOO.widget.Calendar.prototype = {
-
- /**
- * The configuration object used to set up the calendars various locale and style options.
- * @property Config
- * @private
- * @deprecated Configuration properties should be set by calling Calendar.cfg.setProperty.
- * @type Object
- */
- Config : null,
-
- /**
- * The parent CalendarGroup, only to be set explicitly by the parent group
- * @property parent
- * @type CalendarGroup
- */
- parent : null,
-
- /**
- * The index of this item in the parent group
- * @property index
- * @type Number
- */
- index : -1,
-
- /**
- * The collection of calendar table cells
- * @property cells
- * @type HTMLTableCellElement[]
- */
- cells : null,
-
- /**
- * The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays in the format of [YYYY, M, D].
- * @property cellDates
- * @type Array[](Number[])
- */
- cellDates : null,
-
- /**
- * The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.
- * @property id
- * @type String
- */
- id : null,
-
- /**
- * The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.
- * @property oDomContainer
- * @type HTMLElement
- */
- oDomContainer : null,
-
- /**
- * A Date object representing today's date.
- * @property today
- * @type Date
- */
- today : null,
-
- /**
- * The list of render functions, along with required parameters, used to render cells.
- * @property renderStack
- * @type Array[]
- */
- renderStack : null,
-
- /**
- * A copy of the initial render functions created before rendering.
- * @property _renderStack
- * @private
- * @type Array
- */
- _renderStack : null,
-
- /**
- * A Date object representing the month/year that the calendar is initially set to
- * @property _pageDate
- * @private
- * @type Date
- */
- _pageDate : null,
-
- /**
- * The private list of initially selected dates.
- * @property _selectedDates
- * @private
- * @type Array
- */
- _selectedDates : null,
-
- /**
- * A map of DOM event handlers to attach to cells associated with specific CSS class names
- * @property domEventMap
- * @type Object
- */
- domEventMap : null
-};
-
-
-
-/**
-* Initializes the Calendar widget.
-* @method init
-* @param {String} id The id of the table element that will represent the calendar widget
-* @param {String} containerId The id of the container div element that will wrap the calendar table
-* @param {Object} config The configuration object containing the Calendar's arguments
-*/
-YAHOO.widget.Calendar.prototype.init = function(id, containerId, config) {
- this.logger = new YAHOO.widget.LogWriter("Calendar_Core " + id);
-
- this.initEvents();
- this.today = new Date();
- YAHOO.widget.DateMath.clearTime(this.today);
-
- this.id = id;
- this.oDomContainer = document.getElementById(containerId);
- if (! this.oDomContainer) {
- this.logger.log("No valid container present.", "error");
- }
-
- /**
- * The Config object used to hold the configuration variables for the Calendar
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- /**
- * The local object which contains the Calendar's options
- * @property Options
- * @type Object
- */
- this.Options = {};
-
- /**
- * The local object which contains the Calendar's locale settings
- * @property Locale
- * @type Object
- */
- this.Locale = {};
-
- this.initStyles();
-
- YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);
- YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);
-
- this.cellDates = [];
- this.cells = [];
- this.renderStack = [];
- this._renderStack = [];
-
- this.setupConfig();
-
- if (config) {
- this.cfg.applyConfig(config, true);
- }
-
- this.cfg.fireQueue();
-};
-
-/**
-* Renders the built-in IFRAME shim for the IE6 and below
-* @method configIframe
-*/
-YAHOO.widget.Calendar.prototype.configIframe = function(type, args, obj) {
- var useIframe = args[0];
-
- if (YAHOO.util.Dom.inDocument(this.oDomContainer)) {
- if (useIframe) {
- var pos = YAHOO.util.Dom.getStyle(this.oDomContainer, "position");
-
- if (this.browser == "ie" && (pos == "absolute" || pos == "relative")) {
- if (! YAHOO.util.Dom.inDocument(this.iframe)) {
- this.iframe = document.createElement("iframe");
- this.iframe.src = "javascript:false;";
- YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");
- this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);
- }
- }
- } else {
- if (this.iframe) {
- if (this.iframe.parentNode) {
- this.iframe.parentNode.removeChild(this.iframe);
- }
- this.iframe = null;
- }
- }
- }
-};
-
-/**
-* Default handler for the "title" property
-* @method configTitle
-*/
-YAHOO.widget.Calendar.prototype.configTitle = function(type, args, obj) {
- var title = args[0];
- var close = this.cfg.getProperty("close");
-
- var titleDiv;
-
- if (title && title !== "") {
- titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");
- titleDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;
- titleDiv.innerHTML = title;
- this.oDomContainer.insertBefore(titleDiv, this.oDomContainer.firstChild);
- YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
- } else {
- titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
-
- if (titleDiv) {
- YAHOO.util.Event.purgeElement(titleDiv);
- this.oDomContainer.removeChild(titleDiv);
- }
- if (! close) {
- YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
- }
- }
-};
-
-/**
-* Default handler for the "close" property
-* @method configClose
-*/
-YAHOO.widget.Calendar.prototype.configClose = function(type, args, obj) {
- var close = args[0];
- var title = this.cfg.getProperty("title");
-
- var linkClose;
-
- if (close === true) {
- linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || document.createElement("a");
- linkClose.href = "javascript:void(null);";
- linkClose.className = "link-close";
- YAHOO.util.Event.addListener(linkClose, "click", this.hide, this, true);
- var imgClose = document.createElement("img");
- imgClose.src = YAHOO.widget.Calendar.IMG_ROOT + "us/my/bn/x_d.gif";
- imgClose.className = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE;
- linkClose.appendChild(imgClose);
- this.oDomContainer.appendChild(linkClose);
- YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
- } else {
- linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || null;
-
- if (linkClose) {
- YAHOO.util.Event.purgeElement(linkClose);
- this.oDomContainer.removeChild(linkClose);
- }
- if (! title || title === "") {
- YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
- }
- }
-};
-
-/**
-* Initializes Calendar's built-in CustomEvents
-* @method initEvents
-*/
-YAHOO.widget.Calendar.prototype.initEvents = function() {
-
- /**
- * Fired before a selection is made
- * @event beforeSelectEvent
- */
- this.beforeSelectEvent = new YAHOO.util.CustomEvent("beforeSelect");
-
- /**
- * Fired when a selection is made
- * @event selectEvent
- * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
- */
- this.selectEvent = new YAHOO.util.CustomEvent("select");
-
- /**
- * Fired before a selection is made
- * @event beforeDeselectEvent
- */
- this.beforeDeselectEvent = new YAHOO.util.CustomEvent("beforeDeselect");
-
- /**
- * Fired when a selection is made
- * @event deselectEvent
- * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
- */
- this.deselectEvent = new YAHOO.util.CustomEvent("deselect");
-
- /**
- * Fired when the Calendar page is changed
- * @event changePageEvent
- */
- this.changePageEvent = new YAHOO.util.CustomEvent("changePage");
-
- /**
- * Fired before the Calendar is rendered
- * @event beforeRenderEvent
- */
- this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
-
- /**
- * Fired when the Calendar is rendered
- * @event renderEvent
- */
- this.renderEvent = new YAHOO.util.CustomEvent("render");
-
- /**
- * Fired when the Calendar is reset
- * @event resetEvent
- */
- this.resetEvent = new YAHOO.util.CustomEvent("reset");
-
- /**
- * Fired when the Calendar is cleared
- * @event clearEvent
- */
- this.clearEvent = new YAHOO.util.CustomEvent("clear");
-
- this.beforeSelectEvent.subscribe(this.onBeforeSelect, this, true);
- this.selectEvent.subscribe(this.onSelect, this, true);
- this.beforeDeselectEvent.subscribe(this.onBeforeDeselect, this, true);
- this.deselectEvent.subscribe(this.onDeselect, this, true);
- this.changePageEvent.subscribe(this.onChangePage, this, true);
- this.renderEvent.subscribe(this.onRender, this, true);
- this.resetEvent.subscribe(this.onReset, this, true);
- this.clearEvent.subscribe(this.onClear, this, true);
-};
-
-
-/**
-* The default event function that is attached to a date link within a calendar cell
-* when the calendar is rendered.
-* @method doSelectCell
-* @param {DOMEvent} e The event
-* @param {Calendar} cal A reference to the calendar passed by the Event utility
-*/
-YAHOO.widget.Calendar.prototype.doSelectCell = function(e, cal) {
- var target = YAHOO.util.Event.getTarget(e);
-
- var cell,index,d,date;
-
- while (target.tagName.toLowerCase() != "td" && ! YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
- target = target.parentNode;
- if (target.tagName.toLowerCase() == "html") {
- return;
- }
- }
-
- cell = target;
-
- if (YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
- index = cell.id.split("cell")[1];
- d = cal.cellDates[index];
- date = new Date(d[0],d[1]-1,d[2]);
-
- cal.logger.log("Selecting cell " + index + " via click", "info");
-
- if (cal.Options.MULTI_SELECT) {
- link = cell.getElementsByTagName("a")[0];
- if (link) {
- link.blur();
- }
-
- var cellDate = cal.cellDates[index];
- var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);
-
- if (cellDateIndex > -1) {
- cal.deselectCell(index);
- } else {
- cal.selectCell(index);
- }
-
- } else {
- link = cell.getElementsByTagName("a")[0];
- if (link) {
- link.blur();
- }
- cal.selectCell(index);
- }
- }
-};
-
-/**
-* The event that is executed when the user hovers over a cell
-* @method doCellMouseOver
-* @param {DOMEvent} e The event
-* @param {Calendar} cal A reference to the calendar passed by the Event utility
-*/
-YAHOO.widget.Calendar.prototype.doCellMouseOver = function(e, cal) {
- var target;
- if (e) {
- target = YAHOO.util.Event.getTarget(e);
- } else {
- target = this;
- }
-
- while (target.tagName.toLowerCase() != "td") {
- target = target.parentNode;
- if (target.tagName.toLowerCase() == "html") {
- return;
- }
- }
-
- if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
- YAHOO.util.Dom.addClass(target, cal.Style.CSS_CELL_HOVER);
- }
-};
-
-/**
-* The event that is executed when the user moves the mouse out of a cell
-* @method doCellMouseOut
-* @param {DOMEvent} e The event
-* @param {Calendar} cal A reference to the calendar passed by the Event utility
-*/
-YAHOO.widget.Calendar.prototype.doCellMouseOut = function(e, cal) {
- var target;
- if (e) {
- target = YAHOO.util.Event.getTarget(e);
- } else {
- target = this;
- }
-
- while (target.tagName.toLowerCase() != "td") {
- target = target.parentNode;
- if (target.tagName.toLowerCase() == "html") {
- return;
- }
- }
-
- if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
- YAHOO.util.Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
- }
-};
-
-YAHOO.widget.Calendar.prototype.setupConfig = function() {
-
- /**
- * The month/year representing the current visible Calendar date (mm/yyyy)
- * @config pagedate
- * @type String
- * @default today's date
- */
- this.cfg.addProperty("pagedate", { value:new Date(), handler:this.configPageDate } );
-
- /**
- * The date or range of dates representing the current Calendar selection
- * @config selected
- * @type String
- * @default []
- */
- this.cfg.addProperty("selected", { value:[], handler:this.configSelected } );
-
- /**
- * The title to display above the Calendar's month header
- * @config title
- * @type String
- * @default ""
- */
- this.cfg.addProperty("title", { value:"", handler:this.configTitle } );
-
- /**
- * Whether or not a close button should be displayed for this Calendar
- * @config close
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("close", { value:false, handler:this.configClose } );
-
- /**
- * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
- * @config iframe
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("iframe", { value:true, handler:this.configIframe, validator:this.cfg.checkBoolean } );
-
- /**
- * The minimum selectable date in the current Calendar (mm/dd/yyyy)
- * @config mindate
- * @type String
- * @default null
- */
- this.cfg.addProperty("mindate", { value:null, handler:this.configMinDate } );
-
- /**
- * The maximum selectable date in the current Calendar (mm/dd/yyyy)
- * @config maxdate
- * @type String
- * @default null
- */
- this.cfg.addProperty("maxdate", { value:null, handler:this.configMaxDate } );
-
-
- // Options properties
-
- /**
- * True if the Calendar should allow multiple selections. False by default.
- * @config MULTI_SELECT
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("MULTI_SELECT", { value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
-
- /**
- * The weekday the week begins on. Default is 0 (Sunday).
- * @config START_WEEKDAY
- * @type number
- * @default 0
- */
- this.cfg.addProperty("START_WEEKDAY", { value:0, handler:this.configOptions, validator:this.cfg.checkNumber } );
-
- /**
- * True if the Calendar should show weekday labels. True by default.
- * @config SHOW_WEEKDAYS
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("SHOW_WEEKDAYS", { value:true, handler:this.configOptions, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row headers. False by default.
- * @config SHOW_WEEK_HEADER
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("SHOW_WEEK_HEADER",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row footers. False by default.
- * @config SHOW_WEEK_FOOTER
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("SHOW_WEEK_FOOTER",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
- * @config HIDE_BLANK_WEEKS
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("HIDE_BLANK_WEEKS",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
-
- /**
- * The image that should be used for the left navigation arrow.
- * @config NAV_ARROW_LEFT
- * @type String
- * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif"
- */
- this.cfg.addProperty("NAV_ARROW_LEFT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif", handler:this.configOptions } );
-
- /**
- * The image that should be used for the left navigation arrow.
- * @config NAV_ARROW_RIGHT
- * @type String
- * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif"
- */
- this.cfg.addProperty("NAV_ARROW_RIGHT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif", handler:this.configOptions } );
-
- // Locale properties
-
- /**
- * The short month labels for the current locale.
- * @config MONTHS_SHORT
- * @type String[]
- * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
- */
- this.cfg.addProperty("MONTHS_SHORT", { value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], handler:this.configLocale } );
-
- /**
- * The long month labels for the current locale.
- * @config MONTHS_LONG
- * @type String[]
- * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
- */
- this.cfg.addProperty("MONTHS_LONG", { value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], handler:this.configLocale } );
-
- /**
- * The 1-character weekday labels for the current locale.
- * @config WEEKDAYS_1CHAR
- * @type String[]
- * @default ["S", "M", "T", "W", "T", "F", "S"]
- */
- this.cfg.addProperty("WEEKDAYS_1CHAR", { value:["S", "M", "T", "W", "T", "F", "S"], handler:this.configLocale } );
-
- /**
- * The short weekday labels for the current locale.
- * @config WEEKDAYS_SHORT
- * @type String[]
- * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
- */
- this.cfg.addProperty("WEEKDAYS_SHORT", { value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], handler:this.configLocale } );
-
- /**
- * The medium weekday labels for the current locale.
- * @config WEEKDAYS_MEDIUM
- * @type String[]
- * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
- */
- this.cfg.addProperty("WEEKDAYS_MEDIUM", { value:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], handler:this.configLocale } );
-
- /**
- * The long weekday labels for the current locale.
- * @config WEEKDAYS_LONG
- * @type String[]
- * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
- */
- this.cfg.addProperty("WEEKDAYS_LONG", { value:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], handler:this.configLocale } );
-
- /**
- * Refreshes the locale values used to build the Calendar.
- * @method refreshLocale
- * @private
- */
- var refreshLocale = function() {
- this.cfg.refireEvent("LOCALE_MONTHS");
- this.cfg.refireEvent("LOCALE_WEEKDAYS");
- };
-
- this.cfg.subscribeToConfigEvent("START_WEEKDAY", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("MONTHS_SHORT", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("MONTHS_LONG", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("WEEKDAYS_1CHAR", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("WEEKDAYS_SHORT", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("WEEKDAYS_MEDIUM", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("WEEKDAYS_LONG", refreshLocale, this, true);
-
- /**
- * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
- * @config LOCALE_MONTHS
- * @type String
- * @default "long"
- */
- this.cfg.addProperty("LOCALE_MONTHS", { value:"long", handler:this.configLocaleValues } );
-
- /**
- * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
- * @config LOCALE_WEEKDAYS
- * @type String
- * @default "short"
- */
- this.cfg.addProperty("LOCALE_WEEKDAYS", { value:"short", handler:this.configLocaleValues } );
-
- /**
- * The value used to delimit individual dates in a date string passed to various Calendar functions.
- * @config DATE_DELIMITER
- * @type String
- * @default ","
- */
- this.cfg.addProperty("DATE_DELIMITER", { value:",", handler:this.configLocale } );
-
- /**
- * The value used to delimit date fields in a date string passed to various Calendar functions.
- * @config DATE_FIELD_DELIMITER
- * @type String
- * @default "/"
- */
- this.cfg.addProperty("DATE_FIELD_DELIMITER",{ value:"/", handler:this.configLocale } );
-
- /**
- * The value used to delimit date ranges in a date string passed to various Calendar functions.
- * @config DATE_RANGE_DELIMITER
- * @type String
- * @default "-"
- */
- this.cfg.addProperty("DATE_RANGE_DELIMITER",{ value:"-", handler:this.configLocale } );
-
- /**
- * The position of the month in a month/year date string
- * @config MY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MY_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the year in a month/year date string
- * @config MY_YEAR_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MY_YEAR_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day date string
- * @config MD_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MD_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the day in a month/year date string
- * @config MD_DAY_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MD_DAY_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day/year date string
- * @config MDY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MDY_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the day in a month/day/year date string
- * @config MDY_DAY_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MDY_DAY_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the year in a month/day/year date string
- * @config MDY_YEAR_POSITION
- * @type Number
- * @default 3
- */
- this.cfg.addProperty("MDY_YEAR_POSITION", { value:3, handler:this.configLocale, validator:this.cfg.checkNumber } );
-};
-
-/**
-* The default handler for the "pagedate" property
-* @method configPageDate
-*/
-YAHOO.widget.Calendar.prototype.configPageDate = function(type, args, obj) {
- var val = args[0];
- var month, year, aMonthYear;
-
- if (val) {
- if (val instanceof Date) {
- val = YAHOO.widget.DateMath.findMonthStart(val);
- this.cfg.setProperty("pagedate", val, true);
- if (! this._pageDate) {
- this._pageDate = this.cfg.getProperty("pagedate");
- }
- return;
- } else {
- aMonthYear = val.split(this.cfg.getProperty("DATE_FIELD_DELIMITER"));
- month = parseInt(aMonthYear[this.cfg.getProperty("MY_MONTH_POSITION")-1], 10)-1;
- year = parseInt(aMonthYear[this.cfg.getProperty("MY_YEAR_POSITION")-1], 10);
- }
- } else {
- month = this.today.getMonth();
- year = this.today.getFullYear();
- }
-
- this.cfg.setProperty("pagedate", new Date(year, month, 1), true);
-
- this.logger.log("Set month/year to " + month + "/" + year, "info");
-
- if (! this._pageDate) {
- this._pageDate = this.cfg.getProperty("pagedate");
- }
-};
-
-/**
-* The default handler for the "mindate" property
-* @method configMinDate
-*/
-YAHOO.widget.Calendar.prototype.configMinDate = function(type, args, obj) {
- var val = args[0];
- if (typeof val == 'string') {
- val = this._parseDate(val);
- this.cfg.setProperty("mindate", new Date(val[0],(val[1]-1),val[2]));
- }
-};
-
-/**
-* The default handler for the "maxdate" property
-* @method configMaxDate
-*/
-YAHOO.widget.Calendar.prototype.configMaxDate = function(type, args, obj) {
- var val = args[0];
- if (typeof val == 'string') {
- val = this._parseDate(val);
- this.cfg.setProperty("maxdate", new Date(val[0],(val[1]-1),val[2]));
- }
-};
-
-/**
-* The default handler for the "selected" property
-* @method configSelected
-*/
-YAHOO.widget.Calendar.prototype.configSelected = function(type, args, obj) {
- var selected = args[0];
-
- if (selected) {
- if (typeof selected == 'string') {
- this.cfg.setProperty("selected", this._parseDates(selected), true);
- }
- }
- if (! this._selectedDates) {
- this._selectedDates = this.cfg.getProperty("selected");
- }
-};
-
-/**
-* The default handler for all configuration options properties
-* @method configOptions
-*/
-YAHOO.widget.Calendar.prototype.configOptions = function(type, args, obj) {
- type = type.toUpperCase();
- var val = args[0];
- this.Options[type] = val;
-};
-
-/**
-* The default handler for all configuration locale properties
-* @method configLocale
-*/
-YAHOO.widget.Calendar.prototype.configLocale = function(type, args, obj) {
- type = type.toUpperCase();
- var val = args[0];
- this.Locale[type] = val;
-
- this.cfg.refireEvent("LOCALE_MONTHS");
- this.cfg.refireEvent("LOCALE_WEEKDAYS");
-
-};
-
-/**
-* The default handler for all configuration locale field length properties
-* @method configLocaleValues
-*/
-YAHOO.widget.Calendar.prototype.configLocaleValues = function(type, args, obj) {
- type = type.toUpperCase();
- var val = args[0];
-
- switch (type) {
- case "LOCALE_MONTHS":
- switch (val) {
- case "short":
- this.Locale.LOCALE_MONTHS = this.cfg.getProperty("MONTHS_SHORT").concat();
- break;
- case "long":
- this.Locale.LOCALE_MONTHS = this.cfg.getProperty("MONTHS_LONG").concat();
- break;
- }
- break;
- case "LOCALE_WEEKDAYS":
- switch (val) {
- case "1char":
- this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_1CHAR").concat();
- break;
- case "short":
- this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_SHORT").concat();
- break;
- case "medium":
- this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_MEDIUM").concat();
- break;
- case "long":
- this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_LONG").concat();
- break;
- }
-
- var START_WEEKDAY = this.cfg.getProperty("START_WEEKDAY");
-
- if (START_WEEKDAY > 0) {
- for (var w=0;w";
- html[html.length] = "";
- html[html.length] = '';
- html[html.length] = ' ';
-
- if (this.cfg.getProperty("SHOW_WEEKDAYS")) {
- html = this.buildWeekdays(html);
- }
-
- html[html.length] = '';
-
- return html;
-};
-
-/**
-* Renders the Calendar's weekday headers.
-* @method buildWeekdays
-* @param {Array} html The current working HTML array
-* @return {Array} The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.buildWeekdays = function(html) {
-
- html[html.length] = '';
-
- if (this.cfg.getProperty("SHOW_WEEK_HEADER")) {
- html[html.length] = ' ';
- }
-
- for(var i=0;i' + this.Locale.LOCALE_WEEKDAYS[i] + '';
- }
-
- if (this.cfg.getProperty("SHOW_WEEK_FOOTER")) {
- html[html.length] = ' ';
- }
-
- html[html.length] = ' ';
-
- return html;
-};
-
-/**
-* Renders the calendar body.
-* @method renderBody
-* @param {Date} workingDate The current working Date being used for the render process
-* @param {Array} html The current working HTML array
-* @return {Array} The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.renderBody = function(workingDate, html) {
- this.logger.log("Rendering body", "info");
-
- var startDay = this.cfg.getProperty("START_WEEKDAY");
-
- this.preMonthDays = workingDate.getDay();
- if (startDay > 0) {
- this.preMonthDays -= startDay;
- }
- if (this.preMonthDays < 0) {
- this.preMonthDays += 7;
- }
-
- this.monthDays = YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();
- this.postMonthDays = YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;
-
- this.logger.log(this.preMonthDays + " preciding out-of-month days", "info");
- this.logger.log(this.monthDays + " month days", "info");
- this.logger.log(this.postMonthDays + " post-month days", "info");
-
- workingDate = YAHOO.widget.DateMath.subtract(workingDate, YAHOO.widget.DateMath.DAY, this.preMonthDays);
- this.logger.log("Calendar page starts on " + workingDate, "info");
-
- var useDate,weekNum,weekClass;
- useDate = this.cfg.getProperty("pagedate");
-
- html[html.length] = '';
-
- var i = 0;
-
- var tempDiv = document.createElement("div");
- var cell = document.createElement("td");
- tempDiv.appendChild(cell);
-
- var jan1 = new Date(useDate.getFullYear(),0,1);
-
- var cal = this.parent || this;
-
- for (var r=0;r<6;r++) {
-
- weekNum = YAHOO.widget.DateMath.getWeekNumber(workingDate, useDate.getFullYear(), startDay);
-
- weekClass = "w" + weekNum;
-
- if (r !== 0 && this.isDateOOM(workingDate) && this.cfg.getProperty("HIDE_BLANK_WEEKS") === true) {
- break;
- } else {
-
- html[html.length] = '';
-
- if (this.cfg.getProperty("SHOW_WEEK_HEADER")) { html = this.renderRowHeader(weekNum, html); }
-
- for (var d=0;d<7;d++){ // Render actual days
-
- var cellRenderers = [];
-
- this.clearElement(cell);
-
- YAHOO.util.Dom.addClass(cell, "calcell");
-
- cell.id = this.id + "_cell" + i;
- this.logger.log("Rendering cell " + cell.id + " (" + workingDate.getFullYear() + "-" + (workingDate.getMonth()+1) + "-" + workingDate.getDate() + ")", "cellrender");
-
- cell.innerHTML = i;
-
- var renderer = null;
-
- if (workingDate.getFullYear() == this.today.getFullYear() &&
- workingDate.getMonth() == this.today.getMonth() &&
- workingDate.getDate() == this.today.getDate()) {
- cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;
- }
-
- this.cellDates[this.cellDates.length]=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]; // Add this date to cellDates
-
- if (this.isDateOOM(workingDate)) {
- cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;
- } else {
-
- YAHOO.util.Dom.addClass(cell, "wd" + workingDate.getDay());
- YAHOO.util.Dom.addClass(cell, "d" + workingDate.getDate());
-
- for (var s=0;s= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
- renderer = rArray[2];
-
- if (workingDate.getTime()==d2.getTime()) {
- this.renderStack.splice(s,1);
- }
- }
- break;
- case YAHOO.widget.Calendar.WEEKDAY:
-
- var weekday = rArray[1][0];
- if (workingDate.getDay()+1 == weekday) {
- renderer = rArray[2];
- }
- break;
- case YAHOO.widget.Calendar.MONTH:
-
- month = rArray[1][0];
- if (workingDate.getMonth()+1 == month) {
- renderer = rArray[2];
- }
- break;
- }
-
- if (renderer) {
- cellRenderers[cellRenderers.length]=renderer;
- }
- }
-
- }
-
- if (this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]) > -1) {
- cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected;
- }
-
- var mindate = this.cfg.getProperty("mindate");
- var maxdate = this.cfg.getProperty("maxdate");
-
- if (mindate) {
- mindate = YAHOO.widget.DateMath.clearTime(mindate);
- }
- if (maxdate) {
- maxdate = YAHOO.widget.DateMath.clearTime(maxdate);
- }
-
- if (
- (mindate && (workingDate.getTime() < mindate.getTime())) ||
- (maxdate && (workingDate.getTime() > maxdate.getTime()))
- ) {
- cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;
- } else {
- cellRenderers[cellRenderers.length]=cal.styleCellDefault;
- cellRenderers[cellRenderers.length]=cal.renderCellDefault;
- }
-
-
-
- for (var x=0;x= 0 && i <= 6) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TOP);
- }
- if ((i % 7) === 0) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
- }
- if (((i+1) % 7) === 0) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);
- }
-
- var postDays = this.postMonthDays;
- if (postDays >= 7 && this.cfg.getProperty("HIDE_BLANK_WEEKS")) {
- var blankWeeks = Math.floor(postDays/7);
- for (var p=0;p= ((this.preMonthDays+postDays+this.monthDays)-7)) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
- }
-
- html[html.length] = tempDiv.innerHTML;
-
- i++;
- }
-
- if (this.cfg.getProperty("SHOW_WEEK_FOOTER")) { html = this.renderRowFooter(weekNum, html); }
-
- html[html.length] = ' ';
- }
- }
-
- html[html.length] = ' ';
-
- return html;
-};
-
-/**
-* Renders the calendar footer. In the default implementation, there is
-* no footer.
-* @method renderFooter
-* @param {Array} html The current working HTML array
-* @return {Array} The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.renderFooter = function(html) { return html; };
-
-/**
-* Renders the calendar after it has been configured. The render() method has a specific call chain that will execute
-* when the method is called: renderHeader, renderBody, renderFooter.
-* Refer to the documentation for those methods for information on
-* individual render tasks.
-* @method render
-*/
-YAHOO.widget.Calendar.prototype.render = function() {
- this.beforeRenderEvent.fire();
-
- // Find starting day of the current month
- var workingDate = YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty("pagedate"));
-
- this.resetRenderers();
- this.cellDates.length = 0;
-
- YAHOO.util.Event.purgeElement(this.oDomContainer, true);
-
- var html = [];
-
- html[html.length] = '';
- html = this.renderHeader(html);
- html = this.renderBody(workingDate, html);
- html = this.renderFooter(html);
- html[html.length] = '
';
-
- this.oDomContainer.innerHTML = html.join("\n");
-
- this.applyListeners();
- this.cells = this.oDomContainer.getElementsByTagName("td");
-
- this.cfg.refireEvent("title");
- this.cfg.refireEvent("close");
- this.cfg.refireEvent("iframe");
-
- this.renderEvent.fire();
-};
-
-/**
-* Applies the Calendar's DOM listeners to applicable elements.
-* @method applyListeners
-*/
-YAHOO.widget.Calendar.prototype.applyListeners = function() {
-
- var root = this.oDomContainer;
- var cal = this.parent || this;
-
- var linkLeft, linkRight;
-
- linkLeft = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, "a", root);
- linkRight = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, "a", root);
-
- if (linkLeft) {
- this.linkLeft = linkLeft[0];
- YAHOO.util.Event.addListener(this.linkLeft, "mousedown", cal.previousMonth, cal, true);
- }
-
- if (linkRight) {
- this.linkRight = linkRight[0];
- YAHOO.util.Event.addListener(this.linkRight, "mousedown", cal.nextMonth, cal, true);
- }
-
- if (this.domEventMap) {
- var el,elements;
- for (var cls in this.domEventMap) {
- if (this.domEventMap.hasOwnProperty(cls)) {
- var items = this.domEventMap[cls];
-
- if (! (items instanceof Array)) {
- items = [items];
- }
-
- for (var i=0;i' + weekNum + '';
- return html;
-};
-
-/**
-* Renders the row footer for a week.
-* @method renderRowFooter
-* @param {Number} weekNum The week number of the current row
-* @param {Array} cell The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.renderRowFooter = function(weekNum, html) {
- html[html.length] = '';
- return html;
-};
-
-/**
-* Renders a single standard calendar cell in the calendar widget table.
-* All logic for determining how a standard default cell will be rendered is
-* encapsulated in this method, and must be accounted for when extending the
-* widget class.
-* @method renderCellDefault
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellDefault = function(workingDate, cell) {
- cell.innerHTML = '' + this.buildDayLabel(workingDate) + " ";
-};
-
-/**
-* Styles a selectable cell.
-* @method styleCellDefault
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.styleCellDefault = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTABLE);
-};
-
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight1 style
-* @method renderCellStyleHighlight1
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight1 = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);
-};
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight2 style
-* @method renderCellStyleHighlight2
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight2 = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);
-};
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight3 style
-* @method renderCellStyleHighlight3
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight3 = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);
-};
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight4 style
-* @method renderCellStyleHighlight4
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight4 = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
-};
-
-/**
-* Applies the default style used for rendering today's date to the current calendar cell
-* @method renderCellStyleToday
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleToday = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TODAY);
-};
-
-/**
-* Applies the default style used for rendering selected dates to the current calendar cell
-* @method renderCellStyleSelected
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
-* should not be terminated
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleSelected = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);
-};
-
-/**
-* Applies the default style used for rendering dates that are not a part of the current
-* month (preceding or trailing the cells for the current month)
-* @method renderCellNotThisMonth
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
-* should not be terminated
-*/
-YAHOO.widget.Calendar.prototype.renderCellNotThisMonth = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);
- cell.innerHTML=workingDate.getDate();
- return YAHOO.widget.Calendar.STOP_RENDER;
-};
-
-/**
-* Renders the current calendar cell as a non-selectable "black-out" date using the default
-* restricted style.
-* @method renderBodyCellRestricted
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
-* should not be terminated
-*/
-YAHOO.widget.Calendar.prototype.renderBodyCellRestricted = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
- cell.innerHTML=workingDate.getDate();
- return YAHOO.widget.Calendar.STOP_RENDER;
-};
-
-// END BUILT-IN TABLE CELL RENDERERS
-
-// BEGIN MONTH NAVIGATION METHODS
-
-/**
-* Adds the designated number of months to the current calendar month, and sets the current
-* calendar page date to the new month.
-* @method addMonths
-* @param {Number} count The number of months to add to the current calendar
-*/
-YAHOO.widget.Calendar.prototype.addMonths = function(count) {
- this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.MONTH, count));
- this.resetRenderers();
- this.changePageEvent.fire();
-};
-
-/**
-* Subtracts the designated number of months from the current calendar month, and sets the current
-* calendar page date to the new month.
-* @method subtractMonths
-* @param {Number} count The number of months to subtract from the current calendar
-*/
-YAHOO.widget.Calendar.prototype.subtractMonths = function(count) {
- this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.MONTH, count));
- this.resetRenderers();
- this.changePageEvent.fire();
-};
-
-/**
-* Adds the designated number of years to the current calendar, and sets the current
-* calendar page date to the new month.
-* @method addYears
-* @param {Number} count The number of years to add to the current calendar
-*/
-YAHOO.widget.Calendar.prototype.addYears = function(count) {
- this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.YEAR, count));
- this.resetRenderers();
- this.changePageEvent.fire();
-};
-
-/**
-* Subtcats the designated number of years from the current calendar, and sets the current
-* calendar page date to the new month.
-* @method subtractYears
-* @param {Number} count The number of years to subtract from the current calendar
-*/
-YAHOO.widget.Calendar.prototype.subtractYears = function(count) {
- this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.YEAR, count));
- this.resetRenderers();
- this.changePageEvent.fire();
-};
-
-/**
-* Navigates to the next month page in the calendar widget.
-* @method nextMonth
-*/
-YAHOO.widget.Calendar.prototype.nextMonth = function() {
- this.addMonths(1);
-};
-
-/**
-* Navigates to the previous month page in the calendar widget.
-* @method previousMonth
-*/
-YAHOO.widget.Calendar.prototype.previousMonth = function() {
- this.subtractMonths(1);
-};
-
-/**
-* Navigates to the next year in the currently selected month in the calendar widget.
-* @method nextYear
-*/
-YAHOO.widget.Calendar.prototype.nextYear = function() {
- this.addYears(1);
-};
-
-/**
-* Navigates to the previous year in the currently selected month in the calendar widget.
-* @method previousYear
-*/
-YAHOO.widget.Calendar.prototype.previousYear = function() {
- this.subtractYears(1);
-};
-
-// END MONTH NAVIGATION METHODS
-
-// BEGIN SELECTION METHODS
-
-/**
-* Resets the calendar widget to the originally selected month and year, and
-* sets the calendar to the initial selection(s).
-* @method reset
-*/
-YAHOO.widget.Calendar.prototype.reset = function() {
- this.cfg.resetProperty("selected");
- this.cfg.resetProperty("pagedate");
- this.resetEvent.fire();
-};
-
-/**
-* Clears the selected dates in the current calendar widget and sets the calendar
-* to the current month and year.
-* @method clear
-*/
-YAHOO.widget.Calendar.prototype.clear = function() {
- this.cfg.setProperty("selected", []);
- this.cfg.setProperty("pagedate", new Date(this.today.getTime()));
- this.clearEvent.fire();
-};
-
-/**
-* Selects a date or a collection of dates on the current calendar. This method, by default,
-* does not call the render method explicitly. Once selection has completed, render must be
-* called for the changes to be reflected visually.
-* @method select
-* @param {String/Date/Date[]} date The date string of dates to select in the current calendar. Valid formats are
-* individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
-* Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
-* This method can also take a JavaScript Date object or an array of Date objects.
-* @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
-*/
-YAHOO.widget.Calendar.prototype.select = function(date) {
- this.logger.log("Select: " + date, "info");
-
- this.beforeSelectEvent.fire();
-
- var selected = this.cfg.getProperty("selected");
- var aToBeSelected = this._toFieldArray(date);
- this.logger.log("Selection field array: " + aToBeSelected, "info");
-
- for (var a=0;a -1) {
- if (this.cfg.getProperty("pagedate").getMonth() == dCellDate.getMonth() &&
- this.cfg.getProperty("pagedate").getFullYear() == dCellDate.getFullYear()) {
- YAHOO.util.Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
- }
-
- selected.splice(cellDateIndex, 1);
- }
-
-
- if (this.parent) {
- this.parent.cfg.setProperty("selected", selected);
- } else {
- this.cfg.setProperty("selected", selected);
- }
-
- this.deselectEvent.fire(selectDate);
- return this.getSelectedDates();
-};
-
-/**
-* Deselects all dates on the current calendar.
-* @method deselectAll
-* @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
-* Assuming that this function executes properly, the return value should be an empty array.
-* However, the empty array is returned for the sake of being able to check the selection status
-* of the calendar.
-*/
-YAHOO.widget.Calendar.prototype.deselectAll = function() {
- this.beforeDeselectEvent.fire();
-
- var selected = this.cfg.getProperty("selected");
- var count = selected.length;
- var sel = selected.concat();
-
- if (this.parent) {
- this.parent.cfg.setProperty("selected", []);
- } else {
- this.cfg.setProperty("selected", []);
- }
-
- if (count > 0) {
- this.deselectEvent.fire(sel);
- }
-
- return this.getSelectedDates();
-};
-
-// END SELECTION METHODS
-
-// BEGIN TYPE CONVERSION METHODS
-
-/**
-* Converts a date (either a JavaScript Date object, or a date string) to the internal data structure
-* used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].
-* @method _toFieldArray
-* @private
-* @param {String/Date/Date[]} date The date string of dates to deselect in the current calendar. Valid formats are
-* individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
-* Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
-* This method can also take a JavaScript Date object or an array of Date objects.
-* @return {Array[](Number[])} Array of date field arrays
-*/
-YAHOO.widget.Calendar.prototype._toFieldArray = function(date) {
- var returnDate = [];
-
- if (date instanceof Date) {
- returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];
- } else if (typeof date == 'string') {
- returnDate = this._parseDates(date);
- } else if (date instanceof Array) {
- for (var i=0;i
-*
-*
-*
-* The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.
-* @namespace YAHOO.widget
-* @class CalendarGroup
-* @constructor
-* @param {String} id The id of the table element that will represent the calendar widget
-* @param {String} containerId The id of the container div element that will wrap the calendar table
-* @param {Object} config The configuration object containing the Calendar's arguments
-*/
-YAHOO.widget.CalendarGroup = function(id, containerId, config) {
- if (arguments.length > 0) {
- this.init(id, containerId, config);
- }
-};
-
-/**
-* Initializes the calendar group. All subclasses must call this method in order for the
-* group to be initialized properly.
-* @method init
-* @param {String} id The id of the table element that will represent the calendar widget
-* @param {String} containerId The id of the container div element that will wrap the calendar table
-* @param {Object} config The configuration object containing the Calendar's arguments
-*/
-YAHOO.widget.CalendarGroup.prototype.init = function(id, containerId, config) {
- this.logger = new YAHOO.widget.LogWriter("CalendarGroup " + id);
-
- this.initEvents();
- this.initStyles();
-
- /**
- * The collection of Calendar pages contained within the CalendarGroup
- * @property pages
- * @type YAHOO.widget.Calendar[]
- */
- this.pages = [];
-
- /**
- * The unique id associated with the CalendarGroup
- * @property id
- * @type String
- */
- this.id = id;
-
- /**
- * The unique id associated with the CalendarGroup container
- * @property containerId
- * @type String
- */
- this.containerId = containerId;
-
- /**
- * The outer containing element for the CalendarGroup
- * @property oDomContainer
- * @type HTMLElement
- */
- this.oDomContainer = document.getElementById(containerId);
-
- YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_CONTAINER);
- YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_MULTI_UP);
-
- /**
- * The Config object used to hold the configuration variables for the CalendarGroup
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- /**
- * The local object which contains the CalendarGroup's options
- * @property Options
- * @type Object
- */
- this.Options = {};
-
- /**
- * The local object which contains the CalendarGroup's locale settings
- * @property Locale
- * @type Object
- */
- this.Locale = {};
-
- this.setupConfig();
-
- if (config) {
- this.cfg.applyConfig(config, true);
- }
-
- this.cfg.fireQueue();
-
- // OPERA HACK FOR MISWRAPPED FLOATS
- if (this.browser == "opera"){
- var fixWidth = function() {
- var startW = this.oDomContainer.offsetWidth;
- var w = 0;
- for (var p=0;p 0) {
- this.oDomContainer.style.width = w + "px";
- }
- };
- this.renderEvent.subscribe(fixWidth,this,true);
- }
-
- this.logger.log("Initialized " + pageCount + "-page CalendarGroup", "info");
-};
-
-
-YAHOO.widget.CalendarGroup.prototype.setupConfig = function() {
- /**
- * The number of pages to include in the CalendarGroup. This value can only be set once, in the CalendarGroup's constructor arguments.
- * @config pages
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("pages", { value:2, validator:this.cfg.checkNumber, handler:this.configPages } );
-
- /**
- * The month/year representing the current visible Calendar date (mm/yyyy)
- * @config pagedate
- * @type String
- * @default today's date
- */
- this.cfg.addProperty("pagedate", { value:new Date(), handler:this.configPageDate } );
-
- /**
- * The date or range of dates representing the current Calendar selection
- * @config selected
- * @type String
- * @default []
- */
- this.cfg.addProperty("selected", { value:[], handler:this.delegateConfig } );
-
- /**
- * The title to display above the CalendarGroup's month header
- * @config title
- * @type String
- * @default ""
- */
- this.cfg.addProperty("title", { value:"", handler:this.configTitle } );
-
- /**
- * Whether or not a close button should be displayed for this CalendarGroup
- * @config close
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("close", { value:false, handler:this.configClose } );
-
- /**
- * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
- * @config iframe
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("iframe", { value:true, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * The minimum selectable date in the current Calendar (mm/dd/yyyy)
- * @config mindate
- * @type String
- * @default null
- */
- this.cfg.addProperty("mindate", { value:null, handler:this.delegateConfig } );
-
- /**
- * The maximum selectable date in the current Calendar (mm/dd/yyyy)
- * @config maxdate
- * @type String
- * @default null
- */
- this.cfg.addProperty("maxdate", { value:null, handler:this.delegateConfig } );
-
- // Options properties
-
- /**
- * True if the Calendar should allow multiple selections. False by default.
- * @config MULTI_SELECT
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("MULTI_SELECT", { value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * The weekday the week begins on. Default is 0 (Sunday).
- * @config START_WEEKDAY
- * @type number
- * @default 0
- */
- this.cfg.addProperty("START_WEEKDAY", { value:0, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * True if the Calendar should show weekday labels. True by default.
- * @config SHOW_WEEKDAYS
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("SHOW_WEEKDAYS", { value:true, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row headers. False by default.
- * @config SHOW_WEEK_HEADER
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("SHOW_WEEK_HEADER",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row footers. False by default.
- * @config SHOW_WEEK_FOOTER
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("SHOW_WEEK_FOOTER",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
- * @config HIDE_BLANK_WEEKS
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("HIDE_BLANK_WEEKS",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * The image that should be used for the left navigation arrow.
- * @config NAV_ARROW_LEFT
- * @type String
- * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif"
- */
- this.cfg.addProperty("NAV_ARROW_LEFT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif", handler:this.delegateConfig } );
-
- /**
- * The image that should be used for the left navigation arrow.
- * @config NAV_ARROW_RIGHT
- * @type String
- * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif"
- */
- this.cfg.addProperty("NAV_ARROW_RIGHT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif", handler:this.delegateConfig } );
-
- // Locale properties
-
- /**
- * The short month labels for the current locale.
- * @config MONTHS_SHORT
- * @type String[]
- * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
- */
- this.cfg.addProperty("MONTHS_SHORT", { value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], handler:this.delegateConfig } );
-
- /**
- * The long month labels for the current locale.
- * @config MONTHS_LONG
- * @type String[]
- * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
- */
- this.cfg.addProperty("MONTHS_LONG", { value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], handler:this.delegateConfig } );
-
- /**
- * The 1-character weekday labels for the current locale.
- * @config WEEKDAYS_1CHAR
- * @type String[]
- * @default ["S", "M", "T", "W", "T", "F", "S"]
- */
- this.cfg.addProperty("WEEKDAYS_1CHAR", { value:["S", "M", "T", "W", "T", "F", "S"], handler:this.delegateConfig } );
-
- /**
- * The short weekday labels for the current locale.
- * @config WEEKDAYS_SHORT
- * @type String[]
- * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
- */
- this.cfg.addProperty("WEEKDAYS_SHORT", { value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], handler:this.delegateConfig } );
-
- /**
- * The medium weekday labels for the current locale.
- * @config WEEKDAYS_MEDIUM
- * @type String[]
- * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
- */
- this.cfg.addProperty("WEEKDAYS_MEDIUM", { value:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], handler:this.delegateConfig } );
-
- /**
- * The long weekday labels for the current locale.
- * @config WEEKDAYS_LONG
- * @type String[]
- * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
- */
- this.cfg.addProperty("WEEKDAYS_LONG", { value:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], handler:this.delegateConfig } );
-
- /**
- * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
- * @config LOCALE_MONTHS
- * @type String
- * @default "long"
- */
- this.cfg.addProperty("LOCALE_MONTHS", { value:"long", handler:this.delegateConfig } );
-
- /**
- * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
- * @config LOCALE_WEEKDAYS
- * @type String
- * @default "short"
- */
- this.cfg.addProperty("LOCALE_WEEKDAYS", { value:"short", handler:this.delegateConfig } );
-
- /**
- * The value used to delimit individual dates in a date string passed to various Calendar functions.
- * @config DATE_DELIMITER
- * @type String
- * @default ","
- */
- this.cfg.addProperty("DATE_DELIMITER", { value:",", handler:this.delegateConfig } );
-
- /**
- * The value used to delimit date fields in a date string passed to various Calendar functions.
- * @config DATE_FIELD_DELIMITER
- * @type String
- * @default "/"
- */
- this.cfg.addProperty("DATE_FIELD_DELIMITER",{ value:"/", handler:this.delegateConfig } );
-
- /**
- * The value used to delimit date ranges in a date string passed to various Calendar functions.
- * @config DATE_RANGE_DELIMITER
- * @type String
- * @default "-"
- */
- this.cfg.addProperty("DATE_RANGE_DELIMITER",{ value:"-", handler:this.delegateConfig } );
-
- /**
- * The position of the month in a month/year date string
- * @config MY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MY_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the year in a month/year date string
- * @config MY_YEAR_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MY_YEAR_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day date string
- * @config MD_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MD_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the day in a month/year date string
- * @config MD_DAY_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MD_DAY_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day/year date string
- * @config MDY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MDY_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the day in a month/day/year date string
- * @config MDY_DAY_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MDY_DAY_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the year in a month/day/year date string
- * @config MDY_YEAR_POSITION
- * @type Number
- * @default 3
- */
- this.cfg.addProperty("MDY_YEAR_POSITION", { value:3, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
-};
-
-/**
-* Initializes CalendarGroup's built-in CustomEvents
-* @method initEvents
-*/
-YAHOO.widget.CalendarGroup.prototype.initEvents = function() {
- var me = this;
-
- /**
- * Proxy subscriber to subscribe to the CalendarGroup's child Calendars' CustomEvents
- * @method sub
- * @private
- * @param {Function} fn The function to subscribe to this CustomEvent
- * @param {Object} obj The CustomEvent's scope object
- * @param {Boolean} bOverride Whether or not to apply scope correction
- */
- var sub = function(fn, obj, bOverride) {
- for (var p=0;p0) {
- year+=1;
- }
- cal.setYear(year);
- }
-};
-/**
-* Calls the render function of all child calendars within the group.
-* @method render
-*/
-YAHOO.widget.CalendarGroup.prototype.render = function() {
- this.renderHeader();
- for (var p=0;p=0;--p) {
- var cal = this.pages[p];
- cal.previousMonth();
- }
-};
-
-/**
-* Navigates to the next year in the currently selected month in the calendar widget.
-* @method nextYear
-*/
-YAHOO.widget.CalendarGroup.prototype.nextYear = function() {
- for (var p=0;p 11) {
+ while (newMonth > 11) {
+ newMonth -= 12;
+ years += 1;
+ }
+ }
+
+ d.setMonth(newMonth);
+ d.setFullYear(date.getFullYear() + years);
+ break;
+ case this.DAY:
+ d.setDate(date.getDate() + amount);
+ break;
+ case this.YEAR:
+ d.setFullYear(date.getFullYear() + amount);
+ break;
+ case this.WEEK:
+ d.setDate(date.getDate() + (amount * 7));
+ break;
+ }
+ return d;
+ },
+
+ /**
+ * Subtracts the specified amount of time from the this instance.
+ * @method subtract
+ * @param {Date} date The JavaScript Date object to perform subtraction on
+ * @param {Number} field The this field constant to be used for performing subtraction.
+ * @param {Number} amount The number of units (measured in the field constant) to subtract from the date.
+ * @return {Date} The resulting Date object
+ */
+ subtract : function(date, field, amount) {
+ return this.add(date, field, (amount*-1));
+ },
+
+ /**
+ * Determines whether a given date is before another date on the calendar.
+ * @method before
+ * @param {Date} date The Date object to compare with the compare argument
+ * @param {Date} compareTo The Date object to use for the comparison
+ * @return {Boolean} true if the date occurs before the compared date; false if not.
+ */
+ before : function(date, compareTo) {
+ var ms = compareTo.getTime();
+ if (date.getTime() < ms) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Determines whether a given date is after another date on the calendar.
+ * @method after
+ * @param {Date} date The Date object to compare with the compare argument
+ * @param {Date} compareTo The Date object to use for the comparison
+ * @return {Boolean} true if the date occurs after the compared date; false if not.
+ */
+ after : function(date, compareTo) {
+ var ms = compareTo.getTime();
+ if (date.getTime() > ms) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Determines whether a given date is between two other dates on the calendar.
+ * @method between
+ * @param {Date} date The date to check for
+ * @param {Date} dateBegin The start of the range
+ * @param {Date} dateEnd The end of the range
+ * @return {Boolean} true if the date occurs between the compared dates; false if not.
+ */
+ between : function(date, dateBegin, dateEnd) {
+ if (this.after(date, dateBegin) && this.before(date, dateEnd)) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Retrieves a JavaScript Date object representing January 1 of any given year.
+ * @method getJan1
+ * @param {Number} calendarYear The calendar year for which to retrieve January 1
+ * @return {Date} January 1 of the calendar year specified.
+ */
+ getJan1 : function(calendarYear) {
+ return new Date(calendarYear,0,1);
+ },
+
+ /**
+ * Calculates the number of days the specified date is from January 1 of the specified calendar year.
+ * Passing January 1 to this function would return an offset value of zero.
+ * @method getDayOffset
+ * @param {Date} date The JavaScript date for which to find the offset
+ * @param {Number} calendarYear The calendar year to use for determining the offset
+ * @return {Number} The number of days since January 1 of the given year
+ */
+ getDayOffset : function(date, calendarYear) {
+ var beginYear = this.getJan1(calendarYear); // Find the start of the year. This will be in week 1.
+
+ // Find the number of days the passed in date is away from the calendar year start
+ var dayOffset = Math.ceil((date.getTime()-beginYear.getTime()) / this.ONE_DAY_MS);
+ return dayOffset;
+ },
+
+ /**
+ * Calculates the week number for the given date. This function assumes that week 1 is the
+ * week in which January 1 appears, regardless of whether the week consists of a full 7 days.
+ * The calendar year can be specified to help find what a the week number would be for a given
+ * date if the date overlaps years. For instance, a week may be considered week 1 of 2005, or
+ * week 53 of 2004. Specifying the optional calendarYear allows one to make this distinction
+ * easily.
+ * @method getWeekNumber
+ * @param {Date} date The JavaScript date for which to find the week number
+ * @param {Number} calendarYear OPTIONAL - The calendar year to use for determining the week number. Default is
+ * the calendar year of parameter "date".
+ * @param {Number} weekStartsOn OPTIONAL - The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).
+ * @return {Number} The week number of the given date.
+ */
+ getWeekNumber : function(date, calendarYear) {
+ date = this.clearTime(date);
+ var nearestThurs = new Date(date.getTime() + (4 * this.ONE_DAY_MS) - ((date.getDay()) * this.ONE_DAY_MS));
+
+ var jan1 = new Date(nearestThurs.getFullYear(),0,1);
+ var dayOfYear = ((nearestThurs.getTime() - jan1.getTime()) / this.ONE_DAY_MS) - 1;
+
+ var weekNum = Math.ceil((dayOfYear)/ 7);
+ return weekNum;
+ },
+
+ /**
+ * Determines if a given week overlaps two different years.
+ * @method isYearOverlapWeek
+ * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
+ * @return {Boolean} true if the date overlaps two different years.
+ */
+ isYearOverlapWeek : function(weekBeginDate) {
+ var overlaps = false;
+ var nextWeek = this.add(weekBeginDate, this.DAY, 6);
+ if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {
+ overlaps = true;
+ }
+ return overlaps;
+ },
+
+ /**
+ * Determines if a given week overlaps two different months.
+ * @method isMonthOverlapWeek
+ * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
+ * @return {Boolean} true if the date overlaps two different months.
+ */
+ isMonthOverlapWeek : function(weekBeginDate) {
+ var overlaps = false;
+ var nextWeek = this.add(weekBeginDate, this.DAY, 6);
+ if (nextWeek.getMonth() != weekBeginDate.getMonth()) {
+ overlaps = true;
+ }
+ return overlaps;
+ },
+
+ /**
+ * Gets the first day of a month containing a given date.
+ * @method findMonthStart
+ * @param {Date} date The JavaScript Date used to calculate the month start
+ * @return {Date} The JavaScript Date representing the first day of the month
+ */
+ findMonthStart : function(date) {
+ var start = new Date(date.getFullYear(), date.getMonth(), 1);
+ return start;
+ },
+
+ /**
+ * Gets the last day of a month containing a given date.
+ * @method findMonthEnd
+ * @param {Date} date The JavaScript Date used to calculate the month end
+ * @return {Date} The JavaScript Date representing the last day of the month
+ */
+ findMonthEnd : function(date) {
+ var start = this.findMonthStart(date);
+ var nextMonth = this.add(start, this.MONTH, 1);
+ var end = this.subtract(nextMonth, this.DAY, 1);
+ return end;
+ },
+
+ /**
+ * Clears the time fields from a given date, effectively setting the time to midnight.
+ * @method clearTime
+ * @param {Date} date The JavaScript Date for which the time fields will be cleared
+ * @return {Date} The JavaScript Date cleared of all time fields
+ */
+ clearTime : function(date) {
+ date.setHours(12,0,0,0);
+ return date;
+ }
+};
+
+/**
+* The Calendar component is a UI control that enables users to choose one or more dates from a graphical calendar presented in a one-month ("one-up") or two-month ("two-up") interface. Calendars are generated entirely via script and can be navigated without any page refreshes.
+* @module Calendar
+* @title Calendar Widget
+* @namespace YAHOO.widget
+* @requires yahoo,dom,event
+*/
+
+/**
+* Calendar is the base class for the Calendar widget. In its most basic
+* implementation, it has the ability to render a calendar widget on the page
+* that can be manipulated to select a single date, move back and forth between
+* months and years.
+* To construct the placeholder for the calendar widget, the code is as
+* follows:
+*
+*
+*
+* Note that the table can be replaced with any kind of element.
+*
+* @namespace YAHOO.widget
+* @class Calendar
+* @constructor
+* @param {String} id The id of the table element that will represent the calendar widget
+* @param {String} containerId The id of the container div element that will wrap the calendar table
+* @param {Object} config The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.Calendar = function(id, containerId, config) {
+ this.init(id, containerId, config);
+};
+
+/**
+* The path to be used for images loaded for the Calendar
+* @property YAHOO.widget.Calendar.IMG_ROOT
+* @static
+* @type String
+*/
+YAHOO.widget.Calendar.IMG_ROOT = (window.location.href.toLowerCase().indexOf("https") === 0 ? "https://a248.e.akamai.net/sec.yimg.com/i/" : "http://us.i1.yimg.com/us.yimg.com/i/");
+
+/**
+* Type constant used for renderers to represent an individual date (M/D/Y)
+* @property YAHOO.widget.Calendar.DATE
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.DATE = "D";
+
+/**
+* Type constant used for renderers to represent an individual date across any year (M/D)
+* @property YAHOO.widget.Calendar.MONTH_DAY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.MONTH_DAY = "MD";
+
+/**
+* Type constant used for renderers to represent a weekday
+* @property YAHOO.widget.Calendar.WEEKDAY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.WEEKDAY = "WD";
+
+/**
+* Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)
+* @property YAHOO.widget.Calendar.RANGE
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.RANGE = "R";
+
+/**
+* Type constant used for renderers to represent a month across any year
+* @property YAHOO.widget.Calendar.MONTH
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.MONTH = "M";
+
+/**
+* Constant that represents the total number of date cells that are displayed in a given month
+* @property YAHOO.widget.Calendar.DISPLAY_DAYS
+* @static
+* @final
+* @type Number
+*/
+YAHOO.widget.Calendar.DISPLAY_DAYS = 42;
+
+/**
+* Constant used for halting the execution of the remainder of the render stack
+* @property YAHOO.widget.Calendar.STOP_RENDER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.STOP_RENDER = "S";
+
+YAHOO.widget.Calendar.prototype = {
+
+ /**
+ * The configuration object used to set up the calendars various locale and style options.
+ * @property Config
+ * @private
+ * @deprecated Configuration properties should be set by calling Calendar.cfg.setProperty.
+ * @type Object
+ */
+ Config : null,
+
+ /**
+ * The parent CalendarGroup, only to be set explicitly by the parent group
+ * @property parent
+ * @type CalendarGroup
+ */
+ parent : null,
+
+ /**
+ * The index of this item in the parent group
+ * @property index
+ * @type Number
+ */
+ index : -1,
+
+ /**
+ * The collection of calendar table cells
+ * @property cells
+ * @type HTMLTableCellElement[]
+ */
+ cells : null,
+
+ /**
+ * The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays in the format of [YYYY, M, D].
+ * @property cellDates
+ * @type Array[](Number[])
+ */
+ cellDates : null,
+
+ /**
+ * The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.
+ * @property id
+ * @type String
+ */
+ id : null,
+
+ /**
+ * The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.
+ * @property oDomContainer
+ * @type HTMLElement
+ */
+ oDomContainer : null,
+
+ /**
+ * A Date object representing today's date.
+ * @property today
+ * @type Date
+ */
+ today : null,
+
+ /**
+ * The list of render functions, along with required parameters, used to render cells.
+ * @property renderStack
+ * @type Array[]
+ */
+ renderStack : null,
+
+ /**
+ * A copy of the initial render functions created before rendering.
+ * @property _renderStack
+ * @private
+ * @type Array
+ */
+ _renderStack : null,
+
+ /**
+ * A Date object representing the month/year that the calendar is initially set to
+ * @property _pageDate
+ * @private
+ * @type Date
+ */
+ _pageDate : null,
+
+ /**
+ * The private list of initially selected dates.
+ * @property _selectedDates
+ * @private
+ * @type Array
+ */
+ _selectedDates : null,
+
+ /**
+ * A map of DOM event handlers to attach to cells associated with specific CSS class names
+ * @property domEventMap
+ * @type Object
+ */
+ domEventMap : null
+};
+
+
+
+/**
+* Initializes the Calendar widget.
+* @method init
+* @param {String} id The id of the table element that will represent the calendar widget
+* @param {String} containerId The id of the container div element that will wrap the calendar table
+* @param {Object} config The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.Calendar.prototype.init = function(id, containerId, config) {
+ this.logger = new YAHOO.widget.LogWriter("Calendar_Core " + id);
+
+ this.initEvents();
+ this.today = new Date();
+ YAHOO.widget.DateMath.clearTime(this.today);
+
+ this.id = id;
+ this.oDomContainer = document.getElementById(containerId);
+ if (! this.oDomContainer) {
+ this.logger.log("No valid container present.", "error");
+ }
+
+ /**
+ * The Config object used to hold the configuration variables for the Calendar
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ /**
+ * The local object which contains the Calendar's options
+ * @property Options
+ * @type Object
+ */
+ this.Options = {};
+
+ /**
+ * The local object which contains the Calendar's locale settings
+ * @property Locale
+ * @type Object
+ */
+ this.Locale = {};
+
+ this.initStyles();
+
+ YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);
+ YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);
+
+ this.cellDates = [];
+ this.cells = [];
+ this.renderStack = [];
+ this._renderStack = [];
+
+ this.setupConfig();
+
+ if (config) {
+ this.cfg.applyConfig(config, true);
+ }
+
+ this.cfg.fireQueue();
+};
+
+/**
+* Renders the built-in IFRAME shim for the IE6 and below
+* @method configIframe
+*/
+YAHOO.widget.Calendar.prototype.configIframe = function(type, args, obj) {
+ var useIframe = args[0];
+
+ if (YAHOO.util.Dom.inDocument(this.oDomContainer)) {
+ if (useIframe) {
+ var pos = YAHOO.util.Dom.getStyle(this.oDomContainer, "position");
+
+ if (this.browser == "ie" && (pos == "absolute" || pos == "relative")) {
+ if (! YAHOO.util.Dom.inDocument(this.iframe)) {
+ this.iframe = document.createElement("iframe");
+ this.iframe.src = "javascript:false;";
+ YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");
+ this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);
+ }
+ }
+ } else {
+ if (this.iframe) {
+ if (this.iframe.parentNode) {
+ this.iframe.parentNode.removeChild(this.iframe);
+ }
+ this.iframe = null;
+ }
+ }
+ }
+};
+
+/**
+* Default handler for the "title" property
+* @method configTitle
+*/
+YAHOO.widget.Calendar.prototype.configTitle = function(type, args, obj) {
+ var title = args[0];
+ var close = this.cfg.getProperty("close");
+
+ var titleDiv;
+
+ if (title && title !== "") {
+ titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");
+ titleDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;
+ titleDiv.innerHTML = title;
+ this.oDomContainer.insertBefore(titleDiv, this.oDomContainer.firstChild);
+ YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
+ } else {
+ titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
+
+ if (titleDiv) {
+ YAHOO.util.Event.purgeElement(titleDiv);
+ this.oDomContainer.removeChild(titleDiv);
+ }
+ if (! close) {
+ YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
+ }
+ }
+};
+
+/**
+* Default handler for the "close" property
+* @method configClose
+*/
+YAHOO.widget.Calendar.prototype.configClose = function(type, args, obj) {
+ var close = args[0];
+ var title = this.cfg.getProperty("title");
+
+ var linkClose;
+
+ if (close === true) {
+ linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || document.createElement("a");
+ linkClose.href = "javascript:void(null);";
+ linkClose.className = "link-close";
+ YAHOO.util.Event.addListener(linkClose, "click", this.hide, this, true);
+ var imgClose = document.createElement("img");
+ imgClose.src = YAHOO.widget.Calendar.IMG_ROOT + "us/my/bn/x_d.gif";
+ imgClose.className = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE;
+ linkClose.appendChild(imgClose);
+ this.oDomContainer.appendChild(linkClose);
+ YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
+ } else {
+ linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || null;
+
+ if (linkClose) {
+ YAHOO.util.Event.purgeElement(linkClose);
+ this.oDomContainer.removeChild(linkClose);
+ }
+ if (! title || title === "") {
+ YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
+ }
+ }
+};
+
+/**
+* Initializes Calendar's built-in CustomEvents
+* @method initEvents
+*/
+YAHOO.widget.Calendar.prototype.initEvents = function() {
+
+ /**
+ * Fired before a selection is made
+ * @event beforeSelectEvent
+ */
+ this.beforeSelectEvent = new YAHOO.util.CustomEvent("beforeSelect");
+
+ /**
+ * Fired when a selection is made
+ * @event selectEvent
+ * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
+ */
+ this.selectEvent = new YAHOO.util.CustomEvent("select");
+
+ /**
+ * Fired before a selection is made
+ * @event beforeDeselectEvent
+ */
+ this.beforeDeselectEvent = new YAHOO.util.CustomEvent("beforeDeselect");
+
+ /**
+ * Fired when a selection is made
+ * @event deselectEvent
+ * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
+ */
+ this.deselectEvent = new YAHOO.util.CustomEvent("deselect");
+
+ /**
+ * Fired when the Calendar page is changed
+ * @event changePageEvent
+ */
+ this.changePageEvent = new YAHOO.util.CustomEvent("changePage");
+
+ /**
+ * Fired before the Calendar is rendered
+ * @event beforeRenderEvent
+ */
+ this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
+
+ /**
+ * Fired when the Calendar is rendered
+ * @event renderEvent
+ */
+ this.renderEvent = new YAHOO.util.CustomEvent("render");
+
+ /**
+ * Fired when the Calendar is reset
+ * @event resetEvent
+ */
+ this.resetEvent = new YAHOO.util.CustomEvent("reset");
+
+ /**
+ * Fired when the Calendar is cleared
+ * @event clearEvent
+ */
+ this.clearEvent = new YAHOO.util.CustomEvent("clear");
+
+ this.beforeSelectEvent.subscribe(this.onBeforeSelect, this, true);
+ this.selectEvent.subscribe(this.onSelect, this, true);
+ this.beforeDeselectEvent.subscribe(this.onBeforeDeselect, this, true);
+ this.deselectEvent.subscribe(this.onDeselect, this, true);
+ this.changePageEvent.subscribe(this.onChangePage, this, true);
+ this.renderEvent.subscribe(this.onRender, this, true);
+ this.resetEvent.subscribe(this.onReset, this, true);
+ this.clearEvent.subscribe(this.onClear, this, true);
+};
+
+
+/**
+* The default event function that is attached to a date link within a calendar cell
+* when the calendar is rendered.
+* @method doSelectCell
+* @param {DOMEvent} e The event
+* @param {Calendar} cal A reference to the calendar passed by the Event utility
+*/
+YAHOO.widget.Calendar.prototype.doSelectCell = function(e, cal) {
+ var target = YAHOO.util.Event.getTarget(e);
+
+ var cell,index,d,date;
+
+ while (target.tagName.toLowerCase() != "td" && ! YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+ target = target.parentNode;
+ if (target.tagName.toLowerCase() == "html") {
+ return;
+ }
+ }
+
+ cell = target;
+
+ if (YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
+ index = cell.id.split("cell")[1];
+ d = cal.cellDates[index];
+ date = new Date(d[0],d[1]-1,d[2]);
+
+ cal.logger.log("Selecting cell " + index + " via click", "info");
+
+ if (cal.Options.MULTI_SELECT) {
+ link = cell.getElementsByTagName("a")[0];
+ if (link) {
+ link.blur();
+ }
+
+ var cellDate = cal.cellDates[index];
+ var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);
+
+ if (cellDateIndex > -1) {
+ cal.deselectCell(index);
+ } else {
+ cal.selectCell(index);
+ }
+
+ } else {
+ link = cell.getElementsByTagName("a")[0];
+ if (link) {
+ link.blur();
+ }
+ cal.selectCell(index);
+ }
+ }
+};
+
+/**
+* The event that is executed when the user hovers over a cell
+* @method doCellMouseOver
+* @param {DOMEvent} e The event
+* @param {Calendar} cal A reference to the calendar passed by the Event utility
+*/
+YAHOO.widget.Calendar.prototype.doCellMouseOver = function(e, cal) {
+ var target;
+ if (e) {
+ target = YAHOO.util.Event.getTarget(e);
+ } else {
+ target = this;
+ }
+
+ while (target.tagName.toLowerCase() != "td") {
+ target = target.parentNode;
+ if (target.tagName.toLowerCase() == "html") {
+ return;
+ }
+ }
+
+ if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+ YAHOO.util.Dom.addClass(target, cal.Style.CSS_CELL_HOVER);
+ }
+};
+
+/**
+* The event that is executed when the user moves the mouse out of a cell
+* @method doCellMouseOut
+* @param {DOMEvent} e The event
+* @param {Calendar} cal A reference to the calendar passed by the Event utility
+*/
+YAHOO.widget.Calendar.prototype.doCellMouseOut = function(e, cal) {
+ var target;
+ if (e) {
+ target = YAHOO.util.Event.getTarget(e);
+ } else {
+ target = this;
+ }
+
+ while (target.tagName.toLowerCase() != "td") {
+ target = target.parentNode;
+ if (target.tagName.toLowerCase() == "html") {
+ return;
+ }
+ }
+
+ if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+ YAHOO.util.Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
+ }
+};
+
+YAHOO.widget.Calendar.prototype.setupConfig = function() {
+
+ /**
+ * The month/year representing the current visible Calendar date (mm/yyyy)
+ * @config pagedate
+ * @type String
+ * @default today's date
+ */
+ this.cfg.addProperty("pagedate", { value:new Date(), handler:this.configPageDate } );
+
+ /**
+ * The date or range of dates representing the current Calendar selection
+ * @config selected
+ * @type String
+ * @default []
+ */
+ this.cfg.addProperty("selected", { value:[], handler:this.configSelected } );
+
+ /**
+ * The title to display above the Calendar's month header
+ * @config title
+ * @type String
+ * @default ""
+ */
+ this.cfg.addProperty("title", { value:"", handler:this.configTitle } );
+
+ /**
+ * Whether or not a close button should be displayed for this Calendar
+ * @config close
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("close", { value:false, handler:this.configClose } );
+
+ /**
+ * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
+ * @config iframe
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("iframe", { value:true, handler:this.configIframe, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The minimum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config mindate
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("mindate", { value:null, handler:this.configMinDate } );
+
+ /**
+ * The maximum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config maxdate
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("maxdate", { value:null, handler:this.configMaxDate } );
+
+
+ // Options properties
+
+ /**
+ * True if the Calendar should allow multiple selections. False by default.
+ * @config MULTI_SELECT
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("MULTI_SELECT", { value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The weekday the week begins on. Default is 0 (Sunday).
+ * @config START_WEEKDAY
+ * @type number
+ * @default 0
+ */
+ this.cfg.addProperty("START_WEEKDAY", { value:0, handler:this.configOptions, validator:this.cfg.checkNumber } );
+
+ /**
+ * True if the Calendar should show weekday labels. True by default.
+ * @config SHOW_WEEKDAYS
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("SHOW_WEEKDAYS", { value:true, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row headers. False by default.
+ * @config SHOW_WEEK_HEADER
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("SHOW_WEEK_HEADER",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row footers. False by default.
+ * @config SHOW_WEEK_FOOTER
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("SHOW_WEEK_FOOTER",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
+ * @config HIDE_BLANK_WEEKS
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("HIDE_BLANK_WEEKS",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The image that should be used for the left navigation arrow.
+ * @config NAV_ARROW_LEFT
+ * @type String
+ * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif"
+ */
+ this.cfg.addProperty("NAV_ARROW_LEFT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif", handler:this.configOptions } );
+
+ /**
+ * The image that should be used for the left navigation arrow.
+ * @config NAV_ARROW_RIGHT
+ * @type String
+ * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif"
+ */
+ this.cfg.addProperty("NAV_ARROW_RIGHT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif", handler:this.configOptions } );
+
+ // Locale properties
+
+ /**
+ * The short month labels for the current locale.
+ * @config MONTHS_SHORT
+ * @type String[]
+ * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+ */
+ this.cfg.addProperty("MONTHS_SHORT", { value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], handler:this.configLocale } );
+
+ /**
+ * The long month labels for the current locale.
+ * @config MONTHS_LONG
+ * @type String[]
+ * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+ */
+ this.cfg.addProperty("MONTHS_LONG", { value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], handler:this.configLocale } );
+
+ /**
+ * The 1-character weekday labels for the current locale.
+ * @config WEEKDAYS_1CHAR
+ * @type String[]
+ * @default ["S", "M", "T", "W", "T", "F", "S"]
+ */
+ this.cfg.addProperty("WEEKDAYS_1CHAR", { value:["S", "M", "T", "W", "T", "F", "S"], handler:this.configLocale } );
+
+ /**
+ * The short weekday labels for the current locale.
+ * @config WEEKDAYS_SHORT
+ * @type String[]
+ * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
+ */
+ this.cfg.addProperty("WEEKDAYS_SHORT", { value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], handler:this.configLocale } );
+
+ /**
+ * The medium weekday labels for the current locale.
+ * @config WEEKDAYS_MEDIUM
+ * @type String[]
+ * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
+ */
+ this.cfg.addProperty("WEEKDAYS_MEDIUM", { value:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], handler:this.configLocale } );
+
+ /**
+ * The long weekday labels for the current locale.
+ * @config WEEKDAYS_LONG
+ * @type String[]
+ * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
+ */
+ this.cfg.addProperty("WEEKDAYS_LONG", { value:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], handler:this.configLocale } );
+
+ /**
+ * Refreshes the locale values used to build the Calendar.
+ * @method refreshLocale
+ * @private
+ */
+ var refreshLocale = function() {
+ this.cfg.refireEvent("LOCALE_MONTHS");
+ this.cfg.refireEvent("LOCALE_WEEKDAYS");
+ };
+
+ this.cfg.subscribeToConfigEvent("START_WEEKDAY", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("MONTHS_SHORT", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("MONTHS_LONG", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("WEEKDAYS_1CHAR", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("WEEKDAYS_SHORT", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("WEEKDAYS_MEDIUM", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("WEEKDAYS_LONG", refreshLocale, this, true);
+
+ /**
+ * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
+ * @config LOCALE_MONTHS
+ * @type String
+ * @default "long"
+ */
+ this.cfg.addProperty("LOCALE_MONTHS", { value:"long", handler:this.configLocaleValues } );
+
+ /**
+ * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
+ * @config LOCALE_WEEKDAYS
+ * @type String
+ * @default "short"
+ */
+ this.cfg.addProperty("LOCALE_WEEKDAYS", { value:"short", handler:this.configLocaleValues } );
+
+ /**
+ * The value used to delimit individual dates in a date string passed to various Calendar functions.
+ * @config DATE_DELIMITER
+ * @type String
+ * @default ","
+ */
+ this.cfg.addProperty("DATE_DELIMITER", { value:",", handler:this.configLocale } );
+
+ /**
+ * The value used to delimit date fields in a date string passed to various Calendar functions.
+ * @config DATE_FIELD_DELIMITER
+ * @type String
+ * @default "/"
+ */
+ this.cfg.addProperty("DATE_FIELD_DELIMITER",{ value:"/", handler:this.configLocale } );
+
+ /**
+ * The value used to delimit date ranges in a date string passed to various Calendar functions.
+ * @config DATE_RANGE_DELIMITER
+ * @type String
+ * @default "-"
+ */
+ this.cfg.addProperty("DATE_RANGE_DELIMITER",{ value:"-", handler:this.configLocale } );
+
+ /**
+ * The position of the month in a month/year date string
+ * @config MY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MY_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/year date string
+ * @config MY_YEAR_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MY_YEAR_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day date string
+ * @config MD_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MD_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/year date string
+ * @config MD_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MD_DAY_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day/year date string
+ * @config MDY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MDY_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/day/year date string
+ * @config MDY_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MDY_DAY_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/day/year date string
+ * @config MDY_YEAR_POSITION
+ * @type Number
+ * @default 3
+ */
+ this.cfg.addProperty("MDY_YEAR_POSITION", { value:3, handler:this.configLocale, validator:this.cfg.checkNumber } );
+};
+
+/**
+* The default handler for the "pagedate" property
+* @method configPageDate
+*/
+YAHOO.widget.Calendar.prototype.configPageDate = function(type, args, obj) {
+ var val = args[0];
+ var month, year, aMonthYear;
+
+ if (val) {
+ if (val instanceof Date) {
+ val = YAHOO.widget.DateMath.findMonthStart(val);
+ this.cfg.setProperty("pagedate", val, true);
+ if (! this._pageDate) {
+ this._pageDate = this.cfg.getProperty("pagedate");
+ }
+ return;
+ } else {
+ aMonthYear = val.split(this.cfg.getProperty("DATE_FIELD_DELIMITER"));
+ month = parseInt(aMonthYear[this.cfg.getProperty("MY_MONTH_POSITION")-1], 10)-1;
+ year = parseInt(aMonthYear[this.cfg.getProperty("MY_YEAR_POSITION")-1], 10);
+ }
+ } else {
+ month = this.today.getMonth();
+ year = this.today.getFullYear();
+ }
+
+ this.cfg.setProperty("pagedate", new Date(year, month, 1), true);
+
+ this.logger.log("Set month/year to " + month + "/" + year, "info");
+
+ if (! this._pageDate) {
+ this._pageDate = this.cfg.getProperty("pagedate");
+ }
+};
+
+/**
+* The default handler for the "mindate" property
+* @method configMinDate
+*/
+YAHOO.widget.Calendar.prototype.configMinDate = function(type, args, obj) {
+ var val = args[0];
+ if (typeof val == 'string') {
+ val = this._parseDate(val);
+ this.cfg.setProperty("mindate", new Date(val[0],(val[1]-1),val[2]));
+ }
+};
+
+/**
+* The default handler for the "maxdate" property
+* @method configMaxDate
+*/
+YAHOO.widget.Calendar.prototype.configMaxDate = function(type, args, obj) {
+ var val = args[0];
+ if (typeof val == 'string') {
+ val = this._parseDate(val);
+ this.cfg.setProperty("maxdate", new Date(val[0],(val[1]-1),val[2]));
+ }
+};
+
+/**
+* The default handler for the "selected" property
+* @method configSelected
+*/
+YAHOO.widget.Calendar.prototype.configSelected = function(type, args, obj) {
+ var selected = args[0];
+
+ if (selected) {
+ if (typeof selected == 'string') {
+ this.cfg.setProperty("selected", this._parseDates(selected), true);
+ }
+ }
+ if (! this._selectedDates) {
+ this._selectedDates = this.cfg.getProperty("selected");
+ }
+};
+
+/**
+* The default handler for all configuration options properties
+* @method configOptions
+*/
+YAHOO.widget.Calendar.prototype.configOptions = function(type, args, obj) {
+ type = type.toUpperCase();
+ var val = args[0];
+ this.Options[type] = val;
+};
+
+/**
+* The default handler for all configuration locale properties
+* @method configLocale
+*/
+YAHOO.widget.Calendar.prototype.configLocale = function(type, args, obj) {
+ type = type.toUpperCase();
+ var val = args[0];
+ this.Locale[type] = val;
+
+ this.cfg.refireEvent("LOCALE_MONTHS");
+ this.cfg.refireEvent("LOCALE_WEEKDAYS");
+
+};
+
+/**
+* The default handler for all configuration locale field length properties
+* @method configLocaleValues
+*/
+YAHOO.widget.Calendar.prototype.configLocaleValues = function(type, args, obj) {
+ type = type.toUpperCase();
+ var val = args[0];
+
+ switch (type) {
+ case "LOCALE_MONTHS":
+ switch (val) {
+ case "short":
+ this.Locale.LOCALE_MONTHS = this.cfg.getProperty("MONTHS_SHORT").concat();
+ break;
+ case "long":
+ this.Locale.LOCALE_MONTHS = this.cfg.getProperty("MONTHS_LONG").concat();
+ break;
+ }
+ break;
+ case "LOCALE_WEEKDAYS":
+ switch (val) {
+ case "1char":
+ this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_1CHAR").concat();
+ break;
+ case "short":
+ this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_SHORT").concat();
+ break;
+ case "medium":
+ this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_MEDIUM").concat();
+ break;
+ case "long":
+ this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_LONG").concat();
+ break;
+ }
+
+ var START_WEEKDAY = this.cfg.getProperty("START_WEEKDAY");
+
+ if (START_WEEKDAY > 0) {
+ for (var w=0;w";
+ html[html.length] = "";
+ html[html.length] = '';
+ html[html.length] = ' ';
+
+ if (this.cfg.getProperty("SHOW_WEEKDAYS")) {
+ html = this.buildWeekdays(html);
+ }
+
+ html[html.length] = '';
+
+ return html;
+};
+
+/**
+* Renders the Calendar's weekday headers.
+* @method buildWeekdays
+* @param {Array} html The current working HTML array
+* @return {Array} The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.buildWeekdays = function(html) {
+
+ html[html.length] = '';
+
+ if (this.cfg.getProperty("SHOW_WEEK_HEADER")) {
+ html[html.length] = ' ';
+ }
+
+ for(var i=0;i' + this.Locale.LOCALE_WEEKDAYS[i] + '';
+ }
+
+ if (this.cfg.getProperty("SHOW_WEEK_FOOTER")) {
+ html[html.length] = ' ';
+ }
+
+ html[html.length] = ' ';
+
+ return html;
+};
+
+/**
+* Renders the calendar body.
+* @method renderBody
+* @param {Date} workingDate The current working Date being used for the render process
+* @param {Array} html The current working HTML array
+* @return {Array} The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.renderBody = function(workingDate, html) {
+ this.logger.log("Rendering body", "info");
+
+ var startDay = this.cfg.getProperty("START_WEEKDAY");
+
+ this.preMonthDays = workingDate.getDay();
+ if (startDay > 0) {
+ this.preMonthDays -= startDay;
+ }
+ if (this.preMonthDays < 0) {
+ this.preMonthDays += 7;
+ }
+
+ this.monthDays = YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();
+ this.postMonthDays = YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;
+
+ this.logger.log(this.preMonthDays + " preciding out-of-month days", "info");
+ this.logger.log(this.monthDays + " month days", "info");
+ this.logger.log(this.postMonthDays + " post-month days", "info");
+
+ workingDate = YAHOO.widget.DateMath.subtract(workingDate, YAHOO.widget.DateMath.DAY, this.preMonthDays);
+ this.logger.log("Calendar page starts on " + workingDate, "info");
+
+ var useDate,weekNum,weekClass;
+ useDate = this.cfg.getProperty("pagedate");
+
+ html[html.length] = '';
+
+ var i = 0;
+
+ var tempDiv = document.createElement("div");
+ var cell = document.createElement("td");
+ tempDiv.appendChild(cell);
+
+ var jan1 = new Date(useDate.getFullYear(),0,1);
+
+ var cal = this.parent || this;
+
+ for (var r=0;r<6;r++) {
+
+ weekNum = YAHOO.widget.DateMath.getWeekNumber(workingDate, useDate.getFullYear(), startDay);
+
+ weekClass = "w" + weekNum;
+
+ if (r !== 0 && this.isDateOOM(workingDate) && this.cfg.getProperty("HIDE_BLANK_WEEKS") === true) {
+ break;
+ } else {
+
+ html[html.length] = '';
+
+ if (this.cfg.getProperty("SHOW_WEEK_HEADER")) { html = this.renderRowHeader(weekNum, html); }
+
+ for (var d=0;d<7;d++){ // Render actual days
+
+ var cellRenderers = [];
+
+ this.clearElement(cell);
+
+ YAHOO.util.Dom.addClass(cell, "calcell");
+
+ cell.id = this.id + "_cell" + i;
+ this.logger.log("Rendering cell " + cell.id + " (" + workingDate.getFullYear() + "-" + (workingDate.getMonth()+1) + "-" + workingDate.getDate() + ")", "cellrender");
+
+ cell.innerHTML = i;
+
+ var renderer = null;
+
+ if (workingDate.getFullYear() == this.today.getFullYear() &&
+ workingDate.getMonth() == this.today.getMonth() &&
+ workingDate.getDate() == this.today.getDate()) {
+ cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;
+ }
+
+ this.cellDates[this.cellDates.length]=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]; // Add this date to cellDates
+
+ if (this.isDateOOM(workingDate)) {
+ cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;
+ } else {
+
+ YAHOO.util.Dom.addClass(cell, "wd" + workingDate.getDay());
+ YAHOO.util.Dom.addClass(cell, "d" + workingDate.getDate());
+
+ for (var s=0;s= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
+ renderer = rArray[2];
+
+ if (workingDate.getTime()==d2.getTime()) {
+ this.renderStack.splice(s,1);
+ }
+ }
+ break;
+ case YAHOO.widget.Calendar.WEEKDAY:
+
+ var weekday = rArray[1][0];
+ if (workingDate.getDay()+1 == weekday) {
+ renderer = rArray[2];
+ }
+ break;
+ case YAHOO.widget.Calendar.MONTH:
+
+ month = rArray[1][0];
+ if (workingDate.getMonth()+1 == month) {
+ renderer = rArray[2];
+ }
+ break;
+ }
+
+ if (renderer) {
+ cellRenderers[cellRenderers.length]=renderer;
+ }
+ }
+
+ }
+
+ if (this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]) > -1) {
+ cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected;
+ }
+
+ var mindate = this.cfg.getProperty("mindate");
+ var maxdate = this.cfg.getProperty("maxdate");
+
+ if (mindate) {
+ mindate = YAHOO.widget.DateMath.clearTime(mindate);
+ }
+ if (maxdate) {
+ maxdate = YAHOO.widget.DateMath.clearTime(maxdate);
+ }
+
+ if (
+ (mindate && (workingDate.getTime() < mindate.getTime())) ||
+ (maxdate && (workingDate.getTime() > maxdate.getTime()))
+ ) {
+ cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;
+ } else {
+ cellRenderers[cellRenderers.length]=cal.styleCellDefault;
+ cellRenderers[cellRenderers.length]=cal.renderCellDefault;
+ }
+
+
+
+ for (var x=0;x= 0 && i <= 6) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TOP);
+ }
+ if ((i % 7) === 0) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
+ }
+ if (((i+1) % 7) === 0) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);
+ }
+
+ var postDays = this.postMonthDays;
+ if (postDays >= 7 && this.cfg.getProperty("HIDE_BLANK_WEEKS")) {
+ var blankWeeks = Math.floor(postDays/7);
+ for (var p=0;p= ((this.preMonthDays+postDays+this.monthDays)-7)) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
+ }
+
+ html[html.length] = tempDiv.innerHTML;
+
+ i++;
+ }
+
+ if (this.cfg.getProperty("SHOW_WEEK_FOOTER")) { html = this.renderRowFooter(weekNum, html); }
+
+ html[html.length] = ' ';
+ }
+ }
+
+ html[html.length] = ' ';
+
+ return html;
+};
+
+/**
+* Renders the calendar footer. In the default implementation, there is
+* no footer.
+* @method renderFooter
+* @param {Array} html The current working HTML array
+* @return {Array} The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.renderFooter = function(html) { return html; };
+
+/**
+* Renders the calendar after it has been configured. The render() method has a specific call chain that will execute
+* when the method is called: renderHeader, renderBody, renderFooter.
+* Refer to the documentation for those methods for information on
+* individual render tasks.
+* @method render
+*/
+YAHOO.widget.Calendar.prototype.render = function() {
+ this.beforeRenderEvent.fire();
+
+ // Find starting day of the current month
+ var workingDate = YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty("pagedate"));
+
+ this.resetRenderers();
+ this.cellDates.length = 0;
+
+ YAHOO.util.Event.purgeElement(this.oDomContainer, true);
+
+ var html = [];
+
+ html[html.length] = '';
+ html = this.renderHeader(html);
+ html = this.renderBody(workingDate, html);
+ html = this.renderFooter(html);
+ html[html.length] = '
';
+
+ this.oDomContainer.innerHTML = html.join("\n");
+
+ this.applyListeners();
+ this.cells = this.oDomContainer.getElementsByTagName("td");
+
+ this.cfg.refireEvent("title");
+ this.cfg.refireEvent("close");
+ this.cfg.refireEvent("iframe");
+
+ this.renderEvent.fire();
+};
+
+/**
+* Applies the Calendar's DOM listeners to applicable elements.
+* @method applyListeners
+*/
+YAHOO.widget.Calendar.prototype.applyListeners = function() {
+
+ var root = this.oDomContainer;
+ var cal = this.parent || this;
+
+ var linkLeft, linkRight;
+
+ linkLeft = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, "a", root);
+ linkRight = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, "a", root);
+
+ if (linkLeft) {
+ this.linkLeft = linkLeft[0];
+ YAHOO.util.Event.addListener(this.linkLeft, "mousedown", cal.previousMonth, cal, true);
+ }
+
+ if (linkRight) {
+ this.linkRight = linkRight[0];
+ YAHOO.util.Event.addListener(this.linkRight, "mousedown", cal.nextMonth, cal, true);
+ }
+
+ if (this.domEventMap) {
+ var el,elements;
+ for (var cls in this.domEventMap) {
+ if (this.domEventMap.hasOwnProperty(cls)) {
+ var items = this.domEventMap[cls];
+
+ if (! (items instanceof Array)) {
+ items = [items];
+ }
+
+ for (var i=0;i' + weekNum + '';
+ return html;
+};
+
+/**
+* Renders the row footer for a week.
+* @method renderRowFooter
+* @param {Number} weekNum The week number of the current row
+* @param {Array} cell The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.renderRowFooter = function(weekNum, html) {
+ html[html.length] = '';
+ return html;
+};
+
+/**
+* Renders a single standard calendar cell in the calendar widget table.
+* All logic for determining how a standard default cell will be rendered is
+* encapsulated in this method, and must be accounted for when extending the
+* widget class.
+* @method renderCellDefault
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellDefault = function(workingDate, cell) {
+ cell.innerHTML = '' + this.buildDayLabel(workingDate) + " ";
+};
+
+/**
+* Styles a selectable cell.
+* @method styleCellDefault
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.styleCellDefault = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTABLE);
+};
+
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight1 style
+* @method renderCellStyleHighlight1
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight1 = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);
+};
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight2 style
+* @method renderCellStyleHighlight2
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight2 = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);
+};
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight3 style
+* @method renderCellStyleHighlight3
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight3 = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);
+};
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight4 style
+* @method renderCellStyleHighlight4
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight4 = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
+};
+
+/**
+* Applies the default style used for rendering today's date to the current calendar cell
+* @method renderCellStyleToday
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleToday = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TODAY);
+};
+
+/**
+* Applies the default style used for rendering selected dates to the current calendar cell
+* @method renderCellStyleSelected
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+* should not be terminated
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleSelected = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);
+};
+
+/**
+* Applies the default style used for rendering dates that are not a part of the current
+* month (preceding or trailing the cells for the current month)
+* @method renderCellNotThisMonth
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+* should not be terminated
+*/
+YAHOO.widget.Calendar.prototype.renderCellNotThisMonth = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);
+ cell.innerHTML=workingDate.getDate();
+ return YAHOO.widget.Calendar.STOP_RENDER;
+};
+
+/**
+* Renders the current calendar cell as a non-selectable "black-out" date using the default
+* restricted style.
+* @method renderBodyCellRestricted
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+* should not be terminated
+*/
+YAHOO.widget.Calendar.prototype.renderBodyCellRestricted = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
+ cell.innerHTML=workingDate.getDate();
+ return YAHOO.widget.Calendar.STOP_RENDER;
+};
+
+// END BUILT-IN TABLE CELL RENDERERS
+
+// BEGIN MONTH NAVIGATION METHODS
+
+/**
+* Adds the designated number of months to the current calendar month, and sets the current
+* calendar page date to the new month.
+* @method addMonths
+* @param {Number} count The number of months to add to the current calendar
+*/
+YAHOO.widget.Calendar.prototype.addMonths = function(count) {
+ this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.MONTH, count));
+ this.resetRenderers();
+ this.changePageEvent.fire();
+};
+
+/**
+* Subtracts the designated number of months from the current calendar month, and sets the current
+* calendar page date to the new month.
+* @method subtractMonths
+* @param {Number} count The number of months to subtract from the current calendar
+*/
+YAHOO.widget.Calendar.prototype.subtractMonths = function(count) {
+ this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.MONTH, count));
+ this.resetRenderers();
+ this.changePageEvent.fire();
+};
+
+/**
+* Adds the designated number of years to the current calendar, and sets the current
+* calendar page date to the new month.
+* @method addYears
+* @param {Number} count The number of years to add to the current calendar
+*/
+YAHOO.widget.Calendar.prototype.addYears = function(count) {
+ this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.YEAR, count));
+ this.resetRenderers();
+ this.changePageEvent.fire();
+};
+
+/**
+* Subtcats the designated number of years from the current calendar, and sets the current
+* calendar page date to the new month.
+* @method subtractYears
+* @param {Number} count The number of years to subtract from the current calendar
+*/
+YAHOO.widget.Calendar.prototype.subtractYears = function(count) {
+ this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.YEAR, count));
+ this.resetRenderers();
+ this.changePageEvent.fire();
+};
+
+/**
+* Navigates to the next month page in the calendar widget.
+* @method nextMonth
+*/
+YAHOO.widget.Calendar.prototype.nextMonth = function() {
+ this.addMonths(1);
+};
+
+/**
+* Navigates to the previous month page in the calendar widget.
+* @method previousMonth
+*/
+YAHOO.widget.Calendar.prototype.previousMonth = function() {
+ this.subtractMonths(1);
+};
+
+/**
+* Navigates to the next year in the currently selected month in the calendar widget.
+* @method nextYear
+*/
+YAHOO.widget.Calendar.prototype.nextYear = function() {
+ this.addYears(1);
+};
+
+/**
+* Navigates to the previous year in the currently selected month in the calendar widget.
+* @method previousYear
+*/
+YAHOO.widget.Calendar.prototype.previousYear = function() {
+ this.subtractYears(1);
+};
+
+// END MONTH NAVIGATION METHODS
+
+// BEGIN SELECTION METHODS
+
+/**
+* Resets the calendar widget to the originally selected month and year, and
+* sets the calendar to the initial selection(s).
+* @method reset
+*/
+YAHOO.widget.Calendar.prototype.reset = function() {
+ this.cfg.resetProperty("selected");
+ this.cfg.resetProperty("pagedate");
+ this.resetEvent.fire();
+};
+
+/**
+* Clears the selected dates in the current calendar widget and sets the calendar
+* to the current month and year.
+* @method clear
+*/
+YAHOO.widget.Calendar.prototype.clear = function() {
+ this.cfg.setProperty("selected", []);
+ this.cfg.setProperty("pagedate", new Date(this.today.getTime()));
+ this.clearEvent.fire();
+};
+
+/**
+* Selects a date or a collection of dates on the current calendar. This method, by default,
+* does not call the render method explicitly. Once selection has completed, render must be
+* called for the changes to be reflected visually.
+* @method select
+* @param {String/Date/Date[]} date The date string of dates to select in the current calendar. Valid formats are
+* individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+* Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+* This method can also take a JavaScript Date object or an array of Date objects.
+* @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
+*/
+YAHOO.widget.Calendar.prototype.select = function(date) {
+ this.logger.log("Select: " + date, "info");
+
+ this.beforeSelectEvent.fire();
+
+ var selected = this.cfg.getProperty("selected");
+ var aToBeSelected = this._toFieldArray(date);
+ this.logger.log("Selection field array: " + aToBeSelected, "info");
+
+ for (var a=0;a -1) {
+ if (this.cfg.getProperty("pagedate").getMonth() == dCellDate.getMonth() &&
+ this.cfg.getProperty("pagedate").getFullYear() == dCellDate.getFullYear()) {
+ YAHOO.util.Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
+ }
+
+ selected.splice(cellDateIndex, 1);
+ }
+
+
+ if (this.parent) {
+ this.parent.cfg.setProperty("selected", selected);
+ } else {
+ this.cfg.setProperty("selected", selected);
+ }
+
+ this.deselectEvent.fire(selectDate);
+ return this.getSelectedDates();
+};
+
+/**
+* Deselects all dates on the current calendar.
+* @method deselectAll
+* @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
+* Assuming that this function executes properly, the return value should be an empty array.
+* However, the empty array is returned for the sake of being able to check the selection status
+* of the calendar.
+*/
+YAHOO.widget.Calendar.prototype.deselectAll = function() {
+ this.beforeDeselectEvent.fire();
+
+ var selected = this.cfg.getProperty("selected");
+ var count = selected.length;
+ var sel = selected.concat();
+
+ if (this.parent) {
+ this.parent.cfg.setProperty("selected", []);
+ } else {
+ this.cfg.setProperty("selected", []);
+ }
+
+ if (count > 0) {
+ this.deselectEvent.fire(sel);
+ }
+
+ return this.getSelectedDates();
+};
+
+// END SELECTION METHODS
+
+// BEGIN TYPE CONVERSION METHODS
+
+/**
+* Converts a date (either a JavaScript Date object, or a date string) to the internal data structure
+* used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].
+* @method _toFieldArray
+* @private
+* @param {String/Date/Date[]} date The date string of dates to deselect in the current calendar. Valid formats are
+* individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+* Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+* This method can also take a JavaScript Date object or an array of Date objects.
+* @return {Array[](Number[])} Array of date field arrays
+*/
+YAHOO.widget.Calendar.prototype._toFieldArray = function(date) {
+ var returnDate = [];
+
+ if (date instanceof Date) {
+ returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];
+ } else if (typeof date == 'string') {
+ returnDate = this._parseDates(date);
+ } else if (date instanceof Array) {
+ for (var i=0;i
+*
+*
+*
+* The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.
+* @namespace YAHOO.widget
+* @class CalendarGroup
+* @constructor
+* @param {String} id The id of the table element that will represent the calendar widget
+* @param {String} containerId The id of the container div element that will wrap the calendar table
+* @param {Object} config The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.CalendarGroup = function(id, containerId, config) {
+ if (arguments.length > 0) {
+ this.init(id, containerId, config);
+ }
+};
+
+/**
+* Initializes the calendar group. All subclasses must call this method in order for the
+* group to be initialized properly.
+* @method init
+* @param {String} id The id of the table element that will represent the calendar widget
+* @param {String} containerId The id of the container div element that will wrap the calendar table
+* @param {Object} config The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.CalendarGroup.prototype.init = function(id, containerId, config) {
+ this.logger = new YAHOO.widget.LogWriter("CalendarGroup " + id);
+
+ this.initEvents();
+ this.initStyles();
+
+ /**
+ * The collection of Calendar pages contained within the CalendarGroup
+ * @property pages
+ * @type YAHOO.widget.Calendar[]
+ */
+ this.pages = [];
+
+ /**
+ * The unique id associated with the CalendarGroup
+ * @property id
+ * @type String
+ */
+ this.id = id;
+
+ /**
+ * The unique id associated with the CalendarGroup container
+ * @property containerId
+ * @type String
+ */
+ this.containerId = containerId;
+
+ /**
+ * The outer containing element for the CalendarGroup
+ * @property oDomContainer
+ * @type HTMLElement
+ */
+ this.oDomContainer = document.getElementById(containerId);
+
+ YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_CONTAINER);
+ YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_MULTI_UP);
+
+ /**
+ * The Config object used to hold the configuration variables for the CalendarGroup
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ /**
+ * The local object which contains the CalendarGroup's options
+ * @property Options
+ * @type Object
+ */
+ this.Options = {};
+
+ /**
+ * The local object which contains the CalendarGroup's locale settings
+ * @property Locale
+ * @type Object
+ */
+ this.Locale = {};
+
+ this.setupConfig();
+
+ if (config) {
+ this.cfg.applyConfig(config, true);
+ }
+
+ this.cfg.fireQueue();
+
+ // OPERA HACK FOR MISWRAPPED FLOATS
+ if (this.browser == "opera"){
+ var fixWidth = function() {
+ var startW = this.oDomContainer.offsetWidth;
+ var w = 0;
+ for (var p=0;p 0) {
+ this.oDomContainer.style.width = w + "px";
+ }
+ };
+ this.renderEvent.subscribe(fixWidth,this,true);
+ }
+
+ this.logger.log("Initialized " + pageCount + "-page CalendarGroup", "info");
+};
+
+
+YAHOO.widget.CalendarGroup.prototype.setupConfig = function() {
+ /**
+ * The number of pages to include in the CalendarGroup. This value can only be set once, in the CalendarGroup's constructor arguments.
+ * @config pages
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("pages", { value:2, validator:this.cfg.checkNumber, handler:this.configPages } );
+
+ /**
+ * The month/year representing the current visible Calendar date (mm/yyyy)
+ * @config pagedate
+ * @type String
+ * @default today's date
+ */
+ this.cfg.addProperty("pagedate", { value:new Date(), handler:this.configPageDate } );
+
+ /**
+ * The date or range of dates representing the current Calendar selection
+ * @config selected
+ * @type String
+ * @default []
+ */
+ this.cfg.addProperty("selected", { value:[], handler:this.delegateConfig } );
+
+ /**
+ * The title to display above the CalendarGroup's month header
+ * @config title
+ * @type String
+ * @default ""
+ */
+ this.cfg.addProperty("title", { value:"", handler:this.configTitle } );
+
+ /**
+ * Whether or not a close button should be displayed for this CalendarGroup
+ * @config close
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("close", { value:false, handler:this.configClose } );
+
+ /**
+ * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
+ * @config iframe
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("iframe", { value:true, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The minimum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config mindate
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("mindate", { value:null, handler:this.delegateConfig } );
+
+ /**
+ * The maximum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config maxdate
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("maxdate", { value:null, handler:this.delegateConfig } );
+
+ // Options properties
+
+ /**
+ * True if the Calendar should allow multiple selections. False by default.
+ * @config MULTI_SELECT
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("MULTI_SELECT", { value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The weekday the week begins on. Default is 0 (Sunday).
+ * @config START_WEEKDAY
+ * @type number
+ * @default 0
+ */
+ this.cfg.addProperty("START_WEEKDAY", { value:0, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * True if the Calendar should show weekday labels. True by default.
+ * @config SHOW_WEEKDAYS
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("SHOW_WEEKDAYS", { value:true, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row headers. False by default.
+ * @config SHOW_WEEK_HEADER
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("SHOW_WEEK_HEADER",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row footers. False by default.
+ * @config SHOW_WEEK_FOOTER
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("SHOW_WEEK_FOOTER",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
+ * @config HIDE_BLANK_WEEKS
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("HIDE_BLANK_WEEKS",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The image that should be used for the left navigation arrow.
+ * @config NAV_ARROW_LEFT
+ * @type String
+ * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif"
+ */
+ this.cfg.addProperty("NAV_ARROW_LEFT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif", handler:this.delegateConfig } );
+
+ /**
+ * The image that should be used for the left navigation arrow.
+ * @config NAV_ARROW_RIGHT
+ * @type String
+ * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif"
+ */
+ this.cfg.addProperty("NAV_ARROW_RIGHT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif", handler:this.delegateConfig } );
+
+ // Locale properties
+
+ /**
+ * The short month labels for the current locale.
+ * @config MONTHS_SHORT
+ * @type String[]
+ * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+ */
+ this.cfg.addProperty("MONTHS_SHORT", { value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], handler:this.delegateConfig } );
+
+ /**
+ * The long month labels for the current locale.
+ * @config MONTHS_LONG
+ * @type String[]
+ * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+ */
+ this.cfg.addProperty("MONTHS_LONG", { value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], handler:this.delegateConfig } );
+
+ /**
+ * The 1-character weekday labels for the current locale.
+ * @config WEEKDAYS_1CHAR
+ * @type String[]
+ * @default ["S", "M", "T", "W", "T", "F", "S"]
+ */
+ this.cfg.addProperty("WEEKDAYS_1CHAR", { value:["S", "M", "T", "W", "T", "F", "S"], handler:this.delegateConfig } );
+
+ /**
+ * The short weekday labels for the current locale.
+ * @config WEEKDAYS_SHORT
+ * @type String[]
+ * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
+ */
+ this.cfg.addProperty("WEEKDAYS_SHORT", { value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], handler:this.delegateConfig } );
+
+ /**
+ * The medium weekday labels for the current locale.
+ * @config WEEKDAYS_MEDIUM
+ * @type String[]
+ * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
+ */
+ this.cfg.addProperty("WEEKDAYS_MEDIUM", { value:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], handler:this.delegateConfig } );
+
+ /**
+ * The long weekday labels for the current locale.
+ * @config WEEKDAYS_LONG
+ * @type String[]
+ * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
+ */
+ this.cfg.addProperty("WEEKDAYS_LONG", { value:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], handler:this.delegateConfig } );
+
+ /**
+ * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
+ * @config LOCALE_MONTHS
+ * @type String
+ * @default "long"
+ */
+ this.cfg.addProperty("LOCALE_MONTHS", { value:"long", handler:this.delegateConfig } );
+
+ /**
+ * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
+ * @config LOCALE_WEEKDAYS
+ * @type String
+ * @default "short"
+ */
+ this.cfg.addProperty("LOCALE_WEEKDAYS", { value:"short", handler:this.delegateConfig } );
+
+ /**
+ * The value used to delimit individual dates in a date string passed to various Calendar functions.
+ * @config DATE_DELIMITER
+ * @type String
+ * @default ","
+ */
+ this.cfg.addProperty("DATE_DELIMITER", { value:",", handler:this.delegateConfig } );
+
+ /**
+ * The value used to delimit date fields in a date string passed to various Calendar functions.
+ * @config DATE_FIELD_DELIMITER
+ * @type String
+ * @default "/"
+ */
+ this.cfg.addProperty("DATE_FIELD_DELIMITER",{ value:"/", handler:this.delegateConfig } );
+
+ /**
+ * The value used to delimit date ranges in a date string passed to various Calendar functions.
+ * @config DATE_RANGE_DELIMITER
+ * @type String
+ * @default "-"
+ */
+ this.cfg.addProperty("DATE_RANGE_DELIMITER",{ value:"-", handler:this.delegateConfig } );
+
+ /**
+ * The position of the month in a month/year date string
+ * @config MY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MY_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/year date string
+ * @config MY_YEAR_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MY_YEAR_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day date string
+ * @config MD_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MD_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/year date string
+ * @config MD_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MD_DAY_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day/year date string
+ * @config MDY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MDY_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/day/year date string
+ * @config MDY_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MDY_DAY_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/day/year date string
+ * @config MDY_YEAR_POSITION
+ * @type Number
+ * @default 3
+ */
+ this.cfg.addProperty("MDY_YEAR_POSITION", { value:3, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+};
+
+/**
+* Initializes CalendarGroup's built-in CustomEvents
+* @method initEvents
+*/
+YAHOO.widget.CalendarGroup.prototype.initEvents = function() {
+ var me = this;
+
+ /**
+ * Proxy subscriber to subscribe to the CalendarGroup's child Calendars' CustomEvents
+ * @method sub
+ * @private
+ * @param {Function} fn The function to subscribe to this CustomEvent
+ * @param {Object} obj The CustomEvent's scope object
+ * @param {Boolean} bOverride Whether or not to apply scope correction
+ */
+ var sub = function(fn, obj, bOverride) {
+ for (var p=0;p0) {
+ year+=1;
+ }
+ cal.setYear(year);
+ }
+};
+/**
+* Calls the render function of all child calendars within the group.
+* @method render
+*/
+YAHOO.widget.CalendarGroup.prototype.render = function() {
+ this.renderHeader();
+ for (var p=0;p=0;--p) {
+ var cal = this.pages[p];
+ cal.previousMonth();
+ }
+};
+
+/**
+* Navigates to the next year in the currently selected month in the calendar widget.
+* @method nextYear
+*/
+YAHOO.widget.CalendarGroup.prototype.nextYear = function() {
+ for (var p=0;p11){while(newMonth>11){newMonth-=12;years+=1;}}
-d.setMonth(newMonth);d.setFullYear(date.getFullYear()+years);break;case this.DAY:d.setDate(date.getDate()+amount);break;case this.YEAR:d.setFullYear(date.getFullYear()+amount);break;case this.WEEK:d.setDate(date.getDate()+(amount*7));break;}
-return d;},subtract:function(date,field,amount){return this.add(date,field,(amount*-1));},before:function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()ms){return true;}else{return false;}},between:function(date,dateBegin,dateEnd){if(this.after(date,dateBegin)&&this.before(date,dateEnd)){return true;}else{return false;}},getJan1:function(calendarYear){return new Date(calendarYear,0,1);},getDayOffset:function(date,calendarYear){var beginYear=this.getJan1(calendarYear);var dayOffset=Math.ceil((date.getTime()-beginYear.getTime())/this.ONE_DAY_MS);return dayOffset;},getWeekNumber:function(date,calendarYear){date=this.clearTime(date);var nearestThurs=new Date(date.getTime()+(4*this.ONE_DAY_MS)-((date.getDay())*this.ONE_DAY_MS));var jan1=new Date(nearestThurs.getFullYear(),0,1);var dayOfYear=((nearestThurs.getTime()-jan1.getTime())/this.ONE_DAY_MS)-1;var weekNum=Math.ceil((dayOfYear)/7);return weekNum;},isYearOverlapWeek:function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getFullYear()!=weekBeginDate.getFullYear()){overlaps=true;}
-return overlaps;},isMonthOverlapWeek:function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getMonth()!=weekBeginDate.getMonth()){overlaps=true;}
-return overlaps;},findMonthStart:function(date){var start=new Date(date.getFullYear(),date.getMonth(),1);return start;},findMonthEnd:function(date){var start=this.findMonthStart(date);var nextMonth=this.add(start,this.MONTH,1);var end=this.subtract(nextMonth,this.DAY,1);return end;},clearTime:function(date){date.setHours(12,0,0,0);return date;}};YAHOO.widget.Calendar=function(id,containerId,config){this.init(id,containerId,config);};YAHOO.widget.Calendar.IMG_ROOT=(window.location.href.toLowerCase().indexOf("https")===0?"https://a248.e.akamai.net/sec.yimg.com/i/":"http://us.i1.yimg.com/us.yimg.com/i/");YAHOO.widget.Calendar.DATE="D";YAHOO.widget.Calendar.MONTH_DAY="MD";YAHOO.widget.Calendar.WEEKDAY="WD";YAHOO.widget.Calendar.RANGE="R";YAHOO.widget.Calendar.MONTH="M";YAHOO.widget.Calendar.DISPLAY_DAYS=42;YAHOO.widget.Calendar.STOP_RENDER="S";YAHOO.widget.Calendar.prototype={Config:null,parent:null,index:-1,cells:null,cellDates:null,id:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,_pageDate:null,_selectedDates:null,domEventMap:null};YAHOO.widget.Calendar.prototype.init=function(id,containerId,config){this.initEvents();this.today=new Date();YAHOO.widget.DateMath.clearTime(this.today);this.id=id;this.oDomContainer=document.getElementById(containerId);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.initStyles();YAHOO.util.Dom.addClass(this.oDomContainer,this.Style.CSS_CONTAINER);YAHOO.util.Dom.addClass(this.oDomContainer,this.Style.CSS_SINGLE);this.cellDates=[];this.cells=[];this.renderStack=[];this._renderStack=[];this.setupConfig();if(config){this.cfg.applyConfig(config,true);}
-this.cfg.fireQueue();};YAHOO.widget.Calendar.prototype.configIframe=function(type,args,obj){var useIframe=args[0];if(YAHOO.util.Dom.inDocument(this.oDomContainer)){if(useIframe){var pos=YAHOO.util.Dom.getStyle(this.oDomContainer,"position");if(this.browser=="ie"&&(pos=="absolute"||pos=="relative")){if(!YAHOO.util.Dom.inDocument(this.iframe)){this.iframe=document.createElement("iframe");this.iframe.src="javascript:false;";YAHOO.util.Dom.setStyle(this.iframe,"opacity","0");this.oDomContainer.insertBefore(this.iframe,this.oDomContainer.firstChild);}}}else{if(this.iframe){if(this.iframe.parentNode){this.iframe.parentNode.removeChild(this.iframe);}
-this.iframe=null;}}}};YAHOO.widget.Calendar.prototype.configTitle=function(type,args,obj){var title=args[0];var close=this.cfg.getProperty("close");var titleDiv;if(title&&title!==""){titleDiv=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||document.createElement("div");titleDiv.className=YAHOO.widget.CalendarGroup.CSS_2UPTITLE;titleDiv.innerHTML=title;this.oDomContainer.insertBefore(titleDiv,this.oDomContainer.firstChild);YAHOO.util.Dom.addClass(this.oDomContainer,"withtitle");}else{titleDiv=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||null;if(titleDiv){YAHOO.util.Event.purgeElement(titleDiv);this.oDomContainer.removeChild(titleDiv);}
-if(!close){YAHOO.util.Dom.removeClass(this.oDomContainer,"withtitle");}}};YAHOO.widget.Calendar.prototype.configClose=function(type,args,obj){var close=args[0];var title=this.cfg.getProperty("title");var linkClose;if(close===true){linkClose=YAHOO.util.Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0]||document.createElement("a");linkClose.href="javascript:void(null);";linkClose.className="link-close";YAHOO.util.Event.addListener(linkClose,"click",this.hide,this,true);var imgClose=document.createElement("img");imgClose.src=YAHOO.widget.Calendar.IMG_ROOT+"us/my/bn/x_d.gif";imgClose.className=YAHOO.widget.CalendarGroup.CSS_2UPCLOSE;linkClose.appendChild(imgClose);this.oDomContainer.appendChild(linkClose);YAHOO.util.Dom.addClass(this.oDomContainer,"withtitle");}else{linkClose=YAHOO.util.Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0]||null;if(linkClose){YAHOO.util.Event.purgeElement(linkClose);this.oDomContainer.removeChild(linkClose);}
-if(!title||title===""){YAHOO.util.Dom.removeClass(this.oDomContainer,"withtitle");}}};YAHOO.widget.Calendar.prototype.initEvents=function(){this.beforeSelectEvent=new YAHOO.util.CustomEvent("beforeSelect");this.selectEvent=new YAHOO.util.CustomEvent("select");this.beforeDeselectEvent=new YAHOO.util.CustomEvent("beforeDeselect");this.deselectEvent=new YAHOO.util.CustomEvent("deselect");this.changePageEvent=new YAHOO.util.CustomEvent("changePage");this.beforeRenderEvent=new YAHOO.util.CustomEvent("beforeRender");this.renderEvent=new YAHOO.util.CustomEvent("render");this.resetEvent=new YAHOO.util.CustomEvent("reset");this.clearEvent=new YAHOO.util.CustomEvent("clear");this.beforeSelectEvent.subscribe(this.onBeforeSelect,this,true);this.selectEvent.subscribe(this.onSelect,this,true);this.beforeDeselectEvent.subscribe(this.onBeforeDeselect,this,true);this.deselectEvent.subscribe(this.onDeselect,this,true);this.changePageEvent.subscribe(this.onChangePage,this,true);this.renderEvent.subscribe(this.onRender,this,true);this.resetEvent.subscribe(this.onReset,this,true);this.clearEvent.subscribe(this.onClear,this,true);};YAHOO.widget.Calendar.prototype.doSelectCell=function(e,cal){var target=YAHOO.util.Event.getTarget(e);var cell,index,d,date;while(target.tagName.toLowerCase()!="td"&&!YAHOO.util.Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){target=target.parentNode;if(target.tagName.toLowerCase()=="html"){return;}}
-cell=target;if(YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_SELECTABLE)){index=cell.id.split("cell")[1];d=cal.cellDates[index];date=new Date(d[0],d[1]-1,d[2]);var link;if(cal.Options.MULTI_SELECT){link=cell.getElementsByTagName("a")[0];if(link){link.blur();}
-var cellDate=cal.cellDates[index];var cellDateIndex=cal._indexOfSelectedFieldArray(cellDate);if(cellDateIndex>-1){cal.deselectCell(index);}else{cal.selectCell(index);}}else{link=cell.getElementsByTagName("a")[0];if(link){link.blur();}
-cal.selectCell(index);}}};YAHOO.widget.Calendar.prototype.doCellMouseOver=function(e,cal){var target;if(e){target=YAHOO.util.Event.getTarget(e);}else{target=this;}
-while(target.tagName.toLowerCase()!="td"){target=target.parentNode;if(target.tagName.toLowerCase()=="html"){return;}}
-if(YAHOO.util.Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){YAHOO.util.Dom.addClass(target,cal.Style.CSS_CELL_HOVER);}};YAHOO.widget.Calendar.prototype.doCellMouseOut=function(e,cal){var target;if(e){target=YAHOO.util.Event.getTarget(e);}else{target=this;}
-while(target.tagName.toLowerCase()!="td"){target=target.parentNode;if(target.tagName.toLowerCase()=="html"){return;}}
-if(YAHOO.util.Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){YAHOO.util.Dom.removeClass(target,cal.Style.CSS_CELL_HOVER);}};YAHOO.widget.Calendar.prototype.setupConfig=function(){this.cfg.addProperty("pagedate",{value:new Date(),handler:this.configPageDate});this.cfg.addProperty("selected",{value:[],handler:this.configSelected});this.cfg.addProperty("title",{value:"",handler:this.configTitle});this.cfg.addProperty("close",{value:false,handler:this.configClose});this.cfg.addProperty("iframe",{value:true,handler:this.configIframe,validator:this.cfg.checkBoolean});this.cfg.addProperty("mindate",{value:null,handler:this.configMinDate});this.cfg.addProperty("maxdate",{value:null,handler:this.configMaxDate});this.cfg.addProperty("MULTI_SELECT",{value:false,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty("START_WEEKDAY",{value:0,handler:this.configOptions,validator:this.cfg.checkNumber});this.cfg.addProperty("SHOW_WEEKDAYS",{value:true,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty("SHOW_WEEK_HEADER",{value:false,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty("SHOW_WEEK_FOOTER",{value:false,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty("HIDE_BLANK_WEEKS",{value:false,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty("NAV_ARROW_LEFT",{value:YAHOO.widget.Calendar.IMG_ROOT+"us/tr/callt.gif",handler:this.configOptions});this.cfg.addProperty("NAV_ARROW_RIGHT",{value:YAHOO.widget.Calendar.IMG_ROOT+"us/tr/calrt.gif",handler:this.configOptions});this.cfg.addProperty("MONTHS_SHORT",{value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],handler:this.configLocale});this.cfg.addProperty("MONTHS_LONG",{value:["January","February","March","April","May","June","July","August","September","October","November","December"],handler:this.configLocale});this.cfg.addProperty("WEEKDAYS_1CHAR",{value:["S","M","T","W","T","F","S"],handler:this.configLocale});this.cfg.addProperty("WEEKDAYS_SHORT",{value:["Su","Mo","Tu","We","Th","Fr","Sa"],handler:this.configLocale});this.cfg.addProperty("WEEKDAYS_MEDIUM",{value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],handler:this.configLocale});this.cfg.addProperty("WEEKDAYS_LONG",{value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],handler:this.configLocale});var refreshLocale=function(){this.cfg.refireEvent("LOCALE_MONTHS");this.cfg.refireEvent("LOCALE_WEEKDAYS");};this.cfg.subscribeToConfigEvent("START_WEEKDAY",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("MONTHS_SHORT",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("MONTHS_LONG",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("WEEKDAYS_1CHAR",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("WEEKDAYS_SHORT",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("WEEKDAYS_MEDIUM",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("WEEKDAYS_LONG",refreshLocale,this,true);this.cfg.addProperty("LOCALE_MONTHS",{value:"long",handler:this.configLocaleValues});this.cfg.addProperty("LOCALE_WEEKDAYS",{value:"short",handler:this.configLocaleValues});this.cfg.addProperty("DATE_DELIMITER",{value:",",handler:this.configLocale});this.cfg.addProperty("DATE_FIELD_DELIMITER",{value:"/",handler:this.configLocale});this.cfg.addProperty("DATE_RANGE_DELIMITER",{value:"-",handler:this.configLocale});this.cfg.addProperty("MY_MONTH_POSITION",{value:1,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MY_YEAR_POSITION",{value:2,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MD_MONTH_POSITION",{value:1,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MD_DAY_POSITION",{value:2,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_MONTH_POSITION",{value:1,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_DAY_POSITION",{value:2,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_YEAR_POSITION",{value:3,handler:this.configLocale,validator:this.cfg.checkNumber});};YAHOO.widget.Calendar.prototype.configPageDate=function(type,args,obj){var val=args[0];var month,year,aMonthYear;if(val){if(val instanceof Date){val=YAHOO.widget.DateMath.findMonthStart(val);this.cfg.setProperty("pagedate",val,true);if(!this._pageDate){this._pageDate=this.cfg.getProperty("pagedate");}
-return;}else{aMonthYear=val.split(this.cfg.getProperty("DATE_FIELD_DELIMITER"));month=parseInt(aMonthYear[this.cfg.getProperty("MY_MONTH_POSITION")-1],10)-1;year=parseInt(aMonthYear[this.cfg.getProperty("MY_YEAR_POSITION")-1],10);}}else{month=this.today.getMonth();year=this.today.getFullYear();}
-this.cfg.setProperty("pagedate",new Date(year,month,1),true);if(!this._pageDate){this._pageDate=this.cfg.getProperty("pagedate");}};YAHOO.widget.Calendar.prototype.configMinDate=function(type,args,obj){var val=args[0];if(typeof val=='string'){val=this._parseDate(val);this.cfg.setProperty("mindate",new Date(val[0],(val[1]-1),val[2]));}};YAHOO.widget.Calendar.prototype.configMaxDate=function(type,args,obj){var val=args[0];if(typeof val=='string'){val=this._parseDate(val);this.cfg.setProperty("maxdate",new Date(val[0],(val[1]-1),val[2]));}};YAHOO.widget.Calendar.prototype.configSelected=function(type,args,obj){var selected=args[0];if(selected){if(typeof selected=='string'){this.cfg.setProperty("selected",this._parseDates(selected),true);}}
-if(!this._selectedDates){this._selectedDates=this.cfg.getProperty("selected");}};YAHOO.widget.Calendar.prototype.configOptions=function(type,args,obj){type=type.toUpperCase();var val=args[0];this.Options[type]=val;};YAHOO.widget.Calendar.prototype.configLocale=function(type,args,obj){type=type.toUpperCase();var val=args[0];this.Locale[type]=val;this.cfg.refireEvent("LOCALE_MONTHS");this.cfg.refireEvent("LOCALE_WEEKDAYS");};YAHOO.widget.Calendar.prototype.configLocaleValues=function(type,args,obj){type=type.toUpperCase();var val=args[0];switch(type){case"LOCALE_MONTHS":switch(val){case"short":this.Locale.LOCALE_MONTHS=this.cfg.getProperty("MONTHS_SHORT").concat();break;case"long":this.Locale.LOCALE_MONTHS=this.cfg.getProperty("MONTHS_LONG").concat();break;}
-break;case"LOCALE_WEEKDAYS":switch(val){case"1char":this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty("WEEKDAYS_1CHAR").concat();break;case"short":this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty("WEEKDAYS_SHORT").concat();break;case"medium":this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty("WEEKDAYS_MEDIUM").concat();break;case"long":this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty("WEEKDAYS_LONG").concat();break;}
-var START_WEEKDAY=this.cfg.getProperty("START_WEEKDAY");if(START_WEEKDAY>0){for(var w=0;w";html[html.length]="";html[html.length]='';html[html.length]=' ';if(this.cfg.getProperty("SHOW_WEEKDAYS")){html=this.buildWeekdays(html);}
-html[html.length]='';return html;};YAHOO.widget.Calendar.prototype.buildWeekdays=function(html){html[html.length]='';if(this.cfg.getProperty("SHOW_WEEK_HEADER")){html[html.length]=' ';}
-for(var i=0;i'+this.Locale.LOCALE_WEEKDAYS[i]+'';}
-if(this.cfg.getProperty("SHOW_WEEK_FOOTER")){html[html.length]=' ';}
-html[html.length]=' ';return html;};YAHOO.widget.Calendar.prototype.renderBody=function(workingDate,html){var startDay=this.cfg.getProperty("START_WEEKDAY");this.preMonthDays=workingDate.getDay();if(startDay>0){this.preMonthDays-=startDay;}
-if(this.preMonthDays<0){this.preMonthDays+=7;}
-this.monthDays=YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();this.postMonthDays=YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;workingDate=YAHOO.widget.DateMath.subtract(workingDate,YAHOO.widget.DateMath.DAY,this.preMonthDays);var useDate,weekNum,weekClass;useDate=this.cfg.getProperty("pagedate");html[html.length]='';var i=0;var tempDiv=document.createElement("div");var cell=document.createElement("td");tempDiv.appendChild(cell);var jan1=new Date(useDate.getFullYear(),0,1);var cal=this.parent||this;for(var r=0;r<6;r++){weekNum=YAHOO.widget.DateMath.getWeekNumber(workingDate,useDate.getFullYear(),startDay);weekClass="w"+weekNum;if(r!==0&&this.isDateOOM(workingDate)&&this.cfg.getProperty("HIDE_BLANK_WEEKS")===true){break;}else{html[html.length]='';if(this.cfg.getProperty("SHOW_WEEK_HEADER")){html=this.renderRowHeader(weekNum,html);}
-for(var d=0;d<7;d++){var cellRenderers=[];this.clearElement(cell);YAHOO.util.Dom.addClass(cell,"calcell");cell.id=this.id+"_cell"+i;cell.innerHTML=i;var renderer=null;if(workingDate.getFullYear()==this.today.getFullYear()&&workingDate.getMonth()==this.today.getMonth()&&workingDate.getDate()==this.today.getDate()){cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;}
-this.cellDates[this.cellDates.length]=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];if(this.isDateOOM(workingDate)){cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;}else{YAHOO.util.Dom.addClass(cell,"wd"+workingDate.getDay());YAHOO.util.Dom.addClass(cell,"d"+workingDate.getDate());for(var s=0;s=d1.getTime()&&workingDate.getTime()<=d2.getTime()){renderer=rArray[2];if(workingDate.getTime()==d2.getTime()){this.renderStack.splice(s,1);}}
-break;case YAHOO.widget.Calendar.WEEKDAY:var weekday=rArray[1][0];if(workingDate.getDay()+1==weekday){renderer=rArray[2];}
-break;case YAHOO.widget.Calendar.MONTH:month=rArray[1][0];if(workingDate.getMonth()+1==month){renderer=rArray[2];}
-break;}
-if(renderer){cellRenderers[cellRenderers.length]=renderer;}}}
-if(this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()])>-1){cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected;}
-var mindate=this.cfg.getProperty("mindate");var maxdate=this.cfg.getProperty("maxdate");if(mindate){mindate=YAHOO.widget.DateMath.clearTime(mindate);}
-if(maxdate){maxdate=YAHOO.widget.DateMath.clearTime(maxdate);}
-if((mindate&&(workingDate.getTime()maxdate.getTime()))){cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;}else{cellRenderers[cellRenderers.length]=cal.styleCellDefault;cellRenderers[cellRenderers.length]=cal.renderCellDefault;}
-for(var x=0;x=0&&i<=6){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_TOP);}
-if((i%7)===0){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_LEFT);}
-if(((i+1)%7)===0){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_RIGHT);}
-var postDays=this.postMonthDays;if(postDays>=7&&this.cfg.getProperty("HIDE_BLANK_WEEKS")){var blankWeeks=Math.floor(postDays/7);for(var p=0;p=((this.preMonthDays+postDays+this.monthDays)-7)){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_BOTTOM);}
-html[html.length]=tempDiv.innerHTML;i++;}
-if(this.cfg.getProperty("SHOW_WEEK_FOOTER")){html=this.renderRowFooter(weekNum,html);}
-html[html.length]=' ';}}
-html[html.length]=' ';return html;};YAHOO.widget.Calendar.prototype.renderFooter=function(html){return html;};YAHOO.widget.Calendar.prototype.render=function(){this.beforeRenderEvent.fire();var workingDate=YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty("pagedate"));this.resetRenderers();this.cellDates.length=0;YAHOO.util.Event.purgeElement(this.oDomContainer,true);var html=[];html[html.length]='';html=this.renderHeader(html);html=this.renderBody(workingDate,html);html=this.renderFooter(html);html[html.length]='
';this.oDomContainer.innerHTML=html.join("\n");this.applyListeners();this.cells=this.oDomContainer.getElementsByTagName("td");this.cfg.refireEvent("title");this.cfg.refireEvent("close");this.cfg.refireEvent("iframe");this.renderEvent.fire();};YAHOO.widget.Calendar.prototype.applyListeners=function(){var root=this.oDomContainer;var cal=this.parent||this;var linkLeft,linkRight;linkLeft=YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT,"a",root);linkRight=YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT,"a",root);if(linkLeft){this.linkLeft=linkLeft[0];YAHOO.util.Event.addListener(this.linkLeft,"mousedown",cal.previousMonth,cal,true);}
-if(linkRight){this.linkRight=linkRight[0];YAHOO.util.Event.addListener(this.linkRight,"mousedown",cal.nextMonth,cal,true);}
-if(this.domEventMap){var el,elements;for(var cls in this.domEventMap){if(this.domEventMap.hasOwnProperty(cls)){var items=this.domEventMap[cls];if(!(items instanceof Array)){items=[items];}
-for(var i=0;i'+weekNum+'';return html;};YAHOO.widget.Calendar.prototype.renderRowFooter=function(weekNum,html){html[html.length]='';return html;};YAHOO.widget.Calendar.prototype.renderCellDefault=function(workingDate,cell){cell.innerHTML=''+this.buildDayLabel(workingDate)+" ";};YAHOO.widget.Calendar.prototype.styleCellDefault=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_SELECTABLE);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight1=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT1);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight2=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT2);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight3=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT3);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight4=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT4);};YAHOO.widget.Calendar.prototype.renderCellStyleToday=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_TODAY);};YAHOO.widget.Calendar.prototype.renderCellStyleSelected=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_SELECTED);};YAHOO.widget.Calendar.prototype.renderCellNotThisMonth=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_OOM);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar.STOP_RENDER;};YAHOO.widget.Calendar.prototype.renderBodyCellRestricted=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL);YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_RESTRICTED);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar.STOP_RENDER;};YAHOO.widget.Calendar.prototype.addMonths=function(count){this.cfg.setProperty("pagedate",YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"),YAHOO.widget.DateMath.MONTH,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.subtractMonths=function(count){this.cfg.setProperty("pagedate",YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"),YAHOO.widget.DateMath.MONTH,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.addYears=function(count){this.cfg.setProperty("pagedate",YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"),YAHOO.widget.DateMath.YEAR,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.subtractYears=function(count){this.cfg.setProperty("pagedate",YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"),YAHOO.widget.DateMath.YEAR,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.nextMonth=function(){this.addMonths(1);};YAHOO.widget.Calendar.prototype.previousMonth=function(){this.subtractMonths(1);};YAHOO.widget.Calendar.prototype.nextYear=function(){this.addYears(1);};YAHOO.widget.Calendar.prototype.previousYear=function(){this.subtractYears(1);};YAHOO.widget.Calendar.prototype.reset=function(){this.cfg.resetProperty("selected");this.cfg.resetProperty("pagedate");this.resetEvent.fire();};YAHOO.widget.Calendar.prototype.clear=function(){this.cfg.setProperty("selected",[]);this.cfg.setProperty("pagedate",new Date(this.today.getTime()));this.clearEvent.fire();};YAHOO.widget.Calendar.prototype.select=function(date){this.beforeSelectEvent.fire();var selected=this.cfg.getProperty("selected");var aToBeSelected=this._toFieldArray(date);for(var a=0;a-1){if(this.cfg.getProperty("pagedate").getMonth()==dCellDate.getMonth()&&this.cfg.getProperty("pagedate").getFullYear()==dCellDate.getFullYear()){YAHOO.util.Dom.removeClass(cell,this.Style.CSS_CELL_SELECTED);}
-selected.splice(cellDateIndex,1);}
-if(this.parent){this.parent.cfg.setProperty("selected",selected);}else{this.cfg.setProperty("selected",selected);}
-this.deselectEvent.fire(selectDate);return this.getSelectedDates();};YAHOO.widget.Calendar.prototype.deselectAll=function(){this.beforeDeselectEvent.fire();var selected=this.cfg.getProperty("selected");var count=selected.length;var sel=selected.concat();if(this.parent){this.parent.cfg.setProperty("selected",[]);}else{this.cfg.setProperty("selected",[]);}
-if(count>0){this.deselectEvent.fire(sel);}
-return this.getSelectedDates();};YAHOO.widget.Calendar.prototype._toFieldArray=function(date){var returnDate=[];if(date instanceof Date){returnDate=[[date.getFullYear(),date.getMonth()+1,date.getDate()]];}else if(typeof date=='string'){returnDate=this._parseDates(date);}else if(date instanceof Array){for(var i=0;i0){this.init(id,containerId,config);}};YAHOO.widget.CalendarGroup.prototype.init=function(id,containerId,config){this.initEvents();this.initStyles();this.pages=[];this.id=id;this.containerId=containerId;this.oDomContainer=document.getElementById(containerId);YAHOO.util.Dom.addClass(this.oDomContainer,YAHOO.widget.CalendarGroup.CSS_CONTAINER);YAHOO.util.Dom.addClass(this.oDomContainer,YAHOO.widget.CalendarGroup.CSS_MULTI_UP);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.setupConfig();if(config){this.cfg.applyConfig(config,true);}
-this.cfg.fireQueue();if(this.browser=="opera"){var fixWidth=function(){var startW=this.oDomContainer.offsetWidth;var w=0;for(var p=0;p0){this.oDomContainer.style.width=w+"px";}};this.renderEvent.subscribe(fixWidth,this,true);}};YAHOO.widget.CalendarGroup.prototype.setupConfig=function(){this.cfg.addProperty("pages",{value:2,validator:this.cfg.checkNumber,handler:this.configPages});this.cfg.addProperty("pagedate",{value:new Date(),handler:this.configPageDate});this.cfg.addProperty("selected",{value:[],handler:this.delegateConfig});this.cfg.addProperty("title",{value:"",handler:this.configTitle});this.cfg.addProperty("close",{value:false,handler:this.configClose});this.cfg.addProperty("iframe",{value:true,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("mindate",{value:null,handler:this.delegateConfig});this.cfg.addProperty("maxdate",{value:null,handler:this.delegateConfig});this.cfg.addProperty("MULTI_SELECT",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("START_WEEKDAY",{value:0,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("SHOW_WEEKDAYS",{value:true,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("SHOW_WEEK_HEADER",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("SHOW_WEEK_FOOTER",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("HIDE_BLANK_WEEKS",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("NAV_ARROW_LEFT",{value:YAHOO.widget.Calendar.IMG_ROOT+"us/tr/callt.gif",handler:this.delegateConfig});this.cfg.addProperty("NAV_ARROW_RIGHT",{value:YAHOO.widget.Calendar.IMG_ROOT+"us/tr/calrt.gif",handler:this.delegateConfig});this.cfg.addProperty("MONTHS_SHORT",{value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],handler:this.delegateConfig});this.cfg.addProperty("MONTHS_LONG",{value:["January","February","March","April","May","June","July","August","September","October","November","December"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_1CHAR",{value:["S","M","T","W","T","F","S"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_SHORT",{value:["Su","Mo","Tu","We","Th","Fr","Sa"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_MEDIUM",{value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_LONG",{value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],handler:this.delegateConfig});this.cfg.addProperty("LOCALE_MONTHS",{value:"long",handler:this.delegateConfig});this.cfg.addProperty("LOCALE_WEEKDAYS",{value:"short",handler:this.delegateConfig});this.cfg.addProperty("DATE_DELIMITER",{value:",",handler:this.delegateConfig});this.cfg.addProperty("DATE_FIELD_DELIMITER",{value:"/",handler:this.delegateConfig});this.cfg.addProperty("DATE_RANGE_DELIMITER",{value:"-",handler:this.delegateConfig});this.cfg.addProperty("MY_MONTH_POSITION",{value:1,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MY_YEAR_POSITION",{value:2,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MD_MONTH_POSITION",{value:1,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MD_DAY_POSITION",{value:2,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_MONTH_POSITION",{value:1,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_DAY_POSITION",{value:2,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_YEAR_POSITION",{value:3,handler:this.delegateConfig,validator:this.cfg.checkNumber});};YAHOO.widget.CalendarGroup.prototype.initEvents=function(){var me=this;var sub=function(fn,obj,bOverride){for(var p=0;p0){year+=1;}
-cal.setYear(year);}};YAHOO.widget.CalendarGroup.prototype.render=function(){this.renderHeader();for(var p=0;p=0;--p){var cal=this.pages[p];cal.previousMonth();}};YAHOO.widget.CalendarGroup.prototype.nextYear=function(){for(var p=0;p11){while(newMonth>11){newMonth-=12;years+=1;}}
+d.setMonth(newMonth);d.setFullYear(date.getFullYear()+years);break;case this.DAY:d.setDate(date.getDate()+amount);break;case this.YEAR:d.setFullYear(date.getFullYear()+amount);break;case this.WEEK:d.setDate(date.getDate()+(amount*7));break;}
+return d;},subtract:function(date,field,amount){return this.add(date,field,(amount*-1));},before:function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()ms){return true;}else{return false;}},between:function(date,dateBegin,dateEnd){if(this.after(date,dateBegin)&&this.before(date,dateEnd)){return true;}else{return false;}},getJan1:function(calendarYear){return new Date(calendarYear,0,1);},getDayOffset:function(date,calendarYear){var beginYear=this.getJan1(calendarYear);var dayOffset=Math.ceil((date.getTime()-beginYear.getTime())/this.ONE_DAY_MS);return dayOffset;},getWeekNumber:function(date,calendarYear){date=this.clearTime(date);var nearestThurs=new Date(date.getTime()+(4*this.ONE_DAY_MS)-((date.getDay())*this.ONE_DAY_MS));var jan1=new Date(nearestThurs.getFullYear(),0,1);var dayOfYear=((nearestThurs.getTime()-jan1.getTime())/this.ONE_DAY_MS)-1;var weekNum=Math.ceil((dayOfYear)/7);return weekNum;},isYearOverlapWeek:function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getFullYear()!=weekBeginDate.getFullYear()){overlaps=true;}
+return overlaps;},isMonthOverlapWeek:function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getMonth()!=weekBeginDate.getMonth()){overlaps=true;}
+return overlaps;},findMonthStart:function(date){var start=new Date(date.getFullYear(),date.getMonth(),1);return start;},findMonthEnd:function(date){var start=this.findMonthStart(date);var nextMonth=this.add(start,this.MONTH,1);var end=this.subtract(nextMonth,this.DAY,1);return end;},clearTime:function(date){date.setHours(12,0,0,0);return date;}};YAHOO.widget.Calendar=function(id,containerId,config){this.init(id,containerId,config);};YAHOO.widget.Calendar.IMG_ROOT=(window.location.href.toLowerCase().indexOf("https")===0?"https://a248.e.akamai.net/sec.yimg.com/i/":"http://us.i1.yimg.com/us.yimg.com/i/");YAHOO.widget.Calendar.DATE="D";YAHOO.widget.Calendar.MONTH_DAY="MD";YAHOO.widget.Calendar.WEEKDAY="WD";YAHOO.widget.Calendar.RANGE="R";YAHOO.widget.Calendar.MONTH="M";YAHOO.widget.Calendar.DISPLAY_DAYS=42;YAHOO.widget.Calendar.STOP_RENDER="S";YAHOO.widget.Calendar.prototype={Config:null,parent:null,index:-1,cells:null,cellDates:null,id:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,_pageDate:null,_selectedDates:null,domEventMap:null};YAHOO.widget.Calendar.prototype.init=function(id,containerId,config){this.initEvents();this.today=new Date();YAHOO.widget.DateMath.clearTime(this.today);this.id=id;this.oDomContainer=document.getElementById(containerId);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.initStyles();YAHOO.util.Dom.addClass(this.oDomContainer,this.Style.CSS_CONTAINER);YAHOO.util.Dom.addClass(this.oDomContainer,this.Style.CSS_SINGLE);this.cellDates=[];this.cells=[];this.renderStack=[];this._renderStack=[];this.setupConfig();if(config){this.cfg.applyConfig(config,true);}
+this.cfg.fireQueue();};YAHOO.widget.Calendar.prototype.configIframe=function(type,args,obj){var useIframe=args[0];if(YAHOO.util.Dom.inDocument(this.oDomContainer)){if(useIframe){var pos=YAHOO.util.Dom.getStyle(this.oDomContainer,"position");if(this.browser=="ie"&&(pos=="absolute"||pos=="relative")){if(!YAHOO.util.Dom.inDocument(this.iframe)){this.iframe=document.createElement("iframe");this.iframe.src="javascript:false;";YAHOO.util.Dom.setStyle(this.iframe,"opacity","0");this.oDomContainer.insertBefore(this.iframe,this.oDomContainer.firstChild);}}}else{if(this.iframe){if(this.iframe.parentNode){this.iframe.parentNode.removeChild(this.iframe);}
+this.iframe=null;}}}};YAHOO.widget.Calendar.prototype.configTitle=function(type,args,obj){var title=args[0];var close=this.cfg.getProperty("close");var titleDiv;if(title&&title!==""){titleDiv=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||document.createElement("div");titleDiv.className=YAHOO.widget.CalendarGroup.CSS_2UPTITLE;titleDiv.innerHTML=title;this.oDomContainer.insertBefore(titleDiv,this.oDomContainer.firstChild);YAHOO.util.Dom.addClass(this.oDomContainer,"withtitle");}else{titleDiv=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||null;if(titleDiv){YAHOO.util.Event.purgeElement(titleDiv);this.oDomContainer.removeChild(titleDiv);}
+if(!close){YAHOO.util.Dom.removeClass(this.oDomContainer,"withtitle");}}};YAHOO.widget.Calendar.prototype.configClose=function(type,args,obj){var close=args[0];var title=this.cfg.getProperty("title");var linkClose;if(close===true){linkClose=YAHOO.util.Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0]||document.createElement("a");linkClose.href="javascript:void(null);";linkClose.className="link-close";YAHOO.util.Event.addListener(linkClose,"click",this.hide,this,true);var imgClose=document.createElement("img");imgClose.src=YAHOO.widget.Calendar.IMG_ROOT+"us/my/bn/x_d.gif";imgClose.className=YAHOO.widget.CalendarGroup.CSS_2UPCLOSE;linkClose.appendChild(imgClose);this.oDomContainer.appendChild(linkClose);YAHOO.util.Dom.addClass(this.oDomContainer,"withtitle");}else{linkClose=YAHOO.util.Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0]||null;if(linkClose){YAHOO.util.Event.purgeElement(linkClose);this.oDomContainer.removeChild(linkClose);}
+if(!title||title===""){YAHOO.util.Dom.removeClass(this.oDomContainer,"withtitle");}}};YAHOO.widget.Calendar.prototype.initEvents=function(){this.beforeSelectEvent=new YAHOO.util.CustomEvent("beforeSelect");this.selectEvent=new YAHOO.util.CustomEvent("select");this.beforeDeselectEvent=new YAHOO.util.CustomEvent("beforeDeselect");this.deselectEvent=new YAHOO.util.CustomEvent("deselect");this.changePageEvent=new YAHOO.util.CustomEvent("changePage");this.beforeRenderEvent=new YAHOO.util.CustomEvent("beforeRender");this.renderEvent=new YAHOO.util.CustomEvent("render");this.resetEvent=new YAHOO.util.CustomEvent("reset");this.clearEvent=new YAHOO.util.CustomEvent("clear");this.beforeSelectEvent.subscribe(this.onBeforeSelect,this,true);this.selectEvent.subscribe(this.onSelect,this,true);this.beforeDeselectEvent.subscribe(this.onBeforeDeselect,this,true);this.deselectEvent.subscribe(this.onDeselect,this,true);this.changePageEvent.subscribe(this.onChangePage,this,true);this.renderEvent.subscribe(this.onRender,this,true);this.resetEvent.subscribe(this.onReset,this,true);this.clearEvent.subscribe(this.onClear,this,true);};YAHOO.widget.Calendar.prototype.doSelectCell=function(e,cal){var target=YAHOO.util.Event.getTarget(e);var cell,index,d,date;while(target.tagName.toLowerCase()!="td"&&!YAHOO.util.Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){target=target.parentNode;if(target.tagName.toLowerCase()=="html"){return;}}
+cell=target;if(YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_SELECTABLE)){index=cell.id.split("cell")[1];d=cal.cellDates[index];date=new Date(d[0],d[1]-1,d[2]);var link;if(cal.Options.MULTI_SELECT){link=cell.getElementsByTagName("a")[0];if(link){link.blur();}
+var cellDate=cal.cellDates[index];var cellDateIndex=cal._indexOfSelectedFieldArray(cellDate);if(cellDateIndex>-1){cal.deselectCell(index);}else{cal.selectCell(index);}}else{link=cell.getElementsByTagName("a")[0];if(link){link.blur();}
+cal.selectCell(index);}}};YAHOO.widget.Calendar.prototype.doCellMouseOver=function(e,cal){var target;if(e){target=YAHOO.util.Event.getTarget(e);}else{target=this;}
+while(target.tagName.toLowerCase()!="td"){target=target.parentNode;if(target.tagName.toLowerCase()=="html"){return;}}
+if(YAHOO.util.Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){YAHOO.util.Dom.addClass(target,cal.Style.CSS_CELL_HOVER);}};YAHOO.widget.Calendar.prototype.doCellMouseOut=function(e,cal){var target;if(e){target=YAHOO.util.Event.getTarget(e);}else{target=this;}
+while(target.tagName.toLowerCase()!="td"){target=target.parentNode;if(target.tagName.toLowerCase()=="html"){return;}}
+if(YAHOO.util.Dom.hasClass(target,cal.Style.CSS_CELL_SELECTABLE)){YAHOO.util.Dom.removeClass(target,cal.Style.CSS_CELL_HOVER);}};YAHOO.widget.Calendar.prototype.setupConfig=function(){this.cfg.addProperty("pagedate",{value:new Date(),handler:this.configPageDate});this.cfg.addProperty("selected",{value:[],handler:this.configSelected});this.cfg.addProperty("title",{value:"",handler:this.configTitle});this.cfg.addProperty("close",{value:false,handler:this.configClose});this.cfg.addProperty("iframe",{value:true,handler:this.configIframe,validator:this.cfg.checkBoolean});this.cfg.addProperty("mindate",{value:null,handler:this.configMinDate});this.cfg.addProperty("maxdate",{value:null,handler:this.configMaxDate});this.cfg.addProperty("MULTI_SELECT",{value:false,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty("START_WEEKDAY",{value:0,handler:this.configOptions,validator:this.cfg.checkNumber});this.cfg.addProperty("SHOW_WEEKDAYS",{value:true,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty("SHOW_WEEK_HEADER",{value:false,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty("SHOW_WEEK_FOOTER",{value:false,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty("HIDE_BLANK_WEEKS",{value:false,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty("NAV_ARROW_LEFT",{value:YAHOO.widget.Calendar.IMG_ROOT+"us/tr/callt.gif",handler:this.configOptions});this.cfg.addProperty("NAV_ARROW_RIGHT",{value:YAHOO.widget.Calendar.IMG_ROOT+"us/tr/calrt.gif",handler:this.configOptions});this.cfg.addProperty("MONTHS_SHORT",{value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],handler:this.configLocale});this.cfg.addProperty("MONTHS_LONG",{value:["January","February","March","April","May","June","July","August","September","October","November","December"],handler:this.configLocale});this.cfg.addProperty("WEEKDAYS_1CHAR",{value:["S","M","T","W","T","F","S"],handler:this.configLocale});this.cfg.addProperty("WEEKDAYS_SHORT",{value:["Su","Mo","Tu","We","Th","Fr","Sa"],handler:this.configLocale});this.cfg.addProperty("WEEKDAYS_MEDIUM",{value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],handler:this.configLocale});this.cfg.addProperty("WEEKDAYS_LONG",{value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],handler:this.configLocale});var refreshLocale=function(){this.cfg.refireEvent("LOCALE_MONTHS");this.cfg.refireEvent("LOCALE_WEEKDAYS");};this.cfg.subscribeToConfigEvent("START_WEEKDAY",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("MONTHS_SHORT",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("MONTHS_LONG",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("WEEKDAYS_1CHAR",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("WEEKDAYS_SHORT",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("WEEKDAYS_MEDIUM",refreshLocale,this,true);this.cfg.subscribeToConfigEvent("WEEKDAYS_LONG",refreshLocale,this,true);this.cfg.addProperty("LOCALE_MONTHS",{value:"long",handler:this.configLocaleValues});this.cfg.addProperty("LOCALE_WEEKDAYS",{value:"short",handler:this.configLocaleValues});this.cfg.addProperty("DATE_DELIMITER",{value:",",handler:this.configLocale});this.cfg.addProperty("DATE_FIELD_DELIMITER",{value:"/",handler:this.configLocale});this.cfg.addProperty("DATE_RANGE_DELIMITER",{value:"-",handler:this.configLocale});this.cfg.addProperty("MY_MONTH_POSITION",{value:1,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MY_YEAR_POSITION",{value:2,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MD_MONTH_POSITION",{value:1,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MD_DAY_POSITION",{value:2,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_MONTH_POSITION",{value:1,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_DAY_POSITION",{value:2,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_YEAR_POSITION",{value:3,handler:this.configLocale,validator:this.cfg.checkNumber});};YAHOO.widget.Calendar.prototype.configPageDate=function(type,args,obj){var val=args[0];var month,year,aMonthYear;if(val){if(val instanceof Date){val=YAHOO.widget.DateMath.findMonthStart(val);this.cfg.setProperty("pagedate",val,true);if(!this._pageDate){this._pageDate=this.cfg.getProperty("pagedate");}
+return;}else{aMonthYear=val.split(this.cfg.getProperty("DATE_FIELD_DELIMITER"));month=parseInt(aMonthYear[this.cfg.getProperty("MY_MONTH_POSITION")-1],10)-1;year=parseInt(aMonthYear[this.cfg.getProperty("MY_YEAR_POSITION")-1],10);}}else{month=this.today.getMonth();year=this.today.getFullYear();}
+this.cfg.setProperty("pagedate",new Date(year,month,1),true);if(!this._pageDate){this._pageDate=this.cfg.getProperty("pagedate");}};YAHOO.widget.Calendar.prototype.configMinDate=function(type,args,obj){var val=args[0];if(typeof val=='string'){val=this._parseDate(val);this.cfg.setProperty("mindate",new Date(val[0],(val[1]-1),val[2]));}};YAHOO.widget.Calendar.prototype.configMaxDate=function(type,args,obj){var val=args[0];if(typeof val=='string'){val=this._parseDate(val);this.cfg.setProperty("maxdate",new Date(val[0],(val[1]-1),val[2]));}};YAHOO.widget.Calendar.prototype.configSelected=function(type,args,obj){var selected=args[0];if(selected){if(typeof selected=='string'){this.cfg.setProperty("selected",this._parseDates(selected),true);}}
+if(!this._selectedDates){this._selectedDates=this.cfg.getProperty("selected");}};YAHOO.widget.Calendar.prototype.configOptions=function(type,args,obj){type=type.toUpperCase();var val=args[0];this.Options[type]=val;};YAHOO.widget.Calendar.prototype.configLocale=function(type,args,obj){type=type.toUpperCase();var val=args[0];this.Locale[type]=val;this.cfg.refireEvent("LOCALE_MONTHS");this.cfg.refireEvent("LOCALE_WEEKDAYS");};YAHOO.widget.Calendar.prototype.configLocaleValues=function(type,args,obj){type=type.toUpperCase();var val=args[0];switch(type){case"LOCALE_MONTHS":switch(val){case"short":this.Locale.LOCALE_MONTHS=this.cfg.getProperty("MONTHS_SHORT").concat();break;case"long":this.Locale.LOCALE_MONTHS=this.cfg.getProperty("MONTHS_LONG").concat();break;}
+break;case"LOCALE_WEEKDAYS":switch(val){case"1char":this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty("WEEKDAYS_1CHAR").concat();break;case"short":this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty("WEEKDAYS_SHORT").concat();break;case"medium":this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty("WEEKDAYS_MEDIUM").concat();break;case"long":this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty("WEEKDAYS_LONG").concat();break;}
+var START_WEEKDAY=this.cfg.getProperty("START_WEEKDAY");if(START_WEEKDAY>0){for(var w=0;w";html[html.length]="";html[html.length]='';html[html.length]=' ';if(this.cfg.getProperty("SHOW_WEEKDAYS")){html=this.buildWeekdays(html);}
+html[html.length]='';return html;};YAHOO.widget.Calendar.prototype.buildWeekdays=function(html){html[html.length]='';if(this.cfg.getProperty("SHOW_WEEK_HEADER")){html[html.length]=' ';}
+for(var i=0;i'+this.Locale.LOCALE_WEEKDAYS[i]+'';}
+if(this.cfg.getProperty("SHOW_WEEK_FOOTER")){html[html.length]=' ';}
+html[html.length]=' ';return html;};YAHOO.widget.Calendar.prototype.renderBody=function(workingDate,html){var startDay=this.cfg.getProperty("START_WEEKDAY");this.preMonthDays=workingDate.getDay();if(startDay>0){this.preMonthDays-=startDay;}
+if(this.preMonthDays<0){this.preMonthDays+=7;}
+this.monthDays=YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();this.postMonthDays=YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;workingDate=YAHOO.widget.DateMath.subtract(workingDate,YAHOO.widget.DateMath.DAY,this.preMonthDays);var useDate,weekNum,weekClass;useDate=this.cfg.getProperty("pagedate");html[html.length]='';var i=0;var tempDiv=document.createElement("div");var cell=document.createElement("td");tempDiv.appendChild(cell);var jan1=new Date(useDate.getFullYear(),0,1);var cal=this.parent||this;for(var r=0;r<6;r++){weekNum=YAHOO.widget.DateMath.getWeekNumber(workingDate,useDate.getFullYear(),startDay);weekClass="w"+weekNum;if(r!==0&&this.isDateOOM(workingDate)&&this.cfg.getProperty("HIDE_BLANK_WEEKS")===true){break;}else{html[html.length]='';if(this.cfg.getProperty("SHOW_WEEK_HEADER")){html=this.renderRowHeader(weekNum,html);}
+for(var d=0;d<7;d++){var cellRenderers=[];this.clearElement(cell);YAHOO.util.Dom.addClass(cell,"calcell");cell.id=this.id+"_cell"+i;cell.innerHTML=i;var renderer=null;if(workingDate.getFullYear()==this.today.getFullYear()&&workingDate.getMonth()==this.today.getMonth()&&workingDate.getDate()==this.today.getDate()){cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;}
+this.cellDates[this.cellDates.length]=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];if(this.isDateOOM(workingDate)){cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;}else{YAHOO.util.Dom.addClass(cell,"wd"+workingDate.getDay());YAHOO.util.Dom.addClass(cell,"d"+workingDate.getDate());for(var s=0;s=d1.getTime()&&workingDate.getTime()<=d2.getTime()){renderer=rArray[2];if(workingDate.getTime()==d2.getTime()){this.renderStack.splice(s,1);}}
+break;case YAHOO.widget.Calendar.WEEKDAY:var weekday=rArray[1][0];if(workingDate.getDay()+1==weekday){renderer=rArray[2];}
+break;case YAHOO.widget.Calendar.MONTH:month=rArray[1][0];if(workingDate.getMonth()+1==month){renderer=rArray[2];}
+break;}
+if(renderer){cellRenderers[cellRenderers.length]=renderer;}}}
+if(this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()])>-1){cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected;}
+var mindate=this.cfg.getProperty("mindate");var maxdate=this.cfg.getProperty("maxdate");if(mindate){mindate=YAHOO.widget.DateMath.clearTime(mindate);}
+if(maxdate){maxdate=YAHOO.widget.DateMath.clearTime(maxdate);}
+if((mindate&&(workingDate.getTime()maxdate.getTime()))){cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;}else{cellRenderers[cellRenderers.length]=cal.styleCellDefault;cellRenderers[cellRenderers.length]=cal.renderCellDefault;}
+for(var x=0;x=0&&i<=6){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_TOP);}
+if((i%7)===0){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_LEFT);}
+if(((i+1)%7)===0){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_RIGHT);}
+var postDays=this.postMonthDays;if(postDays>=7&&this.cfg.getProperty("HIDE_BLANK_WEEKS")){var blankWeeks=Math.floor(postDays/7);for(var p=0;p=((this.preMonthDays+postDays+this.monthDays)-7)){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_BOTTOM);}
+html[html.length]=tempDiv.innerHTML;i++;}
+if(this.cfg.getProperty("SHOW_WEEK_FOOTER")){html=this.renderRowFooter(weekNum,html);}
+html[html.length]=' ';}}
+html[html.length]=' ';return html;};YAHOO.widget.Calendar.prototype.renderFooter=function(html){return html;};YAHOO.widget.Calendar.prototype.render=function(){this.beforeRenderEvent.fire();var workingDate=YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty("pagedate"));this.resetRenderers();this.cellDates.length=0;YAHOO.util.Event.purgeElement(this.oDomContainer,true);var html=[];html[html.length]='';html=this.renderHeader(html);html=this.renderBody(workingDate,html);html=this.renderFooter(html);html[html.length]='
';this.oDomContainer.innerHTML=html.join("\n");this.applyListeners();this.cells=this.oDomContainer.getElementsByTagName("td");this.cfg.refireEvent("title");this.cfg.refireEvent("close");this.cfg.refireEvent("iframe");this.renderEvent.fire();};YAHOO.widget.Calendar.prototype.applyListeners=function(){var root=this.oDomContainer;var cal=this.parent||this;var linkLeft,linkRight;linkLeft=YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT,"a",root);linkRight=YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT,"a",root);if(linkLeft){this.linkLeft=linkLeft[0];YAHOO.util.Event.addListener(this.linkLeft,"mousedown",cal.previousMonth,cal,true);}
+if(linkRight){this.linkRight=linkRight[0];YAHOO.util.Event.addListener(this.linkRight,"mousedown",cal.nextMonth,cal,true);}
+if(this.domEventMap){var el,elements;for(var cls in this.domEventMap){if(this.domEventMap.hasOwnProperty(cls)){var items=this.domEventMap[cls];if(!(items instanceof Array)){items=[items];}
+for(var i=0;i'+weekNum+'';return html;};YAHOO.widget.Calendar.prototype.renderRowFooter=function(weekNum,html){html[html.length]='';return html;};YAHOO.widget.Calendar.prototype.renderCellDefault=function(workingDate,cell){cell.innerHTML=''+this.buildDayLabel(workingDate)+" ";};YAHOO.widget.Calendar.prototype.styleCellDefault=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_SELECTABLE);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight1=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT1);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight2=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT2);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight3=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT3);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight4=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT4);};YAHOO.widget.Calendar.prototype.renderCellStyleToday=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_TODAY);};YAHOO.widget.Calendar.prototype.renderCellStyleSelected=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_SELECTED);};YAHOO.widget.Calendar.prototype.renderCellNotThisMonth=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_OOM);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar.STOP_RENDER;};YAHOO.widget.Calendar.prototype.renderBodyCellRestricted=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL);YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_RESTRICTED);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar.STOP_RENDER;};YAHOO.widget.Calendar.prototype.addMonths=function(count){this.cfg.setProperty("pagedate",YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"),YAHOO.widget.DateMath.MONTH,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.subtractMonths=function(count){this.cfg.setProperty("pagedate",YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"),YAHOO.widget.DateMath.MONTH,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.addYears=function(count){this.cfg.setProperty("pagedate",YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"),YAHOO.widget.DateMath.YEAR,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.subtractYears=function(count){this.cfg.setProperty("pagedate",YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"),YAHOO.widget.DateMath.YEAR,count));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.nextMonth=function(){this.addMonths(1);};YAHOO.widget.Calendar.prototype.previousMonth=function(){this.subtractMonths(1);};YAHOO.widget.Calendar.prototype.nextYear=function(){this.addYears(1);};YAHOO.widget.Calendar.prototype.previousYear=function(){this.subtractYears(1);};YAHOO.widget.Calendar.prototype.reset=function(){this.cfg.resetProperty("selected");this.cfg.resetProperty("pagedate");this.resetEvent.fire();};YAHOO.widget.Calendar.prototype.clear=function(){this.cfg.setProperty("selected",[]);this.cfg.setProperty("pagedate",new Date(this.today.getTime()));this.clearEvent.fire();};YAHOO.widget.Calendar.prototype.select=function(date){this.beforeSelectEvent.fire();var selected=this.cfg.getProperty("selected");var aToBeSelected=this._toFieldArray(date);for(var a=0;a-1){if(this.cfg.getProperty("pagedate").getMonth()==dCellDate.getMonth()&&this.cfg.getProperty("pagedate").getFullYear()==dCellDate.getFullYear()){YAHOO.util.Dom.removeClass(cell,this.Style.CSS_CELL_SELECTED);}
+selected.splice(cellDateIndex,1);}
+if(this.parent){this.parent.cfg.setProperty("selected",selected);}else{this.cfg.setProperty("selected",selected);}
+this.deselectEvent.fire(selectDate);return this.getSelectedDates();};YAHOO.widget.Calendar.prototype.deselectAll=function(){this.beforeDeselectEvent.fire();var selected=this.cfg.getProperty("selected");var count=selected.length;var sel=selected.concat();if(this.parent){this.parent.cfg.setProperty("selected",[]);}else{this.cfg.setProperty("selected",[]);}
+if(count>0){this.deselectEvent.fire(sel);}
+return this.getSelectedDates();};YAHOO.widget.Calendar.prototype._toFieldArray=function(date){var returnDate=[];if(date instanceof Date){returnDate=[[date.getFullYear(),date.getMonth()+1,date.getDate()]];}else if(typeof date=='string'){returnDate=this._parseDates(date);}else if(date instanceof Array){for(var i=0;i0){this.init(id,containerId,config);}};YAHOO.widget.CalendarGroup.prototype.init=function(id,containerId,config){this.initEvents();this.initStyles();this.pages=[];this.id=id;this.containerId=containerId;this.oDomContainer=document.getElementById(containerId);YAHOO.util.Dom.addClass(this.oDomContainer,YAHOO.widget.CalendarGroup.CSS_CONTAINER);YAHOO.util.Dom.addClass(this.oDomContainer,YAHOO.widget.CalendarGroup.CSS_MULTI_UP);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.setupConfig();if(config){this.cfg.applyConfig(config,true);}
+this.cfg.fireQueue();if(this.browser=="opera"){var fixWidth=function(){var startW=this.oDomContainer.offsetWidth;var w=0;for(var p=0;p0){this.oDomContainer.style.width=w+"px";}};this.renderEvent.subscribe(fixWidth,this,true);}};YAHOO.widget.CalendarGroup.prototype.setupConfig=function(){this.cfg.addProperty("pages",{value:2,validator:this.cfg.checkNumber,handler:this.configPages});this.cfg.addProperty("pagedate",{value:new Date(),handler:this.configPageDate});this.cfg.addProperty("selected",{value:[],handler:this.delegateConfig});this.cfg.addProperty("title",{value:"",handler:this.configTitle});this.cfg.addProperty("close",{value:false,handler:this.configClose});this.cfg.addProperty("iframe",{value:true,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("mindate",{value:null,handler:this.delegateConfig});this.cfg.addProperty("maxdate",{value:null,handler:this.delegateConfig});this.cfg.addProperty("MULTI_SELECT",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("START_WEEKDAY",{value:0,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("SHOW_WEEKDAYS",{value:true,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("SHOW_WEEK_HEADER",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("SHOW_WEEK_FOOTER",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("HIDE_BLANK_WEEKS",{value:false,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty("NAV_ARROW_LEFT",{value:YAHOO.widget.Calendar.IMG_ROOT+"us/tr/callt.gif",handler:this.delegateConfig});this.cfg.addProperty("NAV_ARROW_RIGHT",{value:YAHOO.widget.Calendar.IMG_ROOT+"us/tr/calrt.gif",handler:this.delegateConfig});this.cfg.addProperty("MONTHS_SHORT",{value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],handler:this.delegateConfig});this.cfg.addProperty("MONTHS_LONG",{value:["January","February","March","April","May","June","July","August","September","October","November","December"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_1CHAR",{value:["S","M","T","W","T","F","S"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_SHORT",{value:["Su","Mo","Tu","We","Th","Fr","Sa"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_MEDIUM",{value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],handler:this.delegateConfig});this.cfg.addProperty("WEEKDAYS_LONG",{value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],handler:this.delegateConfig});this.cfg.addProperty("LOCALE_MONTHS",{value:"long",handler:this.delegateConfig});this.cfg.addProperty("LOCALE_WEEKDAYS",{value:"short",handler:this.delegateConfig});this.cfg.addProperty("DATE_DELIMITER",{value:",",handler:this.delegateConfig});this.cfg.addProperty("DATE_FIELD_DELIMITER",{value:"/",handler:this.delegateConfig});this.cfg.addProperty("DATE_RANGE_DELIMITER",{value:"-",handler:this.delegateConfig});this.cfg.addProperty("MY_MONTH_POSITION",{value:1,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MY_YEAR_POSITION",{value:2,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MD_MONTH_POSITION",{value:1,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MD_DAY_POSITION",{value:2,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_MONTH_POSITION",{value:1,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_DAY_POSITION",{value:2,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty("MDY_YEAR_POSITION",{value:3,handler:this.delegateConfig,validator:this.cfg.checkNumber});};YAHOO.widget.CalendarGroup.prototype.initEvents=function(){var me=this;var sub=function(fn,obj,bOverride){for(var p=0;p0){year+=1;}
+cal.setYear(year);}};YAHOO.widget.CalendarGroup.prototype.render=function(){this.renderHeader();for(var p=0;p=0;--p){var cal=this.pages[p];cal.previousMonth();}};YAHOO.widget.CalendarGroup.prototype.nextYear=function(){for(var p=0;p 11) {
- while (newMonth > 11) {
- newMonth -= 12;
- years += 1;
- }
- }
-
- d.setMonth(newMonth);
- d.setFullYear(date.getFullYear() + years);
- break;
- case this.DAY:
- d.setDate(date.getDate() + amount);
- break;
- case this.YEAR:
- d.setFullYear(date.getFullYear() + amount);
- break;
- case this.WEEK:
- d.setDate(date.getDate() + (amount * 7));
- break;
- }
- return d;
- },
-
- /**
- * Subtracts the specified amount of time from the this instance.
- * @method subtract
- * @param {Date} date The JavaScript Date object to perform subtraction on
- * @param {Number} field The this field constant to be used for performing subtraction.
- * @param {Number} amount The number of units (measured in the field constant) to subtract from the date.
- * @return {Date} The resulting Date object
- */
- subtract : function(date, field, amount) {
- return this.add(date, field, (amount*-1));
- },
-
- /**
- * Determines whether a given date is before another date on the calendar.
- * @method before
- * @param {Date} date The Date object to compare with the compare argument
- * @param {Date} compareTo The Date object to use for the comparison
- * @return {Boolean} true if the date occurs before the compared date; false if not.
- */
- before : function(date, compareTo) {
- var ms = compareTo.getTime();
- if (date.getTime() < ms) {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Determines whether a given date is after another date on the calendar.
- * @method after
- * @param {Date} date The Date object to compare with the compare argument
- * @param {Date} compareTo The Date object to use for the comparison
- * @return {Boolean} true if the date occurs after the compared date; false if not.
- */
- after : function(date, compareTo) {
- var ms = compareTo.getTime();
- if (date.getTime() > ms) {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Determines whether a given date is between two other dates on the calendar.
- * @method between
- * @param {Date} date The date to check for
- * @param {Date} dateBegin The start of the range
- * @param {Date} dateEnd The end of the range
- * @return {Boolean} true if the date occurs between the compared dates; false if not.
- */
- between : function(date, dateBegin, dateEnd) {
- if (this.after(date, dateBegin) && this.before(date, dateEnd)) {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Retrieves a JavaScript Date object representing January 1 of any given year.
- * @method getJan1
- * @param {Number} calendarYear The calendar year for which to retrieve January 1
- * @return {Date} January 1 of the calendar year specified.
- */
- getJan1 : function(calendarYear) {
- return new Date(calendarYear,0,1);
- },
-
- /**
- * Calculates the number of days the specified date is from January 1 of the specified calendar year.
- * Passing January 1 to this function would return an offset value of zero.
- * @method getDayOffset
- * @param {Date} date The JavaScript date for which to find the offset
- * @param {Number} calendarYear The calendar year to use for determining the offset
- * @return {Number} The number of days since January 1 of the given year
- */
- getDayOffset : function(date, calendarYear) {
- var beginYear = this.getJan1(calendarYear); // Find the start of the year. This will be in week 1.
-
- // Find the number of days the passed in date is away from the calendar year start
- var dayOffset = Math.ceil((date.getTime()-beginYear.getTime()) / this.ONE_DAY_MS);
- return dayOffset;
- },
-
- /**
- * Calculates the week number for the given date. This function assumes that week 1 is the
- * week in which January 1 appears, regardless of whether the week consists of a full 7 days.
- * The calendar year can be specified to help find what a the week number would be for a given
- * date if the date overlaps years. For instance, a week may be considered week 1 of 2005, or
- * week 53 of 2004. Specifying the optional calendarYear allows one to make this distinction
- * easily.
- * @method getWeekNumber
- * @param {Date} date The JavaScript date for which to find the week number
- * @param {Number} calendarYear OPTIONAL - The calendar year to use for determining the week number. Default is
- * the calendar year of parameter "date".
- * @param {Number} weekStartsOn OPTIONAL - The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).
- * @return {Number} The week number of the given date.
- */
- getWeekNumber : function(date, calendarYear) {
- date = this.clearTime(date);
- var nearestThurs = new Date(date.getTime() + (4 * this.ONE_DAY_MS) - ((date.getDay()) * this.ONE_DAY_MS));
-
- var jan1 = new Date(nearestThurs.getFullYear(),0,1);
- var dayOfYear = ((nearestThurs.getTime() - jan1.getTime()) / this.ONE_DAY_MS) - 1;
-
- var weekNum = Math.ceil((dayOfYear)/ 7);
- return weekNum;
- },
-
- /**
- * Determines if a given week overlaps two different years.
- * @method isYearOverlapWeek
- * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
- * @return {Boolean} true if the date overlaps two different years.
- */
- isYearOverlapWeek : function(weekBeginDate) {
- var overlaps = false;
- var nextWeek = this.add(weekBeginDate, this.DAY, 6);
- if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {
- overlaps = true;
- }
- return overlaps;
- },
-
- /**
- * Determines if a given week overlaps two different months.
- * @method isMonthOverlapWeek
- * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
- * @return {Boolean} true if the date overlaps two different months.
- */
- isMonthOverlapWeek : function(weekBeginDate) {
- var overlaps = false;
- var nextWeek = this.add(weekBeginDate, this.DAY, 6);
- if (nextWeek.getMonth() != weekBeginDate.getMonth()) {
- overlaps = true;
- }
- return overlaps;
- },
-
- /**
- * Gets the first day of a month containing a given date.
- * @method findMonthStart
- * @param {Date} date The JavaScript Date used to calculate the month start
- * @return {Date} The JavaScript Date representing the first day of the month
- */
- findMonthStart : function(date) {
- var start = new Date(date.getFullYear(), date.getMonth(), 1);
- return start;
- },
-
- /**
- * Gets the last day of a month containing a given date.
- * @method findMonthEnd
- * @param {Date} date The JavaScript Date used to calculate the month end
- * @return {Date} The JavaScript Date representing the last day of the month
- */
- findMonthEnd : function(date) {
- var start = this.findMonthStart(date);
- var nextMonth = this.add(start, this.MONTH, 1);
- var end = this.subtract(nextMonth, this.DAY, 1);
- return end;
- },
-
- /**
- * Clears the time fields from a given date, effectively setting the time to midnight.
- * @method clearTime
- * @param {Date} date The JavaScript Date for which the time fields will be cleared
- * @return {Date} The JavaScript Date cleared of all time fields
- */
- clearTime : function(date) {
- date.setHours(12,0,0,0);
- return date;
- }
-};
-
-/**
-* The Calendar component is a UI control that enables users to choose one or more dates from a graphical calendar presented in a one-month ("one-up") or two-month ("two-up") interface. Calendars are generated entirely via script and can be navigated without any page refreshes.
-* @module Calendar
-* @title Calendar Widget
-* @namespace YAHOO.widget
-* @requires yahoo,dom,event
-*/
-
-/**
-* Calendar is the base class for the Calendar widget. In its most basic
-* implementation, it has the ability to render a calendar widget on the page
-* that can be manipulated to select a single date, move back and forth between
-* months and years.
-* To construct the placeholder for the calendar widget, the code is as
-* follows:
-*
-*
-*
-* Note that the table can be replaced with any kind of element.
-*
-* @namespace YAHOO.widget
-* @class Calendar
-* @constructor
-* @param {String} id The id of the table element that will represent the calendar widget
-* @param {String} containerId The id of the container div element that will wrap the calendar table
-* @param {Object} config The configuration object containing the Calendar's arguments
-*/
-YAHOO.widget.Calendar = function(id, containerId, config) {
- this.init(id, containerId, config);
-};
-
-/**
-* The path to be used for images loaded for the Calendar
-* @property YAHOO.widget.Calendar.IMG_ROOT
-* @static
-* @type String
-*/
-YAHOO.widget.Calendar.IMG_ROOT = (window.location.href.toLowerCase().indexOf("https") === 0 ? "https://a248.e.akamai.net/sec.yimg.com/i/" : "http://us.i1.yimg.com/us.yimg.com/i/");
-
-/**
-* Type constant used for renderers to represent an individual date (M/D/Y)
-* @property YAHOO.widget.Calendar.DATE
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.DATE = "D";
-
-/**
-* Type constant used for renderers to represent an individual date across any year (M/D)
-* @property YAHOO.widget.Calendar.MONTH_DAY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.MONTH_DAY = "MD";
-
-/**
-* Type constant used for renderers to represent a weekday
-* @property YAHOO.widget.Calendar.WEEKDAY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.WEEKDAY = "WD";
-
-/**
-* Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)
-* @property YAHOO.widget.Calendar.RANGE
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.RANGE = "R";
-
-/**
-* Type constant used for renderers to represent a month across any year
-* @property YAHOO.widget.Calendar.MONTH
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.MONTH = "M";
-
-/**
-* Constant that represents the total number of date cells that are displayed in a given month
-* @property YAHOO.widget.Calendar.DISPLAY_DAYS
-* @static
-* @final
-* @type Number
-*/
-YAHOO.widget.Calendar.DISPLAY_DAYS = 42;
-
-/**
-* Constant used for halting the execution of the remainder of the render stack
-* @property YAHOO.widget.Calendar.STOP_RENDER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Calendar.STOP_RENDER = "S";
-
-YAHOO.widget.Calendar.prototype = {
-
- /**
- * The configuration object used to set up the calendars various locale and style options.
- * @property Config
- * @private
- * @deprecated Configuration properties should be set by calling Calendar.cfg.setProperty.
- * @type Object
- */
- Config : null,
-
- /**
- * The parent CalendarGroup, only to be set explicitly by the parent group
- * @property parent
- * @type CalendarGroup
- */
- parent : null,
-
- /**
- * The index of this item in the parent group
- * @property index
- * @type Number
- */
- index : -1,
-
- /**
- * The collection of calendar table cells
- * @property cells
- * @type HTMLTableCellElement[]
- */
- cells : null,
-
- /**
- * The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays in the format of [YYYY, M, D].
- * @property cellDates
- * @type Array[](Number[])
- */
- cellDates : null,
-
- /**
- * The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.
- * @property id
- * @type String
- */
- id : null,
-
- /**
- * The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.
- * @property oDomContainer
- * @type HTMLElement
- */
- oDomContainer : null,
-
- /**
- * A Date object representing today's date.
- * @property today
- * @type Date
- */
- today : null,
-
- /**
- * The list of render functions, along with required parameters, used to render cells.
- * @property renderStack
- * @type Array[]
- */
- renderStack : null,
-
- /**
- * A copy of the initial render functions created before rendering.
- * @property _renderStack
- * @private
- * @type Array
- */
- _renderStack : null,
-
- /**
- * A Date object representing the month/year that the calendar is initially set to
- * @property _pageDate
- * @private
- * @type Date
- */
- _pageDate : null,
-
- /**
- * The private list of initially selected dates.
- * @property _selectedDates
- * @private
- * @type Array
- */
- _selectedDates : null,
-
- /**
- * A map of DOM event handlers to attach to cells associated with specific CSS class names
- * @property domEventMap
- * @type Object
- */
- domEventMap : null
-};
-
-
-
-/**
-* Initializes the Calendar widget.
-* @method init
-* @param {String} id The id of the table element that will represent the calendar widget
-* @param {String} containerId The id of the container div element that will wrap the calendar table
-* @param {Object} config The configuration object containing the Calendar's arguments
-*/
-YAHOO.widget.Calendar.prototype.init = function(id, containerId, config) {
- this.initEvents();
- this.today = new Date();
- YAHOO.widget.DateMath.clearTime(this.today);
-
- this.id = id;
- this.oDomContainer = document.getElementById(containerId);
-
- /**
- * The Config object used to hold the configuration variables for the Calendar
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- /**
- * The local object which contains the Calendar's options
- * @property Options
- * @type Object
- */
- this.Options = {};
-
- /**
- * The local object which contains the Calendar's locale settings
- * @property Locale
- * @type Object
- */
- this.Locale = {};
-
- this.initStyles();
-
- YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);
- YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);
-
- this.cellDates = [];
- this.cells = [];
- this.renderStack = [];
- this._renderStack = [];
-
- this.setupConfig();
-
- if (config) {
- this.cfg.applyConfig(config, true);
- }
-
- this.cfg.fireQueue();
-};
-
-/**
-* Renders the built-in IFRAME shim for the IE6 and below
-* @method configIframe
-*/
-YAHOO.widget.Calendar.prototype.configIframe = function(type, args, obj) {
- var useIframe = args[0];
-
- if (YAHOO.util.Dom.inDocument(this.oDomContainer)) {
- if (useIframe) {
- var pos = YAHOO.util.Dom.getStyle(this.oDomContainer, "position");
-
- if (this.browser == "ie" && (pos == "absolute" || pos == "relative")) {
- if (! YAHOO.util.Dom.inDocument(this.iframe)) {
- this.iframe = document.createElement("iframe");
- this.iframe.src = "javascript:false;";
- YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");
- this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);
- }
- }
- } else {
- if (this.iframe) {
- if (this.iframe.parentNode) {
- this.iframe.parentNode.removeChild(this.iframe);
- }
- this.iframe = null;
- }
- }
- }
-};
-
-/**
-* Default handler for the "title" property
-* @method configTitle
-*/
-YAHOO.widget.Calendar.prototype.configTitle = function(type, args, obj) {
- var title = args[0];
- var close = this.cfg.getProperty("close");
-
- var titleDiv;
-
- if (title && title !== "") {
- titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");
- titleDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;
- titleDiv.innerHTML = title;
- this.oDomContainer.insertBefore(titleDiv, this.oDomContainer.firstChild);
- YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
- } else {
- titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
-
- if (titleDiv) {
- YAHOO.util.Event.purgeElement(titleDiv);
- this.oDomContainer.removeChild(titleDiv);
- }
- if (! close) {
- YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
- }
- }
-};
-
-/**
-* Default handler for the "close" property
-* @method configClose
-*/
-YAHOO.widget.Calendar.prototype.configClose = function(type, args, obj) {
- var close = args[0];
- var title = this.cfg.getProperty("title");
-
- var linkClose;
-
- if (close === true) {
- linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || document.createElement("a");
- linkClose.href = "javascript:void(null);";
- linkClose.className = "link-close";
- YAHOO.util.Event.addListener(linkClose, "click", this.hide, this, true);
- var imgClose = document.createElement("img");
- imgClose.src = YAHOO.widget.Calendar.IMG_ROOT + "us/my/bn/x_d.gif";
- imgClose.className = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE;
- linkClose.appendChild(imgClose);
- this.oDomContainer.appendChild(linkClose);
- YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
- } else {
- linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || null;
-
- if (linkClose) {
- YAHOO.util.Event.purgeElement(linkClose);
- this.oDomContainer.removeChild(linkClose);
- }
- if (! title || title === "") {
- YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
- }
- }
-};
-
-/**
-* Initializes Calendar's built-in CustomEvents
-* @method initEvents
-*/
-YAHOO.widget.Calendar.prototype.initEvents = function() {
-
- /**
- * Fired before a selection is made
- * @event beforeSelectEvent
- */
- this.beforeSelectEvent = new YAHOO.util.CustomEvent("beforeSelect");
-
- /**
- * Fired when a selection is made
- * @event selectEvent
- * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
- */
- this.selectEvent = new YAHOO.util.CustomEvent("select");
-
- /**
- * Fired before a selection is made
- * @event beforeDeselectEvent
- */
- this.beforeDeselectEvent = new YAHOO.util.CustomEvent("beforeDeselect");
-
- /**
- * Fired when a selection is made
- * @event deselectEvent
- * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
- */
- this.deselectEvent = new YAHOO.util.CustomEvent("deselect");
-
- /**
- * Fired when the Calendar page is changed
- * @event changePageEvent
- */
- this.changePageEvent = new YAHOO.util.CustomEvent("changePage");
-
- /**
- * Fired before the Calendar is rendered
- * @event beforeRenderEvent
- */
- this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
-
- /**
- * Fired when the Calendar is rendered
- * @event renderEvent
- */
- this.renderEvent = new YAHOO.util.CustomEvent("render");
-
- /**
- * Fired when the Calendar is reset
- * @event resetEvent
- */
- this.resetEvent = new YAHOO.util.CustomEvent("reset");
-
- /**
- * Fired when the Calendar is cleared
- * @event clearEvent
- */
- this.clearEvent = new YAHOO.util.CustomEvent("clear");
-
- this.beforeSelectEvent.subscribe(this.onBeforeSelect, this, true);
- this.selectEvent.subscribe(this.onSelect, this, true);
- this.beforeDeselectEvent.subscribe(this.onBeforeDeselect, this, true);
- this.deselectEvent.subscribe(this.onDeselect, this, true);
- this.changePageEvent.subscribe(this.onChangePage, this, true);
- this.renderEvent.subscribe(this.onRender, this, true);
- this.resetEvent.subscribe(this.onReset, this, true);
- this.clearEvent.subscribe(this.onClear, this, true);
-};
-
-
-/**
-* The default event function that is attached to a date link within a calendar cell
-* when the calendar is rendered.
-* @method doSelectCell
-* @param {DOMEvent} e The event
-* @param {Calendar} cal A reference to the calendar passed by the Event utility
-*/
-YAHOO.widget.Calendar.prototype.doSelectCell = function(e, cal) {
- var target = YAHOO.util.Event.getTarget(e);
-
- var cell,index,d,date;
-
- while (target.tagName.toLowerCase() != "td" && ! YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
- target = target.parentNode;
- if (target.tagName.toLowerCase() == "html") {
- return;
- }
- }
-
- cell = target;
-
- if (YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
- index = cell.id.split("cell")[1];
- d = cal.cellDates[index];
- date = new Date(d[0],d[1]-1,d[2]);
-
- var link;
-
- if (cal.Options.MULTI_SELECT) {
- link = cell.getElementsByTagName("a")[0];
- if (link) {
- link.blur();
- }
-
- var cellDate = cal.cellDates[index];
- var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);
-
- if (cellDateIndex > -1) {
- cal.deselectCell(index);
- } else {
- cal.selectCell(index);
- }
-
- } else {
- link = cell.getElementsByTagName("a")[0];
- if (link) {
- link.blur();
- }
- cal.selectCell(index);
- }
- }
-};
-
-/**
-* The event that is executed when the user hovers over a cell
-* @method doCellMouseOver
-* @param {DOMEvent} e The event
-* @param {Calendar} cal A reference to the calendar passed by the Event utility
-*/
-YAHOO.widget.Calendar.prototype.doCellMouseOver = function(e, cal) {
- var target;
- if (e) {
- target = YAHOO.util.Event.getTarget(e);
- } else {
- target = this;
- }
-
- while (target.tagName.toLowerCase() != "td") {
- target = target.parentNode;
- if (target.tagName.toLowerCase() == "html") {
- return;
- }
- }
-
- if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
- YAHOO.util.Dom.addClass(target, cal.Style.CSS_CELL_HOVER);
- }
-};
-
-/**
-* The event that is executed when the user moves the mouse out of a cell
-* @method doCellMouseOut
-* @param {DOMEvent} e The event
-* @param {Calendar} cal A reference to the calendar passed by the Event utility
-*/
-YAHOO.widget.Calendar.prototype.doCellMouseOut = function(e, cal) {
- var target;
- if (e) {
- target = YAHOO.util.Event.getTarget(e);
- } else {
- target = this;
- }
-
- while (target.tagName.toLowerCase() != "td") {
- target = target.parentNode;
- if (target.tagName.toLowerCase() == "html") {
- return;
- }
- }
-
- if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
- YAHOO.util.Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
- }
-};
-
-YAHOO.widget.Calendar.prototype.setupConfig = function() {
-
- /**
- * The month/year representing the current visible Calendar date (mm/yyyy)
- * @config pagedate
- * @type String
- * @default today's date
- */
- this.cfg.addProperty("pagedate", { value:new Date(), handler:this.configPageDate } );
-
- /**
- * The date or range of dates representing the current Calendar selection
- * @config selected
- * @type String
- * @default []
- */
- this.cfg.addProperty("selected", { value:[], handler:this.configSelected } );
-
- /**
- * The title to display above the Calendar's month header
- * @config title
- * @type String
- * @default ""
- */
- this.cfg.addProperty("title", { value:"", handler:this.configTitle } );
-
- /**
- * Whether or not a close button should be displayed for this Calendar
- * @config close
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("close", { value:false, handler:this.configClose } );
-
- /**
- * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
- * @config iframe
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("iframe", { value:true, handler:this.configIframe, validator:this.cfg.checkBoolean } );
-
- /**
- * The minimum selectable date in the current Calendar (mm/dd/yyyy)
- * @config mindate
- * @type String
- * @default null
- */
- this.cfg.addProperty("mindate", { value:null, handler:this.configMinDate } );
-
- /**
- * The maximum selectable date in the current Calendar (mm/dd/yyyy)
- * @config maxdate
- * @type String
- * @default null
- */
- this.cfg.addProperty("maxdate", { value:null, handler:this.configMaxDate } );
-
-
- // Options properties
-
- /**
- * True if the Calendar should allow multiple selections. False by default.
- * @config MULTI_SELECT
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("MULTI_SELECT", { value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
-
- /**
- * The weekday the week begins on. Default is 0 (Sunday).
- * @config START_WEEKDAY
- * @type number
- * @default 0
- */
- this.cfg.addProperty("START_WEEKDAY", { value:0, handler:this.configOptions, validator:this.cfg.checkNumber } );
-
- /**
- * True if the Calendar should show weekday labels. True by default.
- * @config SHOW_WEEKDAYS
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("SHOW_WEEKDAYS", { value:true, handler:this.configOptions, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row headers. False by default.
- * @config SHOW_WEEK_HEADER
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("SHOW_WEEK_HEADER",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row footers. False by default.
- * @config SHOW_WEEK_FOOTER
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("SHOW_WEEK_FOOTER",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
- * @config HIDE_BLANK_WEEKS
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("HIDE_BLANK_WEEKS",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
-
- /**
- * The image that should be used for the left navigation arrow.
- * @config NAV_ARROW_LEFT
- * @type String
- * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif"
- */
- this.cfg.addProperty("NAV_ARROW_LEFT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif", handler:this.configOptions } );
-
- /**
- * The image that should be used for the left navigation arrow.
- * @config NAV_ARROW_RIGHT
- * @type String
- * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif"
- */
- this.cfg.addProperty("NAV_ARROW_RIGHT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif", handler:this.configOptions } );
-
- // Locale properties
-
- /**
- * The short month labels for the current locale.
- * @config MONTHS_SHORT
- * @type String[]
- * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
- */
- this.cfg.addProperty("MONTHS_SHORT", { value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], handler:this.configLocale } );
-
- /**
- * The long month labels for the current locale.
- * @config MONTHS_LONG
- * @type String[]
- * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
- */
- this.cfg.addProperty("MONTHS_LONG", { value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], handler:this.configLocale } );
-
- /**
- * The 1-character weekday labels for the current locale.
- * @config WEEKDAYS_1CHAR
- * @type String[]
- * @default ["S", "M", "T", "W", "T", "F", "S"]
- */
- this.cfg.addProperty("WEEKDAYS_1CHAR", { value:["S", "M", "T", "W", "T", "F", "S"], handler:this.configLocale } );
-
- /**
- * The short weekday labels for the current locale.
- * @config WEEKDAYS_SHORT
- * @type String[]
- * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
- */
- this.cfg.addProperty("WEEKDAYS_SHORT", { value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], handler:this.configLocale } );
-
- /**
- * The medium weekday labels for the current locale.
- * @config WEEKDAYS_MEDIUM
- * @type String[]
- * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
- */
- this.cfg.addProperty("WEEKDAYS_MEDIUM", { value:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], handler:this.configLocale } );
-
- /**
- * The long weekday labels for the current locale.
- * @config WEEKDAYS_LONG
- * @type String[]
- * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
- */
- this.cfg.addProperty("WEEKDAYS_LONG", { value:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], handler:this.configLocale } );
-
- /**
- * Refreshes the locale values used to build the Calendar.
- * @method refreshLocale
- * @private
- */
- var refreshLocale = function() {
- this.cfg.refireEvent("LOCALE_MONTHS");
- this.cfg.refireEvent("LOCALE_WEEKDAYS");
- };
-
- this.cfg.subscribeToConfigEvent("START_WEEKDAY", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("MONTHS_SHORT", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("MONTHS_LONG", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("WEEKDAYS_1CHAR", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("WEEKDAYS_SHORT", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("WEEKDAYS_MEDIUM", refreshLocale, this, true);
- this.cfg.subscribeToConfigEvent("WEEKDAYS_LONG", refreshLocale, this, true);
-
- /**
- * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
- * @config LOCALE_MONTHS
- * @type String
- * @default "long"
- */
- this.cfg.addProperty("LOCALE_MONTHS", { value:"long", handler:this.configLocaleValues } );
-
- /**
- * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
- * @config LOCALE_WEEKDAYS
- * @type String
- * @default "short"
- */
- this.cfg.addProperty("LOCALE_WEEKDAYS", { value:"short", handler:this.configLocaleValues } );
-
- /**
- * The value used to delimit individual dates in a date string passed to various Calendar functions.
- * @config DATE_DELIMITER
- * @type String
- * @default ","
- */
- this.cfg.addProperty("DATE_DELIMITER", { value:",", handler:this.configLocale } );
-
- /**
- * The value used to delimit date fields in a date string passed to various Calendar functions.
- * @config DATE_FIELD_DELIMITER
- * @type String
- * @default "/"
- */
- this.cfg.addProperty("DATE_FIELD_DELIMITER",{ value:"/", handler:this.configLocale } );
-
- /**
- * The value used to delimit date ranges in a date string passed to various Calendar functions.
- * @config DATE_RANGE_DELIMITER
- * @type String
- * @default "-"
- */
- this.cfg.addProperty("DATE_RANGE_DELIMITER",{ value:"-", handler:this.configLocale } );
-
- /**
- * The position of the month in a month/year date string
- * @config MY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MY_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the year in a month/year date string
- * @config MY_YEAR_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MY_YEAR_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day date string
- * @config MD_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MD_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the day in a month/year date string
- * @config MD_DAY_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MD_DAY_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day/year date string
- * @config MDY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MDY_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the day in a month/day/year date string
- * @config MDY_DAY_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MDY_DAY_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the year in a month/day/year date string
- * @config MDY_YEAR_POSITION
- * @type Number
- * @default 3
- */
- this.cfg.addProperty("MDY_YEAR_POSITION", { value:3, handler:this.configLocale, validator:this.cfg.checkNumber } );
-};
-
-/**
-* The default handler for the "pagedate" property
-* @method configPageDate
-*/
-YAHOO.widget.Calendar.prototype.configPageDate = function(type, args, obj) {
- var val = args[0];
- var month, year, aMonthYear;
-
- if (val) {
- if (val instanceof Date) {
- val = YAHOO.widget.DateMath.findMonthStart(val);
- this.cfg.setProperty("pagedate", val, true);
- if (! this._pageDate) {
- this._pageDate = this.cfg.getProperty("pagedate");
- }
- return;
- } else {
- aMonthYear = val.split(this.cfg.getProperty("DATE_FIELD_DELIMITER"));
- month = parseInt(aMonthYear[this.cfg.getProperty("MY_MONTH_POSITION")-1], 10)-1;
- year = parseInt(aMonthYear[this.cfg.getProperty("MY_YEAR_POSITION")-1], 10);
- }
- } else {
- month = this.today.getMonth();
- year = this.today.getFullYear();
- }
-
- this.cfg.setProperty("pagedate", new Date(year, month, 1), true);
- if (! this._pageDate) {
- this._pageDate = this.cfg.getProperty("pagedate");
- }
-};
-
-/**
-* The default handler for the "mindate" property
-* @method configMinDate
-*/
-YAHOO.widget.Calendar.prototype.configMinDate = function(type, args, obj) {
- var val = args[0];
- if (typeof val == 'string') {
- val = this._parseDate(val);
- this.cfg.setProperty("mindate", new Date(val[0],(val[1]-1),val[2]));
- }
-};
-
-/**
-* The default handler for the "maxdate" property
-* @method configMaxDate
-*/
-YAHOO.widget.Calendar.prototype.configMaxDate = function(type, args, obj) {
- var val = args[0];
- if (typeof val == 'string') {
- val = this._parseDate(val);
- this.cfg.setProperty("maxdate", new Date(val[0],(val[1]-1),val[2]));
- }
-};
-
-/**
-* The default handler for the "selected" property
-* @method configSelected
-*/
-YAHOO.widget.Calendar.prototype.configSelected = function(type, args, obj) {
- var selected = args[0];
-
- if (selected) {
- if (typeof selected == 'string') {
- this.cfg.setProperty("selected", this._parseDates(selected), true);
- }
- }
- if (! this._selectedDates) {
- this._selectedDates = this.cfg.getProperty("selected");
- }
-};
-
-/**
-* The default handler for all configuration options properties
-* @method configOptions
-*/
-YAHOO.widget.Calendar.prototype.configOptions = function(type, args, obj) {
- type = type.toUpperCase();
- var val = args[0];
- this.Options[type] = val;
-};
-
-/**
-* The default handler for all configuration locale properties
-* @method configLocale
-*/
-YAHOO.widget.Calendar.prototype.configLocale = function(type, args, obj) {
- type = type.toUpperCase();
- var val = args[0];
- this.Locale[type] = val;
-
- this.cfg.refireEvent("LOCALE_MONTHS");
- this.cfg.refireEvent("LOCALE_WEEKDAYS");
-
-};
-
-/**
-* The default handler for all configuration locale field length properties
-* @method configLocaleValues
-*/
-YAHOO.widget.Calendar.prototype.configLocaleValues = function(type, args, obj) {
- type = type.toUpperCase();
- var val = args[0];
-
- switch (type) {
- case "LOCALE_MONTHS":
- switch (val) {
- case "short":
- this.Locale.LOCALE_MONTHS = this.cfg.getProperty("MONTHS_SHORT").concat();
- break;
- case "long":
- this.Locale.LOCALE_MONTHS = this.cfg.getProperty("MONTHS_LONG").concat();
- break;
- }
- break;
- case "LOCALE_WEEKDAYS":
- switch (val) {
- case "1char":
- this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_1CHAR").concat();
- break;
- case "short":
- this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_SHORT").concat();
- break;
- case "medium":
- this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_MEDIUM").concat();
- break;
- case "long":
- this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_LONG").concat();
- break;
- }
-
- var START_WEEKDAY = this.cfg.getProperty("START_WEEKDAY");
-
- if (START_WEEKDAY > 0) {
- for (var w=0;w";
- html[html.length] = "";
- html[html.length] = '';
- html[html.length] = ' ';
-
- if (this.cfg.getProperty("SHOW_WEEKDAYS")) {
- html = this.buildWeekdays(html);
- }
-
- html[html.length] = '';
-
- return html;
-};
-
-/**
-* Renders the Calendar's weekday headers.
-* @method buildWeekdays
-* @param {Array} html The current working HTML array
-* @return {Array} The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.buildWeekdays = function(html) {
-
- html[html.length] = '';
-
- if (this.cfg.getProperty("SHOW_WEEK_HEADER")) {
- html[html.length] = ' ';
- }
-
- for(var i=0;i' + this.Locale.LOCALE_WEEKDAYS[i] + '';
- }
-
- if (this.cfg.getProperty("SHOW_WEEK_FOOTER")) {
- html[html.length] = ' ';
- }
-
- html[html.length] = ' ';
-
- return html;
-};
-
-/**
-* Renders the calendar body.
-* @method renderBody
-* @param {Date} workingDate The current working Date being used for the render process
-* @param {Array} html The current working HTML array
-* @return {Array} The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.renderBody = function(workingDate, html) {
-
- var startDay = this.cfg.getProperty("START_WEEKDAY");
-
- this.preMonthDays = workingDate.getDay();
- if (startDay > 0) {
- this.preMonthDays -= startDay;
- }
- if (this.preMonthDays < 0) {
- this.preMonthDays += 7;
- }
-
- this.monthDays = YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();
- this.postMonthDays = YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;
-
- workingDate = YAHOO.widget.DateMath.subtract(workingDate, YAHOO.widget.DateMath.DAY, this.preMonthDays);
-
- var useDate,weekNum,weekClass;
- useDate = this.cfg.getProperty("pagedate");
-
- html[html.length] = '';
-
- var i = 0;
-
- var tempDiv = document.createElement("div");
- var cell = document.createElement("td");
- tempDiv.appendChild(cell);
-
- var jan1 = new Date(useDate.getFullYear(),0,1);
-
- var cal = this.parent || this;
-
- for (var r=0;r<6;r++) {
-
- weekNum = YAHOO.widget.DateMath.getWeekNumber(workingDate, useDate.getFullYear(), startDay);
-
- weekClass = "w" + weekNum;
-
- if (r !== 0 && this.isDateOOM(workingDate) && this.cfg.getProperty("HIDE_BLANK_WEEKS") === true) {
- break;
- } else {
-
- html[html.length] = '';
-
- if (this.cfg.getProperty("SHOW_WEEK_HEADER")) { html = this.renderRowHeader(weekNum, html); }
-
- for (var d=0;d<7;d++){ // Render actual days
-
- var cellRenderers = [];
-
- this.clearElement(cell);
-
- YAHOO.util.Dom.addClass(cell, "calcell");
-
- cell.id = this.id + "_cell" + i;
-
- cell.innerHTML = i;
-
- var renderer = null;
-
- if (workingDate.getFullYear() == this.today.getFullYear() &&
- workingDate.getMonth() == this.today.getMonth() &&
- workingDate.getDate() == this.today.getDate()) {
- cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;
- }
-
- this.cellDates[this.cellDates.length]=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]; // Add this date to cellDates
-
- if (this.isDateOOM(workingDate)) {
- cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;
- } else {
-
- YAHOO.util.Dom.addClass(cell, "wd" + workingDate.getDay());
- YAHOO.util.Dom.addClass(cell, "d" + workingDate.getDate());
-
- for (var s=0;s= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
- renderer = rArray[2];
-
- if (workingDate.getTime()==d2.getTime()) {
- this.renderStack.splice(s,1);
- }
- }
- break;
- case YAHOO.widget.Calendar.WEEKDAY:
-
- var weekday = rArray[1][0];
- if (workingDate.getDay()+1 == weekday) {
- renderer = rArray[2];
- }
- break;
- case YAHOO.widget.Calendar.MONTH:
-
- month = rArray[1][0];
- if (workingDate.getMonth()+1 == month) {
- renderer = rArray[2];
- }
- break;
- }
-
- if (renderer) {
- cellRenderers[cellRenderers.length]=renderer;
- }
- }
-
- }
-
- if (this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]) > -1) {
- cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected;
- }
-
- var mindate = this.cfg.getProperty("mindate");
- var maxdate = this.cfg.getProperty("maxdate");
-
- if (mindate) {
- mindate = YAHOO.widget.DateMath.clearTime(mindate);
- }
- if (maxdate) {
- maxdate = YAHOO.widget.DateMath.clearTime(maxdate);
- }
-
- if (
- (mindate && (workingDate.getTime() < mindate.getTime())) ||
- (maxdate && (workingDate.getTime() > maxdate.getTime()))
- ) {
- cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;
- } else {
- cellRenderers[cellRenderers.length]=cal.styleCellDefault;
- cellRenderers[cellRenderers.length]=cal.renderCellDefault;
- }
-
-
-
- for (var x=0;x= 0 && i <= 6) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TOP);
- }
- if ((i % 7) === 0) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
- }
- if (((i+1) % 7) === 0) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);
- }
-
- var postDays = this.postMonthDays;
- if (postDays >= 7 && this.cfg.getProperty("HIDE_BLANK_WEEKS")) {
- var blankWeeks = Math.floor(postDays/7);
- for (var p=0;p= ((this.preMonthDays+postDays+this.monthDays)-7)) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
- }
-
- html[html.length] = tempDiv.innerHTML;
-
- i++;
- }
-
- if (this.cfg.getProperty("SHOW_WEEK_FOOTER")) { html = this.renderRowFooter(weekNum, html); }
-
- html[html.length] = ' ';
- }
- }
-
- html[html.length] = ' ';
-
- return html;
-};
-
-/**
-* Renders the calendar footer. In the default implementation, there is
-* no footer.
-* @method renderFooter
-* @param {Array} html The current working HTML array
-* @return {Array} The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.renderFooter = function(html) { return html; };
-
-/**
-* Renders the calendar after it has been configured. The render() method has a specific call chain that will execute
-* when the method is called: renderHeader, renderBody, renderFooter.
-* Refer to the documentation for those methods for information on
-* individual render tasks.
-* @method render
-*/
-YAHOO.widget.Calendar.prototype.render = function() {
- this.beforeRenderEvent.fire();
-
- // Find starting day of the current month
- var workingDate = YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty("pagedate"));
-
- this.resetRenderers();
- this.cellDates.length = 0;
-
- YAHOO.util.Event.purgeElement(this.oDomContainer, true);
-
- var html = [];
-
- html[html.length] = '';
- html = this.renderHeader(html);
- html = this.renderBody(workingDate, html);
- html = this.renderFooter(html);
- html[html.length] = '
';
-
- this.oDomContainer.innerHTML = html.join("\n");
-
- this.applyListeners();
- this.cells = this.oDomContainer.getElementsByTagName("td");
-
- this.cfg.refireEvent("title");
- this.cfg.refireEvent("close");
- this.cfg.refireEvent("iframe");
-
- this.renderEvent.fire();
-};
-
-/**
-* Applies the Calendar's DOM listeners to applicable elements.
-* @method applyListeners
-*/
-YAHOO.widget.Calendar.prototype.applyListeners = function() {
-
- var root = this.oDomContainer;
- var cal = this.parent || this;
-
- var linkLeft, linkRight;
-
- linkLeft = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, "a", root);
- linkRight = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, "a", root);
-
- if (linkLeft) {
- this.linkLeft = linkLeft[0];
- YAHOO.util.Event.addListener(this.linkLeft, "mousedown", cal.previousMonth, cal, true);
- }
-
- if (linkRight) {
- this.linkRight = linkRight[0];
- YAHOO.util.Event.addListener(this.linkRight, "mousedown", cal.nextMonth, cal, true);
- }
-
- if (this.domEventMap) {
- var el,elements;
- for (var cls in this.domEventMap) {
- if (this.domEventMap.hasOwnProperty(cls)) {
- var items = this.domEventMap[cls];
-
- if (! (items instanceof Array)) {
- items = [items];
- }
-
- for (var i=0;i' + weekNum + '';
- return html;
-};
-
-/**
-* Renders the row footer for a week.
-* @method renderRowFooter
-* @param {Number} weekNum The week number of the current row
-* @param {Array} cell The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.renderRowFooter = function(weekNum, html) {
- html[html.length] = '';
- return html;
-};
-
-/**
-* Renders a single standard calendar cell in the calendar widget table.
-* All logic for determining how a standard default cell will be rendered is
-* encapsulated in this method, and must be accounted for when extending the
-* widget class.
-* @method renderCellDefault
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellDefault = function(workingDate, cell) {
- cell.innerHTML = '' + this.buildDayLabel(workingDate) + " ";
-};
-
-/**
-* Styles a selectable cell.
-* @method styleCellDefault
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.styleCellDefault = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTABLE);
-};
-
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight1 style
-* @method renderCellStyleHighlight1
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight1 = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);
-};
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight2 style
-* @method renderCellStyleHighlight2
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight2 = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);
-};
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight3 style
-* @method renderCellStyleHighlight3
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight3 = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);
-};
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight4 style
-* @method renderCellStyleHighlight4
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight4 = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
-};
-
-/**
-* Applies the default style used for rendering today's date to the current calendar cell
-* @method renderCellStyleToday
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleToday = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TODAY);
-};
-
-/**
-* Applies the default style used for rendering selected dates to the current calendar cell
-* @method renderCellStyleSelected
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
-* should not be terminated
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleSelected = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);
-};
-
-/**
-* Applies the default style used for rendering dates that are not a part of the current
-* month (preceding or trailing the cells for the current month)
-* @method renderCellNotThisMonth
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
-* should not be terminated
-*/
-YAHOO.widget.Calendar.prototype.renderCellNotThisMonth = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);
- cell.innerHTML=workingDate.getDate();
- return YAHOO.widget.Calendar.STOP_RENDER;
-};
-
-/**
-* Renders the current calendar cell as a non-selectable "black-out" date using the default
-* restricted style.
-* @method renderBodyCellRestricted
-* @param {Date} workingDate The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement} cell The current working cell in the calendar
-* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
-* should not be terminated
-*/
-YAHOO.widget.Calendar.prototype.renderBodyCellRestricted = function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
- cell.innerHTML=workingDate.getDate();
- return YAHOO.widget.Calendar.STOP_RENDER;
-};
-
-// END BUILT-IN TABLE CELL RENDERERS
-
-// BEGIN MONTH NAVIGATION METHODS
-
-/**
-* Adds the designated number of months to the current calendar month, and sets the current
-* calendar page date to the new month.
-* @method addMonths
-* @param {Number} count The number of months to add to the current calendar
-*/
-YAHOO.widget.Calendar.prototype.addMonths = function(count) {
- this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.MONTH, count));
- this.resetRenderers();
- this.changePageEvent.fire();
-};
-
-/**
-* Subtracts the designated number of months from the current calendar month, and sets the current
-* calendar page date to the new month.
-* @method subtractMonths
-* @param {Number} count The number of months to subtract from the current calendar
-*/
-YAHOO.widget.Calendar.prototype.subtractMonths = function(count) {
- this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.MONTH, count));
- this.resetRenderers();
- this.changePageEvent.fire();
-};
-
-/**
-* Adds the designated number of years to the current calendar, and sets the current
-* calendar page date to the new month.
-* @method addYears
-* @param {Number} count The number of years to add to the current calendar
-*/
-YAHOO.widget.Calendar.prototype.addYears = function(count) {
- this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.YEAR, count));
- this.resetRenderers();
- this.changePageEvent.fire();
-};
-
-/**
-* Subtcats the designated number of years from the current calendar, and sets the current
-* calendar page date to the new month.
-* @method subtractYears
-* @param {Number} count The number of years to subtract from the current calendar
-*/
-YAHOO.widget.Calendar.prototype.subtractYears = function(count) {
- this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.YEAR, count));
- this.resetRenderers();
- this.changePageEvent.fire();
-};
-
-/**
-* Navigates to the next month page in the calendar widget.
-* @method nextMonth
-*/
-YAHOO.widget.Calendar.prototype.nextMonth = function() {
- this.addMonths(1);
-};
-
-/**
-* Navigates to the previous month page in the calendar widget.
-* @method previousMonth
-*/
-YAHOO.widget.Calendar.prototype.previousMonth = function() {
- this.subtractMonths(1);
-};
-
-/**
-* Navigates to the next year in the currently selected month in the calendar widget.
-* @method nextYear
-*/
-YAHOO.widget.Calendar.prototype.nextYear = function() {
- this.addYears(1);
-};
-
-/**
-* Navigates to the previous year in the currently selected month in the calendar widget.
-* @method previousYear
-*/
-YAHOO.widget.Calendar.prototype.previousYear = function() {
- this.subtractYears(1);
-};
-
-// END MONTH NAVIGATION METHODS
-
-// BEGIN SELECTION METHODS
-
-/**
-* Resets the calendar widget to the originally selected month and year, and
-* sets the calendar to the initial selection(s).
-* @method reset
-*/
-YAHOO.widget.Calendar.prototype.reset = function() {
- this.cfg.resetProperty("selected");
- this.cfg.resetProperty("pagedate");
- this.resetEvent.fire();
-};
-
-/**
-* Clears the selected dates in the current calendar widget and sets the calendar
-* to the current month and year.
-* @method clear
-*/
-YAHOO.widget.Calendar.prototype.clear = function() {
- this.cfg.setProperty("selected", []);
- this.cfg.setProperty("pagedate", new Date(this.today.getTime()));
- this.clearEvent.fire();
-};
-
-/**
-* Selects a date or a collection of dates on the current calendar. This method, by default,
-* does not call the render method explicitly. Once selection has completed, render must be
-* called for the changes to be reflected visually.
-* @method select
-* @param {String/Date/Date[]} date The date string of dates to select in the current calendar. Valid formats are
-* individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
-* Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
-* This method can also take a JavaScript Date object or an array of Date objects.
-* @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
-*/
-YAHOO.widget.Calendar.prototype.select = function(date) {
- this.beforeSelectEvent.fire();
-
- var selected = this.cfg.getProperty("selected");
- var aToBeSelected = this._toFieldArray(date);
-
- for (var a=0;a -1) {
- if (this.cfg.getProperty("pagedate").getMonth() == dCellDate.getMonth() &&
- this.cfg.getProperty("pagedate").getFullYear() == dCellDate.getFullYear()) {
- YAHOO.util.Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
- }
-
- selected.splice(cellDateIndex, 1);
- }
-
-
- if (this.parent) {
- this.parent.cfg.setProperty("selected", selected);
- } else {
- this.cfg.setProperty("selected", selected);
- }
-
- this.deselectEvent.fire(selectDate);
- return this.getSelectedDates();
-};
-
-/**
-* Deselects all dates on the current calendar.
-* @method deselectAll
-* @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
-* Assuming that this function executes properly, the return value should be an empty array.
-* However, the empty array is returned for the sake of being able to check the selection status
-* of the calendar.
-*/
-YAHOO.widget.Calendar.prototype.deselectAll = function() {
- this.beforeDeselectEvent.fire();
-
- var selected = this.cfg.getProperty("selected");
- var count = selected.length;
- var sel = selected.concat();
-
- if (this.parent) {
- this.parent.cfg.setProperty("selected", []);
- } else {
- this.cfg.setProperty("selected", []);
- }
-
- if (count > 0) {
- this.deselectEvent.fire(sel);
- }
-
- return this.getSelectedDates();
-};
-
-// END SELECTION METHODS
-
-// BEGIN TYPE CONVERSION METHODS
-
-/**
-* Converts a date (either a JavaScript Date object, or a date string) to the internal data structure
-* used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].
-* @method _toFieldArray
-* @private
-* @param {String/Date/Date[]} date The date string of dates to deselect in the current calendar. Valid formats are
-* individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
-* Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
-* This method can also take a JavaScript Date object or an array of Date objects.
-* @return {Array[](Number[])} Array of date field arrays
-*/
-YAHOO.widget.Calendar.prototype._toFieldArray = function(date) {
- var returnDate = [];
-
- if (date instanceof Date) {
- returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];
- } else if (typeof date == 'string') {
- returnDate = this._parseDates(date);
- } else if (date instanceof Array) {
- for (var i=0;i
-*
-*
-*
-* The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.
-* @namespace YAHOO.widget
-* @class CalendarGroup
-* @constructor
-* @param {String} id The id of the table element that will represent the calendar widget
-* @param {String} containerId The id of the container div element that will wrap the calendar table
-* @param {Object} config The configuration object containing the Calendar's arguments
-*/
-YAHOO.widget.CalendarGroup = function(id, containerId, config) {
- if (arguments.length > 0) {
- this.init(id, containerId, config);
- }
-};
-
-/**
-* Initializes the calendar group. All subclasses must call this method in order for the
-* group to be initialized properly.
-* @method init
-* @param {String} id The id of the table element that will represent the calendar widget
-* @param {String} containerId The id of the container div element that will wrap the calendar table
-* @param {Object} config The configuration object containing the Calendar's arguments
-*/
-YAHOO.widget.CalendarGroup.prototype.init = function(id, containerId, config) {
- this.initEvents();
- this.initStyles();
-
- /**
- * The collection of Calendar pages contained within the CalendarGroup
- * @property pages
- * @type YAHOO.widget.Calendar[]
- */
- this.pages = [];
-
- /**
- * The unique id associated with the CalendarGroup
- * @property id
- * @type String
- */
- this.id = id;
-
- /**
- * The unique id associated with the CalendarGroup container
- * @property containerId
- * @type String
- */
- this.containerId = containerId;
-
- /**
- * The outer containing element for the CalendarGroup
- * @property oDomContainer
- * @type HTMLElement
- */
- this.oDomContainer = document.getElementById(containerId);
-
- YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_CONTAINER);
- YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_MULTI_UP);
-
- /**
- * The Config object used to hold the configuration variables for the CalendarGroup
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- /**
- * The local object which contains the CalendarGroup's options
- * @property Options
- * @type Object
- */
- this.Options = {};
-
- /**
- * The local object which contains the CalendarGroup's locale settings
- * @property Locale
- * @type Object
- */
- this.Locale = {};
-
- this.setupConfig();
-
- if (config) {
- this.cfg.applyConfig(config, true);
- }
-
- this.cfg.fireQueue();
-
- // OPERA HACK FOR MISWRAPPED FLOATS
- if (this.browser == "opera"){
- var fixWidth = function() {
- var startW = this.oDomContainer.offsetWidth;
- var w = 0;
- for (var p=0;p 0) {
- this.oDomContainer.style.width = w + "px";
- }
- };
- this.renderEvent.subscribe(fixWidth,this,true);
- }
-};
-
-
-YAHOO.widget.CalendarGroup.prototype.setupConfig = function() {
- /**
- * The number of pages to include in the CalendarGroup. This value can only be set once, in the CalendarGroup's constructor arguments.
- * @config pages
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("pages", { value:2, validator:this.cfg.checkNumber, handler:this.configPages } );
-
- /**
- * The month/year representing the current visible Calendar date (mm/yyyy)
- * @config pagedate
- * @type String
- * @default today's date
- */
- this.cfg.addProperty("pagedate", { value:new Date(), handler:this.configPageDate } );
-
- /**
- * The date or range of dates representing the current Calendar selection
- * @config selected
- * @type String
- * @default []
- */
- this.cfg.addProperty("selected", { value:[], handler:this.delegateConfig } );
-
- /**
- * The title to display above the CalendarGroup's month header
- * @config title
- * @type String
- * @default ""
- */
- this.cfg.addProperty("title", { value:"", handler:this.configTitle } );
-
- /**
- * Whether or not a close button should be displayed for this CalendarGroup
- * @config close
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("close", { value:false, handler:this.configClose } );
-
- /**
- * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
- * @config iframe
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("iframe", { value:true, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * The minimum selectable date in the current Calendar (mm/dd/yyyy)
- * @config mindate
- * @type String
- * @default null
- */
- this.cfg.addProperty("mindate", { value:null, handler:this.delegateConfig } );
-
- /**
- * The maximum selectable date in the current Calendar (mm/dd/yyyy)
- * @config maxdate
- * @type String
- * @default null
- */
- this.cfg.addProperty("maxdate", { value:null, handler:this.delegateConfig } );
-
- // Options properties
-
- /**
- * True if the Calendar should allow multiple selections. False by default.
- * @config MULTI_SELECT
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("MULTI_SELECT", { value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * The weekday the week begins on. Default is 0 (Sunday).
- * @config START_WEEKDAY
- * @type number
- * @default 0
- */
- this.cfg.addProperty("START_WEEKDAY", { value:0, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * True if the Calendar should show weekday labels. True by default.
- * @config SHOW_WEEKDAYS
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("SHOW_WEEKDAYS", { value:true, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row headers. False by default.
- * @config SHOW_WEEK_HEADER
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("SHOW_WEEK_HEADER",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row footers. False by default.
- * @config SHOW_WEEK_FOOTER
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("SHOW_WEEK_FOOTER",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
- * @config HIDE_BLANK_WEEKS
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("HIDE_BLANK_WEEKS",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
-
- /**
- * The image that should be used for the left navigation arrow.
- * @config NAV_ARROW_LEFT
- * @type String
- * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif"
- */
- this.cfg.addProperty("NAV_ARROW_LEFT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif", handler:this.delegateConfig } );
-
- /**
- * The image that should be used for the left navigation arrow.
- * @config NAV_ARROW_RIGHT
- * @type String
- * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif"
- */
- this.cfg.addProperty("NAV_ARROW_RIGHT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif", handler:this.delegateConfig } );
-
- // Locale properties
-
- /**
- * The short month labels for the current locale.
- * @config MONTHS_SHORT
- * @type String[]
- * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
- */
- this.cfg.addProperty("MONTHS_SHORT", { value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], handler:this.delegateConfig } );
-
- /**
- * The long month labels for the current locale.
- * @config MONTHS_LONG
- * @type String[]
- * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
- */
- this.cfg.addProperty("MONTHS_LONG", { value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], handler:this.delegateConfig } );
-
- /**
- * The 1-character weekday labels for the current locale.
- * @config WEEKDAYS_1CHAR
- * @type String[]
- * @default ["S", "M", "T", "W", "T", "F", "S"]
- */
- this.cfg.addProperty("WEEKDAYS_1CHAR", { value:["S", "M", "T", "W", "T", "F", "S"], handler:this.delegateConfig } );
-
- /**
- * The short weekday labels for the current locale.
- * @config WEEKDAYS_SHORT
- * @type String[]
- * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
- */
- this.cfg.addProperty("WEEKDAYS_SHORT", { value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], handler:this.delegateConfig } );
-
- /**
- * The medium weekday labels for the current locale.
- * @config WEEKDAYS_MEDIUM
- * @type String[]
- * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
- */
- this.cfg.addProperty("WEEKDAYS_MEDIUM", { value:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], handler:this.delegateConfig } );
-
- /**
- * The long weekday labels for the current locale.
- * @config WEEKDAYS_LONG
- * @type String[]
- * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
- */
- this.cfg.addProperty("WEEKDAYS_LONG", { value:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], handler:this.delegateConfig } );
-
- /**
- * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
- * @config LOCALE_MONTHS
- * @type String
- * @default "long"
- */
- this.cfg.addProperty("LOCALE_MONTHS", { value:"long", handler:this.delegateConfig } );
-
- /**
- * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
- * @config LOCALE_WEEKDAYS
- * @type String
- * @default "short"
- */
- this.cfg.addProperty("LOCALE_WEEKDAYS", { value:"short", handler:this.delegateConfig } );
-
- /**
- * The value used to delimit individual dates in a date string passed to various Calendar functions.
- * @config DATE_DELIMITER
- * @type String
- * @default ","
- */
- this.cfg.addProperty("DATE_DELIMITER", { value:",", handler:this.delegateConfig } );
-
- /**
- * The value used to delimit date fields in a date string passed to various Calendar functions.
- * @config DATE_FIELD_DELIMITER
- * @type String
- * @default "/"
- */
- this.cfg.addProperty("DATE_FIELD_DELIMITER",{ value:"/", handler:this.delegateConfig } );
-
- /**
- * The value used to delimit date ranges in a date string passed to various Calendar functions.
- * @config DATE_RANGE_DELIMITER
- * @type String
- * @default "-"
- */
- this.cfg.addProperty("DATE_RANGE_DELIMITER",{ value:"-", handler:this.delegateConfig } );
-
- /**
- * The position of the month in a month/year date string
- * @config MY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MY_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the year in a month/year date string
- * @config MY_YEAR_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MY_YEAR_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day date string
- * @config MD_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MD_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the day in a month/year date string
- * @config MD_DAY_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MD_DAY_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day/year date string
- * @config MDY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- this.cfg.addProperty("MDY_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the day in a month/day/year date string
- * @config MDY_DAY_POSITION
- * @type Number
- * @default 2
- */
- this.cfg.addProperty("MDY_DAY_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
- /**
- * The position of the year in a month/day/year date string
- * @config MDY_YEAR_POSITION
- * @type Number
- * @default 3
- */
- this.cfg.addProperty("MDY_YEAR_POSITION", { value:3, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
-
-};
-
-/**
-* Initializes CalendarGroup's built-in CustomEvents
-* @method initEvents
-*/
-YAHOO.widget.CalendarGroup.prototype.initEvents = function() {
- var me = this;
-
- /**
- * Proxy subscriber to subscribe to the CalendarGroup's child Calendars' CustomEvents
- * @method sub
- * @private
- * @param {Function} fn The function to subscribe to this CustomEvent
- * @param {Object} obj The CustomEvent's scope object
- * @param {Boolean} bOverride Whether or not to apply scope correction
- */
- var sub = function(fn, obj, bOverride) {
- for (var p=0;p0) {
- year+=1;
- }
- cal.setYear(year);
- }
-};
-/**
-* Calls the render function of all child calendars within the group.
-* @method render
-*/
-YAHOO.widget.CalendarGroup.prototype.render = function() {
- this.renderHeader();
- for (var p=0;p=0;--p) {
- var cal = this.pages[p];
- cal.previousMonth();
- }
-};
-
-/**
-* Navigates to the next year in the currently selected month in the calendar widget.
-* @method nextYear
-*/
-YAHOO.widget.CalendarGroup.prototype.nextYear = function() {
- for (var p=0;p 11) {
+ while (newMonth > 11) {
+ newMonth -= 12;
+ years += 1;
+ }
+ }
+
+ d.setMonth(newMonth);
+ d.setFullYear(date.getFullYear() + years);
+ break;
+ case this.DAY:
+ d.setDate(date.getDate() + amount);
+ break;
+ case this.YEAR:
+ d.setFullYear(date.getFullYear() + amount);
+ break;
+ case this.WEEK:
+ d.setDate(date.getDate() + (amount * 7));
+ break;
+ }
+ return d;
+ },
+
+ /**
+ * Subtracts the specified amount of time from the this instance.
+ * @method subtract
+ * @param {Date} date The JavaScript Date object to perform subtraction on
+ * @param {Number} field The this field constant to be used for performing subtraction.
+ * @param {Number} amount The number of units (measured in the field constant) to subtract from the date.
+ * @return {Date} The resulting Date object
+ */
+ subtract : function(date, field, amount) {
+ return this.add(date, field, (amount*-1));
+ },
+
+ /**
+ * Determines whether a given date is before another date on the calendar.
+ * @method before
+ * @param {Date} date The Date object to compare with the compare argument
+ * @param {Date} compareTo The Date object to use for the comparison
+ * @return {Boolean} true if the date occurs before the compared date; false if not.
+ */
+ before : function(date, compareTo) {
+ var ms = compareTo.getTime();
+ if (date.getTime() < ms) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Determines whether a given date is after another date on the calendar.
+ * @method after
+ * @param {Date} date The Date object to compare with the compare argument
+ * @param {Date} compareTo The Date object to use for the comparison
+ * @return {Boolean} true if the date occurs after the compared date; false if not.
+ */
+ after : function(date, compareTo) {
+ var ms = compareTo.getTime();
+ if (date.getTime() > ms) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Determines whether a given date is between two other dates on the calendar.
+ * @method between
+ * @param {Date} date The date to check for
+ * @param {Date} dateBegin The start of the range
+ * @param {Date} dateEnd The end of the range
+ * @return {Boolean} true if the date occurs between the compared dates; false if not.
+ */
+ between : function(date, dateBegin, dateEnd) {
+ if (this.after(date, dateBegin) && this.before(date, dateEnd)) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Retrieves a JavaScript Date object representing January 1 of any given year.
+ * @method getJan1
+ * @param {Number} calendarYear The calendar year for which to retrieve January 1
+ * @return {Date} January 1 of the calendar year specified.
+ */
+ getJan1 : function(calendarYear) {
+ return new Date(calendarYear,0,1);
+ },
+
+ /**
+ * Calculates the number of days the specified date is from January 1 of the specified calendar year.
+ * Passing January 1 to this function would return an offset value of zero.
+ * @method getDayOffset
+ * @param {Date} date The JavaScript date for which to find the offset
+ * @param {Number} calendarYear The calendar year to use for determining the offset
+ * @return {Number} The number of days since January 1 of the given year
+ */
+ getDayOffset : function(date, calendarYear) {
+ var beginYear = this.getJan1(calendarYear); // Find the start of the year. This will be in week 1.
+
+ // Find the number of days the passed in date is away from the calendar year start
+ var dayOffset = Math.ceil((date.getTime()-beginYear.getTime()) / this.ONE_DAY_MS);
+ return dayOffset;
+ },
+
+ /**
+ * Calculates the week number for the given date. This function assumes that week 1 is the
+ * week in which January 1 appears, regardless of whether the week consists of a full 7 days.
+ * The calendar year can be specified to help find what a the week number would be for a given
+ * date if the date overlaps years. For instance, a week may be considered week 1 of 2005, or
+ * week 53 of 2004. Specifying the optional calendarYear allows one to make this distinction
+ * easily.
+ * @method getWeekNumber
+ * @param {Date} date The JavaScript date for which to find the week number
+ * @param {Number} calendarYear OPTIONAL - The calendar year to use for determining the week number. Default is
+ * the calendar year of parameter "date".
+ * @param {Number} weekStartsOn OPTIONAL - The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).
+ * @return {Number} The week number of the given date.
+ */
+ getWeekNumber : function(date, calendarYear) {
+ date = this.clearTime(date);
+ var nearestThurs = new Date(date.getTime() + (4 * this.ONE_DAY_MS) - ((date.getDay()) * this.ONE_DAY_MS));
+
+ var jan1 = new Date(nearestThurs.getFullYear(),0,1);
+ var dayOfYear = ((nearestThurs.getTime() - jan1.getTime()) / this.ONE_DAY_MS) - 1;
+
+ var weekNum = Math.ceil((dayOfYear)/ 7);
+ return weekNum;
+ },
+
+ /**
+ * Determines if a given week overlaps two different years.
+ * @method isYearOverlapWeek
+ * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
+ * @return {Boolean} true if the date overlaps two different years.
+ */
+ isYearOverlapWeek : function(weekBeginDate) {
+ var overlaps = false;
+ var nextWeek = this.add(weekBeginDate, this.DAY, 6);
+ if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {
+ overlaps = true;
+ }
+ return overlaps;
+ },
+
+ /**
+ * Determines if a given week overlaps two different months.
+ * @method isMonthOverlapWeek
+ * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
+ * @return {Boolean} true if the date overlaps two different months.
+ */
+ isMonthOverlapWeek : function(weekBeginDate) {
+ var overlaps = false;
+ var nextWeek = this.add(weekBeginDate, this.DAY, 6);
+ if (nextWeek.getMonth() != weekBeginDate.getMonth()) {
+ overlaps = true;
+ }
+ return overlaps;
+ },
+
+ /**
+ * Gets the first day of a month containing a given date.
+ * @method findMonthStart
+ * @param {Date} date The JavaScript Date used to calculate the month start
+ * @return {Date} The JavaScript Date representing the first day of the month
+ */
+ findMonthStart : function(date) {
+ var start = new Date(date.getFullYear(), date.getMonth(), 1);
+ return start;
+ },
+
+ /**
+ * Gets the last day of a month containing a given date.
+ * @method findMonthEnd
+ * @param {Date} date The JavaScript Date used to calculate the month end
+ * @return {Date} The JavaScript Date representing the last day of the month
+ */
+ findMonthEnd : function(date) {
+ var start = this.findMonthStart(date);
+ var nextMonth = this.add(start, this.MONTH, 1);
+ var end = this.subtract(nextMonth, this.DAY, 1);
+ return end;
+ },
+
+ /**
+ * Clears the time fields from a given date, effectively setting the time to midnight.
+ * @method clearTime
+ * @param {Date} date The JavaScript Date for which the time fields will be cleared
+ * @return {Date} The JavaScript Date cleared of all time fields
+ */
+ clearTime : function(date) {
+ date.setHours(12,0,0,0);
+ return date;
+ }
+};
+
+/**
+* The Calendar component is a UI control that enables users to choose one or more dates from a graphical calendar presented in a one-month ("one-up") or two-month ("two-up") interface. Calendars are generated entirely via script and can be navigated without any page refreshes.
+* @module Calendar
+* @title Calendar Widget
+* @namespace YAHOO.widget
+* @requires yahoo,dom,event
+*/
+
+/**
+* Calendar is the base class for the Calendar widget. In its most basic
+* implementation, it has the ability to render a calendar widget on the page
+* that can be manipulated to select a single date, move back and forth between
+* months and years.
+* To construct the placeholder for the calendar widget, the code is as
+* follows:
+*
+*
+*
+* Note that the table can be replaced with any kind of element.
+*
+* @namespace YAHOO.widget
+* @class Calendar
+* @constructor
+* @param {String} id The id of the table element that will represent the calendar widget
+* @param {String} containerId The id of the container div element that will wrap the calendar table
+* @param {Object} config The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.Calendar = function(id, containerId, config) {
+ this.init(id, containerId, config);
+};
+
+/**
+* The path to be used for images loaded for the Calendar
+* @property YAHOO.widget.Calendar.IMG_ROOT
+* @static
+* @type String
+*/
+YAHOO.widget.Calendar.IMG_ROOT = (window.location.href.toLowerCase().indexOf("https") === 0 ? "https://a248.e.akamai.net/sec.yimg.com/i/" : "http://us.i1.yimg.com/us.yimg.com/i/");
+
+/**
+* Type constant used for renderers to represent an individual date (M/D/Y)
+* @property YAHOO.widget.Calendar.DATE
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.DATE = "D";
+
+/**
+* Type constant used for renderers to represent an individual date across any year (M/D)
+* @property YAHOO.widget.Calendar.MONTH_DAY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.MONTH_DAY = "MD";
+
+/**
+* Type constant used for renderers to represent a weekday
+* @property YAHOO.widget.Calendar.WEEKDAY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.WEEKDAY = "WD";
+
+/**
+* Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)
+* @property YAHOO.widget.Calendar.RANGE
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.RANGE = "R";
+
+/**
+* Type constant used for renderers to represent a month across any year
+* @property YAHOO.widget.Calendar.MONTH
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.MONTH = "M";
+
+/**
+* Constant that represents the total number of date cells that are displayed in a given month
+* @property YAHOO.widget.Calendar.DISPLAY_DAYS
+* @static
+* @final
+* @type Number
+*/
+YAHOO.widget.Calendar.DISPLAY_DAYS = 42;
+
+/**
+* Constant used for halting the execution of the remainder of the render stack
+* @property YAHOO.widget.Calendar.STOP_RENDER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.STOP_RENDER = "S";
+
+YAHOO.widget.Calendar.prototype = {
+
+ /**
+ * The configuration object used to set up the calendars various locale and style options.
+ * @property Config
+ * @private
+ * @deprecated Configuration properties should be set by calling Calendar.cfg.setProperty.
+ * @type Object
+ */
+ Config : null,
+
+ /**
+ * The parent CalendarGroup, only to be set explicitly by the parent group
+ * @property parent
+ * @type CalendarGroup
+ */
+ parent : null,
+
+ /**
+ * The index of this item in the parent group
+ * @property index
+ * @type Number
+ */
+ index : -1,
+
+ /**
+ * The collection of calendar table cells
+ * @property cells
+ * @type HTMLTableCellElement[]
+ */
+ cells : null,
+
+ /**
+ * The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays in the format of [YYYY, M, D].
+ * @property cellDates
+ * @type Array[](Number[])
+ */
+ cellDates : null,
+
+ /**
+ * The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.
+ * @property id
+ * @type String
+ */
+ id : null,
+
+ /**
+ * The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.
+ * @property oDomContainer
+ * @type HTMLElement
+ */
+ oDomContainer : null,
+
+ /**
+ * A Date object representing today's date.
+ * @property today
+ * @type Date
+ */
+ today : null,
+
+ /**
+ * The list of render functions, along with required parameters, used to render cells.
+ * @property renderStack
+ * @type Array[]
+ */
+ renderStack : null,
+
+ /**
+ * A copy of the initial render functions created before rendering.
+ * @property _renderStack
+ * @private
+ * @type Array
+ */
+ _renderStack : null,
+
+ /**
+ * A Date object representing the month/year that the calendar is initially set to
+ * @property _pageDate
+ * @private
+ * @type Date
+ */
+ _pageDate : null,
+
+ /**
+ * The private list of initially selected dates.
+ * @property _selectedDates
+ * @private
+ * @type Array
+ */
+ _selectedDates : null,
+
+ /**
+ * A map of DOM event handlers to attach to cells associated with specific CSS class names
+ * @property domEventMap
+ * @type Object
+ */
+ domEventMap : null
+};
+
+
+
+/**
+* Initializes the Calendar widget.
+* @method init
+* @param {String} id The id of the table element that will represent the calendar widget
+* @param {String} containerId The id of the container div element that will wrap the calendar table
+* @param {Object} config The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.Calendar.prototype.init = function(id, containerId, config) {
+ this.initEvents();
+ this.today = new Date();
+ YAHOO.widget.DateMath.clearTime(this.today);
+
+ this.id = id;
+ this.oDomContainer = document.getElementById(containerId);
+
+ /**
+ * The Config object used to hold the configuration variables for the Calendar
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ /**
+ * The local object which contains the Calendar's options
+ * @property Options
+ * @type Object
+ */
+ this.Options = {};
+
+ /**
+ * The local object which contains the Calendar's locale settings
+ * @property Locale
+ * @type Object
+ */
+ this.Locale = {};
+
+ this.initStyles();
+
+ YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);
+ YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);
+
+ this.cellDates = [];
+ this.cells = [];
+ this.renderStack = [];
+ this._renderStack = [];
+
+ this.setupConfig();
+
+ if (config) {
+ this.cfg.applyConfig(config, true);
+ }
+
+ this.cfg.fireQueue();
+};
+
+/**
+* Renders the built-in IFRAME shim for the IE6 and below
+* @method configIframe
+*/
+YAHOO.widget.Calendar.prototype.configIframe = function(type, args, obj) {
+ var useIframe = args[0];
+
+ if (YAHOO.util.Dom.inDocument(this.oDomContainer)) {
+ if (useIframe) {
+ var pos = YAHOO.util.Dom.getStyle(this.oDomContainer, "position");
+
+ if (this.browser == "ie" && (pos == "absolute" || pos == "relative")) {
+ if (! YAHOO.util.Dom.inDocument(this.iframe)) {
+ this.iframe = document.createElement("iframe");
+ this.iframe.src = "javascript:false;";
+ YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");
+ this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);
+ }
+ }
+ } else {
+ if (this.iframe) {
+ if (this.iframe.parentNode) {
+ this.iframe.parentNode.removeChild(this.iframe);
+ }
+ this.iframe = null;
+ }
+ }
+ }
+};
+
+/**
+* Default handler for the "title" property
+* @method configTitle
+*/
+YAHOO.widget.Calendar.prototype.configTitle = function(type, args, obj) {
+ var title = args[0];
+ var close = this.cfg.getProperty("close");
+
+ var titleDiv;
+
+ if (title && title !== "") {
+ titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");
+ titleDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;
+ titleDiv.innerHTML = title;
+ this.oDomContainer.insertBefore(titleDiv, this.oDomContainer.firstChild);
+ YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
+ } else {
+ titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
+
+ if (titleDiv) {
+ YAHOO.util.Event.purgeElement(titleDiv);
+ this.oDomContainer.removeChild(titleDiv);
+ }
+ if (! close) {
+ YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
+ }
+ }
+};
+
+/**
+* Default handler for the "close" property
+* @method configClose
+*/
+YAHOO.widget.Calendar.prototype.configClose = function(type, args, obj) {
+ var close = args[0];
+ var title = this.cfg.getProperty("title");
+
+ var linkClose;
+
+ if (close === true) {
+ linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || document.createElement("a");
+ linkClose.href = "javascript:void(null);";
+ linkClose.className = "link-close";
+ YAHOO.util.Event.addListener(linkClose, "click", this.hide, this, true);
+ var imgClose = document.createElement("img");
+ imgClose.src = YAHOO.widget.Calendar.IMG_ROOT + "us/my/bn/x_d.gif";
+ imgClose.className = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE;
+ linkClose.appendChild(imgClose);
+ this.oDomContainer.appendChild(linkClose);
+ YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
+ } else {
+ linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || null;
+
+ if (linkClose) {
+ YAHOO.util.Event.purgeElement(linkClose);
+ this.oDomContainer.removeChild(linkClose);
+ }
+ if (! title || title === "") {
+ YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
+ }
+ }
+};
+
+/**
+* Initializes Calendar's built-in CustomEvents
+* @method initEvents
+*/
+YAHOO.widget.Calendar.prototype.initEvents = function() {
+
+ /**
+ * Fired before a selection is made
+ * @event beforeSelectEvent
+ */
+ this.beforeSelectEvent = new YAHOO.util.CustomEvent("beforeSelect");
+
+ /**
+ * Fired when a selection is made
+ * @event selectEvent
+ * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
+ */
+ this.selectEvent = new YAHOO.util.CustomEvent("select");
+
+ /**
+ * Fired before a selection is made
+ * @event beforeDeselectEvent
+ */
+ this.beforeDeselectEvent = new YAHOO.util.CustomEvent("beforeDeselect");
+
+ /**
+ * Fired when a selection is made
+ * @event deselectEvent
+ * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
+ */
+ this.deselectEvent = new YAHOO.util.CustomEvent("deselect");
+
+ /**
+ * Fired when the Calendar page is changed
+ * @event changePageEvent
+ */
+ this.changePageEvent = new YAHOO.util.CustomEvent("changePage");
+
+ /**
+ * Fired before the Calendar is rendered
+ * @event beforeRenderEvent
+ */
+ this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
+
+ /**
+ * Fired when the Calendar is rendered
+ * @event renderEvent
+ */
+ this.renderEvent = new YAHOO.util.CustomEvent("render");
+
+ /**
+ * Fired when the Calendar is reset
+ * @event resetEvent
+ */
+ this.resetEvent = new YAHOO.util.CustomEvent("reset");
+
+ /**
+ * Fired when the Calendar is cleared
+ * @event clearEvent
+ */
+ this.clearEvent = new YAHOO.util.CustomEvent("clear");
+
+ this.beforeSelectEvent.subscribe(this.onBeforeSelect, this, true);
+ this.selectEvent.subscribe(this.onSelect, this, true);
+ this.beforeDeselectEvent.subscribe(this.onBeforeDeselect, this, true);
+ this.deselectEvent.subscribe(this.onDeselect, this, true);
+ this.changePageEvent.subscribe(this.onChangePage, this, true);
+ this.renderEvent.subscribe(this.onRender, this, true);
+ this.resetEvent.subscribe(this.onReset, this, true);
+ this.clearEvent.subscribe(this.onClear, this, true);
+};
+
+
+/**
+* The default event function that is attached to a date link within a calendar cell
+* when the calendar is rendered.
+* @method doSelectCell
+* @param {DOMEvent} e The event
+* @param {Calendar} cal A reference to the calendar passed by the Event utility
+*/
+YAHOO.widget.Calendar.prototype.doSelectCell = function(e, cal) {
+ var target = YAHOO.util.Event.getTarget(e);
+
+ var cell,index,d,date;
+
+ while (target.tagName.toLowerCase() != "td" && ! YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+ target = target.parentNode;
+ if (target.tagName.toLowerCase() == "html") {
+ return;
+ }
+ }
+
+ cell = target;
+
+ if (YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
+ index = cell.id.split("cell")[1];
+ d = cal.cellDates[index];
+ date = new Date(d[0],d[1]-1,d[2]);
+
+ var link;
+
+ if (cal.Options.MULTI_SELECT) {
+ link = cell.getElementsByTagName("a")[0];
+ if (link) {
+ link.blur();
+ }
+
+ var cellDate = cal.cellDates[index];
+ var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);
+
+ if (cellDateIndex > -1) {
+ cal.deselectCell(index);
+ } else {
+ cal.selectCell(index);
+ }
+
+ } else {
+ link = cell.getElementsByTagName("a")[0];
+ if (link) {
+ link.blur();
+ }
+ cal.selectCell(index);
+ }
+ }
+};
+
+/**
+* The event that is executed when the user hovers over a cell
+* @method doCellMouseOver
+* @param {DOMEvent} e The event
+* @param {Calendar} cal A reference to the calendar passed by the Event utility
+*/
+YAHOO.widget.Calendar.prototype.doCellMouseOver = function(e, cal) {
+ var target;
+ if (e) {
+ target = YAHOO.util.Event.getTarget(e);
+ } else {
+ target = this;
+ }
+
+ while (target.tagName.toLowerCase() != "td") {
+ target = target.parentNode;
+ if (target.tagName.toLowerCase() == "html") {
+ return;
+ }
+ }
+
+ if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+ YAHOO.util.Dom.addClass(target, cal.Style.CSS_CELL_HOVER);
+ }
+};
+
+/**
+* The event that is executed when the user moves the mouse out of a cell
+* @method doCellMouseOut
+* @param {DOMEvent} e The event
+* @param {Calendar} cal A reference to the calendar passed by the Event utility
+*/
+YAHOO.widget.Calendar.prototype.doCellMouseOut = function(e, cal) {
+ var target;
+ if (e) {
+ target = YAHOO.util.Event.getTarget(e);
+ } else {
+ target = this;
+ }
+
+ while (target.tagName.toLowerCase() != "td") {
+ target = target.parentNode;
+ if (target.tagName.toLowerCase() == "html") {
+ return;
+ }
+ }
+
+ if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+ YAHOO.util.Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
+ }
+};
+
+YAHOO.widget.Calendar.prototype.setupConfig = function() {
+
+ /**
+ * The month/year representing the current visible Calendar date (mm/yyyy)
+ * @config pagedate
+ * @type String
+ * @default today's date
+ */
+ this.cfg.addProperty("pagedate", { value:new Date(), handler:this.configPageDate } );
+
+ /**
+ * The date or range of dates representing the current Calendar selection
+ * @config selected
+ * @type String
+ * @default []
+ */
+ this.cfg.addProperty("selected", { value:[], handler:this.configSelected } );
+
+ /**
+ * The title to display above the Calendar's month header
+ * @config title
+ * @type String
+ * @default ""
+ */
+ this.cfg.addProperty("title", { value:"", handler:this.configTitle } );
+
+ /**
+ * Whether or not a close button should be displayed for this Calendar
+ * @config close
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("close", { value:false, handler:this.configClose } );
+
+ /**
+ * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
+ * @config iframe
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("iframe", { value:true, handler:this.configIframe, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The minimum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config mindate
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("mindate", { value:null, handler:this.configMinDate } );
+
+ /**
+ * The maximum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config maxdate
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("maxdate", { value:null, handler:this.configMaxDate } );
+
+
+ // Options properties
+
+ /**
+ * True if the Calendar should allow multiple selections. False by default.
+ * @config MULTI_SELECT
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("MULTI_SELECT", { value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The weekday the week begins on. Default is 0 (Sunday).
+ * @config START_WEEKDAY
+ * @type number
+ * @default 0
+ */
+ this.cfg.addProperty("START_WEEKDAY", { value:0, handler:this.configOptions, validator:this.cfg.checkNumber } );
+
+ /**
+ * True if the Calendar should show weekday labels. True by default.
+ * @config SHOW_WEEKDAYS
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("SHOW_WEEKDAYS", { value:true, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row headers. False by default.
+ * @config SHOW_WEEK_HEADER
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("SHOW_WEEK_HEADER",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row footers. False by default.
+ * @config SHOW_WEEK_FOOTER
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("SHOW_WEEK_FOOTER",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
+ * @config HIDE_BLANK_WEEKS
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("HIDE_BLANK_WEEKS",{ value:false, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The image that should be used for the left navigation arrow.
+ * @config NAV_ARROW_LEFT
+ * @type String
+ * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif"
+ */
+ this.cfg.addProperty("NAV_ARROW_LEFT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif", handler:this.configOptions } );
+
+ /**
+ * The image that should be used for the left navigation arrow.
+ * @config NAV_ARROW_RIGHT
+ * @type String
+ * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif"
+ */
+ this.cfg.addProperty("NAV_ARROW_RIGHT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif", handler:this.configOptions } );
+
+ // Locale properties
+
+ /**
+ * The short month labels for the current locale.
+ * @config MONTHS_SHORT
+ * @type String[]
+ * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+ */
+ this.cfg.addProperty("MONTHS_SHORT", { value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], handler:this.configLocale } );
+
+ /**
+ * The long month labels for the current locale.
+ * @config MONTHS_LONG
+ * @type String[]
+ * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+ */
+ this.cfg.addProperty("MONTHS_LONG", { value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], handler:this.configLocale } );
+
+ /**
+ * The 1-character weekday labels for the current locale.
+ * @config WEEKDAYS_1CHAR
+ * @type String[]
+ * @default ["S", "M", "T", "W", "T", "F", "S"]
+ */
+ this.cfg.addProperty("WEEKDAYS_1CHAR", { value:["S", "M", "T", "W", "T", "F", "S"], handler:this.configLocale } );
+
+ /**
+ * The short weekday labels for the current locale.
+ * @config WEEKDAYS_SHORT
+ * @type String[]
+ * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
+ */
+ this.cfg.addProperty("WEEKDAYS_SHORT", { value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], handler:this.configLocale } );
+
+ /**
+ * The medium weekday labels for the current locale.
+ * @config WEEKDAYS_MEDIUM
+ * @type String[]
+ * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
+ */
+ this.cfg.addProperty("WEEKDAYS_MEDIUM", { value:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], handler:this.configLocale } );
+
+ /**
+ * The long weekday labels for the current locale.
+ * @config WEEKDAYS_LONG
+ * @type String[]
+ * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
+ */
+ this.cfg.addProperty("WEEKDAYS_LONG", { value:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], handler:this.configLocale } );
+
+ /**
+ * Refreshes the locale values used to build the Calendar.
+ * @method refreshLocale
+ * @private
+ */
+ var refreshLocale = function() {
+ this.cfg.refireEvent("LOCALE_MONTHS");
+ this.cfg.refireEvent("LOCALE_WEEKDAYS");
+ };
+
+ this.cfg.subscribeToConfigEvent("START_WEEKDAY", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("MONTHS_SHORT", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("MONTHS_LONG", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("WEEKDAYS_1CHAR", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("WEEKDAYS_SHORT", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("WEEKDAYS_MEDIUM", refreshLocale, this, true);
+ this.cfg.subscribeToConfigEvent("WEEKDAYS_LONG", refreshLocale, this, true);
+
+ /**
+ * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
+ * @config LOCALE_MONTHS
+ * @type String
+ * @default "long"
+ */
+ this.cfg.addProperty("LOCALE_MONTHS", { value:"long", handler:this.configLocaleValues } );
+
+ /**
+ * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
+ * @config LOCALE_WEEKDAYS
+ * @type String
+ * @default "short"
+ */
+ this.cfg.addProperty("LOCALE_WEEKDAYS", { value:"short", handler:this.configLocaleValues } );
+
+ /**
+ * The value used to delimit individual dates in a date string passed to various Calendar functions.
+ * @config DATE_DELIMITER
+ * @type String
+ * @default ","
+ */
+ this.cfg.addProperty("DATE_DELIMITER", { value:",", handler:this.configLocale } );
+
+ /**
+ * The value used to delimit date fields in a date string passed to various Calendar functions.
+ * @config DATE_FIELD_DELIMITER
+ * @type String
+ * @default "/"
+ */
+ this.cfg.addProperty("DATE_FIELD_DELIMITER",{ value:"/", handler:this.configLocale } );
+
+ /**
+ * The value used to delimit date ranges in a date string passed to various Calendar functions.
+ * @config DATE_RANGE_DELIMITER
+ * @type String
+ * @default "-"
+ */
+ this.cfg.addProperty("DATE_RANGE_DELIMITER",{ value:"-", handler:this.configLocale } );
+
+ /**
+ * The position of the month in a month/year date string
+ * @config MY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MY_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/year date string
+ * @config MY_YEAR_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MY_YEAR_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day date string
+ * @config MD_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MD_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/year date string
+ * @config MD_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MD_DAY_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day/year date string
+ * @config MDY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MDY_MONTH_POSITION", { value:1, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/day/year date string
+ * @config MDY_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MDY_DAY_POSITION", { value:2, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/day/year date string
+ * @config MDY_YEAR_POSITION
+ * @type Number
+ * @default 3
+ */
+ this.cfg.addProperty("MDY_YEAR_POSITION", { value:3, handler:this.configLocale, validator:this.cfg.checkNumber } );
+};
+
+/**
+* The default handler for the "pagedate" property
+* @method configPageDate
+*/
+YAHOO.widget.Calendar.prototype.configPageDate = function(type, args, obj) {
+ var val = args[0];
+ var month, year, aMonthYear;
+
+ if (val) {
+ if (val instanceof Date) {
+ val = YAHOO.widget.DateMath.findMonthStart(val);
+ this.cfg.setProperty("pagedate", val, true);
+ if (! this._pageDate) {
+ this._pageDate = this.cfg.getProperty("pagedate");
+ }
+ return;
+ } else {
+ aMonthYear = val.split(this.cfg.getProperty("DATE_FIELD_DELIMITER"));
+ month = parseInt(aMonthYear[this.cfg.getProperty("MY_MONTH_POSITION")-1], 10)-1;
+ year = parseInt(aMonthYear[this.cfg.getProperty("MY_YEAR_POSITION")-1], 10);
+ }
+ } else {
+ month = this.today.getMonth();
+ year = this.today.getFullYear();
+ }
+
+ this.cfg.setProperty("pagedate", new Date(year, month, 1), true);
+ if (! this._pageDate) {
+ this._pageDate = this.cfg.getProperty("pagedate");
+ }
+};
+
+/**
+* The default handler for the "mindate" property
+* @method configMinDate
+*/
+YAHOO.widget.Calendar.prototype.configMinDate = function(type, args, obj) {
+ var val = args[0];
+ if (typeof val == 'string') {
+ val = this._parseDate(val);
+ this.cfg.setProperty("mindate", new Date(val[0],(val[1]-1),val[2]));
+ }
+};
+
+/**
+* The default handler for the "maxdate" property
+* @method configMaxDate
+*/
+YAHOO.widget.Calendar.prototype.configMaxDate = function(type, args, obj) {
+ var val = args[0];
+ if (typeof val == 'string') {
+ val = this._parseDate(val);
+ this.cfg.setProperty("maxdate", new Date(val[0],(val[1]-1),val[2]));
+ }
+};
+
+/**
+* The default handler for the "selected" property
+* @method configSelected
+*/
+YAHOO.widget.Calendar.prototype.configSelected = function(type, args, obj) {
+ var selected = args[0];
+
+ if (selected) {
+ if (typeof selected == 'string') {
+ this.cfg.setProperty("selected", this._parseDates(selected), true);
+ }
+ }
+ if (! this._selectedDates) {
+ this._selectedDates = this.cfg.getProperty("selected");
+ }
+};
+
+/**
+* The default handler for all configuration options properties
+* @method configOptions
+*/
+YAHOO.widget.Calendar.prototype.configOptions = function(type, args, obj) {
+ type = type.toUpperCase();
+ var val = args[0];
+ this.Options[type] = val;
+};
+
+/**
+* The default handler for all configuration locale properties
+* @method configLocale
+*/
+YAHOO.widget.Calendar.prototype.configLocale = function(type, args, obj) {
+ type = type.toUpperCase();
+ var val = args[0];
+ this.Locale[type] = val;
+
+ this.cfg.refireEvent("LOCALE_MONTHS");
+ this.cfg.refireEvent("LOCALE_WEEKDAYS");
+
+};
+
+/**
+* The default handler for all configuration locale field length properties
+* @method configLocaleValues
+*/
+YAHOO.widget.Calendar.prototype.configLocaleValues = function(type, args, obj) {
+ type = type.toUpperCase();
+ var val = args[0];
+
+ switch (type) {
+ case "LOCALE_MONTHS":
+ switch (val) {
+ case "short":
+ this.Locale.LOCALE_MONTHS = this.cfg.getProperty("MONTHS_SHORT").concat();
+ break;
+ case "long":
+ this.Locale.LOCALE_MONTHS = this.cfg.getProperty("MONTHS_LONG").concat();
+ break;
+ }
+ break;
+ case "LOCALE_WEEKDAYS":
+ switch (val) {
+ case "1char":
+ this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_1CHAR").concat();
+ break;
+ case "short":
+ this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_SHORT").concat();
+ break;
+ case "medium":
+ this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_MEDIUM").concat();
+ break;
+ case "long":
+ this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty("WEEKDAYS_LONG").concat();
+ break;
+ }
+
+ var START_WEEKDAY = this.cfg.getProperty("START_WEEKDAY");
+
+ if (START_WEEKDAY > 0) {
+ for (var w=0;w";
+ html[html.length] = "";
+ html[html.length] = '';
+ html[html.length] = ' ';
+
+ if (this.cfg.getProperty("SHOW_WEEKDAYS")) {
+ html = this.buildWeekdays(html);
+ }
+
+ html[html.length] = '';
+
+ return html;
+};
+
+/**
+* Renders the Calendar's weekday headers.
+* @method buildWeekdays
+* @param {Array} html The current working HTML array
+* @return {Array} The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.buildWeekdays = function(html) {
+
+ html[html.length] = '';
+
+ if (this.cfg.getProperty("SHOW_WEEK_HEADER")) {
+ html[html.length] = ' ';
+ }
+
+ for(var i=0;i' + this.Locale.LOCALE_WEEKDAYS[i] + '';
+ }
+
+ if (this.cfg.getProperty("SHOW_WEEK_FOOTER")) {
+ html[html.length] = ' ';
+ }
+
+ html[html.length] = ' ';
+
+ return html;
+};
+
+/**
+* Renders the calendar body.
+* @method renderBody
+* @param {Date} workingDate The current working Date being used for the render process
+* @param {Array} html The current working HTML array
+* @return {Array} The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.renderBody = function(workingDate, html) {
+
+ var startDay = this.cfg.getProperty("START_WEEKDAY");
+
+ this.preMonthDays = workingDate.getDay();
+ if (startDay > 0) {
+ this.preMonthDays -= startDay;
+ }
+ if (this.preMonthDays < 0) {
+ this.preMonthDays += 7;
+ }
+
+ this.monthDays = YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();
+ this.postMonthDays = YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;
+
+ workingDate = YAHOO.widget.DateMath.subtract(workingDate, YAHOO.widget.DateMath.DAY, this.preMonthDays);
+
+ var useDate,weekNum,weekClass;
+ useDate = this.cfg.getProperty("pagedate");
+
+ html[html.length] = '';
+
+ var i = 0;
+
+ var tempDiv = document.createElement("div");
+ var cell = document.createElement("td");
+ tempDiv.appendChild(cell);
+
+ var jan1 = new Date(useDate.getFullYear(),0,1);
+
+ var cal = this.parent || this;
+
+ for (var r=0;r<6;r++) {
+
+ weekNum = YAHOO.widget.DateMath.getWeekNumber(workingDate, useDate.getFullYear(), startDay);
+
+ weekClass = "w" + weekNum;
+
+ if (r !== 0 && this.isDateOOM(workingDate) && this.cfg.getProperty("HIDE_BLANK_WEEKS") === true) {
+ break;
+ } else {
+
+ html[html.length] = '';
+
+ if (this.cfg.getProperty("SHOW_WEEK_HEADER")) { html = this.renderRowHeader(weekNum, html); }
+
+ for (var d=0;d<7;d++){ // Render actual days
+
+ var cellRenderers = [];
+
+ this.clearElement(cell);
+
+ YAHOO.util.Dom.addClass(cell, "calcell");
+
+ cell.id = this.id + "_cell" + i;
+
+ cell.innerHTML = i;
+
+ var renderer = null;
+
+ if (workingDate.getFullYear() == this.today.getFullYear() &&
+ workingDate.getMonth() == this.today.getMonth() &&
+ workingDate.getDate() == this.today.getDate()) {
+ cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;
+ }
+
+ this.cellDates[this.cellDates.length]=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]; // Add this date to cellDates
+
+ if (this.isDateOOM(workingDate)) {
+ cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;
+ } else {
+
+ YAHOO.util.Dom.addClass(cell, "wd" + workingDate.getDay());
+ YAHOO.util.Dom.addClass(cell, "d" + workingDate.getDate());
+
+ for (var s=0;s= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
+ renderer = rArray[2];
+
+ if (workingDate.getTime()==d2.getTime()) {
+ this.renderStack.splice(s,1);
+ }
+ }
+ break;
+ case YAHOO.widget.Calendar.WEEKDAY:
+
+ var weekday = rArray[1][0];
+ if (workingDate.getDay()+1 == weekday) {
+ renderer = rArray[2];
+ }
+ break;
+ case YAHOO.widget.Calendar.MONTH:
+
+ month = rArray[1][0];
+ if (workingDate.getMonth()+1 == month) {
+ renderer = rArray[2];
+ }
+ break;
+ }
+
+ if (renderer) {
+ cellRenderers[cellRenderers.length]=renderer;
+ }
+ }
+
+ }
+
+ if (this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]) > -1) {
+ cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected;
+ }
+
+ var mindate = this.cfg.getProperty("mindate");
+ var maxdate = this.cfg.getProperty("maxdate");
+
+ if (mindate) {
+ mindate = YAHOO.widget.DateMath.clearTime(mindate);
+ }
+ if (maxdate) {
+ maxdate = YAHOO.widget.DateMath.clearTime(maxdate);
+ }
+
+ if (
+ (mindate && (workingDate.getTime() < mindate.getTime())) ||
+ (maxdate && (workingDate.getTime() > maxdate.getTime()))
+ ) {
+ cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;
+ } else {
+ cellRenderers[cellRenderers.length]=cal.styleCellDefault;
+ cellRenderers[cellRenderers.length]=cal.renderCellDefault;
+ }
+
+
+
+ for (var x=0;x= 0 && i <= 6) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TOP);
+ }
+ if ((i % 7) === 0) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
+ }
+ if (((i+1) % 7) === 0) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);
+ }
+
+ var postDays = this.postMonthDays;
+ if (postDays >= 7 && this.cfg.getProperty("HIDE_BLANK_WEEKS")) {
+ var blankWeeks = Math.floor(postDays/7);
+ for (var p=0;p= ((this.preMonthDays+postDays+this.monthDays)-7)) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
+ }
+
+ html[html.length] = tempDiv.innerHTML;
+
+ i++;
+ }
+
+ if (this.cfg.getProperty("SHOW_WEEK_FOOTER")) { html = this.renderRowFooter(weekNum, html); }
+
+ html[html.length] = ' ';
+ }
+ }
+
+ html[html.length] = ' ';
+
+ return html;
+};
+
+/**
+* Renders the calendar footer. In the default implementation, there is
+* no footer.
+* @method renderFooter
+* @param {Array} html The current working HTML array
+* @return {Array} The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.renderFooter = function(html) { return html; };
+
+/**
+* Renders the calendar after it has been configured. The render() method has a specific call chain that will execute
+* when the method is called: renderHeader, renderBody, renderFooter.
+* Refer to the documentation for those methods for information on
+* individual render tasks.
+* @method render
+*/
+YAHOO.widget.Calendar.prototype.render = function() {
+ this.beforeRenderEvent.fire();
+
+ // Find starting day of the current month
+ var workingDate = YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty("pagedate"));
+
+ this.resetRenderers();
+ this.cellDates.length = 0;
+
+ YAHOO.util.Event.purgeElement(this.oDomContainer, true);
+
+ var html = [];
+
+ html[html.length] = '';
+ html = this.renderHeader(html);
+ html = this.renderBody(workingDate, html);
+ html = this.renderFooter(html);
+ html[html.length] = '
';
+
+ this.oDomContainer.innerHTML = html.join("\n");
+
+ this.applyListeners();
+ this.cells = this.oDomContainer.getElementsByTagName("td");
+
+ this.cfg.refireEvent("title");
+ this.cfg.refireEvent("close");
+ this.cfg.refireEvent("iframe");
+
+ this.renderEvent.fire();
+};
+
+/**
+* Applies the Calendar's DOM listeners to applicable elements.
+* @method applyListeners
+*/
+YAHOO.widget.Calendar.prototype.applyListeners = function() {
+
+ var root = this.oDomContainer;
+ var cal = this.parent || this;
+
+ var linkLeft, linkRight;
+
+ linkLeft = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, "a", root);
+ linkRight = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, "a", root);
+
+ if (linkLeft) {
+ this.linkLeft = linkLeft[0];
+ YAHOO.util.Event.addListener(this.linkLeft, "mousedown", cal.previousMonth, cal, true);
+ }
+
+ if (linkRight) {
+ this.linkRight = linkRight[0];
+ YAHOO.util.Event.addListener(this.linkRight, "mousedown", cal.nextMonth, cal, true);
+ }
+
+ if (this.domEventMap) {
+ var el,elements;
+ for (var cls in this.domEventMap) {
+ if (this.domEventMap.hasOwnProperty(cls)) {
+ var items = this.domEventMap[cls];
+
+ if (! (items instanceof Array)) {
+ items = [items];
+ }
+
+ for (var i=0;i' + weekNum + '';
+ return html;
+};
+
+/**
+* Renders the row footer for a week.
+* @method renderRowFooter
+* @param {Number} weekNum The week number of the current row
+* @param {Array} cell The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.renderRowFooter = function(weekNum, html) {
+ html[html.length] = '';
+ return html;
+};
+
+/**
+* Renders a single standard calendar cell in the calendar widget table.
+* All logic for determining how a standard default cell will be rendered is
+* encapsulated in this method, and must be accounted for when extending the
+* widget class.
+* @method renderCellDefault
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellDefault = function(workingDate, cell) {
+ cell.innerHTML = '' + this.buildDayLabel(workingDate) + " ";
+};
+
+/**
+* Styles a selectable cell.
+* @method styleCellDefault
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.styleCellDefault = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTABLE);
+};
+
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight1 style
+* @method renderCellStyleHighlight1
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight1 = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);
+};
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight2 style
+* @method renderCellStyleHighlight2
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight2 = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);
+};
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight3 style
+* @method renderCellStyleHighlight3
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight3 = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);
+};
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight4 style
+* @method renderCellStyleHighlight4
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight4 = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
+};
+
+/**
+* Applies the default style used for rendering today's date to the current calendar cell
+* @method renderCellStyleToday
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleToday = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TODAY);
+};
+
+/**
+* Applies the default style used for rendering selected dates to the current calendar cell
+* @method renderCellStyleSelected
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+* should not be terminated
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleSelected = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);
+};
+
+/**
+* Applies the default style used for rendering dates that are not a part of the current
+* month (preceding or trailing the cells for the current month)
+* @method renderCellNotThisMonth
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+* should not be terminated
+*/
+YAHOO.widget.Calendar.prototype.renderCellNotThisMonth = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);
+ cell.innerHTML=workingDate.getDate();
+ return YAHOO.widget.Calendar.STOP_RENDER;
+};
+
+/**
+* Renders the current calendar cell as a non-selectable "black-out" date using the default
+* restricted style.
+* @method renderBodyCellRestricted
+* @param {Date} workingDate The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement} cell The current working cell in the calendar
+* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+* should not be terminated
+*/
+YAHOO.widget.Calendar.prototype.renderBodyCellRestricted = function(workingDate, cell) {
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);
+ YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
+ cell.innerHTML=workingDate.getDate();
+ return YAHOO.widget.Calendar.STOP_RENDER;
+};
+
+// END BUILT-IN TABLE CELL RENDERERS
+
+// BEGIN MONTH NAVIGATION METHODS
+
+/**
+* Adds the designated number of months to the current calendar month, and sets the current
+* calendar page date to the new month.
+* @method addMonths
+* @param {Number} count The number of months to add to the current calendar
+*/
+YAHOO.widget.Calendar.prototype.addMonths = function(count) {
+ this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.MONTH, count));
+ this.resetRenderers();
+ this.changePageEvent.fire();
+};
+
+/**
+* Subtracts the designated number of months from the current calendar month, and sets the current
+* calendar page date to the new month.
+* @method subtractMonths
+* @param {Number} count The number of months to subtract from the current calendar
+*/
+YAHOO.widget.Calendar.prototype.subtractMonths = function(count) {
+ this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.MONTH, count));
+ this.resetRenderers();
+ this.changePageEvent.fire();
+};
+
+/**
+* Adds the designated number of years to the current calendar, and sets the current
+* calendar page date to the new month.
+* @method addYears
+* @param {Number} count The number of years to add to the current calendar
+*/
+YAHOO.widget.Calendar.prototype.addYears = function(count) {
+ this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.add(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.YEAR, count));
+ this.resetRenderers();
+ this.changePageEvent.fire();
+};
+
+/**
+* Subtcats the designated number of years from the current calendar, and sets the current
+* calendar page date to the new month.
+* @method subtractYears
+* @param {Number} count The number of years to subtract from the current calendar
+*/
+YAHOO.widget.Calendar.prototype.subtractYears = function(count) {
+ this.cfg.setProperty("pagedate", YAHOO.widget.DateMath.subtract(this.cfg.getProperty("pagedate"), YAHOO.widget.DateMath.YEAR, count));
+ this.resetRenderers();
+ this.changePageEvent.fire();
+};
+
+/**
+* Navigates to the next month page in the calendar widget.
+* @method nextMonth
+*/
+YAHOO.widget.Calendar.prototype.nextMonth = function() {
+ this.addMonths(1);
+};
+
+/**
+* Navigates to the previous month page in the calendar widget.
+* @method previousMonth
+*/
+YAHOO.widget.Calendar.prototype.previousMonth = function() {
+ this.subtractMonths(1);
+};
+
+/**
+* Navigates to the next year in the currently selected month in the calendar widget.
+* @method nextYear
+*/
+YAHOO.widget.Calendar.prototype.nextYear = function() {
+ this.addYears(1);
+};
+
+/**
+* Navigates to the previous year in the currently selected month in the calendar widget.
+* @method previousYear
+*/
+YAHOO.widget.Calendar.prototype.previousYear = function() {
+ this.subtractYears(1);
+};
+
+// END MONTH NAVIGATION METHODS
+
+// BEGIN SELECTION METHODS
+
+/**
+* Resets the calendar widget to the originally selected month and year, and
+* sets the calendar to the initial selection(s).
+* @method reset
+*/
+YAHOO.widget.Calendar.prototype.reset = function() {
+ this.cfg.resetProperty("selected");
+ this.cfg.resetProperty("pagedate");
+ this.resetEvent.fire();
+};
+
+/**
+* Clears the selected dates in the current calendar widget and sets the calendar
+* to the current month and year.
+* @method clear
+*/
+YAHOO.widget.Calendar.prototype.clear = function() {
+ this.cfg.setProperty("selected", []);
+ this.cfg.setProperty("pagedate", new Date(this.today.getTime()));
+ this.clearEvent.fire();
+};
+
+/**
+* Selects a date or a collection of dates on the current calendar. This method, by default,
+* does not call the render method explicitly. Once selection has completed, render must be
+* called for the changes to be reflected visually.
+* @method select
+* @param {String/Date/Date[]} date The date string of dates to select in the current calendar. Valid formats are
+* individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+* Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+* This method can also take a JavaScript Date object or an array of Date objects.
+* @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
+*/
+YAHOO.widget.Calendar.prototype.select = function(date) {
+ this.beforeSelectEvent.fire();
+
+ var selected = this.cfg.getProperty("selected");
+ var aToBeSelected = this._toFieldArray(date);
+
+ for (var a=0;a -1) {
+ if (this.cfg.getProperty("pagedate").getMonth() == dCellDate.getMonth() &&
+ this.cfg.getProperty("pagedate").getFullYear() == dCellDate.getFullYear()) {
+ YAHOO.util.Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
+ }
+
+ selected.splice(cellDateIndex, 1);
+ }
+
+
+ if (this.parent) {
+ this.parent.cfg.setProperty("selected", selected);
+ } else {
+ this.cfg.setProperty("selected", selected);
+ }
+
+ this.deselectEvent.fire(selectDate);
+ return this.getSelectedDates();
+};
+
+/**
+* Deselects all dates on the current calendar.
+* @method deselectAll
+* @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
+* Assuming that this function executes properly, the return value should be an empty array.
+* However, the empty array is returned for the sake of being able to check the selection status
+* of the calendar.
+*/
+YAHOO.widget.Calendar.prototype.deselectAll = function() {
+ this.beforeDeselectEvent.fire();
+
+ var selected = this.cfg.getProperty("selected");
+ var count = selected.length;
+ var sel = selected.concat();
+
+ if (this.parent) {
+ this.parent.cfg.setProperty("selected", []);
+ } else {
+ this.cfg.setProperty("selected", []);
+ }
+
+ if (count > 0) {
+ this.deselectEvent.fire(sel);
+ }
+
+ return this.getSelectedDates();
+};
+
+// END SELECTION METHODS
+
+// BEGIN TYPE CONVERSION METHODS
+
+/**
+* Converts a date (either a JavaScript Date object, or a date string) to the internal data structure
+* used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].
+* @method _toFieldArray
+* @private
+* @param {String/Date/Date[]} date The date string of dates to deselect in the current calendar. Valid formats are
+* individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+* Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+* This method can also take a JavaScript Date object or an array of Date objects.
+* @return {Array[](Number[])} Array of date field arrays
+*/
+YAHOO.widget.Calendar.prototype._toFieldArray = function(date) {
+ var returnDate = [];
+
+ if (date instanceof Date) {
+ returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];
+ } else if (typeof date == 'string') {
+ returnDate = this._parseDates(date);
+ } else if (date instanceof Array) {
+ for (var i=0;i
+*
+*
+*
+* The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.
+* @namespace YAHOO.widget
+* @class CalendarGroup
+* @constructor
+* @param {String} id The id of the table element that will represent the calendar widget
+* @param {String} containerId The id of the container div element that will wrap the calendar table
+* @param {Object} config The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.CalendarGroup = function(id, containerId, config) {
+ if (arguments.length > 0) {
+ this.init(id, containerId, config);
+ }
+};
+
+/**
+* Initializes the calendar group. All subclasses must call this method in order for the
+* group to be initialized properly.
+* @method init
+* @param {String} id The id of the table element that will represent the calendar widget
+* @param {String} containerId The id of the container div element that will wrap the calendar table
+* @param {Object} config The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.CalendarGroup.prototype.init = function(id, containerId, config) {
+ this.initEvents();
+ this.initStyles();
+
+ /**
+ * The collection of Calendar pages contained within the CalendarGroup
+ * @property pages
+ * @type YAHOO.widget.Calendar[]
+ */
+ this.pages = [];
+
+ /**
+ * The unique id associated with the CalendarGroup
+ * @property id
+ * @type String
+ */
+ this.id = id;
+
+ /**
+ * The unique id associated with the CalendarGroup container
+ * @property containerId
+ * @type String
+ */
+ this.containerId = containerId;
+
+ /**
+ * The outer containing element for the CalendarGroup
+ * @property oDomContainer
+ * @type HTMLElement
+ */
+ this.oDomContainer = document.getElementById(containerId);
+
+ YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_CONTAINER);
+ YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_MULTI_UP);
+
+ /**
+ * The Config object used to hold the configuration variables for the CalendarGroup
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ /**
+ * The local object which contains the CalendarGroup's options
+ * @property Options
+ * @type Object
+ */
+ this.Options = {};
+
+ /**
+ * The local object which contains the CalendarGroup's locale settings
+ * @property Locale
+ * @type Object
+ */
+ this.Locale = {};
+
+ this.setupConfig();
+
+ if (config) {
+ this.cfg.applyConfig(config, true);
+ }
+
+ this.cfg.fireQueue();
+
+ // OPERA HACK FOR MISWRAPPED FLOATS
+ if (this.browser == "opera"){
+ var fixWidth = function() {
+ var startW = this.oDomContainer.offsetWidth;
+ var w = 0;
+ for (var p=0;p 0) {
+ this.oDomContainer.style.width = w + "px";
+ }
+ };
+ this.renderEvent.subscribe(fixWidth,this,true);
+ }
+};
+
+
+YAHOO.widget.CalendarGroup.prototype.setupConfig = function() {
+ /**
+ * The number of pages to include in the CalendarGroup. This value can only be set once, in the CalendarGroup's constructor arguments.
+ * @config pages
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("pages", { value:2, validator:this.cfg.checkNumber, handler:this.configPages } );
+
+ /**
+ * The month/year representing the current visible Calendar date (mm/yyyy)
+ * @config pagedate
+ * @type String
+ * @default today's date
+ */
+ this.cfg.addProperty("pagedate", { value:new Date(), handler:this.configPageDate } );
+
+ /**
+ * The date or range of dates representing the current Calendar selection
+ * @config selected
+ * @type String
+ * @default []
+ */
+ this.cfg.addProperty("selected", { value:[], handler:this.delegateConfig } );
+
+ /**
+ * The title to display above the CalendarGroup's month header
+ * @config title
+ * @type String
+ * @default ""
+ */
+ this.cfg.addProperty("title", { value:"", handler:this.configTitle } );
+
+ /**
+ * Whether or not a close button should be displayed for this CalendarGroup
+ * @config close
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("close", { value:false, handler:this.configClose } );
+
+ /**
+ * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
+ * @config iframe
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("iframe", { value:true, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The minimum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config mindate
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("mindate", { value:null, handler:this.delegateConfig } );
+
+ /**
+ * The maximum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config maxdate
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("maxdate", { value:null, handler:this.delegateConfig } );
+
+ // Options properties
+
+ /**
+ * True if the Calendar should allow multiple selections. False by default.
+ * @config MULTI_SELECT
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("MULTI_SELECT", { value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The weekday the week begins on. Default is 0 (Sunday).
+ * @config START_WEEKDAY
+ * @type number
+ * @default 0
+ */
+ this.cfg.addProperty("START_WEEKDAY", { value:0, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * True if the Calendar should show weekday labels. True by default.
+ * @config SHOW_WEEKDAYS
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("SHOW_WEEKDAYS", { value:true, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row headers. False by default.
+ * @config SHOW_WEEK_HEADER
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("SHOW_WEEK_HEADER",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row footers. False by default.
+ * @config SHOW_WEEK_FOOTER
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("SHOW_WEEK_FOOTER",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
+ * @config HIDE_BLANK_WEEKS
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("HIDE_BLANK_WEEKS",{ value:false, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+ /**
+ * The image that should be used for the left navigation arrow.
+ * @config NAV_ARROW_LEFT
+ * @type String
+ * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif"
+ */
+ this.cfg.addProperty("NAV_ARROW_LEFT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/callt.gif", handler:this.delegateConfig } );
+
+ /**
+ * The image that should be used for the left navigation arrow.
+ * @config NAV_ARROW_RIGHT
+ * @type String
+ * @default YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif"
+ */
+ this.cfg.addProperty("NAV_ARROW_RIGHT", { value:YAHOO.widget.Calendar.IMG_ROOT + "us/tr/calrt.gif", handler:this.delegateConfig } );
+
+ // Locale properties
+
+ /**
+ * The short month labels for the current locale.
+ * @config MONTHS_SHORT
+ * @type String[]
+ * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+ */
+ this.cfg.addProperty("MONTHS_SHORT", { value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], handler:this.delegateConfig } );
+
+ /**
+ * The long month labels for the current locale.
+ * @config MONTHS_LONG
+ * @type String[]
+ * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+ */
+ this.cfg.addProperty("MONTHS_LONG", { value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], handler:this.delegateConfig } );
+
+ /**
+ * The 1-character weekday labels for the current locale.
+ * @config WEEKDAYS_1CHAR
+ * @type String[]
+ * @default ["S", "M", "T", "W", "T", "F", "S"]
+ */
+ this.cfg.addProperty("WEEKDAYS_1CHAR", { value:["S", "M", "T", "W", "T", "F", "S"], handler:this.delegateConfig } );
+
+ /**
+ * The short weekday labels for the current locale.
+ * @config WEEKDAYS_SHORT
+ * @type String[]
+ * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
+ */
+ this.cfg.addProperty("WEEKDAYS_SHORT", { value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], handler:this.delegateConfig } );
+
+ /**
+ * The medium weekday labels for the current locale.
+ * @config WEEKDAYS_MEDIUM
+ * @type String[]
+ * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
+ */
+ this.cfg.addProperty("WEEKDAYS_MEDIUM", { value:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], handler:this.delegateConfig } );
+
+ /**
+ * The long weekday labels for the current locale.
+ * @config WEEKDAYS_LONG
+ * @type String[]
+ * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
+ */
+ this.cfg.addProperty("WEEKDAYS_LONG", { value:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], handler:this.delegateConfig } );
+
+ /**
+ * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
+ * @config LOCALE_MONTHS
+ * @type String
+ * @default "long"
+ */
+ this.cfg.addProperty("LOCALE_MONTHS", { value:"long", handler:this.delegateConfig } );
+
+ /**
+ * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
+ * @config LOCALE_WEEKDAYS
+ * @type String
+ * @default "short"
+ */
+ this.cfg.addProperty("LOCALE_WEEKDAYS", { value:"short", handler:this.delegateConfig } );
+
+ /**
+ * The value used to delimit individual dates in a date string passed to various Calendar functions.
+ * @config DATE_DELIMITER
+ * @type String
+ * @default ","
+ */
+ this.cfg.addProperty("DATE_DELIMITER", { value:",", handler:this.delegateConfig } );
+
+ /**
+ * The value used to delimit date fields in a date string passed to various Calendar functions.
+ * @config DATE_FIELD_DELIMITER
+ * @type String
+ * @default "/"
+ */
+ this.cfg.addProperty("DATE_FIELD_DELIMITER",{ value:"/", handler:this.delegateConfig } );
+
+ /**
+ * The value used to delimit date ranges in a date string passed to various Calendar functions.
+ * @config DATE_RANGE_DELIMITER
+ * @type String
+ * @default "-"
+ */
+ this.cfg.addProperty("DATE_RANGE_DELIMITER",{ value:"-", handler:this.delegateConfig } );
+
+ /**
+ * The position of the month in a month/year date string
+ * @config MY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MY_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/year date string
+ * @config MY_YEAR_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MY_YEAR_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day date string
+ * @config MD_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MD_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/year date string
+ * @config MD_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MD_DAY_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day/year date string
+ * @config MDY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ this.cfg.addProperty("MDY_MONTH_POSITION", { value:1, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/day/year date string
+ * @config MDY_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ this.cfg.addProperty("MDY_DAY_POSITION", { value:2, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/day/year date string
+ * @config MDY_YEAR_POSITION
+ * @type Number
+ * @default 3
+ */
+ this.cfg.addProperty("MDY_YEAR_POSITION", { value:3, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+};
+
+/**
+* Initializes CalendarGroup's built-in CustomEvents
+* @method initEvents
+*/
+YAHOO.widget.CalendarGroup.prototype.initEvents = function() {
+ var me = this;
+
+ /**
+ * Proxy subscriber to subscribe to the CalendarGroup's child Calendars' CustomEvents
+ * @method sub
+ * @private
+ * @param {Function} fn The function to subscribe to this CustomEvent
+ * @param {Object} obj The CustomEvent's scope object
+ * @param {Boolean} bOverride Whether or not to apply scope correction
+ */
+ var sub = function(fn, obj, bOverride) {
+ for (var p=0;p0) {
+ year+=1;
+ }
+ cal.setYear(year);
+ }
+};
+/**
+* Calls the render function of all child calendars within the group.
+* @method render
+*/
+YAHOO.widget.CalendarGroup.prototype.render = function() {
+ this.renderHeader();
+ for (var p=0;p=0;--p) {
+ var cal = this.pages[p];
+ cal.previousMonth();
+ }
+};
+
+/**
+* Navigates to the next year in the currently selected month in the calendar widget.
+* @method nextYear
+*/
+YAHOO.widget.CalendarGroup.prototype.nextYear = function() {
+ for (var p=0;p 13, Opera 9.02 will crash. Connection manager objects count n must be <=
-12 at all times. This condition was not present in Opera version 9.01.
-
-This condition does not apply to other A-Grade browsers (
-http://developer.yahoo.com/yui/articles/gbs/gbs_browser-chart.html)
-
-*** version 0.11.3 ***
-
-* YUI Event dependency for file uploading is now optional.
-
-* uploadFile() now sets unique IDs for each file upload transaction to prevent
-iframe collisions with parallel uploads.
-
-* The callback object now has property responseXML to provide support for file
-upload transactions that return an XML document.
-
-* setForm() will verify if a select option value attribute is present and use
-its value, including empty string, before using the text node value.
-
-* Modified polling mechanism in handleReadyState() and
-handleTransactionResponse() to prevent infinite polling if JavaScript errors
-occur in the user-defined callback.
-
-* createFrame() will now accept a boolean argument of true to set the frame
-source to "javascript:false" to prevent IE from throwing security warnings in an
-HTTPS environment.
-
-* setHeader() now enumerates through the _http_header object using
-hasOwnProperty() to prevent collisions with members added to Object via
-prototype.
-
-* If using setForm() and asyncRequest includes a POST data argument, the data
-will be concatenated to the HTML form POST message.
-
-*** version 0.11.2 ***
-
-* No revisions.
-
-*** version 0.11.1 ***
-
-* uploadFile() now verifies the existence of callback.upload before invoking
-callback, with or without object scope.
-
-*** version 0.11.0 ***
-
-* Each transaction can be defined with a timeout threshold, in milliseconds,
-through the callback object. If the threshold is reached, and the transaction
-hasn't yet completed, the transaction will call abort().
-
-* abort() will now accept a callback object as the second argument. The
-failure callback will receive a response object to indicate the transaction was
-aborted.
-
-* setForm() will now support file uploads by setting the second argument to
-true (e.g., YAHOO.util.Connect.setForm(formObject, true). File upload does not
-use the callback success or failure handler. Instead, it uses a new callback
-object handler: upload.
-
-* HTML form submit will no longer submit form fields without a defined name
-attribute.
-
-* The default POST header of 'Content-Type','application/x-www-form-urlencoded'
-can be overridden by calling setDefaultPostHeader(false). This
-will remove the default header from non-HTML form, POST submissions.
-
-* setHeader() now enumerates through the _http_header object with
-propertyIsEnumerable to prevent collisions with members added to Object via
-prototype.
-
-*** version 0.10.0 ***
-
-* handleTransactionResponse() now treats the full HTTP 2xx range as a success
-case, instead of just HTTP 200.
-
-* To accommodate multiple field values in Mozilla/Firefox, multiple initHeader
-calls with the same label will now result in the values concatenated to a
-comma- delimited string value.
-Example:
-Setting Content-Type:'application/x-www-form-urlencoded' and Content-
-Type:'text/xml' will result in Content-Type:'application/x-www-form-urlencoded,
-text/xml'.
-
-* Default polling interval lowered to 50ms.
-
-* YAHOO.util.Connect.setPollingInterval() will allow you to set a polling
-interval -- in milliseconds -- to override the default value.
-
-* YAHOO.util.Connect.getResponseHeader[headerLabel] now supported as a response
-object property to provide symmetry with the native XHR object's property.
-Example:
-YAHOO.util.Connect.getResponseHeader['Content-Length'] will return the value
-for the Content-Length header, if the header is available.
-
-* YAHOO.util.Connect.allResponseHeaders property renamed to
-getAllResponseHeaders to provide symmetry with the native XHR object's
-property.
-
-* YAHOO.util.Connect.setForm() now supports HTTP GET as well as HTTP POST.
-
-* YAHOO.util.Connect.setForm() now accepts an HTML form object as well as its
-name attribute value.
-
-* YAHOO.util.Connect.setForm() will not submit HTML form fields that are
-disabled or do not have a name attribute value.
-
-* [FIXED] Response exceptions result in infinite callback loop in
-Mozilla/Firefox.
-
-* [FIXED] YAHOO.util.Connect.abort() now properly clears polling interval.
-
-* [FIXED] isCallInProgress() now verifies whether XHR instance still exists,
-and returns false if the connection object is no longer available.
-
-*** version 0.9.0 ***
-
-* Initial release
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+Connection Manager Release Notes
+
+*** version 0.12.0 ***
+
+* When uploading files via setForm() and asyncRequest includes a POST data
+argument, appendPostData() will create hidden input fields for each postData
+label/value and append each field to the form object.
+
+* setForm() returns the assembled label/value string of the parsed HTML form
+fields.
+
+* NOTE: Opera 9.02 does not allow for more than 12 concurrent Connection Manager
+objects.
+
+The following example creates 12 requests in a loop:
+for(var n=0; n<=12; i++){
+ conn[n] = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
+}
+
+If n > 13, Opera 9.02 will crash. Connection manager objects count n must be <=
+12 at all times. This condition was not present in Opera version 9.01.
+
+This condition does not apply to other A-Grade browsers (
+http://developer.yahoo.com/yui/articles/gbs/gbs_browser-chart.html)
+
+*** version 0.11.3 ***
+
+* YUI Event dependency for file uploading is now optional.
+
+* uploadFile() now sets unique IDs for each file upload transaction to prevent
+iframe collisions with parallel uploads.
+
+* The callback object now has property responseXML to provide support for file
+upload transactions that return an XML document.
+
+* setForm() will verify if a select option value attribute is present and use
+its value, including empty string, before using the text node value.
+
+* Modified polling mechanism in handleReadyState() and
+handleTransactionResponse() to prevent infinite polling if JavaScript errors
+occur in the user-defined callback.
+
+* createFrame() will now accept a boolean argument of true to set the frame
+source to "javascript:false" to prevent IE from throwing security warnings in an
+HTTPS environment.
+
+* setHeader() now enumerates through the _http_header object using
+hasOwnProperty() to prevent collisions with members added to Object via
+prototype.
+
+* If using setForm() and asyncRequest includes a POST data argument, the data
+will be concatenated to the HTML form POST message.
+
+*** version 0.11.2 ***
+
+* No revisions.
+
+*** version 0.11.1 ***
+
+* uploadFile() now verifies the existence of callback.upload before invoking
+callback, with or without object scope.
+
+*** version 0.11.0 ***
+
+* Each transaction can be defined with a timeout threshold, in milliseconds,
+through the callback object. If the threshold is reached, and the transaction
+hasn't yet completed, the transaction will call abort().
+
+* abort() will now accept a callback object as the second argument. The
+failure callback will receive a response object to indicate the transaction was
+aborted.
+
+* setForm() will now support file uploads by setting the second argument to
+true (e.g., YAHOO.util.Connect.setForm(formObject, true). File upload does not
+use the callback success or failure handler. Instead, it uses a new callback
+object handler: upload.
+
+* HTML form submit will no longer submit form fields without a defined name
+attribute.
+
+* The default POST header of 'Content-Type','application/x-www-form-urlencoded'
+can be overridden by calling setDefaultPostHeader(false). This
+will remove the default header from non-HTML form, POST submissions.
+
+* setHeader() now enumerates through the _http_header object with
+propertyIsEnumerable to prevent collisions with members added to Object via
+prototype.
+
+*** version 0.10.0 ***
+
+* handleTransactionResponse() now treats the full HTTP 2xx range as a success
+case, instead of just HTTP 200.
+
+* To accommodate multiple field values in Mozilla/Firefox, multiple initHeader
+calls with the same label will now result in the values concatenated to a
+comma- delimited string value.
+Example:
+Setting Content-Type:'application/x-www-form-urlencoded' and Content-
+Type:'text/xml' will result in Content-Type:'application/x-www-form-urlencoded,
+text/xml'.
+
+* Default polling interval lowered to 50ms.
+
+* YAHOO.util.Connect.setPollingInterval() will allow you to set a polling
+interval -- in milliseconds -- to override the default value.
+
+* YAHOO.util.Connect.getResponseHeader[headerLabel] now supported as a response
+object property to provide symmetry with the native XHR object's property.
+Example:
+YAHOO.util.Connect.getResponseHeader['Content-Length'] will return the value
+for the Content-Length header, if the header is available.
+
+* YAHOO.util.Connect.allResponseHeaders property renamed to
+getAllResponseHeaders to provide symmetry with the native XHR object's
+property.
+
+* YAHOO.util.Connect.setForm() now supports HTTP GET as well as HTTP POST.
+
+* YAHOO.util.Connect.setForm() now accepts an HTML form object as well as its
+name attribute value.
+
+* YAHOO.util.Connect.setForm() will not submit HTML form fields that are
+disabled or do not have a name attribute value.
+
+* [FIXED] Response exceptions result in infinite callback loop in
+Mozilla/Firefox.
+
+* [FIXED] YAHOO.util.Connect.abort() now properly clears polling interval.
+
+* [FIXED] isCallInProgress() now verifies whether XHR instance still exists,
+and returns false if the connection object is no longer available.
+
+*** version 0.9.0 ***
+
+* Initial release
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/thirdpartyjs/yui/connection/connection-debug.js b/thirdpartyjs/yui/connection/connection-debug.js
index 887e2bb..6bc1d08 100644
--- a/thirdpartyjs/yui/connection/connection-debug.js
+++ b/thirdpartyjs/yui/connection/connection-debug.js
@@ -1,978 +1,978 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-/**
- * @description
- * The Connection Manager provides a simplified interface to the XMLHttpRequest
- * object. It handles cross-browser instantiantion of XMLHttpRequest, negotiates the
- * interactive states and server response, returning the results to a pre-defined
- * callback you create.
- *
- * @namespace YAHOO.util
- * @module Connection
- * @Class Connect
- */
-YAHOO.util.Connect =
-{
- /**
- * @description Array of MSFT ActiveX ids for XMLHttpRequest.
- * @property _msxml_progid
- * @private
- * @static
- * @type array
- */
- _msxml_progid:[
- 'MSXML2.XMLHTTP.3.0',
- 'MSXML2.XMLHTTP',
- 'Microsoft.XMLHTTP'
- ],
-
- /**
- * @description Object literal of HTTP header(s)
- * @property _http_header
- * @private
- * @static
- * @type object
- */
- _http_header:{},
-
- /**
- * @description Determines if HTTP headers are set.
- * @property _has_http_headers
- * @private
- * @static
- * @type boolean
- */
- _has_http_headers:false,
-
- /**
- * @description Determines if a default header of
- * Content-Type of 'application/x-www-form-urlencoded'
- * will be added to any client HTTP headers sent for POST
- * transactions.
- * @property _use_default_post_header
- * @private
- * @static
- * @type boolean
- */
- _use_default_post_header:true,
-
- /**
- * @description Determines if a default header of
- * Content-Type of 'application/x-www-form-urlencoded'
- * will be added to any client HTTP headers sent for POST
- * transactions.
- * @property _default_post_header
- * @private
- * @static
- * @type boolean
- */
- _default_post_header:'application/x-www-form-urlencoded',
-
- /**
- * @description Property modified by setForm() to determine if the data
- * should be submitted as an HTML form.
- * @property _isFormSubmit
- * @private
- * @static
- * @type boolean
- */
- _isFormSubmit:false,
-
- /**
- * @description Property modified by setForm() to determine if a file(s)
- * upload is expected.
- * @property _isFileUpload
- * @private
- * @static
- * @type boolean
- */
- _isFileUpload:false,
-
- /**
- * @description Property modified by setForm() to set a reference to the HTML
- * form node if the desired action is file upload.
- * @property _formNode
- * @private
- * @static
- * @type object
- */
- _formNode:null,
-
- /**
- * @description Property modified by setForm() to set the HTML form data
- * for each transaction.
- * @property _sFormData
- * @private
- * @static
- * @type string
- */
- _sFormData:null,
-
- /**
- * @description Collection of polling references to the polling mechanism in handleReadyState.
- * @property _poll
- * @private
- * @static
- * @type object
- */
- _poll:{},
-
- /**
- * @description Queue of timeout values for each transaction callback with a defined timeout value.
- * @property _timeOut
- * @private
- * @static
- * @type object
- */
- _timeOut:{},
-
- /**
- * @description The polling frequency, in milliseconds, for HandleReadyState.
- * when attempting to determine a transaction's XHR readyState.
- * The default is 50 milliseconds.
- * @property _polling_interval
- * @private
- * @static
- * @type int
- */
- _polling_interval:50,
-
- /**
- * @description A transaction counter that increments the transaction id for each transaction.
- * @property _transaction_id
- * @private
- * @static
- * @type int
- */
- _transaction_id:0,
-
- /**
- * @description Member to add an ActiveX id to the existing xml_progid array.
- * In the event(unlikely) a new ActiveX id is introduced, it can be added
- * without internal code modifications.
- * @method setProgId
- * @public
- * @static
- * @param {string} id The ActiveX id to be added to initialize the XHR object.
- * @return void
- */
- setProgId:function(id)
- {
- this._msxml_progid.unshift(id);
- YAHOO.log('ActiveX Program Id ' + id + ' added to _msxml_progid.', 'info', 'Connection');
- },
-
- /**
- * @description Member to enable or disable the default POST header.
- * @method setDefaultPostHeader
- * @public
- * @static
- * @param {boolean} b Set and use default header - true or false .
- * @return void
- */
- setDefaultPostHeader:function(b)
- {
- this._use_default_post_header = b;
- YAHOO.log('Use default POST header set to ' + b, 'info', 'Connection');
- },
-
- /**
- * @description Member to modify the default polling interval.
- * @method setPollingInterval
- * @public
- * @static
- * @param {int} i The polling interval in milliseconds.
- * @return void
- */
- setPollingInterval:function(i)
- {
- if(typeof i == 'number' && isFinite(i)){
- this._polling_interval = i;
- YAHOO.log('Default polling interval set to ' + i +'ms', 'info', 'Connection');
- }
- },
-
- /**
- * @description Instantiates a XMLHttpRequest object and returns an object with two properties:
- * the XMLHttpRequest instance and the transaction id.
- * @method createXhrObject
- * @private
- * @static
- * @param {int} transactionId Property containing the transaction id for this transaction.
- * @return object
- */
- createXhrObject:function(transactionId)
- {
- var obj,http;
- try
- {
- // Instantiates XMLHttpRequest in non-IE browsers and assigns to http.
- http = new XMLHttpRequest();
- // Object literal with http and tId properties
- obj = { conn:http, tId:transactionId };
- YAHOO.log('XHR object created for transaction ' + transactionId, 'info', 'Connection');
- }
- catch(e)
- {
- for(var i=0; i= 200 && httpStatus < 300){
- responseObject = this.createResponseObject(o, callback.argument);
- if(callback.success){
- if(!callback.scope){
- callback.success(responseObject);
- YAHOO.log('Success callback. HTTP code is ' + httpStatus, 'info', 'Connection');
- }
- else{
- // If a scope property is defined, the callback will be fired from
- // the context of the object.
- callback.success.apply(callback.scope, [responseObject]);
- YAHOO.log('Success callback with scope. HTTP code is ' + httpStatus, 'info', 'Connection');
- }
- }
- }
- else{
- switch(httpStatus){
- // The following cases are wininet.dll error codes that may be encountered.
- case 12002: // Server timeout
- case 12029: // 12029 to 12031 correspond to dropped connections.
- case 12030:
- case 12031:
- case 12152: // Connection closed by server.
- case 13030: // See above comments for variable status.
- responseObject = this.createExceptionObject(o.tId, callback.argument, (isAbort?isAbort:false));
- if(callback.failure){
- if(!callback.scope){
- callback.failure(responseObject);
- YAHOO.log('Failure callback. Exception detected. Status code is ' + httpStatus, 'warn', 'Connection');
- }
- else{
- callback.failure.apply(callback.scope, [responseObject]);
- YAHOO.log('Failure callback with scope. Exception detected. Status code is ' + httpStatus, 'warn', 'Connection');
- }
- }
- break;
- default:
- responseObject = this.createResponseObject(o, callback.argument);
- if(callback.failure){
- if(!callback.scope){
- callback.failure(responseObject);
- YAHOO.log('Failure callback. HTTP status code is ' + httpStatus, 'warn', 'Connection');
- }
- else{
- callback.failure.apply(callback.scope, [responseObject]);
- YAHOO.log('Failure callback with scope. HTTP status code is ' + httpStatus, 'warn', 'Connection');
- }
- }
- }
- }
-
- this.releaseObject(o);
- responseObject = null;
- },
-
- /**
- * @description This method evaluates the server response, creates and returns the results via
- * its properties. Success and failure cases will differ in the response
- * object's property values.
- * @method createResponseObject
- * @private
- * @static
- * @param {object} o The connection object
- * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback
- * @return {object}
- */
- createResponseObject:function(o, callbackArg)
- {
- var obj = {};
- var headerObj = {};
-
- try
- {
- var headerStr = o.conn.getAllResponseHeaders();
- var header = headerStr.split('\n');
- for(var i=0; i ');
-
- // IE will throw a security exception in an SSL environment if the
- // iframe source is undefined.
- if(typeof secureUri == 'boolean'){
- io.src = 'javascript:false';
- }
- else if(typeof secureURI == 'string'){
- // Deprecated
- io.src = secureUri;
- }
- }
- else{
- var io = document.createElement('iframe');
- io.id = frameId;
- io.name = frameId;
- }
-
- io.style.position = 'absolute';
- io.style.top = '-1000px';
- io.style.left = '-1000px';
-
- document.body.appendChild(io);
- YAHOO.log('File upload iframe created. Id is:' + frameId, 'info', 'Connection');
- },
-
- /**
- * @description Parses the POST data and creates hidden form elements
- * for each key-value, and appends them to the HTML form object.
- * @method appendPostData
- * @private
- * @static
- * @param {string} postData The HTTP POST data
- * @return {array} formElements Collection of hidden fields.
- */
- appendPostData:function(postData)
- {
- var formElements = new Array();
- var postMessage = postData.split('&');
- for(var i=0; i < postMessage.length; i++){
- var delimitPos = postMessage[i].indexOf('=');
- if(delimitPos != -1){
- formElements[i] = document.createElement('input');
- formElements[i].type = 'hidden';
- formElements[i].name = postMessage[i].substring(0,delimitPos);
- formElements[i].value = postMessage[i].substring(delimitPos+1);
- this._formNode.appendChild(formElements[i]);
- }
- }
-
- return formElements;
- },
-
- /**
- * @description Uploads HTML form, including files/attachments, to the
- * iframe created in createFrame.
- * @method uploadFile
- * @private
- * @static
- * @param {int} id The transaction id.
- * @param {object} callback - User-defined callback object.
- * @param {string} uri Fully qualified path of resource.
- * @return {void}
- */
- uploadFile:function(id, callback, uri, postData){
-
- // Each iframe has an id prefix of "yuiIO" followed
- // by the unique transaction id.
- var frameId = 'yuiIO' + id;
- var io = document.getElementById(frameId);
-
- // Initialize the HTML form properties in case they are
- // not defined in the HTML form.
- this._formNode.action = uri;
- this._formNode.method = 'POST';
- this._formNode.target = frameId;
-
- if(this._formNode.encoding){
- // IE does not respect property enctype for HTML forms.
- // Instead use property encoding.
- this._formNode.encoding = 'multipart/form-data';
- }
- else{
- this._formNode.enctype = 'multipart/form-data';
- }
-
-
- if(postData){
- var oElements = this.appendPostData(postData);
- }
-
- this._formNode.submit();
-
- if(oElements && oElements.length > 0){
- for(var i=0; i < oElements.length; i++){
- this._formNode.removeChild(oElements[i]);
- }
- }
-
- // Reset HTML form status properties.
- this.resetFormState();
-
- // Create the upload callback handler that fires when the iframe
- // receives the load event. Subsequently, the event handler is detached
- // and the iframe removed from the document.
-
- var uploadCallback = function()
- {
- var obj = {};
- obj.tId = id;
- obj.argument = callback.argument;
-
- try
- {
- obj.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
- obj.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
- }
- catch(e){}
-
- if(callback.upload){
- if(!callback.scope){
- callback.upload(obj);
- YAHOO.log('Upload callback.', 'info', 'Connection');
- }
- else{
- callback.upload.apply(callback.scope, [obj]);
- YAHOO.log('Upload callback with scope.', 'info', 'Connection');
- }
- }
-
- if(YAHOO.util.Event){
- YAHOO.util.Event.removeListener(io, "load", uploadCallback);
- }
- else if(window.detachEvent){
- io.detachEvent('onload', uploadCallback);
- }
- else{
- io.removeEventListener('load', uploadCallback, false);
- }
- setTimeout(
- function(){
- document.body.removeChild(io);
- YAHOO.log('File upload iframe destroyed. Id is:' + frameId, 'info', 'Connection');
- }, 100);
- };
-
-
- // Bind the onload handler to the iframe to detect the file upload response.
- if(YAHOO.util.Event){
- YAHOO.util.Event.addListener(io, "load", uploadCallback);
- }
- else if(window.attachEvent){
- io.attachEvent('onload', uploadCallback);
- }
- else{
- io.addEventListener('load', uploadCallback, false);
- }
- },
-
- /**
- * @description Method to terminate a transaction, if it has not reached readyState 4.
- * @method abort
- * @public
- * @static
- * @param {object} o The connection object returned by asyncRequest.
- * @param {object} callback User-defined callback object.
- * @param {string} isTimeout boolean to indicate if abort was a timeout.
- * @return {boolean}
- */
- abort:function(o, callback, isTimeout)
- {
- if(this.isCallInProgress(o)){
- o.conn.abort();
- window.clearInterval(this._poll[o.tId]);
- delete this._poll[o.tId];
- if(isTimeout){
- delete this._timeOut[o.tId];
- }
-
- this.handleTransactionResponse(o, callback, true);
- YAHOO.log('Transaction ' + o.tId + ' aborted.', 'info', 'Connection');
-
- return true;
- }
- else{
- YAHOO.log('Transaction ' + o.tId + ' abort call failed.', 'warn', 'Connection');
- return false;
- }
- },
-
- /**
- * Public method to check if the transaction is still being processed.
- *
- * @method isCallInProgress
- * @public
- * @static
- * @param {object} o The connection object returned by asyncRequest
- * @return {boolean}
- */
- isCallInProgress:function(o)
- {
- // if the XHR object assigned to the transaction has not been dereferenced,
- // then check its readyState status. Otherwise, return false.
- if(o.conn){
- return o.conn.readyState != 4 && o.conn.readyState != 0;
- }
- else{
- //The XHR object has been destroyed.
- return false;
- }
- },
-
- /**
- * @description Dereference the XHR instance and the connection object after the transaction is completed.
- * @method releaseObject
- * @private
- * @static
- * @param {object} o The connection object
- * @return {void}
- */
- releaseObject:function(o)
- {
- //dereference the XHR instance.
- o.conn = null;
- YAHOO.log('Connection object for transaction ' + o.tId + ' destroyed.', 'info', 'Connection');
- //dereference the connection object.
- o = null;
- }
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+ * @description
+ * The Connection Manager provides a simplified interface to the XMLHttpRequest
+ * object. It handles cross-browser instantiantion of XMLHttpRequest, negotiates the
+ * interactive states and server response, returning the results to a pre-defined
+ * callback you create.
+ *
+ * @namespace YAHOO.util
+ * @module Connection
+ * @Class Connect
+ */
+YAHOO.util.Connect =
+{
+ /**
+ * @description Array of MSFT ActiveX ids for XMLHttpRequest.
+ * @property _msxml_progid
+ * @private
+ * @static
+ * @type array
+ */
+ _msxml_progid:[
+ 'MSXML2.XMLHTTP.3.0',
+ 'MSXML2.XMLHTTP',
+ 'Microsoft.XMLHTTP'
+ ],
+
+ /**
+ * @description Object literal of HTTP header(s)
+ * @property _http_header
+ * @private
+ * @static
+ * @type object
+ */
+ _http_header:{},
+
+ /**
+ * @description Determines if HTTP headers are set.
+ * @property _has_http_headers
+ * @private
+ * @static
+ * @type boolean
+ */
+ _has_http_headers:false,
+
+ /**
+ * @description Determines if a default header of
+ * Content-Type of 'application/x-www-form-urlencoded'
+ * will be added to any client HTTP headers sent for POST
+ * transactions.
+ * @property _use_default_post_header
+ * @private
+ * @static
+ * @type boolean
+ */
+ _use_default_post_header:true,
+
+ /**
+ * @description Determines if a default header of
+ * Content-Type of 'application/x-www-form-urlencoded'
+ * will be added to any client HTTP headers sent for POST
+ * transactions.
+ * @property _default_post_header
+ * @private
+ * @static
+ * @type boolean
+ */
+ _default_post_header:'application/x-www-form-urlencoded',
+
+ /**
+ * @description Property modified by setForm() to determine if the data
+ * should be submitted as an HTML form.
+ * @property _isFormSubmit
+ * @private
+ * @static
+ * @type boolean
+ */
+ _isFormSubmit:false,
+
+ /**
+ * @description Property modified by setForm() to determine if a file(s)
+ * upload is expected.
+ * @property _isFileUpload
+ * @private
+ * @static
+ * @type boolean
+ */
+ _isFileUpload:false,
+
+ /**
+ * @description Property modified by setForm() to set a reference to the HTML
+ * form node if the desired action is file upload.
+ * @property _formNode
+ * @private
+ * @static
+ * @type object
+ */
+ _formNode:null,
+
+ /**
+ * @description Property modified by setForm() to set the HTML form data
+ * for each transaction.
+ * @property _sFormData
+ * @private
+ * @static
+ * @type string
+ */
+ _sFormData:null,
+
+ /**
+ * @description Collection of polling references to the polling mechanism in handleReadyState.
+ * @property _poll
+ * @private
+ * @static
+ * @type object
+ */
+ _poll:{},
+
+ /**
+ * @description Queue of timeout values for each transaction callback with a defined timeout value.
+ * @property _timeOut
+ * @private
+ * @static
+ * @type object
+ */
+ _timeOut:{},
+
+ /**
+ * @description The polling frequency, in milliseconds, for HandleReadyState.
+ * when attempting to determine a transaction's XHR readyState.
+ * The default is 50 milliseconds.
+ * @property _polling_interval
+ * @private
+ * @static
+ * @type int
+ */
+ _polling_interval:50,
+
+ /**
+ * @description A transaction counter that increments the transaction id for each transaction.
+ * @property _transaction_id
+ * @private
+ * @static
+ * @type int
+ */
+ _transaction_id:0,
+
+ /**
+ * @description Member to add an ActiveX id to the existing xml_progid array.
+ * In the event(unlikely) a new ActiveX id is introduced, it can be added
+ * without internal code modifications.
+ * @method setProgId
+ * @public
+ * @static
+ * @param {string} id The ActiveX id to be added to initialize the XHR object.
+ * @return void
+ */
+ setProgId:function(id)
+ {
+ this._msxml_progid.unshift(id);
+ YAHOO.log('ActiveX Program Id ' + id + ' added to _msxml_progid.', 'info', 'Connection');
+ },
+
+ /**
+ * @description Member to enable or disable the default POST header.
+ * @method setDefaultPostHeader
+ * @public
+ * @static
+ * @param {boolean} b Set and use default header - true or false .
+ * @return void
+ */
+ setDefaultPostHeader:function(b)
+ {
+ this._use_default_post_header = b;
+ YAHOO.log('Use default POST header set to ' + b, 'info', 'Connection');
+ },
+
+ /**
+ * @description Member to modify the default polling interval.
+ * @method setPollingInterval
+ * @public
+ * @static
+ * @param {int} i The polling interval in milliseconds.
+ * @return void
+ */
+ setPollingInterval:function(i)
+ {
+ if(typeof i == 'number' && isFinite(i)){
+ this._polling_interval = i;
+ YAHOO.log('Default polling interval set to ' + i +'ms', 'info', 'Connection');
+ }
+ },
+
+ /**
+ * @description Instantiates a XMLHttpRequest object and returns an object with two properties:
+ * the XMLHttpRequest instance and the transaction id.
+ * @method createXhrObject
+ * @private
+ * @static
+ * @param {int} transactionId Property containing the transaction id for this transaction.
+ * @return object
+ */
+ createXhrObject:function(transactionId)
+ {
+ var obj,http;
+ try
+ {
+ // Instantiates XMLHttpRequest in non-IE browsers and assigns to http.
+ http = new XMLHttpRequest();
+ // Object literal with http and tId properties
+ obj = { conn:http, tId:transactionId };
+ YAHOO.log('XHR object created for transaction ' + transactionId, 'info', 'Connection');
+ }
+ catch(e)
+ {
+ for(var i=0; i= 200 && httpStatus < 300){
+ responseObject = this.createResponseObject(o, callback.argument);
+ if(callback.success){
+ if(!callback.scope){
+ callback.success(responseObject);
+ YAHOO.log('Success callback. HTTP code is ' + httpStatus, 'info', 'Connection');
+ }
+ else{
+ // If a scope property is defined, the callback will be fired from
+ // the context of the object.
+ callback.success.apply(callback.scope, [responseObject]);
+ YAHOO.log('Success callback with scope. HTTP code is ' + httpStatus, 'info', 'Connection');
+ }
+ }
+ }
+ else{
+ switch(httpStatus){
+ // The following cases are wininet.dll error codes that may be encountered.
+ case 12002: // Server timeout
+ case 12029: // 12029 to 12031 correspond to dropped connections.
+ case 12030:
+ case 12031:
+ case 12152: // Connection closed by server.
+ case 13030: // See above comments for variable status.
+ responseObject = this.createExceptionObject(o.tId, callback.argument, (isAbort?isAbort:false));
+ if(callback.failure){
+ if(!callback.scope){
+ callback.failure(responseObject);
+ YAHOO.log('Failure callback. Exception detected. Status code is ' + httpStatus, 'warn', 'Connection');
+ }
+ else{
+ callback.failure.apply(callback.scope, [responseObject]);
+ YAHOO.log('Failure callback with scope. Exception detected. Status code is ' + httpStatus, 'warn', 'Connection');
+ }
+ }
+ break;
+ default:
+ responseObject = this.createResponseObject(o, callback.argument);
+ if(callback.failure){
+ if(!callback.scope){
+ callback.failure(responseObject);
+ YAHOO.log('Failure callback. HTTP status code is ' + httpStatus, 'warn', 'Connection');
+ }
+ else{
+ callback.failure.apply(callback.scope, [responseObject]);
+ YAHOO.log('Failure callback with scope. HTTP status code is ' + httpStatus, 'warn', 'Connection');
+ }
+ }
+ }
+ }
+
+ this.releaseObject(o);
+ responseObject = null;
+ },
+
+ /**
+ * @description This method evaluates the server response, creates and returns the results via
+ * its properties. Success and failure cases will differ in the response
+ * object's property values.
+ * @method createResponseObject
+ * @private
+ * @static
+ * @param {object} o The connection object
+ * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback
+ * @return {object}
+ */
+ createResponseObject:function(o, callbackArg)
+ {
+ var obj = {};
+ var headerObj = {};
+
+ try
+ {
+ var headerStr = o.conn.getAllResponseHeaders();
+ var header = headerStr.split('\n');
+ for(var i=0; i ');
+
+ // IE will throw a security exception in an SSL environment if the
+ // iframe source is undefined.
+ if(typeof secureUri == 'boolean'){
+ io.src = 'javascript:false';
+ }
+ else if(typeof secureURI == 'string'){
+ // Deprecated
+ io.src = secureUri;
+ }
+ }
+ else{
+ var io = document.createElement('iframe');
+ io.id = frameId;
+ io.name = frameId;
+ }
+
+ io.style.position = 'absolute';
+ io.style.top = '-1000px';
+ io.style.left = '-1000px';
+
+ document.body.appendChild(io);
+ YAHOO.log('File upload iframe created. Id is:' + frameId, 'info', 'Connection');
+ },
+
+ /**
+ * @description Parses the POST data and creates hidden form elements
+ * for each key-value, and appends them to the HTML form object.
+ * @method appendPostData
+ * @private
+ * @static
+ * @param {string} postData The HTTP POST data
+ * @return {array} formElements Collection of hidden fields.
+ */
+ appendPostData:function(postData)
+ {
+ var formElements = new Array();
+ var postMessage = postData.split('&');
+ for(var i=0; i < postMessage.length; i++){
+ var delimitPos = postMessage[i].indexOf('=');
+ if(delimitPos != -1){
+ formElements[i] = document.createElement('input');
+ formElements[i].type = 'hidden';
+ formElements[i].name = postMessage[i].substring(0,delimitPos);
+ formElements[i].value = postMessage[i].substring(delimitPos+1);
+ this._formNode.appendChild(formElements[i]);
+ }
+ }
+
+ return formElements;
+ },
+
+ /**
+ * @description Uploads HTML form, including files/attachments, to the
+ * iframe created in createFrame.
+ * @method uploadFile
+ * @private
+ * @static
+ * @param {int} id The transaction id.
+ * @param {object} callback - User-defined callback object.
+ * @param {string} uri Fully qualified path of resource.
+ * @return {void}
+ */
+ uploadFile:function(id, callback, uri, postData){
+
+ // Each iframe has an id prefix of "yuiIO" followed
+ // by the unique transaction id.
+ var frameId = 'yuiIO' + id;
+ var io = document.getElementById(frameId);
+
+ // Initialize the HTML form properties in case they are
+ // not defined in the HTML form.
+ this._formNode.action = uri;
+ this._formNode.method = 'POST';
+ this._formNode.target = frameId;
+
+ if(this._formNode.encoding){
+ // IE does not respect property enctype for HTML forms.
+ // Instead use property encoding.
+ this._formNode.encoding = 'multipart/form-data';
+ }
+ else{
+ this._formNode.enctype = 'multipart/form-data';
+ }
+
+
+ if(postData){
+ var oElements = this.appendPostData(postData);
+ }
+
+ this._formNode.submit();
+
+ if(oElements && oElements.length > 0){
+ for(var i=0; i < oElements.length; i++){
+ this._formNode.removeChild(oElements[i]);
+ }
+ }
+
+ // Reset HTML form status properties.
+ this.resetFormState();
+
+ // Create the upload callback handler that fires when the iframe
+ // receives the load event. Subsequently, the event handler is detached
+ // and the iframe removed from the document.
+
+ var uploadCallback = function()
+ {
+ var obj = {};
+ obj.tId = id;
+ obj.argument = callback.argument;
+
+ try
+ {
+ obj.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
+ obj.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
+ }
+ catch(e){}
+
+ if(callback.upload){
+ if(!callback.scope){
+ callback.upload(obj);
+ YAHOO.log('Upload callback.', 'info', 'Connection');
+ }
+ else{
+ callback.upload.apply(callback.scope, [obj]);
+ YAHOO.log('Upload callback with scope.', 'info', 'Connection');
+ }
+ }
+
+ if(YAHOO.util.Event){
+ YAHOO.util.Event.removeListener(io, "load", uploadCallback);
+ }
+ else if(window.detachEvent){
+ io.detachEvent('onload', uploadCallback);
+ }
+ else{
+ io.removeEventListener('load', uploadCallback, false);
+ }
+ setTimeout(
+ function(){
+ document.body.removeChild(io);
+ YAHOO.log('File upload iframe destroyed. Id is:' + frameId, 'info', 'Connection');
+ }, 100);
+ };
+
+
+ // Bind the onload handler to the iframe to detect the file upload response.
+ if(YAHOO.util.Event){
+ YAHOO.util.Event.addListener(io, "load", uploadCallback);
+ }
+ else if(window.attachEvent){
+ io.attachEvent('onload', uploadCallback);
+ }
+ else{
+ io.addEventListener('load', uploadCallback, false);
+ }
+ },
+
+ /**
+ * @description Method to terminate a transaction, if it has not reached readyState 4.
+ * @method abort
+ * @public
+ * @static
+ * @param {object} o The connection object returned by asyncRequest.
+ * @param {object} callback User-defined callback object.
+ * @param {string} isTimeout boolean to indicate if abort was a timeout.
+ * @return {boolean}
+ */
+ abort:function(o, callback, isTimeout)
+ {
+ if(this.isCallInProgress(o)){
+ o.conn.abort();
+ window.clearInterval(this._poll[o.tId]);
+ delete this._poll[o.tId];
+ if(isTimeout){
+ delete this._timeOut[o.tId];
+ }
+
+ this.handleTransactionResponse(o, callback, true);
+ YAHOO.log('Transaction ' + o.tId + ' aborted.', 'info', 'Connection');
+
+ return true;
+ }
+ else{
+ YAHOO.log('Transaction ' + o.tId + ' abort call failed.', 'warn', 'Connection');
+ return false;
+ }
+ },
+
+ /**
+ * Public method to check if the transaction is still being processed.
+ *
+ * @method isCallInProgress
+ * @public
+ * @static
+ * @param {object} o The connection object returned by asyncRequest
+ * @return {boolean}
+ */
+ isCallInProgress:function(o)
+ {
+ // if the XHR object assigned to the transaction has not been dereferenced,
+ // then check its readyState status. Otherwise, return false.
+ if(o.conn){
+ return o.conn.readyState != 4 && o.conn.readyState != 0;
+ }
+ else{
+ //The XHR object has been destroyed.
+ return false;
+ }
+ },
+
+ /**
+ * @description Dereference the XHR instance and the connection object after the transaction is completed.
+ * @method releaseObject
+ * @private
+ * @static
+ * @param {object} o The connection object
+ * @return {void}
+ */
+ releaseObject:function(o)
+ {
+ //dereference the XHR instance.
+ o.conn = null;
+ YAHOO.log('Connection object for transaction ' + o.tId + ' destroyed.', 'info', 'Connection');
+ //dereference the connection object.
+ o = null;
+ }
};
\ No newline at end of file
diff --git a/thirdpartyjs/yui/connection/connection-min.js b/thirdpartyjs/yui/connection/connection-min.js
index 95d39ac..684da79 100644
--- a/thirdpartyjs/yui/connection/connection-min.js
+++ b/thirdpartyjs/yui/connection/connection-min.js
@@ -1,99 +1,99 @@
-/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt version: 0.12.0 */
-YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded',_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,setProgId:function(id)
-{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
-{this._use_default_post_header=b;},setPollingInterval:function(i)
-{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
-{var obj,http;try
-{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
-catch(e)
-{for(var i=0;i=200&&httpStatus<300){try
-{responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
-else{callback.success.apply(callback.scope,[responseObject]);}}}
-catch(e){}}
-else{try
-{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
-else{callback.failure.apply(callback.scope,[responseObject]);}}
-break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
-else{callback.failure.apply(callback.scope,[responseObject]);}}}}
-catch(e){}}
-this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
-{var obj={};var headerObj={};try
-{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i ');if(typeof secureUri=='boolean'){io.src='javascript:false';}
-else if(typeof secureURI=='string'){io.src=secureUri;}}
-else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
-io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData)
-{var formElements=new Array();var postMessage=postData.split('&');for(var i=0;i0){try
-{for(var i=0;i=200&&httpStatus<300){try
+{responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
+else{callback.success.apply(callback.scope,[responseObject]);}}}
+catch(e){}}
+else{try
+{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
+else{callback.failure.apply(callback.scope,[responseObject]);}}
+break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
+else{callback.failure.apply(callback.scope,[responseObject]);}}}}
+catch(e){}}
+this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
+{var obj={};var headerObj={};try
+{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i ');if(typeof secureUri=='boolean'){io.src='javascript:false';}
+else if(typeof secureURI=='string'){io.src=secureUri;}}
+else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
+io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData)
+{var formElements=new Array();var postMessage=postData.split('&');for(var i=0;i0){try
+{for(var i=0;i= 200 && httpStatus < 300){
- try
- {
- responseObject = this.createResponseObject(o, callback.argument);
- if(callback.success){
- if(!callback.scope){
- callback.success(responseObject);
- }
- else{
- // If a scope property is defined, the callback will be fired from
- // the context of the object.
- callback.success.apply(callback.scope, [responseObject]);
- }
- }
- }
- catch(e){}
- }
- else{
- try
- {
- switch(httpStatus){
- // The following cases are wininet.dll error codes that may be encountered.
- case 12002: // Server timeout
- case 12029: // 12029 to 12031 correspond to dropped connections.
- case 12030:
- case 12031:
- case 12152: // Connection closed by server.
- case 13030: // See above comments for variable status.
- responseObject = this.createExceptionObject(o.tId, callback.argument, (isAbort?isAbort:false));
- if(callback.failure){
- if(!callback.scope){
- callback.failure(responseObject);
- }
- else{
- callback.failure.apply(callback.scope, [responseObject]);
- }
- }
- break;
- default:
- responseObject = this.createResponseObject(o, callback.argument);
- if(callback.failure){
- if(!callback.scope){
- callback.failure(responseObject);
- }
- else{
- callback.failure.apply(callback.scope, [responseObject]);
- }
- }
- }
- }
- catch(e){}
- }
-
- this.releaseObject(o);
- responseObject = null;
- },
-
- /**
- * @description This method evaluates the server response, creates and returns the results via
- * its properties. Success and failure cases will differ in the response
- * object's property values.
- * @method createResponseObject
- * @private
- * @static
- * @param {object} o The connection object
- * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback
- * @return {object}
- */
- createResponseObject:function(o, callbackArg)
- {
- var obj = {};
- var headerObj = {};
-
- try
- {
- var headerStr = o.conn.getAllResponseHeaders();
- var header = headerStr.split('\n');
- for(var i=0; i ');
-
- // IE will throw a security exception in an SSL environment if the
- // iframe source is undefined.
- if(typeof secureUri == 'boolean'){
- io.src = 'javascript:false';
- }
- else if(typeof secureURI == 'string'){
- // Deprecated
- io.src = secureUri;
- }
- }
- else{
- var io = document.createElement('iframe');
- io.id = frameId;
- io.name = frameId;
- }
-
- io.style.position = 'absolute';
- io.style.top = '-1000px';
- io.style.left = '-1000px';
-
- document.body.appendChild(io);
- },
-
- /**
- * @description Parses the POST data and creates hidden form elements
- * for each key-value, and appends them to the HTML form object.
- * @method appendPostData
- * @private
- * @static
- * @param {string} postData The HTTP POST data
- * @return {array} formElements Collection of hidden fields.
- */
- appendPostData:function(postData)
- {
- var formElements = new Array();
- var postMessage = postData.split('&');
- for(var i=0; i < postMessage.length; i++){
- var delimitPos = postMessage[i].indexOf('=');
- if(delimitPos != -1){
- formElements[i] = document.createElement('input');
- formElements[i].type = 'hidden';
- formElements[i].name = postMessage[i].substring(0,delimitPos);
- formElements[i].value = postMessage[i].substring(delimitPos+1);
- this._formNode.appendChild(formElements[i]);
- }
- }
-
- return formElements;
- },
-
- /**
- * @description Uploads HTML form, including files/attachments, to the
- * iframe created in createFrame.
- * @method uploadFile
- * @private
- * @static
- * @param {int} id The transaction id.
- * @param {object} callback - User-defined callback object.
- * @param {string} uri Fully qualified path of resource.
- * @return {void}
- */
- uploadFile:function(id, callback, uri, postData){
-
- // Each iframe has an id prefix of "yuiIO" followed
- // by the unique transaction id.
- var frameId = 'yuiIO' + id;
- var io = document.getElementById(frameId);
-
- // Initialize the HTML form properties in case they are
- // not defined in the HTML form.
- this._formNode.action = uri;
- this._formNode.method = 'POST';
- this._formNode.target = frameId;
-
- if(this._formNode.encoding){
- // IE does not respect property enctype for HTML forms.
- // Instead use property encoding.
- this._formNode.encoding = 'multipart/form-data';
- }
- else{
- this._formNode.enctype = 'multipart/form-data';
- }
-
- if(postData){
- var oElements = this.appendPostData(postData);
- }
-
- this._formNode.submit();
-
- if(oElements && oElements.length > 0){
- try
- {
- for(var i=0; i < oElements.length; i++){
- this._formNode.removeChild(oElements[i]);
- }
- }
- catch(e){}
- }
-
- // Reset HTML form status properties.
- this.resetFormState();
-
- // Create the upload callback handler that fires when the iframe
- // receives the load event. Subsequently, the event handler is detached
- // and the iframe removed from the document.
-
- var uploadCallback = function()
- {
- var obj = {};
- obj.tId = id;
- obj.argument = callback.argument;
-
- try
- {
- obj.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
- obj.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
- }
- catch(e){}
-
- if(callback.upload){
- if(!callback.scope){
- callback.upload(obj);
- }
- else{
- callback.upload.apply(callback.scope, [obj]);
- }
- }
-
- if(YAHOO.util.Event){
- YAHOO.util.Event.removeListener(io, "load", uploadCallback);
- }
- else if(window.detachEvent){
- io.detachEvent('onload', uploadCallback);
- }
- else{
- io.removeEventListener('load', uploadCallback, false);
- }
- setTimeout(function(){ document.body.removeChild(io); }, 100);
- };
-
-
- // Bind the onload handler to the iframe to detect the file upload response.
- if(YAHOO.util.Event){
- YAHOO.util.Event.addListener(io, "load", uploadCallback);
- }
- else if(window.attachEvent){
- io.attachEvent('onload', uploadCallback);
- }
- else{
- io.addEventListener('load', uploadCallback, false);
- }
- },
-
- /**
- * @description Method to terminate a transaction, if it has not reached readyState 4.
- * @method abort
- * @public
- * @static
- * @param {object} o The connection object returned by asyncRequest.
- * @param {object} callback User-defined callback object.
- * @param {string} isTimeout boolean to indicate if abort was a timeout.
- * @return {boolean}
- */
- abort:function(o, callback, isTimeout)
- {
- if(this.isCallInProgress(o)){
- o.conn.abort();
- window.clearInterval(this._poll[o.tId]);
- delete this._poll[o.tId];
- if(isTimeout){
- delete this._timeOut[o.tId];
- }
-
- this.handleTransactionResponse(o, callback, true);
-
- return true;
- }
- else{
- return false;
- }
- },
-
- /**
- * Public method to check if the transaction is still being processed.
- *
- * @method isCallInProgress
- * @public
- * @static
- * @param {object} o The connection object returned by asyncRequest
- * @return {boolean}
- */
- isCallInProgress:function(o)
- {
- // if the XHR object assigned to the transaction has not been dereferenced,
- // then check its readyState status. Otherwise, return false.
- if(o.conn){
- return o.conn.readyState != 4 && o.conn.readyState != 0;
- }
- else{
- //The XHR object has been destroyed.
- return false;
- }
- },
-
- /**
- * @description Dereference the XHR instance and the connection object after the transaction is completed.
- * @method releaseObject
- * @private
- * @static
- * @param {object} o The connection object
- * @return {void}
- */
- releaseObject:function(o)
- {
- //dereference the XHR instance.
- o.conn = null;
- //dereference the connection object.
- o = null;
- }
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+ * @description
+ * The Connection Manager provides a simplified interface to the XMLHttpRequest
+ * object. It handles cross-browser instantiantion of XMLHttpRequest, negotiates the
+ * interactive states and server response, returning the results to a pre-defined
+ * callback you create.
+ *
+ * @namespace YAHOO.util
+ * @module Connection
+ * @Class Connect
+ */
+YAHOO.util.Connect =
+{
+ /**
+ * @description Array of MSFT ActiveX ids for XMLHttpRequest.
+ * @property _msxml_progid
+ * @private
+ * @static
+ * @type array
+ */
+ _msxml_progid:[
+ 'MSXML2.XMLHTTP.3.0',
+ 'MSXML2.XMLHTTP',
+ 'Microsoft.XMLHTTP'
+ ],
+
+ /**
+ * @description Object literal of HTTP header(s)
+ * @property _http_header
+ * @private
+ * @static
+ * @type object
+ */
+ _http_header:{},
+
+ /**
+ * @description Determines if HTTP headers are set.
+ * @property _has_http_headers
+ * @private
+ * @static
+ * @type boolean
+ */
+ _has_http_headers:false,
+
+ /**
+ * @description Determines if a default header of
+ * Content-Type of 'application/x-www-form-urlencoded'
+ * will be added to any client HTTP headers sent for POST
+ * transactions.
+ * @property _use_default_post_header
+ * @private
+ * @static
+ * @type boolean
+ */
+ _use_default_post_header:true,
+
+ /**
+ * @description Determines if a default header of
+ * Content-Type of 'application/x-www-form-urlencoded'
+ * will be added to any client HTTP headers sent for POST
+ * transactions.
+ * @property _default_post_header
+ * @private
+ * @static
+ * @type boolean
+ */
+ _default_post_header:'application/x-www-form-urlencoded',
+
+ /**
+ * @description Property modified by setForm() to determine if the data
+ * should be submitted as an HTML form.
+ * @property _isFormSubmit
+ * @private
+ * @static
+ * @type boolean
+ */
+ _isFormSubmit:false,
+
+ /**
+ * @description Property modified by setForm() to determine if a file(s)
+ * upload is expected.
+ * @property _isFileUpload
+ * @private
+ * @static
+ * @type boolean
+ */
+ _isFileUpload:false,
+
+ /**
+ * @description Property modified by setForm() to set a reference to the HTML
+ * form node if the desired action is file upload.
+ * @property _formNode
+ * @private
+ * @static
+ * @type object
+ */
+ _formNode:null,
+
+ /**
+ * @description Property modified by setForm() to set the HTML form data
+ * for each transaction.
+ * @property _sFormData
+ * @private
+ * @static
+ * @type string
+ */
+ _sFormData:null,
+
+ /**
+ * @description Collection of polling references to the polling mechanism in handleReadyState.
+ * @property _poll
+ * @private
+ * @static
+ * @type object
+ */
+ _poll:{},
+
+ /**
+ * @description Queue of timeout values for each transaction callback with a defined timeout value.
+ * @property _timeOut
+ * @private
+ * @static
+ * @type object
+ */
+ _timeOut:{},
+
+ /**
+ * @description The polling frequency, in milliseconds, for HandleReadyState.
+ * when attempting to determine a transaction's XHR readyState.
+ * The default is 50 milliseconds.
+ * @property _polling_interval
+ * @private
+ * @static
+ * @type int
+ */
+ _polling_interval:50,
+
+ /**
+ * @description A transaction counter that increments the transaction id for each transaction.
+ * @property _transaction_id
+ * @private
+ * @static
+ * @type int
+ */
+ _transaction_id:0,
+
+ /**
+ * @description Member to add an ActiveX id to the existing xml_progid array.
+ * In the event(unlikely) a new ActiveX id is introduced, it can be added
+ * without internal code modifications.
+ * @method setProgId
+ * @public
+ * @static
+ * @param {string} id The ActiveX id to be added to initialize the XHR object.
+ * @return void
+ */
+ setProgId:function(id)
+ {
+ this._msxml_progid.unshift(id);
+ },
+
+ /**
+ * @description Member to enable or disable the default POST header.
+ * @method setDefaultPostHeader
+ * @public
+ * @static
+ * @param {boolean} b Set and use default header - true or false .
+ * @return void
+ */
+ setDefaultPostHeader:function(b)
+ {
+ this._use_default_post_header = b;
+ },
+
+ /**
+ * @description Member to modify the default polling interval.
+ * @method setPollingInterval
+ * @public
+ * @static
+ * @param {int} i The polling interval in milliseconds.
+ * @return void
+ */
+ setPollingInterval:function(i)
+ {
+ if(typeof i == 'number' && isFinite(i)){
+ this._polling_interval = i;
+ }
+ },
+
+ /**
+ * @description Instantiates a XMLHttpRequest object and returns an object with two properties:
+ * the XMLHttpRequest instance and the transaction id.
+ * @method createXhrObject
+ * @private
+ * @static
+ * @param {int} transactionId Property containing the transaction id for this transaction.
+ * @return object
+ */
+ createXhrObject:function(transactionId)
+ {
+ var obj,http;
+ try
+ {
+ // Instantiates XMLHttpRequest in non-IE browsers and assigns to http.
+ http = new XMLHttpRequest();
+ // Object literal with http and tId properties
+ obj = { conn:http, tId:transactionId };
+ }
+ catch(e)
+ {
+ for(var i=0; i= 200 && httpStatus < 300){
+ try
+ {
+ responseObject = this.createResponseObject(o, callback.argument);
+ if(callback.success){
+ if(!callback.scope){
+ callback.success(responseObject);
+ }
+ else{
+ // If a scope property is defined, the callback will be fired from
+ // the context of the object.
+ callback.success.apply(callback.scope, [responseObject]);
+ }
+ }
+ }
+ catch(e){}
+ }
+ else{
+ try
+ {
+ switch(httpStatus){
+ // The following cases are wininet.dll error codes that may be encountered.
+ case 12002: // Server timeout
+ case 12029: // 12029 to 12031 correspond to dropped connections.
+ case 12030:
+ case 12031:
+ case 12152: // Connection closed by server.
+ case 13030: // See above comments for variable status.
+ responseObject = this.createExceptionObject(o.tId, callback.argument, (isAbort?isAbort:false));
+ if(callback.failure){
+ if(!callback.scope){
+ callback.failure(responseObject);
+ }
+ else{
+ callback.failure.apply(callback.scope, [responseObject]);
+ }
+ }
+ break;
+ default:
+ responseObject = this.createResponseObject(o, callback.argument);
+ if(callback.failure){
+ if(!callback.scope){
+ callback.failure(responseObject);
+ }
+ else{
+ callback.failure.apply(callback.scope, [responseObject]);
+ }
+ }
+ }
+ }
+ catch(e){}
+ }
+
+ this.releaseObject(o);
+ responseObject = null;
+ },
+
+ /**
+ * @description This method evaluates the server response, creates and returns the results via
+ * its properties. Success and failure cases will differ in the response
+ * object's property values.
+ * @method createResponseObject
+ * @private
+ * @static
+ * @param {object} o The connection object
+ * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback
+ * @return {object}
+ */
+ createResponseObject:function(o, callbackArg)
+ {
+ var obj = {};
+ var headerObj = {};
+
+ try
+ {
+ var headerStr = o.conn.getAllResponseHeaders();
+ var header = headerStr.split('\n');
+ for(var i=0; i ');
+
+ // IE will throw a security exception in an SSL environment if the
+ // iframe source is undefined.
+ if(typeof secureUri == 'boolean'){
+ io.src = 'javascript:false';
+ }
+ else if(typeof secureURI == 'string'){
+ // Deprecated
+ io.src = secureUri;
+ }
+ }
+ else{
+ var io = document.createElement('iframe');
+ io.id = frameId;
+ io.name = frameId;
+ }
+
+ io.style.position = 'absolute';
+ io.style.top = '-1000px';
+ io.style.left = '-1000px';
+
+ document.body.appendChild(io);
+ },
+
+ /**
+ * @description Parses the POST data and creates hidden form elements
+ * for each key-value, and appends them to the HTML form object.
+ * @method appendPostData
+ * @private
+ * @static
+ * @param {string} postData The HTTP POST data
+ * @return {array} formElements Collection of hidden fields.
+ */
+ appendPostData:function(postData)
+ {
+ var formElements = new Array();
+ var postMessage = postData.split('&');
+ for(var i=0; i < postMessage.length; i++){
+ var delimitPos = postMessage[i].indexOf('=');
+ if(delimitPos != -1){
+ formElements[i] = document.createElement('input');
+ formElements[i].type = 'hidden';
+ formElements[i].name = postMessage[i].substring(0,delimitPos);
+ formElements[i].value = postMessage[i].substring(delimitPos+1);
+ this._formNode.appendChild(formElements[i]);
+ }
+ }
+
+ return formElements;
+ },
+
+ /**
+ * @description Uploads HTML form, including files/attachments, to the
+ * iframe created in createFrame.
+ * @method uploadFile
+ * @private
+ * @static
+ * @param {int} id The transaction id.
+ * @param {object} callback - User-defined callback object.
+ * @param {string} uri Fully qualified path of resource.
+ * @return {void}
+ */
+ uploadFile:function(id, callback, uri, postData){
+
+ // Each iframe has an id prefix of "yuiIO" followed
+ // by the unique transaction id.
+ var frameId = 'yuiIO' + id;
+ var io = document.getElementById(frameId);
+
+ // Initialize the HTML form properties in case they are
+ // not defined in the HTML form.
+ this._formNode.action = uri;
+ this._formNode.method = 'POST';
+ this._formNode.target = frameId;
+
+ if(this._formNode.encoding){
+ // IE does not respect property enctype for HTML forms.
+ // Instead use property encoding.
+ this._formNode.encoding = 'multipart/form-data';
+ }
+ else{
+ this._formNode.enctype = 'multipart/form-data';
+ }
+
+ if(postData){
+ var oElements = this.appendPostData(postData);
+ }
+
+ this._formNode.submit();
+
+ if(oElements && oElements.length > 0){
+ try
+ {
+ for(var i=0; i < oElements.length; i++){
+ this._formNode.removeChild(oElements[i]);
+ }
+ }
+ catch(e){}
+ }
+
+ // Reset HTML form status properties.
+ this.resetFormState();
+
+ // Create the upload callback handler that fires when the iframe
+ // receives the load event. Subsequently, the event handler is detached
+ // and the iframe removed from the document.
+
+ var uploadCallback = function()
+ {
+ var obj = {};
+ obj.tId = id;
+ obj.argument = callback.argument;
+
+ try
+ {
+ obj.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
+ obj.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
+ }
+ catch(e){}
+
+ if(callback.upload){
+ if(!callback.scope){
+ callback.upload(obj);
+ }
+ else{
+ callback.upload.apply(callback.scope, [obj]);
+ }
+ }
+
+ if(YAHOO.util.Event){
+ YAHOO.util.Event.removeListener(io, "load", uploadCallback);
+ }
+ else if(window.detachEvent){
+ io.detachEvent('onload', uploadCallback);
+ }
+ else{
+ io.removeEventListener('load', uploadCallback, false);
+ }
+ setTimeout(function(){ document.body.removeChild(io); }, 100);
+ };
+
+
+ // Bind the onload handler to the iframe to detect the file upload response.
+ if(YAHOO.util.Event){
+ YAHOO.util.Event.addListener(io, "load", uploadCallback);
+ }
+ else if(window.attachEvent){
+ io.attachEvent('onload', uploadCallback);
+ }
+ else{
+ io.addEventListener('load', uploadCallback, false);
+ }
+ },
+
+ /**
+ * @description Method to terminate a transaction, if it has not reached readyState 4.
+ * @method abort
+ * @public
+ * @static
+ * @param {object} o The connection object returned by asyncRequest.
+ * @param {object} callback User-defined callback object.
+ * @param {string} isTimeout boolean to indicate if abort was a timeout.
+ * @return {boolean}
+ */
+ abort:function(o, callback, isTimeout)
+ {
+ if(this.isCallInProgress(o)){
+ o.conn.abort();
+ window.clearInterval(this._poll[o.tId]);
+ delete this._poll[o.tId];
+ if(isTimeout){
+ delete this._timeOut[o.tId];
+ }
+
+ this.handleTransactionResponse(o, callback, true);
+
+ return true;
+ }
+ else{
+ return false;
+ }
+ },
+
+ /**
+ * Public method to check if the transaction is still being processed.
+ *
+ * @method isCallInProgress
+ * @public
+ * @static
+ * @param {object} o The connection object returned by asyncRequest
+ * @return {boolean}
+ */
+ isCallInProgress:function(o)
+ {
+ // if the XHR object assigned to the transaction has not been dereferenced,
+ // then check its readyState status. Otherwise, return false.
+ if(o.conn){
+ return o.conn.readyState != 4 && o.conn.readyState != 0;
+ }
+ else{
+ //The XHR object has been destroyed.
+ return false;
+ }
+ },
+
+ /**
+ * @description Dereference the XHR instance and the connection object after the transaction is completed.
+ * @method releaseObject
+ * @private
+ * @static
+ * @param {object} o The connection object
+ * @return {void}
+ */
+ releaseObject:function(o)
+ {
+ //dereference the XHR instance.
+ o.conn = null;
+ //dereference the connection object.
+ o = null;
+ }
};
\ No newline at end of file
diff --git a/thirdpartyjs/yui/container/README b/thirdpartyjs/yui/container/README
index 702f453..99ecba4 100644
--- a/thirdpartyjs/yui/container/README
+++ b/thirdpartyjs/yui/container/README
@@ -1,115 +1,115 @@
-Container Release Notes
-
-*** version 0.12.0 ***
-
- All Classes
- - New documentation format implemented, and removed unnecessary
- prototype null references previously used for generating
- documentation
- - Modified the
-
- Config
- - Added 'undefined' check when reading initial properties for
- .reset()
- - Fixed Firefox warning on .resetProperty()
- - Fixed issue preventing resetProperty() from resetting values
- correctly
-
- Module
- - Removed unused "childNodesInDom" property
-
- Overlay
- - Converted center() to use Dom utility
- - Fixed configVisible() to properly detect actual visible/hidden
- status in Internet Explorer, which reports "inherit" for all elements
- by default.
- - Updated onDomResize to properly reapply "context" property
- - Unified scroll/resize handlers so that they fire properly (when the
- event has completed) as opposed to constantly (as seen in Mozilla-
- based browsers)
-
- Panel
- - Modified modality mask to show before Panel is shown (prior to any
- animation)
- - Modified buildWrapper to eliminate cloning of the initial markup
- module, which fixes issues with select options not maintaining their
- default selections in IE
- - Modality mask is now z-indexed properly so that the mask z-index is
- always one less than the Panel z-index
-
- Dialog
- - Fixed Connection to get "action" attribute using getAttribute, to
- allow for form fields named "action"
- - Added support for "GET" by retrieving the form "method" rather than
- always defaulting to "POST"
-
- KeyListener
- - Fixed to work properly with Safari 2.0 by matching against keyCode
- or charCode
-
-*** version 0.11.4 ***
-
- - Panel: Modality mask is now properly removed from DOM on Panel
- destroy.
-
-*** version 0.11.3 ***
-
- - Module: Fixed SSL warning issue in IE
- - Overlay: Fixed memory leak related to iframe shim in IE
- - Panel: No focusable elements under the mask can now be tabbed to
- - Panel: Set Panel container overflow to hidden to fix scrolling issue
- in Opera 9
-
-*** version 0.11.2 ***
-
- - All: JsLint optimization
- - Overlay: Fixed SSL issues with monitorresize property
- - OverlayManager: Fixed z-index incrementing issues
- - Dialog: Form elements called "name" will now function properly
- - Dialog: Removed unnecessary scope:this reference
-
-*** version 0.11.1 ***
-
- - Tooltip: Removed incorrect logger statement
- - Dialog: Corrected logic that was causing browser lockup in IE for
- SimpleDialog
- - Dialog: Fixed "firstButtom" typo
-
-*** version 0.11.0 ***
-
- - toString function added to all classes for easy logging
- - YAHOO.extend is now being used for inheritance on all container
- classes
- - Module: monitorresize feature now works on all browsers
- - Module: Fixed bug with image root and isSecure
- - Overlay: Fixed bugs related to IFRAME shim positioning
- - Overlay: center() now works in quirks mode
- - Overlay: Overlay now has a custom destroy() method that also removes
- the IFRAME shim
- - OverlayManager: Fixed bug in the prototype that was preventing
- multiple Managers on one page
- - OverlayManager: focusEvent now fires at all appropriate times
- - Tooltip: context can now be specified as an array, so Tooltips can be
- reused across multiple context elements
- - Tooltip: preventoverlap now functions properly for large context
- elements (i.e, images)
- - Tooltip: fixed bugs regarding setTimeout
- - Tooltip: added mousemove event to allow for more accurate Tooltip
- positioning
- - Panel: added dragEvent for monitoring all event handlers for drag and
- drop
- - Panel: modality mask is now resized on scroll
- - Panel: KeyListeners are now properly destroyed when the Panel is
- destroyed
- - Panel: Header is now sized properly in quirks mode
- - Dialog: Blinking cursor issue is fixed for Firefox
- - Dialog: callback object for Connection is now public (this.callback)
- - Dialog: onsuccess/onfailure properties removed (as a result of the
- public callback object)
- - Dialog: Dialog is now invisible by default
- - Dialog: Buttons are now properly cleaned up on destroy
-
-*** version 0.10.0 ***
-
-* Initial release
-
+Container Release Notes
+
+*** version 0.12.0 ***
+
+ All Classes
+ - New documentation format implemented, and removed unnecessary
+ prototype null references previously used for generating
+ documentation
+ - Modified the
+
+ Config
+ - Added 'undefined' check when reading initial properties for
+ .reset()
+ - Fixed Firefox warning on .resetProperty()
+ - Fixed issue preventing resetProperty() from resetting values
+ correctly
+
+ Module
+ - Removed unused "childNodesInDom" property
+
+ Overlay
+ - Converted center() to use Dom utility
+ - Fixed configVisible() to properly detect actual visible/hidden
+ status in Internet Explorer, which reports "inherit" for all elements
+ by default.
+ - Updated onDomResize to properly reapply "context" property
+ - Unified scroll/resize handlers so that they fire properly (when the
+ event has completed) as opposed to constantly (as seen in Mozilla-
+ based browsers)
+
+ Panel
+ - Modified modality mask to show before Panel is shown (prior to any
+ animation)
+ - Modified buildWrapper to eliminate cloning of the initial markup
+ module, which fixes issues with select options not maintaining their
+ default selections in IE
+ - Modality mask is now z-indexed properly so that the mask z-index is
+ always one less than the Panel z-index
+
+ Dialog
+ - Fixed Connection to get "action" attribute using getAttribute, to
+ allow for form fields named "action"
+ - Added support for "GET" by retrieving the form "method" rather than
+ always defaulting to "POST"
+
+ KeyListener
+ - Fixed to work properly with Safari 2.0 by matching against keyCode
+ or charCode
+
+*** version 0.11.4 ***
+
+ - Panel: Modality mask is now properly removed from DOM on Panel
+ destroy.
+
+*** version 0.11.3 ***
+
+ - Module: Fixed SSL warning issue in IE
+ - Overlay: Fixed memory leak related to iframe shim in IE
+ - Panel: No focusable elements under the mask can now be tabbed to
+ - Panel: Set Panel container overflow to hidden to fix scrolling issue
+ in Opera 9
+
+*** version 0.11.2 ***
+
+ - All: JsLint optimization
+ - Overlay: Fixed SSL issues with monitorresize property
+ - OverlayManager: Fixed z-index incrementing issues
+ - Dialog: Form elements called "name" will now function properly
+ - Dialog: Removed unnecessary scope:this reference
+
+*** version 0.11.1 ***
+
+ - Tooltip: Removed incorrect logger statement
+ - Dialog: Corrected logic that was causing browser lockup in IE for
+ SimpleDialog
+ - Dialog: Fixed "firstButtom" typo
+
+*** version 0.11.0 ***
+
+ - toString function added to all classes for easy logging
+ - YAHOO.extend is now being used for inheritance on all container
+ classes
+ - Module: monitorresize feature now works on all browsers
+ - Module: Fixed bug with image root and isSecure
+ - Overlay: Fixed bugs related to IFRAME shim positioning
+ - Overlay: center() now works in quirks mode
+ - Overlay: Overlay now has a custom destroy() method that also removes
+ the IFRAME shim
+ - OverlayManager: Fixed bug in the prototype that was preventing
+ multiple Managers on one page
+ - OverlayManager: focusEvent now fires at all appropriate times
+ - Tooltip: context can now be specified as an array, so Tooltips can be
+ reused across multiple context elements
+ - Tooltip: preventoverlap now functions properly for large context
+ elements (i.e, images)
+ - Tooltip: fixed bugs regarding setTimeout
+ - Tooltip: added mousemove event to allow for more accurate Tooltip
+ positioning
+ - Panel: added dragEvent for monitoring all event handlers for drag and
+ drop
+ - Panel: modality mask is now resized on scroll
+ - Panel: KeyListeners are now properly destroyed when the Panel is
+ destroyed
+ - Panel: Header is now sized properly in quirks mode
+ - Dialog: Blinking cursor issue is fixed for Firefox
+ - Dialog: callback object for Connection is now public (this.callback)
+ - Dialog: onsuccess/onfailure properties removed (as a result of the
+ public callback object)
+ - Dialog: Dialog is now invisible by default
+ - Dialog: Buttons are now properly cleaned up on destroy
+
+*** version 0.10.0 ***
+
+* Initial release
+
diff --git a/thirdpartyjs/yui/container/assets/container.css b/thirdpartyjs/yui/container/assets/container.css
index c482bc2..ee5da15 100644
--- a/thirdpartyjs/yui/container/assets/container.css
+++ b/thirdpartyjs/yui/container/assets/container.css
@@ -1,211 +1,211 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-Version 0.11.0
-*/
-
-.overlay {
- position:absolute;
- display:block;
-}
-
-.tt {
- visibility:hidden;
- position:absolute;
- color:#333;
- background-color:#FDFFB4;
- font-family:arial,helvetica,verdana,sans-serif;
- padding:2px;
- border:1px solid #FCC90D;
- font:100% sans-serif;
- width:auto;
-}
-
-* html body.masked select {
- visibility:hidden;
-}
-
-* html div.panel-container select {
- visibility:inherit;
-}
-
-* html div.drag select {
- visibility:hidden;
-}
-
-* html div.hide-select select {
- visibility:hidden;
-}
-
-.mask {
- z-index:0;
- display:none;
- position:absolute;
- top:0;
- left:0;
- -moz-opacity: 0.5;
- opacity:.50;
- filter: alpha(opacity=50);
- background-color:#CCC;
-}
-
-.hide-scrollbars * {
- overflow:hidden;
-}
-
-.hide-scrollbars textarea, .hide-scrollbars select {
- overflow:hidden;
- display:none;
-}
-
-.show-scrollbars textarea, .show-scrollbars select {
- overflow:visible;
-}
-
-.panel-container {
- position:absolute;
- background-color:transparent;
- z-index:6;
- visibility:hidden;
- overflow:visible;
- width:auto;
-}
-
-.panel-container.matte {
- padding:3px;
- background-color:#FFF;
-}
-
-.panel-container.matte .underlay {
- display:none;
-}
-
-.panel-container.shadow {
- padding:0px;
- background-color:transparent;
-}
-
-.panel-container.shadow .underlay {
- visibility:inherit;
- position:absolute;
- background-color:#CCC;
- top:3px;left:3px;
- z-index:0;
- width:100%;
- height:100%;
- -moz-opacity: 0.7;
- opacity:.70;
- filter:alpha(opacity=70);
- zoom:1;
-}
-
-.panel {
- visibility:hidden;
- border-collapse:separate;
- position:relative;
- left:0px;top:0px;
- font:1em Arial;
- background-color:#FFF;
- border:1px solid #000;
- z-index:1;
- overflow:hidden;
-}
-
-.panel .hd {
- background-color:#3d77cb;
- color:#FFF;
- font-size:100%;
- line-height:100%;
- border:1px solid #FFF;
- border-bottom:1px solid #000;
- font-weight:bold;
- overflow:hidden;
- padding:4px;
-}
-
-.panel .bd {
- overflow:hidden;
- padding:4px;
-}
-
-.panel .bd p {
- margin:0 0 1em;
-}
-
-.panel .close {
- position:absolute;
- top:5px;
- right:4px;
- z-index:6;
- height:12px;
- width:12px;
- margin:0px;
- padding:0px;
- background-repeat:no-repeat;
- cursor:pointer;
- visibility:inherit;
-}
-
-.panel .close.nonsecure {
- background-image:url(http://us.i1.yimg.com/us.yimg.com/i/nt/ic/ut/alt3/close12_1.gif);
-}
-
-.panel .close.secure {
- background-image:url(https://a248.e.akamai.net/sec.yimg.com/i/nt/ic/ut/alt3/close12_1.gif);
-}
-
-.panel .ft {
- padding:4px;
- overflow:hidden;
-}
-
-.simple-dialog .bd .icon {
- background-repeat:no-repeat;
- width:16px;
- height:16px;
- margin-right:10px;
- float:left;
-}
-
-.dialog .ft, .simple-dialog .ft {
- padding-bottom:5px;
- padding-right:5px;
- text-align:right;
-}
-
-.dialog form, .simple-dialog form {
- margin:0;
-}
-
-.button-group button {
- font:100 76% verdana;
- text-decoration:none;
- background-color: #E4E4E4;
- color: #333;
- cursor: hand;
- vertical-align: middle;
- border: 2px solid #797979;
- border-top-color:#FFF;
- border-left-color:#FFF;
- margin:2px;
- padding:2px;
-}
-
-.button-group button.default {
- font-weight:bold;
-}
-
-.button-group button:hover, .button-group button.hover {
- border:2px solid #90A029;
- background-color:#EBF09E;
- border-top-color:#FFF;
- border-left-color:#FFF;
-}
-
-.button-group button:active {
- border:2px solid #E4E4E4;
- background-color:#BBB;
- border-top-color:#333;
- border-left-color:#333;
-}
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+Version 0.11.0
+*/
+
+.overlay {
+ position:absolute;
+ display:block;
+}
+
+.tt {
+ visibility:hidden;
+ position:absolute;
+ color:#333;
+ background-color:#FDFFB4;
+ font-family:arial,helvetica,verdana,sans-serif;
+ padding:2px;
+ border:1px solid #FCC90D;
+ font:100% sans-serif;
+ width:auto;
+}
+
+* html body.masked select {
+ visibility:hidden;
+}
+
+* html div.panel-container select {
+ visibility:inherit;
+}
+
+* html div.drag select {
+ visibility:hidden;
+}
+
+* html div.hide-select select {
+ visibility:hidden;
+}
+
+.mask {
+ z-index:0;
+ display:none;
+ position:absolute;
+ top:0;
+ left:0;
+ -moz-opacity: 0.5;
+ opacity:.50;
+ filter: alpha(opacity=50);
+ background-color:#CCC;
+}
+
+.hide-scrollbars * {
+ overflow:hidden;
+}
+
+.hide-scrollbars textarea, .hide-scrollbars select {
+ overflow:hidden;
+ display:none;
+}
+
+.show-scrollbars textarea, .show-scrollbars select {
+ overflow:visible;
+}
+
+.panel-container {
+ position:absolute;
+ background-color:transparent;
+ z-index:6;
+ visibility:hidden;
+ overflow:visible;
+ width:auto;
+}
+
+.panel-container.matte {
+ padding:3px;
+ background-color:#FFF;
+}
+
+.panel-container.matte .underlay {
+ display:none;
+}
+
+.panel-container.shadow {
+ padding:0px;
+ background-color:transparent;
+}
+
+.panel-container.shadow .underlay {
+ visibility:inherit;
+ position:absolute;
+ background-color:#CCC;
+ top:3px;left:3px;
+ z-index:0;
+ width:100%;
+ height:100%;
+ -moz-opacity: 0.7;
+ opacity:.70;
+ filter:alpha(opacity=70);
+ zoom:1;
+}
+
+.panel {
+ visibility:hidden;
+ border-collapse:separate;
+ position:relative;
+ left:0px;top:0px;
+ font:1em Arial;
+ background-color:#FFF;
+ border:1px solid #000;
+ z-index:1;
+ overflow:hidden;
+}
+
+.panel .hd {
+ background-color:#3d77cb;
+ color:#FFF;
+ font-size:100%;
+ line-height:100%;
+ border:1px solid #FFF;
+ border-bottom:1px solid #000;
+ font-weight:bold;
+ overflow:hidden;
+ padding:4px;
+}
+
+.panel .bd {
+ overflow:hidden;
+ padding:4px;
+}
+
+.panel .bd p {
+ margin:0 0 1em;
+}
+
+.panel .close {
+ position:absolute;
+ top:5px;
+ right:4px;
+ z-index:6;
+ height:12px;
+ width:12px;
+ margin:0px;
+ padding:0px;
+ background-repeat:no-repeat;
+ cursor:pointer;
+ visibility:inherit;
+}
+
+.panel .close.nonsecure {
+ background-image:url(http://us.i1.yimg.com/us.yimg.com/i/nt/ic/ut/alt3/close12_1.gif);
+}
+
+.panel .close.secure {
+ background-image:url(https://a248.e.akamai.net/sec.yimg.com/i/nt/ic/ut/alt3/close12_1.gif);
+}
+
+.panel .ft {
+ padding:4px;
+ overflow:hidden;
+}
+
+.simple-dialog .bd .icon {
+ background-repeat:no-repeat;
+ width:16px;
+ height:16px;
+ margin-right:10px;
+ float:left;
+}
+
+.dialog .ft, .simple-dialog .ft {
+ padding-bottom:5px;
+ padding-right:5px;
+ text-align:right;
+}
+
+.dialog form, .simple-dialog form {
+ margin:0;
+}
+
+.button-group button {
+ font:100 76% verdana;
+ text-decoration:none;
+ background-color: #E4E4E4;
+ color: #333;
+ cursor: hand;
+ vertical-align: middle;
+ border: 2px solid #797979;
+ border-top-color:#FFF;
+ border-left-color:#FFF;
+ margin:2px;
+ padding:2px;
+}
+
+.button-group button.default {
+ font-weight:bold;
+}
+
+.button-group button:hover, .button-group button.hover {
+ border:2px solid #90A029;
+ background-color:#EBF09E;
+ border-top-color:#FFF;
+ border-left-color:#FFF;
+}
+
+.button-group button:active {
+ border:2px solid #E4E4E4;
+ background-color:#BBB;
+ border-top-color:#333;
+ border-left-color:#333;
+}
diff --git a/thirdpartyjs/yui/container/container-debug.js b/thirdpartyjs/yui/container/container-debug.js
index bdef184..02db573 100644
--- a/thirdpartyjs/yui/container/container-debug.js
+++ b/thirdpartyjs/yui/container/container-debug.js
@@ -1,4602 +1,4602 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-/**
-* Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.
-* @class YAHOO.util.Config
-* @constructor
-* @param {Object} owner The owner Object to which this Config Object belongs
-*/
-YAHOO.util.Config = function(owner) {
- if (owner) {
- this.init(owner);
- } else {
- YAHOO.log("No owner specified for Config object", "error");
- }
-};
-
-YAHOO.util.Config.prototype = {
-
- /**
- * Object reference to the owner of this Config Object
- * @property owner
- * @type Object
- */
- owner : null,
-
- /**
- * Boolean flag that specifies whether a queue is currently being executed
- * @property queueInProgress
- * @type Boolean
- */
- queueInProgress : false,
-
-
- /**
- * Validates that the value passed in is a Boolean.
- * @method checkBoolean
- * @param {Object} val The value to validate
- * @return {Boolean} true, if the value is valid
- */
- checkBoolean: function(val) {
- if (typeof val == 'boolean') {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Validates that the value passed in is a number.
- * @method checkNumber
- * @param {Object} val The value to validate
- * @return {Boolean} true, if the value is valid
- */
- checkNumber: function(val) {
- if (isNaN(val)) {
- return false;
- } else {
- return true;
- }
- }
-};
-
-
-/**
-* Initializes the configuration Object and all of its local members.
-* @method init
-* @param {Object} owner The owner Object to which this Config Object belongs
-*/
-YAHOO.util.Config.prototype.init = function(owner) {
-
- this.owner = owner;
-
- /**
- * Object reference to the owner of this Config Object
- * @event configChangedEvent
- */
- this.configChangedEvent = new YAHOO.util.CustomEvent("configChanged");
- this.queueInProgress = false;
-
- /* Private Members */
-
- /**
- * Maintains the local collection of configuration property objects and their specified values
- * @property config
- * @private
- * @type Object
- */
- var config = {};
-
- /**
- * Maintains the local collection of configuration property objects as they were initially applied.
- * This object is used when resetting a property.
- * @property initialConfig
- * @private
- * @type Object
- */
- var initialConfig = {};
-
- /**
- * Maintains the local, normalized CustomEvent queue
- * @property eventQueue
- * @private
- * @type Object
- */
- var eventQueue = [];
-
- /**
- * Fires a configuration property event using the specified value.
- * @method fireEvent
- * @private
- * @param {String} key The configuration property's name
- * @param {value} Object The value of the correct type for the property
- */
- var fireEvent = function( key, value ) {
- YAHOO.log("Firing Config event: " + key + "=" + value, "info");
-
- key = key.toLowerCase();
-
- var property = config[key];
-
- if (typeof property != 'undefined' && property.event) {
- property.event.fire(value);
- }
- };
- /* End Private Members */
-
- /**
- * Adds a property to the Config Object's private config hash.
- * @method addProperty
- * @param {String} key The configuration property's name
- * @param {Object} propertyObject The Object containing all of this property's arguments
- */
- this.addProperty = function( key, propertyObject ) {
- key = key.toLowerCase();
-
- YAHOO.log("Added property: " + key, "info");
-
- config[key] = propertyObject;
-
- propertyObject.event = new YAHOO.util.CustomEvent(key);
- propertyObject.key = key;
-
- if (propertyObject.handler) {
- propertyObject.event.subscribe(propertyObject.handler, this.owner, true);
- }
-
- this.setProperty(key, propertyObject.value, true);
-
- if (! propertyObject.suppressEvent) {
- this.queueProperty(key, propertyObject.value);
- }
- };
-
- /**
- * Returns a key-value configuration map of the values currently set in the Config Object.
- * @method getConfig
- * @return {Object} The current config, represented in a key-value map
- */
- this.getConfig = function() {
- var cfg = {};
-
- for (var prop in config) {
- var property = config[prop];
- if (typeof property != 'undefined' && property.event) {
- cfg[prop] = property.value;
- }
- }
-
- return cfg;
- };
-
- /**
- * Returns the value of specified property.
- * @method getProperty
- * @param {String} key The name of the property
- * @return {Object} The value of the specified property
- */
- this.getProperty = function(key) {
- key = key.toLowerCase();
-
- var property = config[key];
- if (typeof property != 'undefined' && property.event) {
- return property.value;
- } else {
- return undefined;
- }
- };
-
- /**
- * Resets the specified property's value to its initial value.
- * @method resetProperty
- * @param {String} key The name of the property
- * @return {Boolean} True is the property was reset, false if not
- */
- this.resetProperty = function(key) {
- key = key.toLowerCase();
-
- var property = config[key];
- if (typeof property != 'undefined' && property.event) {
- if (initialConfig[key] && initialConfig[key] != 'undefined') {
- this.setProperty(key, initialConfig[key]);
- }
- return true;
- } else {
- return false;
- }
- };
-
- /**
- * Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.
- * @method setProperty
- * @param {String} key The name of the property
- * @param {String} value The value to set the property to
- * @param {Boolean} silent Whether the value should be set silently, without firing the property event.
- * @return {Boolean} True, if the set was successful, false if it failed.
- */
- this.setProperty = function(key, value, silent) {
- key = key.toLowerCase();
-
- YAHOO.log("setProperty: " + key + "=" + value, "info");
-
- if (this.queueInProgress && ! silent) {
- this.queueProperty(key,value); // Currently running through a queue...
- return true;
- } else {
- var property = config[key];
- if (typeof property != 'undefined' && property.event) {
- if (property.validator && ! property.validator(value)) { // validator
- return false;
- } else {
- property.value = value;
- if (! silent) {
- fireEvent(key, value);
- this.configChangedEvent.fire([key, value]);
- }
- return true;
- }
- } else {
- return false;
- }
- }
- };
-
- /**
- * Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is
- * moved from its current position to the end of the queue.
- * @method queueProperty
- * @param {String} key The name of the property
- * @param {String} value The value to set the property to
- * @return {Boolean} true, if the set was successful, false if it failed.
- */
- this.queueProperty = function(key, value) {
- key = key.toLowerCase();
-
- YAHOO.log("queueProperty: " + key + "=" + value, "info");
-
- var property = config[key];
-
- if (typeof property != 'undefined' && property.event) {
- if (typeof value != 'undefined' && property.validator && ! property.validator(value)) { // validator
- return false;
- } else {
-
- if (typeof value != 'undefined') {
- property.value = value;
- } else {
- value = property.value;
- }
-
- var foundDuplicate = false;
-
- for (var i=0;iOR
-* @param {HTMLElement} el The element representing the Module
-* @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
-*/
-YAHOO.widget.Module = function(el, userConfig) {
- if (el) {
- this.init(el, userConfig);
- } else {
- YAHOO.log("No element or element ID specified for Module instantiation", "error");
- }
-};
-
-/**
-* Constant representing the prefix path to use for non-secure images
-* @property YAHOO.widget.Module.IMG_ROOT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";
-
-/**
-* Constant representing the prefix path to use for securely served images
-* @property YAHOO.widget.Module.IMG_ROOT_SSL
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";
-
-/**
-* Constant for the default CSS class name that represents a Module
-* @property YAHOO.widget.Module.CSS_MODULE
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_MODULE = "module";
-
-/**
-* Constant representing the module header
-* @property YAHOO.widget.Module.CSS_HEADER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_HEADER = "hd";
-
-/**
-* Constant representing the module body
-* @property YAHOO.widget.Module.CSS_BODY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_BODY = "bd";
-
-/**
-* Constant representing the module footer
-* @property YAHOO.widget.Module.CSS_FOOTER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_FOOTER = "ft";
-
-/**
-* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size
-* @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
-
-YAHOO.widget.Module.prototype = {
-
- /**
- * The class's constructor function
- * @property contructor
- * @type Function
- */
- constructor : YAHOO.widget.Module,
-
- /**
- * The main module element that contains the header, body, and footer
- * @property element
- * @type HTMLElement
- */
- element : null,
-
- /**
- * The header element, denoted with CSS class "hd"
- * @property header
- * @type HTMLElement
- */
- header : null,
-
- /**
- * The body element, denoted with CSS class "bd"
- * @property body
- * @type HTMLElement
- */
- body : null,
-
- /**
- * The footer element, denoted with CSS class "ft"
- * @property footer
- * @type HTMLElement
- */
- footer : null,
-
- /**
- * The id of the element
- * @property id
- * @type String
- */
- id : null,
-
- /**
- * The String representing the image root
- * @property imageRoot
- * @type String
- */
- imageRoot : YAHOO.widget.Module.IMG_ROOT,
-
- /**
- * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
- * @method initEvents
- */
- initEvents : function() {
-
- /**
- * CustomEvent fired prior to class initalization.
- * @event beforeInitEvent
- * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
- */
- this.beforeInitEvent = new YAHOO.util.CustomEvent("beforeInit");
-
- /**
- * CustomEvent fired after class initalization.
- * @event initEvent
- * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
- */
- this.initEvent = new YAHOO.util.CustomEvent("init");
-
- /**
- * CustomEvent fired when the Module is appended to the DOM
- * @event appendEvent
- */
- this.appendEvent = new YAHOO.util.CustomEvent("append");
-
- /**
- * CustomEvent fired before the Module is rendered
- * @event beforeRenderEvent
- */
- this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
-
- /**
- * CustomEvent fired after the Module is rendered
- * @event renderEvent
- */
- this.renderEvent = new YAHOO.util.CustomEvent("render");
-
- /**
- * CustomEvent fired when the header content of the Module is modified
- * @event changeHeaderEvent
- * @param {String/HTMLElement} content String/element representing the new header content
- */
- this.changeHeaderEvent = new YAHOO.util.CustomEvent("changeHeader");
-
- /**
- * CustomEvent fired when the body content of the Module is modified
- * @event changeBodyEvent
- * @param {String/HTMLElement} content String/element representing the new body content
- */
- this.changeBodyEvent = new YAHOO.util.CustomEvent("changeBody");
-
- /**
- * CustomEvent fired when the footer content of the Module is modified
- * @event changeFooterEvent
- * @param {String/HTMLElement} content String/element representing the new footer content
- */
- this.changeFooterEvent = new YAHOO.util.CustomEvent("changeFooter");
-
- /**
- * CustomEvent fired when the content of the Module is modified
- * @event changeContentEvent
- */
- this.changeContentEvent = new YAHOO.util.CustomEvent("changeContent");
-
- /**
- * CustomEvent fired when the Module is destroyed
- * @event destroyEvent
- */
- this.destroyEvent = new YAHOO.util.CustomEvent("destroy");
-
- /**
- * CustomEvent fired before the Module is shown
- * @event beforeShowEvent
- */
- this.beforeShowEvent = new YAHOO.util.CustomEvent("beforeShow");
-
- /**
- * CustomEvent fired after the Module is shown
- * @event showEvent
- */
- this.showEvent = new YAHOO.util.CustomEvent("show");
-
- /**
- * CustomEvent fired before the Module is hidden
- * @event beforeHideEvent
- */
- this.beforeHideEvent = new YAHOO.util.CustomEvent("beforeHide");
-
- /**
- * CustomEvent fired after the Module is hidden
- * @event hideEvent
- */
- this.hideEvent = new YAHOO.util.CustomEvent("hide");
- },
-
- /**
- * String representing the current user-agent platform
- * @property platform
- * @type String
- */
- platform : function() {
- var ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {
- return "windows";
- } else if (ua.indexOf("macintosh") != -1) {
- return "mac";
- } else {
- return false;
- }
- }(),
-
- /**
- * String representing the current user-agent browser
- * @property browser
- * @type String
- */
- browser : function() {
- var ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
- return 'opera';
- } else if (ua.indexOf('msie 7')!=-1) { // IE7
- return 'ie7';
- } else if (ua.indexOf('msie') !=-1) { // IE
- return 'ie';
- } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
- return 'safari';
- } else if (ua.indexOf('gecko') != -1) { // Gecko
- return 'gecko';
- } else {
- return false;
- }
- }(),
-
- /**
- * Boolean representing whether or not the current browsing context is secure (https)
- * @property isSecure
- * @type Boolean
- */
- isSecure : function() {
- if (window.location.href.toLowerCase().indexOf("https") === 0) {
- return true;
- } else {
- return false;
- }
- }(),
-
- /**
- * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
- */
- initDefaultConfig : function() {
- // Add properties //
-
- /**
- * Specifies whether the Module is visible on the page.
- * @config visible
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );
-
- /**
- * Object or array of objects representing the ContainerEffect classes that are active for animating the container.
- * @config effect
- * @type Object
- * @default null
- */
- this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );
-
- /**
- * Specifies whether to create a special proxy iframe to monitor for user font resizing in the document
- * @config monitorresize
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );
- },
-
- /**
- * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
- * @method init
- * @param {String} el The element ID representing the Module OR
- * @param {HTMLElement} el The element representing the Module
- * @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
- */
- init : function(el, userConfig) {
-
- this.initEvents();
-
- this.beforeInitEvent.fire(YAHOO.widget.Module);
-
- /**
- * The Module's Config object used for monitoring configuration properties.
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- if (this.isSecure) {
- this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;
- }
-
- if (typeof el == "string") {
- var elId = el;
-
- el = document.getElementById(el);
- if (! el) {
- el = document.createElement("DIV");
- el.id = elId;
- }
- }
-
- this.element = el;
-
- if (el.id) {
- this.id = el.id;
- }
-
- var childNodes = this.element.childNodes;
-
- if (childNodes) {
- for (var i=0;iOR
- * @param {HTMLElement} headerContent The HTMLElement to append to the header
- */
- setHeader : function(headerContent) {
- if (! this.header) {
- this.header = document.createElement("DIV");
- this.header.className = YAHOO.widget.Module.CSS_HEADER;
- }
-
- if (typeof headerContent == "string") {
- this.header.innerHTML = headerContent;
- } else {
- this.header.innerHTML = "";
- this.header.appendChild(headerContent);
- }
-
- this.changeHeaderEvent.fire(headerContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the header. If no header is present, one will be automatically created.
- * @method appendToHeader
- * @param {HTMLElement} element The element to append to the header
- */
- appendToHeader : function(element) {
- if (! this.header) {
- this.header = document.createElement("DIV");
- this.header.className = YAHOO.widget.Module.CSS_HEADER;
- }
-
- this.header.appendChild(element);
- this.changeHeaderEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.
- * @method setBody
- * @param {String} bodyContent The HTML used to set the body OR
- * @param {HTMLElement} bodyContent The HTMLElement to append to the body
- */
- setBody : function(bodyContent) {
- if (! this.body) {
- this.body = document.createElement("DIV");
- this.body.className = YAHOO.widget.Module.CSS_BODY;
- }
-
- if (typeof bodyContent == "string")
- {
- this.body.innerHTML = bodyContent;
- } else {
- this.body.innerHTML = "";
- this.body.appendChild(bodyContent);
- }
-
- this.changeBodyEvent.fire(bodyContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the body. If no body is present, one will be automatically created.
- * @method appendToBody
- * @param {HTMLElement} element The element to append to the body
- */
- appendToBody : function(element) {
- if (! this.body) {
- this.body = document.createElement("DIV");
- this.body.className = YAHOO.widget.Module.CSS_BODY;
- }
-
- this.body.appendChild(element);
- this.changeBodyEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.
- * @method setFooter
- * @param {String} footerContent The HTML used to set the footer OR
- * @param {HTMLElement} footerContent The HTMLElement to append to the footer
- */
- setFooter : function(footerContent) {
- if (! this.footer) {
- this.footer = document.createElement("DIV");
- this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
- }
-
- if (typeof footerContent == "string") {
- this.footer.innerHTML = footerContent;
- } else {
- this.footer.innerHTML = "";
- this.footer.appendChild(footerContent);
- }
-
- this.changeFooterEvent.fire(footerContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the footer. If no footer is present, one will be automatically created.
- * @method appendToFooter
- * @param {HTMLElement} element The element to append to the footer
- */
- appendToFooter : function(element) {
- if (! this.footer) {
- this.footer = document.createElement("DIV");
- this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
- }
-
- this.footer.appendChild(element);
- this.changeFooterEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.
- * @method render
- * @param {String} appendToNode The element id to which the Module should be appended to prior to rendering OR
- * @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
- * @param {HTMLElement} moduleElement OPTIONAL. The element that represents the actual Standard Module container.
- * @return {Boolean} Success or failure of the render
- */
- render : function(appendToNode, moduleElement) {
- this.beforeRenderEvent.fire();
-
- if (! moduleElement) {
- moduleElement = this.element;
- }
-
- var me = this;
- var appendTo = function(element) {
- if (typeof element == "string") {
- element = document.getElementById(element);
- }
-
- if (element) {
- element.appendChild(me.element);
- me.appendEvent.fire();
- }
- };
-
- if (appendToNode) {
- appendTo(appendToNode);
- } else { // No node was passed in. If the element is not pre-marked up, this fails
- if (! YAHOO.util.Dom.inDocument(this.element)) {
- YAHOO.log("Render failed. Must specify appendTo node if Module isn't already in the DOM.", "error");
- return false;
- }
- }
-
- // Need to get everything into the DOM if it isn't already
-
- if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {
- // There is a header, but it's not in the DOM yet... need to add it
- var firstChild = moduleElement.firstChild;
- if (firstChild) { // Insert before first child if exists
- moduleElement.insertBefore(this.header, firstChild);
- } else { // Append to empty body because there are no children
- moduleElement.appendChild(this.header);
- }
- }
-
- if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {
- // There is a body, but it's not in the DOM yet... need to add it
- if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM
- moduleElement.insertBefore(this.body, this.footer);
- } else { // Append to element because there is no footer
- moduleElement.appendChild(this.body);
- }
- }
-
- if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {
- // There is a footer, but it's not in the DOM yet... need to add it
- moduleElement.appendChild(this.footer);
- }
-
- this.renderEvent.fire();
- return true;
- },
-
- /**
- * Removes the Module element from the DOM and sets all child elements to null.
- * @method destroy
- */
- destroy : function() {
- if (this.element) {
- var parent = this.element.parentNode;
- }
- if (parent) {
- parent.removeChild(this.element);
- }
-
- this.element = null;
- this.header = null;
- this.body = null;
- this.footer = null;
-
- this.destroyEvent.fire();
- },
-
- /**
- * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.
- * @method show
- */
- show : function() {
- this.cfg.setProperty("visible", true);
- },
-
- /**
- * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.
- * @method hide
- */
- hide : function() {
- this.cfg.setProperty("visible", false);
- },
-
- // BUILT-IN EVENT HANDLERS FOR MODULE //
-
- /**
- * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".
- * This method is responsible for firing showEvent and hideEvent.
- * @param {String} type The CustomEvent type (usually the property name)
- * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
- * @method configVisible
- */
- configVisible : function(type, args, obj) {
- var visible = args[0];
- if (visible) {
- this.beforeShowEvent.fire();
- YAHOO.util.Dom.setStyle(this.element, "display", "block");
- this.showEvent.fire();
- } else {
- this.beforeHideEvent.fire();
- YAHOO.util.Dom.setStyle(this.element, "display", "none");
- this.hideEvent.fire();
- }
- },
-
- /**
- * Default event handler for the "monitorresize" configuration property
- * @param {String} type The CustomEvent type (usually the property name)
- * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
- * @method configMonitorResize
- */
- configMonitorResize : function(type, args, obj) {
- var monitor = args[0];
- if (monitor) {
- this.initResizeMonitor();
- } else {
- YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);
- this.resizeMonitor = null;
- }
- }
-};
-
-/**
-* Returns a String representation of the Object.
-* @method toString
-* @return {String} The string representation of the Module
-*/
-YAHOO.widget.Module.prototype.toString = function() {
- return "Module " + this.id;
-};
-
-/**
-* Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.
-* @class Overlay
-* @namespace YAHOO.widget
-* @extends YAHOO.widget.Module
-* @param {String} el The element ID representing the Overlay OR
-* @param {HTMLElement} el The element representing the Overlay
-* @param {Object} userConfig The configuration object literal containing 10/23/2006the configuration that should be set for this Overlay. See configuration documentation for more details.
-* @constructor
-*/
-YAHOO.widget.Overlay = function(el, userConfig) {
- YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);
-
-/**
-* The URL that will be placed in the iframe
-* @property YAHOO.widget.Overlay.IFRAME_SRC
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"
-
-/**
-* Constant representing the top left corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.TOP_LEFT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.TOP_LEFT = "tl";
-
-/**
-* Constant representing the top right corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.TOP_RIGHT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.TOP_RIGHT = "tr";
-
-/**
-* Constant representing the top bottom left corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.BOTTOM_LEFT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";
-
-/**
-* Constant representing the bottom right corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.BOTTOM_RIGHT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";
-
-/**
-* Constant representing the default CSS class used for an Overlay
-* @property YAHOO.widget.Overlay.CSS_OVERLAY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";
-
-/**
-* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
-* @method init
-* @param {String} el The element ID representing the Overlay OR
-* @param {HTMLElement} el The element representing the Overlay
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
-*/
-YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {
- YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
-
- this.beforeInitEvent.fire(YAHOO.widget.Overlay);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- if (this.platform == "mac" && this.browser == "gecko") {
- if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {
- this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);
- }
- if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {
- this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);
- }
- }
-
- this.initEvent.fire(YAHOO.widget.Overlay);
-
-};
-
-/**
-* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.
-* @method initEvents
-*/
-YAHOO.widget.Overlay.prototype.initEvents = function() {
- YAHOO.widget.Overlay.superclass.initEvents.call(this);
-
- /**
- * CustomEvent fired before the Overlay is moved.
- * @event beforeMoveEvent
- * @param {Number} x x coordinate
- * @param {Number} y y coordinate
- */
- this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);
-
- /**
- * CustomEvent fired after the Overlay is moved.
- * @event moveEvent
- * @param {Number} x x coordinate
- * @param {Number} y y coordinate
- */
- this.moveEvent = new YAHOO.util.CustomEvent("move", this);
-};
-
-/**
-* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
-* @method initDefaultConfig
-*/
-YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {
- YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);
-
- // Add overlay config properties //
-
- /**
- * The absolute x-coordinate position of the Overlay
- * @config x
- * @type Number
- * @default null
- */
- this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * The absolute y-coordinate position of the Overlay
- * @config y
- * @type Number
- * @default null
- */
- this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * An array with the absolute x and y positions of the Overlay
- * @config xy
- * @type Number[]
- * @default null
- */
- this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * The array of context arguments for context-sensitive positioning. The format is: [id or element, element corner, context corner]. For example, setting this property to ["img1", "tl", "bl"] would align the Overlay's top left corner to the context element's bottom left corner.
- * @config context
- * @type Array
- * @default null
- */
- this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * True if the Overlay should be anchored to the center of the viewport.
- * @config fixedcenter
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );
-
- /**
- * CSS width of the Overlay.
- * @config width
- * @type String
- * @default null
- */
- this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * CSS height of the Overlay.
- * @config height
- * @type String
- * @default null
- */
- this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * CSS z-index of the Overlay.
- * @config zIndex
- * @type Number
- * @default null
- */
- this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );
-
- /**
- * True if the Overlay should be prevented from being positioned out of the viewport.
- * @config constraintoviewport
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );
-
- /**
- * True if the Overlay should have an IFRAME shim (for correcting the select z-index bug in IE6 and below).
- * @config iframe
- * @type Boolean
- * @default true for IE6 and below, false for all others
- */
- this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );
-};
-
-/**
-* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);
-* @method moveTo
-* @param {Number} x The Overlay's new x position
-* @param {Number} y The Overlay's new y position
-*/
-YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {
- this.cfg.setProperty("xy",[x,y]);
-};
-
-/**
-* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
-* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
-* @method hideMacGeckoScrollbars
-*/
-YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {
- YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");
- YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");
-};
-
-/**
-* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
-* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
-* @method showMacGeckoScrollbars
-*/
-YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {
- YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");
- YAHOO.util.Dom.addClass(this.element, "show-scrollbars");
-};
-
-// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.
-* @method configVisible
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {
- var visible = args[0];
- var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");
-
- if (currentVis == "inherit") {
- var e = this.element.parentNode;
- while (e.nodeType != 9 && e.nodeType != 11) {
- currentVis = YAHOO.util.Dom.getStyle(e, "visibility");
- if (currentVis != "inherit") { break; }
- e = e.parentNode;
- }
- if (currentVis == "inherit") {
- currentVis = "visible";
- }
- }
-
- var effect = this.cfg.getProperty("effect");
-
- var effectInstances = [];
- if (effect) {
- if (effect instanceof Array) {
- for (var i=0;i rightConstraint) {
- x = rightConstraint;
- }
-
- if (y < topConstraint) {
- y = topConstraint;
- } else if (y > bottomConstraint) {
- y = bottomConstraint;
- }
-
- this.cfg.setProperty("x", x, true);
- this.cfg.setProperty("y", y, true);
- this.cfg.setProperty("xy", [x,y], true);
-};
-
-/**
-* Centers the container in the viewport.
-* @method center
-*/
-YAHOO.widget.Overlay.prototype.center = function() {
- var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
- var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
-
- var viewPortWidth = YAHOO.util.Dom.getClientWidth();
- var viewPortHeight = YAHOO.util.Dom.getClientHeight();
-
- var elementWidth = this.element.offsetWidth;
- var elementHeight = this.element.offsetHeight;
-
- var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;
- var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;
-
- this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
-
- this.cfg.refireEvent("iframe");
-};
-
-/**
-* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.
-* @method syncPosition
-*/
-YAHOO.widget.Overlay.prototype.syncPosition = function() {
- var pos = YAHOO.util.Dom.getXY(this.element);
- this.cfg.setProperty("x", pos[0], true);
- this.cfg.setProperty("y", pos[1], true);
- this.cfg.setProperty("xy", pos, true);
-};
-
-/**
-* Event handler fired when the resize monitor element is resized.
-* @method onDomResize
-* @param {DOMEvent} e The resize DOM event
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {
- YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);
- var me = this;
- setTimeout(function() {
- me.syncPosition();
- me.cfg.refireEvent("iframe");
- me.cfg.refireEvent("context");
- }, 0);
-};
-
-/**
-* Removes the Overlay element from the DOM and sets all child elements to null.
-* @method destroy
-*/
-YAHOO.widget.Overlay.prototype.destroy = function() {
- if (this.iframe) {
- this.iframe.parentNode.removeChild(this.iframe);
- }
-
- this.iframe = null;
-
- YAHOO.widget.Overlay.superclass.destroy.call(this);
-};
-
-/**
-* Returns a String representation of the object.
-* @method toString
-* @return {String} The string representation of the Overlay.
-*/
-YAHOO.widget.Overlay.prototype.toString = function() {
- return "Overlay " + this.id;
-};
-
-/**
-* A singleton CustomEvent used for reacting to the DOM event for window scroll
-* @event YAHOO.widget.Overlay.windowScrollEvent
-*/
-YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");
-
-/**
-* A singleton CustomEvent used for reacting to the DOM event for window resize
-* @event YAHOO.widget.Overlay.windowResizeEvent
-*/
-YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");
-
-/**
-* The DOM event handler used to fire the CustomEvent for window scroll
-* @method YAHOO.widget.Overlay.windowScrollHandler
-* @static
-* @param {DOMEvent} e The DOM scroll event
-*/
-YAHOO.widget.Overlay.windowScrollHandler = function(e) {
- if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
- if (! window.scrollEnd) {
- window.scrollEnd = -1;
- }
- clearTimeout(window.scrollEnd);
- window.scrollEnd = setTimeout(function() { YAHOO.widget.Overlay.windowScrollEvent.fire(); }, 1);
- } else {
- YAHOO.widget.Overlay.windowScrollEvent.fire();
- }
-};
-
-/**
-* The DOM event handler used to fire the CustomEvent for window resize
-* @method YAHOO.widget.Overlay.windowResizeHandler
-* @static
-* @param {DOMEvent} e The DOM resize event
-*/
-YAHOO.widget.Overlay.windowResizeHandler = function(e) {
- if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
- if (! window.resizeEnd) {
- window.resizeEnd = -1;
- }
- clearTimeout(window.resizeEnd);
- window.resizeEnd = setTimeout(function() { YAHOO.widget.Overlay.windowResizeEvent.fire(); }, 100);
- } else {
- YAHOO.widget.Overlay.windowResizeEvent.fire();
- }
-};
-
-/**
-* A boolean that indicated whether the window resize and scroll events have already been subscribed to.
-* @property YAHOO.widget.Overlay._initialized
-* @private
-* @type Boolean
-*/
-YAHOO.widget.Overlay._initialized = null;
-
-if (YAHOO.widget.Overlay._initialized === null) {
- YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);
- YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);
-
- YAHOO.widget.Overlay._initialized = true;
-}
-
-/**
-* OverlayManager is used for maintaining the focus status of multiple Overlays.* @namespace YAHOO.widget
-* @namespace YAHOO.widget
-* @class OverlayManager
-* @constructor
-* @param {Array} overlays Optional. A collection of Overlays to register with the manager.
-* @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
-*/
-YAHOO.widget.OverlayManager = function(userConfig) {
- this.init(userConfig);
-};
-
-/**
-* The CSS class representing a focused Overlay
-* @property YAHOO.widget.OverlayManager.CSS_FOCUSED
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";
-
-YAHOO.widget.OverlayManager.prototype = {
- /**
- * The class's constructor function
- * @property contructor
- * @type Function
- */
- constructor : YAHOO.widget.OverlayManager,
-
- /**
- * The array of Overlays that are currently registered
- * @property overlays
- * @type YAHOO.widget.Overlay[]
- */
- overlays : null,
-
- /**
- * Initializes the default configuration of the OverlayManager
- * @method initDefaultConfig
- */
- initDefaultConfig : function() {
- /**
- * The collection of registered Overlays in use by the OverlayManager
- * @config overlays
- * @type YAHOO.widget.Overlay[]
- * @default null
- */
- this.cfg.addProperty("overlays", { suppressEvent:true } );
-
- /**
- * The default DOM event that should be used to focus an Overlay
- * @config focusevent
- * @type String
- * @default "mousedown"
- */
- this.cfg.addProperty("focusevent", { value:"mousedown" } );
- },
-
- /**
- * Initializes the OverlayManager
- * @method init
- * @param {YAHOO.widget.Overlay[]} overlays Optional. A collection of Overlays to register with the manager.
- * @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
- */
- init : function(userConfig) {
- /**
- * The OverlayManager's Config object used for monitoring configuration properties.
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- this.initDefaultConfig();
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
- this.cfg.fireQueue();
-
- /**
- * The currently activated Overlay
- * @property activeOverlay
- * @private
- * @type YAHOO.widget.Overlay
- */
- var activeOverlay = null;
-
- /**
- * Returns the currently focused Overlay
- * @method getActive
- * @return {YAHOO.widget.Overlay} The currently focused Overlay
- */
- this.getActive = function() {
- return activeOverlay;
- };
-
- /**
- * Focuses the specified Overlay
- * @method focus
- * @param {YAHOO.widget.Overlay} overlay The Overlay to focus
- * @param {String} overlay The id of the Overlay to focus
- */
- this.focus = function(overlay) {
- var o = this.find(overlay);
- if (o) {
- this.blurAll();
- activeOverlay = o;
- YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);
- this.overlays.sort(this.compareZIndexDesc);
- var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");
- if (! isNaN(topZIndex) && this.overlays[0] != overlay) {
- activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex, 10) + 2));
- }
- this.overlays.sort(this.compareZIndexDesc);
- }
- };
-
- /**
- * Removes the specified Overlay from the manager
- * @method remove
- * @param {YAHOO.widget.Overlay} overlay The Overlay to remove
- * @param {String} overlay The id of the Overlay to remove
- */
- this.remove = function(overlay) {
- var o = this.find(overlay);
- if (o) {
- var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");
- o.cfg.setProperty("zIndex", -1000, true);
- this.overlays.sort(this.compareZIndexDesc);
- this.overlays = this.overlays.slice(0, this.overlays.length-1);
- o.cfg.setProperty("zIndex", originalZ, true);
-
- o.cfg.setProperty("manager", null);
- o.focusEvent = null;
- o.blurEvent = null;
- o.focus = null;
- o.blur = null;
- }
- };
-
- /**
- * Removes focus from all registered Overlays in the manager
- * @method blurAll
- */
- this.blurAll = function() {
- activeOverlay = null;
- for (var o=0;o 0) {
- return true;
- }
- } else {
- return false;
- }
- },
-
- /**
- * Attempts to locate an Overlay by instance or ID.
- * @method find
- * @param {YAHOO.widget.Overlay} overlay An Overlay to locate within the manager
- * @param {String} overlay An Overlay id to locate within the manager
- * @return {YAHOO.widget.Overlay} The requested Overlay, if found, or null if it cannot be located.
- */
- find : function(overlay) {
- if (overlay instanceof YAHOO.widget.Overlay) {
- for (var o=0;o zIndex2) {
- return -1;
- } else if (zIndex1 < zIndex2) {
- return 1;
- } else {
- return 0;
- }
- },
-
- /**
- * Shows all Overlays in the manager.
- * @method showAll
- */
- showAll : function() {
- for (var o=0;oOR
-* @param {HTMLElement} el The element representing the Tooltip
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
-*/
-YAHOO.widget.Tooltip = function(el, userConfig) {
- YAHOO.widget.Tooltip.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.Tooltip, YAHOO.widget.Overlay);
-
-/**
-* Constant representing the Tooltip CSS class
-* @property YAHOO.widget.Tooltip.CSS_TOOLTIP
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Tooltip.CSS_TOOLTIP = "tt";
-
-/**
-* The Tooltip initialization method. This method is automatically called by the constructor. A Tooltip is automatically rendered by the init method, and it also is set to be invisible by default, and constrained to viewport by default as well.
-* @method init
-* @param {String} el The element ID representing the Tooltip OR
-* @param {HTMLElement} el The element representing the Tooltip
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Tooltip. See configuration documentation for more details.
-*/
-YAHOO.widget.Tooltip.prototype.init = function(el, userConfig) {
- this.logger = YAHOO.widget.Tooltip.logger;
-
- if (document.readyState && document.readyState != "complete") {
- var deferredInit = function() {
- this.init(el, userConfig);
- };
- YAHOO.util.Event.addListener(window, "load", deferredInit, this, true);
- } else {
- YAHOO.widget.Tooltip.superclass.init.call(this, el);
-
- this.beforeInitEvent.fire(YAHOO.widget.Tooltip);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Tooltip.CSS_TOOLTIP);
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- this.cfg.queueProperty("visible",false);
- this.cfg.queueProperty("constraintoviewport",true);
-
- this.setBody("");
- this.render(this.cfg.getProperty("container"));
-
- this.initEvent.fire(YAHOO.widget.Tooltip);
- }
-};
-
-/**
-* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
-* @method initDefaultConfig
-*/
-YAHOO.widget.Tooltip.prototype.initDefaultConfig = function() {
- YAHOO.widget.Tooltip.superclass.initDefaultConfig.call(this);
-
- /**
- * Specifies whether the Tooltip should be kept from overlapping its context element.
- * @config preventoverlap
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("preventoverlap", { value:true, validator:this.cfg.checkBoolean, supercedes:["x","y","xy"] } );
-
- /**
- * The number of milliseconds to wait before showing a Tooltip on mouseover.
- * @config showdelay
- * @type Number
- * @default 200
- */
- this.cfg.addProperty("showdelay", { value:200, handler:this.configShowDelay, validator:this.cfg.checkNumber } );
-
- /**
- * The number of milliseconds to wait before automatically dismissing a Tooltip after the mouse has been resting on the context element.
- * @config autodismissdelay
- * @type Number
- * @default 5000
- */
- this.cfg.addProperty("autodismissdelay", { value:5000, handler:this.configAutoDismissDelay, validator:this.cfg.checkNumber } );
-
- /**
- * The number of milliseconds to wait before hiding a Tooltip on mouseover.
- * @config hidedelay
- * @type Number
- * @default 250
- */
- this.cfg.addProperty("hidedelay", { value:250, handler:this.configHideDelay, validator:this.cfg.checkNumber } );
-
- /**
- * Specifies the Tooltip's text.
- * @config text
- * @type String
- * @default null
- */
- this.cfg.addProperty("text", { handler:this.configText, suppressEvent:true } );
-
- /**
- * Specifies the container element that the Tooltip's markup should be rendered into.
- * @config container
- * @type HTMLElement/String
- * @default document.body
- */
- this.cfg.addProperty("container", { value:document.body, handler:this.configContainer } );
-
- /**
- * Specifies the element or elements that the Tooltip should be anchored to on mouseover.
- * @config context
- * @type HTMLElement[]/String[]
- * @default null
- */
-
-};
-
-// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* The default event handler fired when the "text" property is changed.
-* @method configText
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Tooltip.prototype.configText = function(type, args, obj) {
- var text = args[0];
- if (text) {
- this.setBody(text);
- }
-};
-
-/**
-* The default event handler fired when the "container" property is changed.
-* @method configContainer
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Tooltip.prototype.configContainer = function(type, args, obj) {
- var container = args[0];
- if (typeof container == 'string') {
- this.cfg.setProperty("container", document.getElementById(container), true);
- }
-};
-
-/**
-* The default event handler fired when the "context" property is changed.
-* @method configContext
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Tooltip.prototype.configContext = function(type, args, obj) {
- var context = args[0];
- if (context) {
-
- // Normalize parameter into an array
- if (! (context instanceof Array)) {
- if (typeof context == "string") {
- this.cfg.setProperty("context", [document.getElementById(context)], true);
- } else { // Assuming this is an element
- this.cfg.setProperty("context", [context], true);
- }
- context = this.cfg.getProperty("context");
- }
-
-
- // Remove any existing mouseover/mouseout listeners
- if (this._context) {
- for (var c=0;cOR
-* @param {HTMLElement} el The element representing the Panel
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Panel. See configuration documentation for more details.
-*/
-YAHOO.widget.Panel = function(el, userConfig) {
- YAHOO.widget.Panel.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.Panel, YAHOO.widget.Overlay);
-
-/**
-* Constant representing the default CSS class used for a Panel
-* @property YAHOO.widget.Panel.CSS_PANEL
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Panel.CSS_PANEL = "panel";
-
-/**
-* Constant representing the default CSS class used for a Panel's wrapping container
-* @property YAHOO.widget.Panel.CSS_PANEL_CONTAINER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Panel.CSS_PANEL_CONTAINER = "panel-container";
-
-/**
-* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
-* @method init
-* @param {String} el The element ID representing the Overlay OR
-* @param {HTMLElement} el The element representing the Overlay
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
-*/
-YAHOO.widget.Panel.prototype.init = function(el, userConfig) {
- YAHOO.widget.Panel.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
-
- this.beforeInitEvent.fire(YAHOO.widget.Panel);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Panel.CSS_PANEL);
-
- this.buildWrapper();
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- this.beforeRenderEvent.subscribe(function() {
- var draggable = this.cfg.getProperty("draggable");
- if (draggable) {
- if (! this.header) {
- this.setHeader(" ");
- }
- }
- }, this, true);
-
- var me = this;
-
- this.showMaskEvent.subscribe(function() {
- var checkFocusable = function(el) {
- if (el.tagName == "A" || el.tagName == "BUTTON" || el.tagName == "SELECT" || el.tagName == "INPUT" || el.tagName == "TEXTAREA" || el.tagName == "FORM") {
- if (! YAHOO.util.Dom.isAncestor(me.element, el)) {
- YAHOO.util.Event.addListener(el, "focus", el.blur);
- return true;
- }
- } else {
- return false;
- }
- };
-
- this.focusableElements = YAHOO.util.Dom.getElementsBy(checkFocusable);
- }, this, true);
-
- this.hideMaskEvent.subscribe(function() {
- for (var i=0;iOR
-* @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
-* @return {boolean} Success or failure of the render
-*/
-YAHOO.widget.Panel.prototype.render = function(appendToNode) {
- return YAHOO.widget.Panel.superclass.render.call(this, appendToNode, this.innerElement);
-};
-
-/**
-* Returns a String representation of the object.
-* @method toString
-* @return {String} The string representation of the Panel.
-*/
-YAHOO.widget.Panel.prototype.toString = function() {
- return "Panel " + this.id;
-};
-
-/**
-* Dialog is an implementation of Panel that can be used to submit form data. Built-in functionality for buttons with event handlers is included, and button sets can be build dynamically, or the preincluded ones for Submit/Cancel and OK/Cancel can be utilized. Forms can be processed in 3 ways -- via an asynchronous Connection utility call, a simple form POST or GET, or manually.
-* @namespace YAHOO.widget
-* @class Dialog
-* @extends YAHOO.widget.Panel
-* @constructor
-* @param {String} el The element ID representing the Dialog OR
-* @param {HTMLElement} el The element representing the Dialog
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.
-*/
-YAHOO.widget.Dialog = function(el, userConfig) {
- YAHOO.widget.Dialog.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.Dialog, YAHOO.widget.Panel);
-
-/**
-* Constant representing the default CSS class used for a Dialog
-* @property YAHOO.widget.Dialog.CSS_DIALOG
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Dialog.CSS_DIALOG = "dialog";
-
-/**
-* Initializes the class's configurable properties which can be changed using the Dialog's Config object (cfg).
-* @method initDefaultConfig
-*/
-YAHOO.widget.Dialog.prototype.initDefaultConfig = function() {
- YAHOO.widget.Dialog.superclass.initDefaultConfig.call(this);
-
- /**
- * The internally maintained callback object for use with the Connection utility
- * @property callback
- * @type Object
- */
- this.callback = {
- /**
- * The function to execute upon success of the Connection submission
- * @property callback.success
- * @type Function
- */
- success : null,
- /**
- * The function to execute upon failure of the Connection submission
- * @property callback.failure
- * @type Function
- */
- failure : null,
- /**
- * The arbitraty argument or arguments to pass to the Connection callback functions
- * @property callback.argument
- * @type Object
- */
- argument: null
- };
-
- // Add form dialog config properties //
-
- /**
- * The method to use for posting the Dialog's form. Possible values are "async", "form", and "manual".
- * @config postmethod
- * @type String
- * @default async
- */
- this.cfg.addProperty("postmethod", { value:"async", validator:function(val) {
- if (val != "form" && val != "async" && val != "none" && val != "manual") {
- return false;
- } else {
- return true;
- }
- } });
-
- /**
- * Object literal(s) defining the buttons for the Dialog's footer.
- * @config buttons
- * @type Object[]
- * @default "none"
- */
- this.cfg.addProperty("buttons", { value:"none", handler:this.configButtons } );
-};
-
-/**
-* Initializes the custom events for Dialog which are fired automatically at appropriate times by the Dialog class.
-* @method initEvents
-*/
-YAHOO.widget.Dialog.prototype.initEvents = function() {
- YAHOO.widget.Dialog.superclass.initEvents.call(this);
-
- /**
- * CustomEvent fired prior to submission
- * @event beforeSumitEvent
- */
- this.beforeSubmitEvent = new YAHOO.util.CustomEvent("beforeSubmit");
-
- /**
- * CustomEvent fired after submission
- * @event submitEvent
- */
- this.submitEvent = new YAHOO.util.CustomEvent("submit");
-
- /**
- * CustomEvent fired prior to manual submission
- * @event manualSubmitEvent
- */
- this.manualSubmitEvent = new YAHOO.util.CustomEvent("manualSubmit");
-
- /**
- * CustomEvent fired prior to asynchronous submission
- * @event asyncSubmitEvent
- */
- this.asyncSubmitEvent = new YAHOO.util.CustomEvent("asyncSubmit");
-
- /**
- * CustomEvent fired prior to form-based submission
- * @event formSubmitEvent
- */
- this.formSubmitEvent = new YAHOO.util.CustomEvent("formSubmit");
-
- /**
- * CustomEvent fired after cancel
- * @event cancelEvent
- */
- this.cancelEvent = new YAHOO.util.CustomEvent("cancel");
-};
-
-/**
-* The Dialog initialization method, which is executed for Dialog and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
-* @method init
-* @param {String} el The element ID representing the Dialog OR
-* @param {HTMLElement} el The element representing the Dialog
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.
-*/
-YAHOO.widget.Dialog.prototype.init = function(el, userConfig) {
- YAHOO.widget.Dialog.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
-
- this.beforeInitEvent.fire(YAHOO.widget.Dialog);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Dialog.CSS_DIALOG);
-
- this.cfg.setProperty("visible", false);
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- this.renderEvent.subscribe(this.registerForm, this, true);
-
- this.showEvent.subscribe(this.focusFirst, this, true);
- this.beforeHideEvent.subscribe(this.blurButtons, this, true);
-
- this.beforeRenderEvent.subscribe(function() {
- var buttonCfg = this.cfg.getProperty("buttons");
- if (buttonCfg && buttonCfg != "none") {
- if (! this.footer) {
- this.setFooter("");
- }
- }
- }, this, true);
-
- this.initEvent.fire(YAHOO.widget.Dialog);
-};
-
-/**
-* Performs the submission of the Dialog form depending on the value of "postmethod" property.
-* @method doSubmit
-*/
-YAHOO.widget.Dialog.prototype.doSubmit = function() {
- var pm = this.cfg.getProperty("postmethod");
- switch (pm) {
- case "async":
- var method = this.form.getAttribute("method") || 'POST';
- method = method.toUpperCase();
- YAHOO.util.Connect.setForm(this.form);
- var cObj = YAHOO.util.Connect.asyncRequest(method, this.form.getAttribute("action"), this.callback);
- this.asyncSubmitEvent.fire();
- break;
- case "form":
- this.form.submit();
- this.formSubmitEvent.fire();
- break;
- case "none":
- case "manual":
- this.manualSubmitEvent.fire();
- break;
- }
-};
-
-/**
-* Prepares the Dialog's internal FORM object, creating one if one is not currently present.
-* @method registerForm
-*/
-YAHOO.widget.Dialog.prototype.registerForm = function() {
- var form = this.element.getElementsByTagName("FORM")[0];
-
- if (! form) {
- var formHTML = "";
- this.body.innerHTML += formHTML;
- form = this.element.getElementsByTagName("FORM")[0];
- }
-
- this.firstFormElement = function() {
- for (var f=0;f=0;f-- ) {
- var el = form.elements[f];
- if (el.focus) {
- if (el.type && el.type != "hidden") {
- return el;
- }
- }
- }
- return null;
- }();
-
- this.form = form;
-
- if (this.cfg.getProperty("modal") && this.form) {
-
- var me = this;
-
- var firstElement = this.firstFormElement || this.firstButton;
- if (firstElement) {
- this.preventBackTab = new YAHOO.util.KeyListener(firstElement, { shift:true, keys:9 }, {fn:me.focusLast, scope:me, correctScope:true} );
- this.showEvent.subscribe(this.preventBackTab.enable, this.preventBackTab, true);
- this.hideEvent.subscribe(this.preventBackTab.disable, this.preventBackTab, true);
- }
-
- var lastElement = this.lastButton || this.lastFormElement;
- if (lastElement) {
- this.preventTabOut = new YAHOO.util.KeyListener(lastElement, { shift:false, keys:9 }, {fn:me.focusFirst, scope:me, correctScope:true} );
- this.showEvent.subscribe(this.preventTabOut.enable, this.preventTabOut, true);
- this.hideEvent.subscribe(this.preventTabOut.disable, this.preventTabOut, true);
- }
- }
-};
-
-// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* The default event handler for the "buttons" configuration property
-* @method configButtons
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Dialog.prototype.configButtons = function(type, args, obj) {
- var buttons = args[0];
- if (buttons != "none") {
- this.buttonSpan = null;
- this.buttonSpan = document.createElement("SPAN");
- this.buttonSpan.className = "button-group";
-
- for (var b=0;bOR
-* @param {HTMLElement} el The element representing the SimpleDialog
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.
-*/
-YAHOO.widget.SimpleDialog = function(el, userConfig) {
- YAHOO.widget.SimpleDialog.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.SimpleDialog, YAHOO.widget.Dialog);
-
-/**
-* Constant for the standard network icon for a blocking action
-* @property YAHOO.widget.SimpleDialog.ICON_BLOCK
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_BLOCK = "nt/ic/ut/bsc/blck16_1.gif";
-
-/**
-* Constant for the standard network icon for alarm
-* @property YAHOO.widget.SimpleDialog.ICON_ALARM
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_ALARM = "nt/ic/ut/bsc/alrt16_1.gif";
-
-/**
-* Constant for the standard network icon for help
-* @property YAHOO.widget.SimpleDialog.ICON_HELP
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_HELP = "nt/ic/ut/bsc/hlp16_1.gif";
-
-/**
-* Constant for the standard network icon for info
-* @property YAHOO.widget.SimpleDialog.ICON_INFO
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_INFO = "nt/ic/ut/bsc/info16_1.gif";
-
-/**
-* Constant for the standard network icon for warn
-* @property YAHOO.widget.SimpleDialog.ICON_WARN
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_WARN = "nt/ic/ut/bsc/warn16_1.gif";
-
-/**
-* Constant for the standard network icon for a tip
-* @property YAHOO.widget.SimpleDialog.ICON_TIP
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_TIP = "nt/ic/ut/bsc/tip16_1.gif";
-
-/**
-* Constant representing the default CSS class used for a SimpleDialog
-* @property YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG = "simple-dialog";
-
-/**
-* Initializes the class's configurable properties which can be changed using the SimpleDialog's Config object (cfg).
-* @method initDefaultConfig
-*/
-YAHOO.widget.SimpleDialog.prototype.initDefaultConfig = function() {
- YAHOO.widget.SimpleDialog.superclass.initDefaultConfig.call(this);
-
- // Add dialog config properties //
-
- /**
- * Sets the informational icon for the SimpleDialog
- * @config icon
- * @type String
- * @default "none"
- */
- this.cfg.addProperty("icon", { value:"none", handler:this.configIcon, suppressEvent:true } );
-
- /**
- * Sets the text for the SimpleDialog
- * @config text
- * @type String
- * @default ""
- */
- this.cfg.addProperty("text", { value:"", handler:this.configText, suppressEvent:true, supercedes:["icon"] } );
-};
-
-
-/**
-* The SimpleDialog initialization method, which is executed for SimpleDialog and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
-* @method init
-* @param {String} el The element ID representing the SimpleDialog OR
-* @param {HTMLElement} el The element representing the SimpleDialog
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.
-*/
-YAHOO.widget.SimpleDialog.prototype.init = function(el, userConfig) {
- YAHOO.widget.SimpleDialog.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
-
- this.beforeInitEvent.fire(YAHOO.widget.SimpleDialog);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG);
-
- this.cfg.queueProperty("postmethod", "manual");
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- this.beforeRenderEvent.subscribe(function() {
- if (! this.body) {
- this.setBody("");
- }
- }, this, true);
-
- this.initEvent.fire(YAHOO.widget.SimpleDialog);
-
-};
-/**
-* Prepares the SimpleDialog's internal FORM object, creating one if one is not currently present, and adding the value hidden field.
-* @method registerForm
-*/
-YAHOO.widget.SimpleDialog.prototype.registerForm = function() {
- YAHOO.widget.SimpleDialog.superclass.registerForm.call(this);
- this.form.innerHTML += " ";
-};
-
-// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* Fired when the "icon" property is set.
-* @method configIcon
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.SimpleDialog.prototype.configIcon = function(type,args,obj) {
- var icon = args[0];
- if (icon && icon != "none") {
- var iconHTML = " ";
- this.body.innerHTML = iconHTML + this.body.innerHTML;
- }
-};
-
-/**
-* Fired when the "text" property is set.
-* @method configText
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.SimpleDialog.prototype.configText = function(type,args,obj) {
- var text = args[0];
- if (text) {
- this.setBody(text);
- this.cfg.refireEvent("icon");
- }
-};
-// END BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* Returns a string representation of the object.
-* @method toString
-* @return {String} The string representation of the SimpleDialog
-*/
-YAHOO.widget.SimpleDialog.prototype.toString = function() {
- return "SimpleDialog " + this.id;
-};
-
-/**
-* ContainerEffect encapsulates animation transitions that are executed when an Overlay is shown or hidden.
-* @namespace YAHOO.widget
-* @class ContainerEffect
-* @constructor
-* @param {YAHOO.widget.Overlay} overlay The Overlay that the animation should be associated with
-* @param {Object} attrIn The object literal representing the animation arguments to be used for the animate-in transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(Number), and method(i.e. YAHOO.util.Easing.easeIn).
-* @param {Object} attrOut The object literal representing the animation arguments to be used for the animate-out transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(Number), and method(i.e. YAHOO.util.Easing.easeIn).
-* @param {HTMLElement} targetElement Optional. The target element that should be animated during the transition. Defaults to overlay.element.
-* @param {class} Optional. The animation class to instantiate. Defaults to YAHOO.util.Anim. Other options include YAHOO.util.Motion.
-*/
-YAHOO.widget.ContainerEffect = function(overlay, attrIn, attrOut, targetElement, animClass) {
- if (! animClass) {
- animClass = YAHOO.util.Anim;
- }
-
- /**
- * The overlay to animate
- * @property overlay
- * @type YAHOO.widget.Overlay
- */
- this.overlay = overlay;
- /**
- * The animation attributes to use when transitioning into view
- * @property attrIn
- * @type Object
- */
- this.attrIn = attrIn;
- /**
- * The animation attributes to use when transitioning out of view
- * @property attrOut
- * @type Object
- */
- this.attrOut = attrOut;
- /**
- * The target element to be animated
- * @property targetElement
- * @type HTMLElement
- */
- this.targetElement = targetElement || overlay.element;
- /**
- * The animation class to use for animating the overlay
- * @property animClass
- * @type class
- */
- this.animClass = animClass;
-};
-
-/**
-* Initializes the animation classes and events.
-* @method init
-*/
-YAHOO.widget.ContainerEffect.prototype.init = function() {
- this.beforeAnimateInEvent = new YAHOO.util.CustomEvent("beforeAnimateIn");
- this.beforeAnimateOutEvent = new YAHOO.util.CustomEvent("beforeAnimateOut");
-
- this.animateInCompleteEvent = new YAHOO.util.CustomEvent("animateInComplete");
- this.animateOutCompleteEvent = new YAHOO.util.CustomEvent("animateOutComplete");
-
- this.animIn = new this.animClass(this.targetElement, this.attrIn.attributes, this.attrIn.duration, this.attrIn.method);
- this.animIn.onStart.subscribe(this.handleStartAnimateIn, this);
- this.animIn.onTween.subscribe(this.handleTweenAnimateIn, this);
- this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn, this);
-
- this.animOut = new this.animClass(this.targetElement, this.attrOut.attributes, this.attrOut.duration, this.attrOut.method);
- this.animOut.onStart.subscribe(this.handleStartAnimateOut, this);
- this.animOut.onTween.subscribe(this.handleTweenAnimateOut, this);
- this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut, this);
-};
-
-/**
-* Triggers the in-animation.
-* @method animateIn
-*/
-YAHOO.widget.ContainerEffect.prototype.animateIn = function() {
- this.beforeAnimateInEvent.fire();
- this.animIn.animate();
-};
-
-/**
-* Triggers the out-animation.
-* @method animateOut
-*/
-YAHOO.widget.ContainerEffect.prototype.animateOut = function() {
- this.beforeAnimateOutEvent.fire();
- this.animOut.animate();
-};
-
-/**
-* The default onStart handler for the in-animation.
-* @method handleStartAnimateIn
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn = function(type, args, obj) { };
-/**
-* The default onTween handler for the in-animation.
-* @method handleTweenAnimateIn
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn = function(type, args, obj) { };
-/**
-* The default onComplete handler for the in-animation.
-* @method handleCompleteAnimateIn
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn = function(type, args, obj) { };
-
-/**
-* The default onStart handler for the out-animation.
-* @method handleStartAnimateOut
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut = function(type, args, obj) { };
-/**
-* The default onTween handler for the out-animation.
-* @method handleTweenAnimateOut
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut = function(type, args, obj) { };
-/**
-* The default onComplete handler for the out-animation.
-* @method handleCompleteAnimateOut
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut = function(type, args, obj) { };
-
-/**
-* Returns a string representation of the object.
-* @method toString
-* @return {String} The string representation of the ContainerEffect
-*/
-YAHOO.widget.ContainerEffect.prototype.toString = function() {
- var output = "ContainerEffect";
- if (this.overlay) {
- output += " [" + this.overlay.toString() + "]";
- }
- return output;
-};
-
-/**
-* A pre-configured ContainerEffect instance that can be used for fading an overlay in and out.
-* @method FADE
-* @static
-* @param {Overlay} The Overlay object to animate
-* @param {Number} The duration of the animation
-* @return {ContainerEffect} The configured ContainerEffect object
-*/
-YAHOO.widget.ContainerEffect.FADE = function(overlay, dur) {
- var fade = new YAHOO.widget.ContainerEffect(overlay, { attributes:{opacity: {from:0, to:1}}, duration:dur, method:YAHOO.util.Easing.easeIn }, { attributes:{opacity: {to:0}}, duration:dur, method:YAHOO.util.Easing.easeOut}, overlay.element );
-
- fade.handleStartAnimateIn = function(type,args,obj) {
- YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");
-
- if (! obj.overlay.underlay) {
- obj.overlay.cfg.refireEvent("underlay");
- }
-
- if (obj.overlay.underlay) {
- obj.initialUnderlayOpacity = YAHOO.util.Dom.getStyle(obj.overlay.underlay, "opacity");
- obj.overlay.underlay.style.filter = null;
- }
-
- YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");
- YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 0);
- };
-
- fade.handleCompleteAnimateIn = function(type,args,obj) {
- YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");
-
- if (obj.overlay.element.style.filter) {
- obj.overlay.element.style.filter = null;
- }
-
- if (obj.overlay.underlay) {
- YAHOO.util.Dom.setStyle(obj.overlay.underlay, "opacity", obj.initialUnderlayOpacity);
- }
-
- obj.overlay.cfg.refireEvent("iframe");
- obj.animateInCompleteEvent.fire();
- };
-
- fade.handleStartAnimateOut = function(type, args, obj) {
- YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");
-
- if (obj.overlay.underlay) {
- obj.overlay.underlay.style.filter = null;
- }
- };
-
- fade.handleCompleteAnimateOut = function(type, args, obj) {
- YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");
- if (obj.overlay.element.style.filter) {
- obj.overlay.element.style.filter = null;
- }
- YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");
- YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 1);
-
- obj.overlay.cfg.refireEvent("iframe");
-
- obj.animateOutCompleteEvent.fire();
- };
-
- fade.init();
- return fade;
-};
-
-
-/**
-* A pre-configured ContainerEffect instance that can be used for sliding an overlay in and out.
-* @method SLIDE
-* @static
-* @param {Overlay} The Overlay object to animate
-* @param {Number} The duration of the animation
-* @return {ContainerEffect} The configured ContainerEffect object
-*/
-YAHOO.widget.ContainerEffect.SLIDE = function(overlay, dur) {
- var x = overlay.cfg.getProperty("x") || YAHOO.util.Dom.getX(overlay.element);
- var y = overlay.cfg.getProperty("y") || YAHOO.util.Dom.getY(overlay.element);
-
- var clientWidth = YAHOO.util.Dom.getClientWidth();
- var offsetWidth = overlay.element.offsetWidth;
-
- var slide = new YAHOO.widget.ContainerEffect(overlay, {
- attributes:{ points: { to:[x, y] } },
- duration:dur,
- method:YAHOO.util.Easing.easeIn
- },
- {
- attributes:{ points: { to:[(clientWidth+25), y] } },
- duration:dur,
- method:YAHOO.util.Easing.easeOut
- },
- overlay.element,
- YAHOO.util.Motion);
-
-
- slide.handleStartAnimateIn = function(type,args,obj) {
- obj.overlay.element.style.left = (-25-offsetWidth) + "px";
- obj.overlay.element.style.top = y + "px";
- };
-
- slide.handleTweenAnimateIn = function(type, args, obj) {
-
-
- var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
-
- var currentX = pos[0];
- var currentY = pos[1];
-
- if (YAHOO.util.Dom.getStyle(obj.overlay.element, "visibility") == "hidden" && currentX < x) {
- YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");
- }
-
- obj.overlay.cfg.setProperty("xy", [currentX,currentY], true);
- obj.overlay.cfg.refireEvent("iframe");
- };
-
- slide.handleCompleteAnimateIn = function(type, args, obj) {
- obj.overlay.cfg.setProperty("xy", [x,y], true);
- obj.startX = x;
- obj.startY = y;
- obj.overlay.cfg.refireEvent("iframe");
- obj.animateInCompleteEvent.fire();
- };
-
- slide.handleStartAnimateOut = function(type, args, obj) {
- var vw = YAHOO.util.Dom.getViewportWidth();
-
- var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
-
- var yso = pos[1];
-
- var currentTo = obj.animOut.attributes.points.to;
- obj.animOut.attributes.points.to = [(vw+25), yso];
- };
-
- slide.handleTweenAnimateOut = function(type, args, obj) {
- var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
-
- var xto = pos[0];
- var yto = pos[1];
-
- obj.overlay.cfg.setProperty("xy", [xto,yto], true);
- obj.overlay.cfg.refireEvent("iframe");
- };
-
- slide.handleCompleteAnimateOut = function(type, args, obj) {
- YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");
-
- obj.overlay.cfg.setProperty("xy", [x,y]);
- obj.animateOutCompleteEvent.fire();
- };
-
- slide.init();
- return slide;
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+* Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.
+* @class YAHOO.util.Config
+* @constructor
+* @param {Object} owner The owner Object to which this Config Object belongs
+*/
+YAHOO.util.Config = function(owner) {
+ if (owner) {
+ this.init(owner);
+ } else {
+ YAHOO.log("No owner specified for Config object", "error");
+ }
+};
+
+YAHOO.util.Config.prototype = {
+
+ /**
+ * Object reference to the owner of this Config Object
+ * @property owner
+ * @type Object
+ */
+ owner : null,
+
+ /**
+ * Boolean flag that specifies whether a queue is currently being executed
+ * @property queueInProgress
+ * @type Boolean
+ */
+ queueInProgress : false,
+
+
+ /**
+ * Validates that the value passed in is a Boolean.
+ * @method checkBoolean
+ * @param {Object} val The value to validate
+ * @return {Boolean} true, if the value is valid
+ */
+ checkBoolean: function(val) {
+ if (typeof val == 'boolean') {
+ return true;
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Validates that the value passed in is a number.
+ * @method checkNumber
+ * @param {Object} val The value to validate
+ * @return {Boolean} true, if the value is valid
+ */
+ checkNumber: function(val) {
+ if (isNaN(val)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+};
+
+
+/**
+* Initializes the configuration Object and all of its local members.
+* @method init
+* @param {Object} owner The owner Object to which this Config Object belongs
+*/
+YAHOO.util.Config.prototype.init = function(owner) {
+
+ this.owner = owner;
+
+ /**
+ * Object reference to the owner of this Config Object
+ * @event configChangedEvent
+ */
+ this.configChangedEvent = new YAHOO.util.CustomEvent("configChanged");
+ this.queueInProgress = false;
+
+ /* Private Members */
+
+ /**
+ * Maintains the local collection of configuration property objects and their specified values
+ * @property config
+ * @private
+ * @type Object
+ */
+ var config = {};
+
+ /**
+ * Maintains the local collection of configuration property objects as they were initially applied.
+ * This object is used when resetting a property.
+ * @property initialConfig
+ * @private
+ * @type Object
+ */
+ var initialConfig = {};
+
+ /**
+ * Maintains the local, normalized CustomEvent queue
+ * @property eventQueue
+ * @private
+ * @type Object
+ */
+ var eventQueue = [];
+
+ /**
+ * Fires a configuration property event using the specified value.
+ * @method fireEvent
+ * @private
+ * @param {String} key The configuration property's name
+ * @param {value} Object The value of the correct type for the property
+ */
+ var fireEvent = function( key, value ) {
+ YAHOO.log("Firing Config event: " + key + "=" + value, "info");
+
+ key = key.toLowerCase();
+
+ var property = config[key];
+
+ if (typeof property != 'undefined' && property.event) {
+ property.event.fire(value);
+ }
+ };
+ /* End Private Members */
+
+ /**
+ * Adds a property to the Config Object's private config hash.
+ * @method addProperty
+ * @param {String} key The configuration property's name
+ * @param {Object} propertyObject The Object containing all of this property's arguments
+ */
+ this.addProperty = function( key, propertyObject ) {
+ key = key.toLowerCase();
+
+ YAHOO.log("Added property: " + key, "info");
+
+ config[key] = propertyObject;
+
+ propertyObject.event = new YAHOO.util.CustomEvent(key);
+ propertyObject.key = key;
+
+ if (propertyObject.handler) {
+ propertyObject.event.subscribe(propertyObject.handler, this.owner, true);
+ }
+
+ this.setProperty(key, propertyObject.value, true);
+
+ if (! propertyObject.suppressEvent) {
+ this.queueProperty(key, propertyObject.value);
+ }
+ };
+
+ /**
+ * Returns a key-value configuration map of the values currently set in the Config Object.
+ * @method getConfig
+ * @return {Object} The current config, represented in a key-value map
+ */
+ this.getConfig = function() {
+ var cfg = {};
+
+ for (var prop in config) {
+ var property = config[prop];
+ if (typeof property != 'undefined' && property.event) {
+ cfg[prop] = property.value;
+ }
+ }
+
+ return cfg;
+ };
+
+ /**
+ * Returns the value of specified property.
+ * @method getProperty
+ * @param {String} key The name of the property
+ * @return {Object} The value of the specified property
+ */
+ this.getProperty = function(key) {
+ key = key.toLowerCase();
+
+ var property = config[key];
+ if (typeof property != 'undefined' && property.event) {
+ return property.value;
+ } else {
+ return undefined;
+ }
+ };
+
+ /**
+ * Resets the specified property's value to its initial value.
+ * @method resetProperty
+ * @param {String} key The name of the property
+ * @return {Boolean} True is the property was reset, false if not
+ */
+ this.resetProperty = function(key) {
+ key = key.toLowerCase();
+
+ var property = config[key];
+ if (typeof property != 'undefined' && property.event) {
+ if (initialConfig[key] && initialConfig[key] != 'undefined') {
+ this.setProperty(key, initialConfig[key]);
+ }
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ /**
+ * Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.
+ * @method setProperty
+ * @param {String} key The name of the property
+ * @param {String} value The value to set the property to
+ * @param {Boolean} silent Whether the value should be set silently, without firing the property event.
+ * @return {Boolean} True, if the set was successful, false if it failed.
+ */
+ this.setProperty = function(key, value, silent) {
+ key = key.toLowerCase();
+
+ YAHOO.log("setProperty: " + key + "=" + value, "info");
+
+ if (this.queueInProgress && ! silent) {
+ this.queueProperty(key,value); // Currently running through a queue...
+ return true;
+ } else {
+ var property = config[key];
+ if (typeof property != 'undefined' && property.event) {
+ if (property.validator && ! property.validator(value)) { // validator
+ return false;
+ } else {
+ property.value = value;
+ if (! silent) {
+ fireEvent(key, value);
+ this.configChangedEvent.fire([key, value]);
+ }
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+ };
+
+ /**
+ * Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is
+ * moved from its current position to the end of the queue.
+ * @method queueProperty
+ * @param {String} key The name of the property
+ * @param {String} value The value to set the property to
+ * @return {Boolean} true, if the set was successful, false if it failed.
+ */
+ this.queueProperty = function(key, value) {
+ key = key.toLowerCase();
+
+ YAHOO.log("queueProperty: " + key + "=" + value, "info");
+
+ var property = config[key];
+
+ if (typeof property != 'undefined' && property.event) {
+ if (typeof value != 'undefined' && property.validator && ! property.validator(value)) { // validator
+ return false;
+ } else {
+
+ if (typeof value != 'undefined') {
+ property.value = value;
+ } else {
+ value = property.value;
+ }
+
+ var foundDuplicate = false;
+
+ for (var i=0;iOR
+* @param {HTMLElement} el The element representing the Module
+* @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
+*/
+YAHOO.widget.Module = function(el, userConfig) {
+ if (el) {
+ this.init(el, userConfig);
+ } else {
+ YAHOO.log("No element or element ID specified for Module instantiation", "error");
+ }
+};
+
+/**
+* Constant representing the prefix path to use for non-secure images
+* @property YAHOO.widget.Module.IMG_ROOT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";
+
+/**
+* Constant representing the prefix path to use for securely served images
+* @property YAHOO.widget.Module.IMG_ROOT_SSL
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";
+
+/**
+* Constant for the default CSS class name that represents a Module
+* @property YAHOO.widget.Module.CSS_MODULE
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_MODULE = "module";
+
+/**
+* Constant representing the module header
+* @property YAHOO.widget.Module.CSS_HEADER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_HEADER = "hd";
+
+/**
+* Constant representing the module body
+* @property YAHOO.widget.Module.CSS_BODY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_BODY = "bd";
+
+/**
+* Constant representing the module footer
+* @property YAHOO.widget.Module.CSS_FOOTER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_FOOTER = "ft";
+
+/**
+* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size
+* @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
+
+YAHOO.widget.Module.prototype = {
+
+ /**
+ * The class's constructor function
+ * @property contructor
+ * @type Function
+ */
+ constructor : YAHOO.widget.Module,
+
+ /**
+ * The main module element that contains the header, body, and footer
+ * @property element
+ * @type HTMLElement
+ */
+ element : null,
+
+ /**
+ * The header element, denoted with CSS class "hd"
+ * @property header
+ * @type HTMLElement
+ */
+ header : null,
+
+ /**
+ * The body element, denoted with CSS class "bd"
+ * @property body
+ * @type HTMLElement
+ */
+ body : null,
+
+ /**
+ * The footer element, denoted with CSS class "ft"
+ * @property footer
+ * @type HTMLElement
+ */
+ footer : null,
+
+ /**
+ * The id of the element
+ * @property id
+ * @type String
+ */
+ id : null,
+
+ /**
+ * The String representing the image root
+ * @property imageRoot
+ * @type String
+ */
+ imageRoot : YAHOO.widget.Module.IMG_ROOT,
+
+ /**
+ * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
+ * @method initEvents
+ */
+ initEvents : function() {
+
+ /**
+ * CustomEvent fired prior to class initalization.
+ * @event beforeInitEvent
+ * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
+ */
+ this.beforeInitEvent = new YAHOO.util.CustomEvent("beforeInit");
+
+ /**
+ * CustomEvent fired after class initalization.
+ * @event initEvent
+ * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
+ */
+ this.initEvent = new YAHOO.util.CustomEvent("init");
+
+ /**
+ * CustomEvent fired when the Module is appended to the DOM
+ * @event appendEvent
+ */
+ this.appendEvent = new YAHOO.util.CustomEvent("append");
+
+ /**
+ * CustomEvent fired before the Module is rendered
+ * @event beforeRenderEvent
+ */
+ this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
+
+ /**
+ * CustomEvent fired after the Module is rendered
+ * @event renderEvent
+ */
+ this.renderEvent = new YAHOO.util.CustomEvent("render");
+
+ /**
+ * CustomEvent fired when the header content of the Module is modified
+ * @event changeHeaderEvent
+ * @param {String/HTMLElement} content String/element representing the new header content
+ */
+ this.changeHeaderEvent = new YAHOO.util.CustomEvent("changeHeader");
+
+ /**
+ * CustomEvent fired when the body content of the Module is modified
+ * @event changeBodyEvent
+ * @param {String/HTMLElement} content String/element representing the new body content
+ */
+ this.changeBodyEvent = new YAHOO.util.CustomEvent("changeBody");
+
+ /**
+ * CustomEvent fired when the footer content of the Module is modified
+ * @event changeFooterEvent
+ * @param {String/HTMLElement} content String/element representing the new footer content
+ */
+ this.changeFooterEvent = new YAHOO.util.CustomEvent("changeFooter");
+
+ /**
+ * CustomEvent fired when the content of the Module is modified
+ * @event changeContentEvent
+ */
+ this.changeContentEvent = new YAHOO.util.CustomEvent("changeContent");
+
+ /**
+ * CustomEvent fired when the Module is destroyed
+ * @event destroyEvent
+ */
+ this.destroyEvent = new YAHOO.util.CustomEvent("destroy");
+
+ /**
+ * CustomEvent fired before the Module is shown
+ * @event beforeShowEvent
+ */
+ this.beforeShowEvent = new YAHOO.util.CustomEvent("beforeShow");
+
+ /**
+ * CustomEvent fired after the Module is shown
+ * @event showEvent
+ */
+ this.showEvent = new YAHOO.util.CustomEvent("show");
+
+ /**
+ * CustomEvent fired before the Module is hidden
+ * @event beforeHideEvent
+ */
+ this.beforeHideEvent = new YAHOO.util.CustomEvent("beforeHide");
+
+ /**
+ * CustomEvent fired after the Module is hidden
+ * @event hideEvent
+ */
+ this.hideEvent = new YAHOO.util.CustomEvent("hide");
+ },
+
+ /**
+ * String representing the current user-agent platform
+ * @property platform
+ * @type String
+ */
+ platform : function() {
+ var ua = navigator.userAgent.toLowerCase();
+ if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {
+ return "windows";
+ } else if (ua.indexOf("macintosh") != -1) {
+ return "mac";
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * String representing the current user-agent browser
+ * @property browser
+ * @type String
+ */
+ browser : function() {
+ var ua = navigator.userAgent.toLowerCase();
+ if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
+ return 'opera';
+ } else if (ua.indexOf('msie 7')!=-1) { // IE7
+ return 'ie7';
+ } else if (ua.indexOf('msie') !=-1) { // IE
+ return 'ie';
+ } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
+ return 'safari';
+ } else if (ua.indexOf('gecko') != -1) { // Gecko
+ return 'gecko';
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * Boolean representing whether or not the current browsing context is secure (https)
+ * @property isSecure
+ * @type Boolean
+ */
+ isSecure : function() {
+ if (window.location.href.toLowerCase().indexOf("https") === 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
+ */
+ initDefaultConfig : function() {
+ // Add properties //
+
+ /**
+ * Specifies whether the Module is visible on the page.
+ * @config visible
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );
+
+ /**
+ * Object or array of objects representing the ContainerEffect classes that are active for animating the container.
+ * @config effect
+ * @type Object
+ * @default null
+ */
+ this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );
+
+ /**
+ * Specifies whether to create a special proxy iframe to monitor for user font resizing in the document
+ * @config monitorresize
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );
+ },
+
+ /**
+ * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+ * @method init
+ * @param {String} el The element ID representing the Module OR
+ * @param {HTMLElement} el The element representing the Module
+ * @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
+ */
+ init : function(el, userConfig) {
+
+ this.initEvents();
+
+ this.beforeInitEvent.fire(YAHOO.widget.Module);
+
+ /**
+ * The Module's Config object used for monitoring configuration properties.
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ if (this.isSecure) {
+ this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;
+ }
+
+ if (typeof el == "string") {
+ var elId = el;
+
+ el = document.getElementById(el);
+ if (! el) {
+ el = document.createElement("DIV");
+ el.id = elId;
+ }
+ }
+
+ this.element = el;
+
+ if (el.id) {
+ this.id = el.id;
+ }
+
+ var childNodes = this.element.childNodes;
+
+ if (childNodes) {
+ for (var i=0;iOR
+ * @param {HTMLElement} headerContent The HTMLElement to append to the header
+ */
+ setHeader : function(headerContent) {
+ if (! this.header) {
+ this.header = document.createElement("DIV");
+ this.header.className = YAHOO.widget.Module.CSS_HEADER;
+ }
+
+ if (typeof headerContent == "string") {
+ this.header.innerHTML = headerContent;
+ } else {
+ this.header.innerHTML = "";
+ this.header.appendChild(headerContent);
+ }
+
+ this.changeHeaderEvent.fire(headerContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the header. If no header is present, one will be automatically created.
+ * @method appendToHeader
+ * @param {HTMLElement} element The element to append to the header
+ */
+ appendToHeader : function(element) {
+ if (! this.header) {
+ this.header = document.createElement("DIV");
+ this.header.className = YAHOO.widget.Module.CSS_HEADER;
+ }
+
+ this.header.appendChild(element);
+ this.changeHeaderEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.
+ * @method setBody
+ * @param {String} bodyContent The HTML used to set the body OR
+ * @param {HTMLElement} bodyContent The HTMLElement to append to the body
+ */
+ setBody : function(bodyContent) {
+ if (! this.body) {
+ this.body = document.createElement("DIV");
+ this.body.className = YAHOO.widget.Module.CSS_BODY;
+ }
+
+ if (typeof bodyContent == "string")
+ {
+ this.body.innerHTML = bodyContent;
+ } else {
+ this.body.innerHTML = "";
+ this.body.appendChild(bodyContent);
+ }
+
+ this.changeBodyEvent.fire(bodyContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the body. If no body is present, one will be automatically created.
+ * @method appendToBody
+ * @param {HTMLElement} element The element to append to the body
+ */
+ appendToBody : function(element) {
+ if (! this.body) {
+ this.body = document.createElement("DIV");
+ this.body.className = YAHOO.widget.Module.CSS_BODY;
+ }
+
+ this.body.appendChild(element);
+ this.changeBodyEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.
+ * @method setFooter
+ * @param {String} footerContent The HTML used to set the footer OR
+ * @param {HTMLElement} footerContent The HTMLElement to append to the footer
+ */
+ setFooter : function(footerContent) {
+ if (! this.footer) {
+ this.footer = document.createElement("DIV");
+ this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
+ }
+
+ if (typeof footerContent == "string") {
+ this.footer.innerHTML = footerContent;
+ } else {
+ this.footer.innerHTML = "";
+ this.footer.appendChild(footerContent);
+ }
+
+ this.changeFooterEvent.fire(footerContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the footer. If no footer is present, one will be automatically created.
+ * @method appendToFooter
+ * @param {HTMLElement} element The element to append to the footer
+ */
+ appendToFooter : function(element) {
+ if (! this.footer) {
+ this.footer = document.createElement("DIV");
+ this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
+ }
+
+ this.footer.appendChild(element);
+ this.changeFooterEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.
+ * @method render
+ * @param {String} appendToNode The element id to which the Module should be appended to prior to rendering OR
+ * @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
+ * @param {HTMLElement} moduleElement OPTIONAL. The element that represents the actual Standard Module container.
+ * @return {Boolean} Success or failure of the render
+ */
+ render : function(appendToNode, moduleElement) {
+ this.beforeRenderEvent.fire();
+
+ if (! moduleElement) {
+ moduleElement = this.element;
+ }
+
+ var me = this;
+ var appendTo = function(element) {
+ if (typeof element == "string") {
+ element = document.getElementById(element);
+ }
+
+ if (element) {
+ element.appendChild(me.element);
+ me.appendEvent.fire();
+ }
+ };
+
+ if (appendToNode) {
+ appendTo(appendToNode);
+ } else { // No node was passed in. If the element is not pre-marked up, this fails
+ if (! YAHOO.util.Dom.inDocument(this.element)) {
+ YAHOO.log("Render failed. Must specify appendTo node if Module isn't already in the DOM.", "error");
+ return false;
+ }
+ }
+
+ // Need to get everything into the DOM if it isn't already
+
+ if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {
+ // There is a header, but it's not in the DOM yet... need to add it
+ var firstChild = moduleElement.firstChild;
+ if (firstChild) { // Insert before first child if exists
+ moduleElement.insertBefore(this.header, firstChild);
+ } else { // Append to empty body because there are no children
+ moduleElement.appendChild(this.header);
+ }
+ }
+
+ if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {
+ // There is a body, but it's not in the DOM yet... need to add it
+ if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM
+ moduleElement.insertBefore(this.body, this.footer);
+ } else { // Append to element because there is no footer
+ moduleElement.appendChild(this.body);
+ }
+ }
+
+ if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {
+ // There is a footer, but it's not in the DOM yet... need to add it
+ moduleElement.appendChild(this.footer);
+ }
+
+ this.renderEvent.fire();
+ return true;
+ },
+
+ /**
+ * Removes the Module element from the DOM and sets all child elements to null.
+ * @method destroy
+ */
+ destroy : function() {
+ if (this.element) {
+ var parent = this.element.parentNode;
+ }
+ if (parent) {
+ parent.removeChild(this.element);
+ }
+
+ this.element = null;
+ this.header = null;
+ this.body = null;
+ this.footer = null;
+
+ this.destroyEvent.fire();
+ },
+
+ /**
+ * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.
+ * @method show
+ */
+ show : function() {
+ this.cfg.setProperty("visible", true);
+ },
+
+ /**
+ * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.
+ * @method hide
+ */
+ hide : function() {
+ this.cfg.setProperty("visible", false);
+ },
+
+ // BUILT-IN EVENT HANDLERS FOR MODULE //
+
+ /**
+ * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".
+ * This method is responsible for firing showEvent and hideEvent.
+ * @param {String} type The CustomEvent type (usually the property name)
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+ * @method configVisible
+ */
+ configVisible : function(type, args, obj) {
+ var visible = args[0];
+ if (visible) {
+ this.beforeShowEvent.fire();
+ YAHOO.util.Dom.setStyle(this.element, "display", "block");
+ this.showEvent.fire();
+ } else {
+ this.beforeHideEvent.fire();
+ YAHOO.util.Dom.setStyle(this.element, "display", "none");
+ this.hideEvent.fire();
+ }
+ },
+
+ /**
+ * Default event handler for the "monitorresize" configuration property
+ * @param {String} type The CustomEvent type (usually the property name)
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+ * @method configMonitorResize
+ */
+ configMonitorResize : function(type, args, obj) {
+ var monitor = args[0];
+ if (monitor) {
+ this.initResizeMonitor();
+ } else {
+ YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);
+ this.resizeMonitor = null;
+ }
+ }
+};
+
+/**
+* Returns a String representation of the Object.
+* @method toString
+* @return {String} The string representation of the Module
+*/
+YAHOO.widget.Module.prototype.toString = function() {
+ return "Module " + this.id;
+};
+
+/**
+* Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.
+* @class Overlay
+* @namespace YAHOO.widget
+* @extends YAHOO.widget.Module
+* @param {String} el The element ID representing the Overlay OR
+* @param {HTMLElement} el The element representing the Overlay
+* @param {Object} userConfig The configuration object literal containing 10/23/2006the configuration that should be set for this Overlay. See configuration documentation for more details.
+* @constructor
+*/
+YAHOO.widget.Overlay = function(el, userConfig) {
+ YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);
+
+/**
+* The URL that will be placed in the iframe
+* @property YAHOO.widget.Overlay.IFRAME_SRC
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"
+
+/**
+* Constant representing the top left corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.TOP_LEFT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.TOP_LEFT = "tl";
+
+/**
+* Constant representing the top right corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.TOP_RIGHT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.TOP_RIGHT = "tr";
+
+/**
+* Constant representing the top bottom left corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.BOTTOM_LEFT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";
+
+/**
+* Constant representing the bottom right corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.BOTTOM_RIGHT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";
+
+/**
+* Constant representing the default CSS class used for an Overlay
+* @property YAHOO.widget.Overlay.CSS_OVERLAY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";
+
+/**
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+* @method init
+* @param {String} el The element ID representing the Overlay OR
+* @param {HTMLElement} el The element representing the Overlay
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
+*/
+YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {
+ YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
+
+ this.beforeInitEvent.fire(YAHOO.widget.Overlay);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ if (this.platform == "mac" && this.browser == "gecko") {
+ if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {
+ this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);
+ }
+ if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {
+ this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);
+ }
+ }
+
+ this.initEvent.fire(YAHOO.widget.Overlay);
+
+};
+
+/**
+* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.
+* @method initEvents
+*/
+YAHOO.widget.Overlay.prototype.initEvents = function() {
+ YAHOO.widget.Overlay.superclass.initEvents.call(this);
+
+ /**
+ * CustomEvent fired before the Overlay is moved.
+ * @event beforeMoveEvent
+ * @param {Number} x x coordinate
+ * @param {Number} y y coordinate
+ */
+ this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);
+
+ /**
+ * CustomEvent fired after the Overlay is moved.
+ * @event moveEvent
+ * @param {Number} x x coordinate
+ * @param {Number} y y coordinate
+ */
+ this.moveEvent = new YAHOO.util.CustomEvent("move", this);
+};
+
+/**
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
+* @method initDefaultConfig
+*/
+YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {
+ YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);
+
+ // Add overlay config properties //
+
+ /**
+ * The absolute x-coordinate position of the Overlay
+ * @config x
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * The absolute y-coordinate position of the Overlay
+ * @config y
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * An array with the absolute x and y positions of the Overlay
+ * @config xy
+ * @type Number[]
+ * @default null
+ */
+ this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * The array of context arguments for context-sensitive positioning. The format is: [id or element, element corner, context corner]. For example, setting this property to ["img1", "tl", "bl"] would align the Overlay's top left corner to the context element's bottom left corner.
+ * @config context
+ * @type Array
+ * @default null
+ */
+ this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * True if the Overlay should be anchored to the center of the viewport.
+ * @config fixedcenter
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );
+
+ /**
+ * CSS width of the Overlay.
+ * @config width
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * CSS height of the Overlay.
+ * @config height
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * CSS z-index of the Overlay.
+ * @config zIndex
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );
+
+ /**
+ * True if the Overlay should be prevented from being positioned out of the viewport.
+ * @config constraintoviewport
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );
+
+ /**
+ * True if the Overlay should have an IFRAME shim (for correcting the select z-index bug in IE6 and below).
+ * @config iframe
+ * @type Boolean
+ * @default true for IE6 and below, false for all others
+ */
+ this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );
+};
+
+/**
+* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);
+* @method moveTo
+* @param {Number} x The Overlay's new x position
+* @param {Number} y The Overlay's new y position
+*/
+YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {
+ this.cfg.setProperty("xy",[x,y]);
+};
+
+/**
+* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
+* @method hideMacGeckoScrollbars
+*/
+YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {
+ YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");
+ YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");
+};
+
+/**
+* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
+* @method showMacGeckoScrollbars
+*/
+YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {
+ YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");
+ YAHOO.util.Dom.addClass(this.element, "show-scrollbars");
+};
+
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.
+* @method configVisible
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {
+ var visible = args[0];
+ var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");
+
+ if (currentVis == "inherit") {
+ var e = this.element.parentNode;
+ while (e.nodeType != 9 && e.nodeType != 11) {
+ currentVis = YAHOO.util.Dom.getStyle(e, "visibility");
+ if (currentVis != "inherit") { break; }
+ e = e.parentNode;
+ }
+ if (currentVis == "inherit") {
+ currentVis = "visible";
+ }
+ }
+
+ var effect = this.cfg.getProperty("effect");
+
+ var effectInstances = [];
+ if (effect) {
+ if (effect instanceof Array) {
+ for (var i=0;i rightConstraint) {
+ x = rightConstraint;
+ }
+
+ if (y < topConstraint) {
+ y = topConstraint;
+ } else if (y > bottomConstraint) {
+ y = bottomConstraint;
+ }
+
+ this.cfg.setProperty("x", x, true);
+ this.cfg.setProperty("y", y, true);
+ this.cfg.setProperty("xy", [x,y], true);
+};
+
+/**
+* Centers the container in the viewport.
+* @method center
+*/
+YAHOO.widget.Overlay.prototype.center = function() {
+ var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+ var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+
+ var viewPortWidth = YAHOO.util.Dom.getClientWidth();
+ var viewPortHeight = YAHOO.util.Dom.getClientHeight();
+
+ var elementWidth = this.element.offsetWidth;
+ var elementHeight = this.element.offsetHeight;
+
+ var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;
+ var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;
+
+ this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
+
+ this.cfg.refireEvent("iframe");
+};
+
+/**
+* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.
+* @method syncPosition
+*/
+YAHOO.widget.Overlay.prototype.syncPosition = function() {
+ var pos = YAHOO.util.Dom.getXY(this.element);
+ this.cfg.setProperty("x", pos[0], true);
+ this.cfg.setProperty("y", pos[1], true);
+ this.cfg.setProperty("xy", pos, true);
+};
+
+/**
+* Event handler fired when the resize monitor element is resized.
+* @method onDomResize
+* @param {DOMEvent} e The resize DOM event
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {
+ YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);
+ var me = this;
+ setTimeout(function() {
+ me.syncPosition();
+ me.cfg.refireEvent("iframe");
+ me.cfg.refireEvent("context");
+ }, 0);
+};
+
+/**
+* Removes the Overlay element from the DOM and sets all child elements to null.
+* @method destroy
+*/
+YAHOO.widget.Overlay.prototype.destroy = function() {
+ if (this.iframe) {
+ this.iframe.parentNode.removeChild(this.iframe);
+ }
+
+ this.iframe = null;
+
+ YAHOO.widget.Overlay.superclass.destroy.call(this);
+};
+
+/**
+* Returns a String representation of the object.
+* @method toString
+* @return {String} The string representation of the Overlay.
+*/
+YAHOO.widget.Overlay.prototype.toString = function() {
+ return "Overlay " + this.id;
+};
+
+/**
+* A singleton CustomEvent used for reacting to the DOM event for window scroll
+* @event YAHOO.widget.Overlay.windowScrollEvent
+*/
+YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");
+
+/**
+* A singleton CustomEvent used for reacting to the DOM event for window resize
+* @event YAHOO.widget.Overlay.windowResizeEvent
+*/
+YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");
+
+/**
+* The DOM event handler used to fire the CustomEvent for window scroll
+* @method YAHOO.widget.Overlay.windowScrollHandler
+* @static
+* @param {DOMEvent} e The DOM scroll event
+*/
+YAHOO.widget.Overlay.windowScrollHandler = function(e) {
+ if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
+ if (! window.scrollEnd) {
+ window.scrollEnd = -1;
+ }
+ clearTimeout(window.scrollEnd);
+ window.scrollEnd = setTimeout(function() { YAHOO.widget.Overlay.windowScrollEvent.fire(); }, 1);
+ } else {
+ YAHOO.widget.Overlay.windowScrollEvent.fire();
+ }
+};
+
+/**
+* The DOM event handler used to fire the CustomEvent for window resize
+* @method YAHOO.widget.Overlay.windowResizeHandler
+* @static
+* @param {DOMEvent} e The DOM resize event
+*/
+YAHOO.widget.Overlay.windowResizeHandler = function(e) {
+ if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
+ if (! window.resizeEnd) {
+ window.resizeEnd = -1;
+ }
+ clearTimeout(window.resizeEnd);
+ window.resizeEnd = setTimeout(function() { YAHOO.widget.Overlay.windowResizeEvent.fire(); }, 100);
+ } else {
+ YAHOO.widget.Overlay.windowResizeEvent.fire();
+ }
+};
+
+/**
+* A boolean that indicated whether the window resize and scroll events have already been subscribed to.
+* @property YAHOO.widget.Overlay._initialized
+* @private
+* @type Boolean
+*/
+YAHOO.widget.Overlay._initialized = null;
+
+if (YAHOO.widget.Overlay._initialized === null) {
+ YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);
+ YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);
+
+ YAHOO.widget.Overlay._initialized = true;
+}
+
+/**
+* OverlayManager is used for maintaining the focus status of multiple Overlays.* @namespace YAHOO.widget
+* @namespace YAHOO.widget
+* @class OverlayManager
+* @constructor
+* @param {Array} overlays Optional. A collection of Overlays to register with the manager.
+* @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
+*/
+YAHOO.widget.OverlayManager = function(userConfig) {
+ this.init(userConfig);
+};
+
+/**
+* The CSS class representing a focused Overlay
+* @property YAHOO.widget.OverlayManager.CSS_FOCUSED
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";
+
+YAHOO.widget.OverlayManager.prototype = {
+ /**
+ * The class's constructor function
+ * @property contructor
+ * @type Function
+ */
+ constructor : YAHOO.widget.OverlayManager,
+
+ /**
+ * The array of Overlays that are currently registered
+ * @property overlays
+ * @type YAHOO.widget.Overlay[]
+ */
+ overlays : null,
+
+ /**
+ * Initializes the default configuration of the OverlayManager
+ * @method initDefaultConfig
+ */
+ initDefaultConfig : function() {
+ /**
+ * The collection of registered Overlays in use by the OverlayManager
+ * @config overlays
+ * @type YAHOO.widget.Overlay[]
+ * @default null
+ */
+ this.cfg.addProperty("overlays", { suppressEvent:true } );
+
+ /**
+ * The default DOM event that should be used to focus an Overlay
+ * @config focusevent
+ * @type String
+ * @default "mousedown"
+ */
+ this.cfg.addProperty("focusevent", { value:"mousedown" } );
+ },
+
+ /**
+ * Initializes the OverlayManager
+ * @method init
+ * @param {YAHOO.widget.Overlay[]} overlays Optional. A collection of Overlays to register with the manager.
+ * @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
+ */
+ init : function(userConfig) {
+ /**
+ * The OverlayManager's Config object used for monitoring configuration properties.
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ this.initDefaultConfig();
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+ this.cfg.fireQueue();
+
+ /**
+ * The currently activated Overlay
+ * @property activeOverlay
+ * @private
+ * @type YAHOO.widget.Overlay
+ */
+ var activeOverlay = null;
+
+ /**
+ * Returns the currently focused Overlay
+ * @method getActive
+ * @return {YAHOO.widget.Overlay} The currently focused Overlay
+ */
+ this.getActive = function() {
+ return activeOverlay;
+ };
+
+ /**
+ * Focuses the specified Overlay
+ * @method focus
+ * @param {YAHOO.widget.Overlay} overlay The Overlay to focus
+ * @param {String} overlay The id of the Overlay to focus
+ */
+ this.focus = function(overlay) {
+ var o = this.find(overlay);
+ if (o) {
+ this.blurAll();
+ activeOverlay = o;
+ YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);
+ this.overlays.sort(this.compareZIndexDesc);
+ var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");
+ if (! isNaN(topZIndex) && this.overlays[0] != overlay) {
+ activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex, 10) + 2));
+ }
+ this.overlays.sort(this.compareZIndexDesc);
+ }
+ };
+
+ /**
+ * Removes the specified Overlay from the manager
+ * @method remove
+ * @param {YAHOO.widget.Overlay} overlay The Overlay to remove
+ * @param {String} overlay The id of the Overlay to remove
+ */
+ this.remove = function(overlay) {
+ var o = this.find(overlay);
+ if (o) {
+ var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");
+ o.cfg.setProperty("zIndex", -1000, true);
+ this.overlays.sort(this.compareZIndexDesc);
+ this.overlays = this.overlays.slice(0, this.overlays.length-1);
+ o.cfg.setProperty("zIndex", originalZ, true);
+
+ o.cfg.setProperty("manager", null);
+ o.focusEvent = null;
+ o.blurEvent = null;
+ o.focus = null;
+ o.blur = null;
+ }
+ };
+
+ /**
+ * Removes focus from all registered Overlays in the manager
+ * @method blurAll
+ */
+ this.blurAll = function() {
+ activeOverlay = null;
+ for (var o=0;o 0) {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Attempts to locate an Overlay by instance or ID.
+ * @method find
+ * @param {YAHOO.widget.Overlay} overlay An Overlay to locate within the manager
+ * @param {String} overlay An Overlay id to locate within the manager
+ * @return {YAHOO.widget.Overlay} The requested Overlay, if found, or null if it cannot be located.
+ */
+ find : function(overlay) {
+ if (overlay instanceof YAHOO.widget.Overlay) {
+ for (var o=0;o zIndex2) {
+ return -1;
+ } else if (zIndex1 < zIndex2) {
+ return 1;
+ } else {
+ return 0;
+ }
+ },
+
+ /**
+ * Shows all Overlays in the manager.
+ * @method showAll
+ */
+ showAll : function() {
+ for (var o=0;oOR
+* @param {HTMLElement} el The element representing the Tooltip
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
+*/
+YAHOO.widget.Tooltip = function(el, userConfig) {
+ YAHOO.widget.Tooltip.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.Tooltip, YAHOO.widget.Overlay);
+
+/**
+* Constant representing the Tooltip CSS class
+* @property YAHOO.widget.Tooltip.CSS_TOOLTIP
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Tooltip.CSS_TOOLTIP = "tt";
+
+/**
+* The Tooltip initialization method. This method is automatically called by the constructor. A Tooltip is automatically rendered by the init method, and it also is set to be invisible by default, and constrained to viewport by default as well.
+* @method init
+* @param {String} el The element ID representing the Tooltip OR
+* @param {HTMLElement} el The element representing the Tooltip
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Tooltip. See configuration documentation for more details.
+*/
+YAHOO.widget.Tooltip.prototype.init = function(el, userConfig) {
+ this.logger = YAHOO.widget.Tooltip.logger;
+
+ if (document.readyState && document.readyState != "complete") {
+ var deferredInit = function() {
+ this.init(el, userConfig);
+ };
+ YAHOO.util.Event.addListener(window, "load", deferredInit, this, true);
+ } else {
+ YAHOO.widget.Tooltip.superclass.init.call(this, el);
+
+ this.beforeInitEvent.fire(YAHOO.widget.Tooltip);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Tooltip.CSS_TOOLTIP);
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ this.cfg.queueProperty("visible",false);
+ this.cfg.queueProperty("constraintoviewport",true);
+
+ this.setBody("");
+ this.render(this.cfg.getProperty("container"));
+
+ this.initEvent.fire(YAHOO.widget.Tooltip);
+ }
+};
+
+/**
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
+* @method initDefaultConfig
+*/
+YAHOO.widget.Tooltip.prototype.initDefaultConfig = function() {
+ YAHOO.widget.Tooltip.superclass.initDefaultConfig.call(this);
+
+ /**
+ * Specifies whether the Tooltip should be kept from overlapping its context element.
+ * @config preventoverlap
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("preventoverlap", { value:true, validator:this.cfg.checkBoolean, supercedes:["x","y","xy"] } );
+
+ /**
+ * The number of milliseconds to wait before showing a Tooltip on mouseover.
+ * @config showdelay
+ * @type Number
+ * @default 200
+ */
+ this.cfg.addProperty("showdelay", { value:200, handler:this.configShowDelay, validator:this.cfg.checkNumber } );
+
+ /**
+ * The number of milliseconds to wait before automatically dismissing a Tooltip after the mouse has been resting on the context element.
+ * @config autodismissdelay
+ * @type Number
+ * @default 5000
+ */
+ this.cfg.addProperty("autodismissdelay", { value:5000, handler:this.configAutoDismissDelay, validator:this.cfg.checkNumber } );
+
+ /**
+ * The number of milliseconds to wait before hiding a Tooltip on mouseover.
+ * @config hidedelay
+ * @type Number
+ * @default 250
+ */
+ this.cfg.addProperty("hidedelay", { value:250, handler:this.configHideDelay, validator:this.cfg.checkNumber } );
+
+ /**
+ * Specifies the Tooltip's text.
+ * @config text
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("text", { handler:this.configText, suppressEvent:true } );
+
+ /**
+ * Specifies the container element that the Tooltip's markup should be rendered into.
+ * @config container
+ * @type HTMLElement/String
+ * @default document.body
+ */
+ this.cfg.addProperty("container", { value:document.body, handler:this.configContainer } );
+
+ /**
+ * Specifies the element or elements that the Tooltip should be anchored to on mouseover.
+ * @config context
+ * @type HTMLElement[]/String[]
+ * @default null
+ */
+
+};
+
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* The default event handler fired when the "text" property is changed.
+* @method configText
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Tooltip.prototype.configText = function(type, args, obj) {
+ var text = args[0];
+ if (text) {
+ this.setBody(text);
+ }
+};
+
+/**
+* The default event handler fired when the "container" property is changed.
+* @method configContainer
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Tooltip.prototype.configContainer = function(type, args, obj) {
+ var container = args[0];
+ if (typeof container == 'string') {
+ this.cfg.setProperty("container", document.getElementById(container), true);
+ }
+};
+
+/**
+* The default event handler fired when the "context" property is changed.
+* @method configContext
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Tooltip.prototype.configContext = function(type, args, obj) {
+ var context = args[0];
+ if (context) {
+
+ // Normalize parameter into an array
+ if (! (context instanceof Array)) {
+ if (typeof context == "string") {
+ this.cfg.setProperty("context", [document.getElementById(context)], true);
+ } else { // Assuming this is an element
+ this.cfg.setProperty("context", [context], true);
+ }
+ context = this.cfg.getProperty("context");
+ }
+
+
+ // Remove any existing mouseover/mouseout listeners
+ if (this._context) {
+ for (var c=0;cOR
+* @param {HTMLElement} el The element representing the Panel
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Panel. See configuration documentation for more details.
+*/
+YAHOO.widget.Panel = function(el, userConfig) {
+ YAHOO.widget.Panel.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.Panel, YAHOO.widget.Overlay);
+
+/**
+* Constant representing the default CSS class used for a Panel
+* @property YAHOO.widget.Panel.CSS_PANEL
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Panel.CSS_PANEL = "panel";
+
+/**
+* Constant representing the default CSS class used for a Panel's wrapping container
+* @property YAHOO.widget.Panel.CSS_PANEL_CONTAINER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Panel.CSS_PANEL_CONTAINER = "panel-container";
+
+/**
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+* @method init
+* @param {String} el The element ID representing the Overlay OR
+* @param {HTMLElement} el The element representing the Overlay
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
+*/
+YAHOO.widget.Panel.prototype.init = function(el, userConfig) {
+ YAHOO.widget.Panel.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
+
+ this.beforeInitEvent.fire(YAHOO.widget.Panel);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Panel.CSS_PANEL);
+
+ this.buildWrapper();
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ this.beforeRenderEvent.subscribe(function() {
+ var draggable = this.cfg.getProperty("draggable");
+ if (draggable) {
+ if (! this.header) {
+ this.setHeader(" ");
+ }
+ }
+ }, this, true);
+
+ var me = this;
+
+ this.showMaskEvent.subscribe(function() {
+ var checkFocusable = function(el) {
+ if (el.tagName == "A" || el.tagName == "BUTTON" || el.tagName == "SELECT" || el.tagName == "INPUT" || el.tagName == "TEXTAREA" || el.tagName == "FORM") {
+ if (! YAHOO.util.Dom.isAncestor(me.element, el)) {
+ YAHOO.util.Event.addListener(el, "focus", el.blur);
+ return true;
+ }
+ } else {
+ return false;
+ }
+ };
+
+ this.focusableElements = YAHOO.util.Dom.getElementsBy(checkFocusable);
+ }, this, true);
+
+ this.hideMaskEvent.subscribe(function() {
+ for (var i=0;iOR
+* @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
+* @return {boolean} Success or failure of the render
+*/
+YAHOO.widget.Panel.prototype.render = function(appendToNode) {
+ return YAHOO.widget.Panel.superclass.render.call(this, appendToNode, this.innerElement);
+};
+
+/**
+* Returns a String representation of the object.
+* @method toString
+* @return {String} The string representation of the Panel.
+*/
+YAHOO.widget.Panel.prototype.toString = function() {
+ return "Panel " + this.id;
+};
+
+/**
+* Dialog is an implementation of Panel that can be used to submit form data. Built-in functionality for buttons with event handlers is included, and button sets can be build dynamically, or the preincluded ones for Submit/Cancel and OK/Cancel can be utilized. Forms can be processed in 3 ways -- via an asynchronous Connection utility call, a simple form POST or GET, or manually.
+* @namespace YAHOO.widget
+* @class Dialog
+* @extends YAHOO.widget.Panel
+* @constructor
+* @param {String} el The element ID representing the Dialog OR
+* @param {HTMLElement} el The element representing the Dialog
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.
+*/
+YAHOO.widget.Dialog = function(el, userConfig) {
+ YAHOO.widget.Dialog.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.Dialog, YAHOO.widget.Panel);
+
+/**
+* Constant representing the default CSS class used for a Dialog
+* @property YAHOO.widget.Dialog.CSS_DIALOG
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Dialog.CSS_DIALOG = "dialog";
+
+/**
+* Initializes the class's configurable properties which can be changed using the Dialog's Config object (cfg).
+* @method initDefaultConfig
+*/
+YAHOO.widget.Dialog.prototype.initDefaultConfig = function() {
+ YAHOO.widget.Dialog.superclass.initDefaultConfig.call(this);
+
+ /**
+ * The internally maintained callback object for use with the Connection utility
+ * @property callback
+ * @type Object
+ */
+ this.callback = {
+ /**
+ * The function to execute upon success of the Connection submission
+ * @property callback.success
+ * @type Function
+ */
+ success : null,
+ /**
+ * The function to execute upon failure of the Connection submission
+ * @property callback.failure
+ * @type Function
+ */
+ failure : null,
+ /**
+ * The arbitraty argument or arguments to pass to the Connection callback functions
+ * @property callback.argument
+ * @type Object
+ */
+ argument: null
+ };
+
+ // Add form dialog config properties //
+
+ /**
+ * The method to use for posting the Dialog's form. Possible values are "async", "form", and "manual".
+ * @config postmethod
+ * @type String
+ * @default async
+ */
+ this.cfg.addProperty("postmethod", { value:"async", validator:function(val) {
+ if (val != "form" && val != "async" && val != "none" && val != "manual") {
+ return false;
+ } else {
+ return true;
+ }
+ } });
+
+ /**
+ * Object literal(s) defining the buttons for the Dialog's footer.
+ * @config buttons
+ * @type Object[]
+ * @default "none"
+ */
+ this.cfg.addProperty("buttons", { value:"none", handler:this.configButtons } );
+};
+
+/**
+* Initializes the custom events for Dialog which are fired automatically at appropriate times by the Dialog class.
+* @method initEvents
+*/
+YAHOO.widget.Dialog.prototype.initEvents = function() {
+ YAHOO.widget.Dialog.superclass.initEvents.call(this);
+
+ /**
+ * CustomEvent fired prior to submission
+ * @event beforeSumitEvent
+ */
+ this.beforeSubmitEvent = new YAHOO.util.CustomEvent("beforeSubmit");
+
+ /**
+ * CustomEvent fired after submission
+ * @event submitEvent
+ */
+ this.submitEvent = new YAHOO.util.CustomEvent("submit");
+
+ /**
+ * CustomEvent fired prior to manual submission
+ * @event manualSubmitEvent
+ */
+ this.manualSubmitEvent = new YAHOO.util.CustomEvent("manualSubmit");
+
+ /**
+ * CustomEvent fired prior to asynchronous submission
+ * @event asyncSubmitEvent
+ */
+ this.asyncSubmitEvent = new YAHOO.util.CustomEvent("asyncSubmit");
+
+ /**
+ * CustomEvent fired prior to form-based submission
+ * @event formSubmitEvent
+ */
+ this.formSubmitEvent = new YAHOO.util.CustomEvent("formSubmit");
+
+ /**
+ * CustomEvent fired after cancel
+ * @event cancelEvent
+ */
+ this.cancelEvent = new YAHOO.util.CustomEvent("cancel");
+};
+
+/**
+* The Dialog initialization method, which is executed for Dialog and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+* @method init
+* @param {String} el The element ID representing the Dialog OR
+* @param {HTMLElement} el The element representing the Dialog
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.
+*/
+YAHOO.widget.Dialog.prototype.init = function(el, userConfig) {
+ YAHOO.widget.Dialog.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
+
+ this.beforeInitEvent.fire(YAHOO.widget.Dialog);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Dialog.CSS_DIALOG);
+
+ this.cfg.setProperty("visible", false);
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ this.renderEvent.subscribe(this.registerForm, this, true);
+
+ this.showEvent.subscribe(this.focusFirst, this, true);
+ this.beforeHideEvent.subscribe(this.blurButtons, this, true);
+
+ this.beforeRenderEvent.subscribe(function() {
+ var buttonCfg = this.cfg.getProperty("buttons");
+ if (buttonCfg && buttonCfg != "none") {
+ if (! this.footer) {
+ this.setFooter("");
+ }
+ }
+ }, this, true);
+
+ this.initEvent.fire(YAHOO.widget.Dialog);
+};
+
+/**
+* Performs the submission of the Dialog form depending on the value of "postmethod" property.
+* @method doSubmit
+*/
+YAHOO.widget.Dialog.prototype.doSubmit = function() {
+ var pm = this.cfg.getProperty("postmethod");
+ switch (pm) {
+ case "async":
+ var method = this.form.getAttribute("method") || 'POST';
+ method = method.toUpperCase();
+ YAHOO.util.Connect.setForm(this.form);
+ var cObj = YAHOO.util.Connect.asyncRequest(method, this.form.getAttribute("action"), this.callback);
+ this.asyncSubmitEvent.fire();
+ break;
+ case "form":
+ this.form.submit();
+ this.formSubmitEvent.fire();
+ break;
+ case "none":
+ case "manual":
+ this.manualSubmitEvent.fire();
+ break;
+ }
+};
+
+/**
+* Prepares the Dialog's internal FORM object, creating one if one is not currently present.
+* @method registerForm
+*/
+YAHOO.widget.Dialog.prototype.registerForm = function() {
+ var form = this.element.getElementsByTagName("FORM")[0];
+
+ if (! form) {
+ var formHTML = "";
+ this.body.innerHTML += formHTML;
+ form = this.element.getElementsByTagName("FORM")[0];
+ }
+
+ this.firstFormElement = function() {
+ for (var f=0;f=0;f-- ) {
+ var el = form.elements[f];
+ if (el.focus) {
+ if (el.type && el.type != "hidden") {
+ return el;
+ }
+ }
+ }
+ return null;
+ }();
+
+ this.form = form;
+
+ if (this.cfg.getProperty("modal") && this.form) {
+
+ var me = this;
+
+ var firstElement = this.firstFormElement || this.firstButton;
+ if (firstElement) {
+ this.preventBackTab = new YAHOO.util.KeyListener(firstElement, { shift:true, keys:9 }, {fn:me.focusLast, scope:me, correctScope:true} );
+ this.showEvent.subscribe(this.preventBackTab.enable, this.preventBackTab, true);
+ this.hideEvent.subscribe(this.preventBackTab.disable, this.preventBackTab, true);
+ }
+
+ var lastElement = this.lastButton || this.lastFormElement;
+ if (lastElement) {
+ this.preventTabOut = new YAHOO.util.KeyListener(lastElement, { shift:false, keys:9 }, {fn:me.focusFirst, scope:me, correctScope:true} );
+ this.showEvent.subscribe(this.preventTabOut.enable, this.preventTabOut, true);
+ this.hideEvent.subscribe(this.preventTabOut.disable, this.preventTabOut, true);
+ }
+ }
+};
+
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* The default event handler for the "buttons" configuration property
+* @method configButtons
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Dialog.prototype.configButtons = function(type, args, obj) {
+ var buttons = args[0];
+ if (buttons != "none") {
+ this.buttonSpan = null;
+ this.buttonSpan = document.createElement("SPAN");
+ this.buttonSpan.className = "button-group";
+
+ for (var b=0;bOR
+* @param {HTMLElement} el The element representing the SimpleDialog
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.
+*/
+YAHOO.widget.SimpleDialog = function(el, userConfig) {
+ YAHOO.widget.SimpleDialog.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.SimpleDialog, YAHOO.widget.Dialog);
+
+/**
+* Constant for the standard network icon for a blocking action
+* @property YAHOO.widget.SimpleDialog.ICON_BLOCK
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_BLOCK = "nt/ic/ut/bsc/blck16_1.gif";
+
+/**
+* Constant for the standard network icon for alarm
+* @property YAHOO.widget.SimpleDialog.ICON_ALARM
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_ALARM = "nt/ic/ut/bsc/alrt16_1.gif";
+
+/**
+* Constant for the standard network icon for help
+* @property YAHOO.widget.SimpleDialog.ICON_HELP
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_HELP = "nt/ic/ut/bsc/hlp16_1.gif";
+
+/**
+* Constant for the standard network icon for info
+* @property YAHOO.widget.SimpleDialog.ICON_INFO
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_INFO = "nt/ic/ut/bsc/info16_1.gif";
+
+/**
+* Constant for the standard network icon for warn
+* @property YAHOO.widget.SimpleDialog.ICON_WARN
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_WARN = "nt/ic/ut/bsc/warn16_1.gif";
+
+/**
+* Constant for the standard network icon for a tip
+* @property YAHOO.widget.SimpleDialog.ICON_TIP
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_TIP = "nt/ic/ut/bsc/tip16_1.gif";
+
+/**
+* Constant representing the default CSS class used for a SimpleDialog
+* @property YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG = "simple-dialog";
+
+/**
+* Initializes the class's configurable properties which can be changed using the SimpleDialog's Config object (cfg).
+* @method initDefaultConfig
+*/
+YAHOO.widget.SimpleDialog.prototype.initDefaultConfig = function() {
+ YAHOO.widget.SimpleDialog.superclass.initDefaultConfig.call(this);
+
+ // Add dialog config properties //
+
+ /**
+ * Sets the informational icon for the SimpleDialog
+ * @config icon
+ * @type String
+ * @default "none"
+ */
+ this.cfg.addProperty("icon", { value:"none", handler:this.configIcon, suppressEvent:true } );
+
+ /**
+ * Sets the text for the SimpleDialog
+ * @config text
+ * @type String
+ * @default ""
+ */
+ this.cfg.addProperty("text", { value:"", handler:this.configText, suppressEvent:true, supercedes:["icon"] } );
+};
+
+
+/**
+* The SimpleDialog initialization method, which is executed for SimpleDialog and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+* @method init
+* @param {String} el The element ID representing the SimpleDialog OR
+* @param {HTMLElement} el The element representing the SimpleDialog
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.
+*/
+YAHOO.widget.SimpleDialog.prototype.init = function(el, userConfig) {
+ YAHOO.widget.SimpleDialog.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
+
+ this.beforeInitEvent.fire(YAHOO.widget.SimpleDialog);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG);
+
+ this.cfg.queueProperty("postmethod", "manual");
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ this.beforeRenderEvent.subscribe(function() {
+ if (! this.body) {
+ this.setBody("");
+ }
+ }, this, true);
+
+ this.initEvent.fire(YAHOO.widget.SimpleDialog);
+
+};
+/**
+* Prepares the SimpleDialog's internal FORM object, creating one if one is not currently present, and adding the value hidden field.
+* @method registerForm
+*/
+YAHOO.widget.SimpleDialog.prototype.registerForm = function() {
+ YAHOO.widget.SimpleDialog.superclass.registerForm.call(this);
+ this.form.innerHTML += " ";
+};
+
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* Fired when the "icon" property is set.
+* @method configIcon
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.SimpleDialog.prototype.configIcon = function(type,args,obj) {
+ var icon = args[0];
+ if (icon && icon != "none") {
+ var iconHTML = " ";
+ this.body.innerHTML = iconHTML + this.body.innerHTML;
+ }
+};
+
+/**
+* Fired when the "text" property is set.
+* @method configText
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.SimpleDialog.prototype.configText = function(type,args,obj) {
+ var text = args[0];
+ if (text) {
+ this.setBody(text);
+ this.cfg.refireEvent("icon");
+ }
+};
+// END BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* Returns a string representation of the object.
+* @method toString
+* @return {String} The string representation of the SimpleDialog
+*/
+YAHOO.widget.SimpleDialog.prototype.toString = function() {
+ return "SimpleDialog " + this.id;
+};
+
+/**
+* ContainerEffect encapsulates animation transitions that are executed when an Overlay is shown or hidden.
+* @namespace YAHOO.widget
+* @class ContainerEffect
+* @constructor
+* @param {YAHOO.widget.Overlay} overlay The Overlay that the animation should be associated with
+* @param {Object} attrIn The object literal representing the animation arguments to be used for the animate-in transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(Number), and method(i.e. YAHOO.util.Easing.easeIn).
+* @param {Object} attrOut The object literal representing the animation arguments to be used for the animate-out transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(Number), and method(i.e. YAHOO.util.Easing.easeIn).
+* @param {HTMLElement} targetElement Optional. The target element that should be animated during the transition. Defaults to overlay.element.
+* @param {class} Optional. The animation class to instantiate. Defaults to YAHOO.util.Anim. Other options include YAHOO.util.Motion.
+*/
+YAHOO.widget.ContainerEffect = function(overlay, attrIn, attrOut, targetElement, animClass) {
+ if (! animClass) {
+ animClass = YAHOO.util.Anim;
+ }
+
+ /**
+ * The overlay to animate
+ * @property overlay
+ * @type YAHOO.widget.Overlay
+ */
+ this.overlay = overlay;
+ /**
+ * The animation attributes to use when transitioning into view
+ * @property attrIn
+ * @type Object
+ */
+ this.attrIn = attrIn;
+ /**
+ * The animation attributes to use when transitioning out of view
+ * @property attrOut
+ * @type Object
+ */
+ this.attrOut = attrOut;
+ /**
+ * The target element to be animated
+ * @property targetElement
+ * @type HTMLElement
+ */
+ this.targetElement = targetElement || overlay.element;
+ /**
+ * The animation class to use for animating the overlay
+ * @property animClass
+ * @type class
+ */
+ this.animClass = animClass;
+};
+
+/**
+* Initializes the animation classes and events.
+* @method init
+*/
+YAHOO.widget.ContainerEffect.prototype.init = function() {
+ this.beforeAnimateInEvent = new YAHOO.util.CustomEvent("beforeAnimateIn");
+ this.beforeAnimateOutEvent = new YAHOO.util.CustomEvent("beforeAnimateOut");
+
+ this.animateInCompleteEvent = new YAHOO.util.CustomEvent("animateInComplete");
+ this.animateOutCompleteEvent = new YAHOO.util.CustomEvent("animateOutComplete");
+
+ this.animIn = new this.animClass(this.targetElement, this.attrIn.attributes, this.attrIn.duration, this.attrIn.method);
+ this.animIn.onStart.subscribe(this.handleStartAnimateIn, this);
+ this.animIn.onTween.subscribe(this.handleTweenAnimateIn, this);
+ this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn, this);
+
+ this.animOut = new this.animClass(this.targetElement, this.attrOut.attributes, this.attrOut.duration, this.attrOut.method);
+ this.animOut.onStart.subscribe(this.handleStartAnimateOut, this);
+ this.animOut.onTween.subscribe(this.handleTweenAnimateOut, this);
+ this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut, this);
+};
+
+/**
+* Triggers the in-animation.
+* @method animateIn
+*/
+YAHOO.widget.ContainerEffect.prototype.animateIn = function() {
+ this.beforeAnimateInEvent.fire();
+ this.animIn.animate();
+};
+
+/**
+* Triggers the out-animation.
+* @method animateOut
+*/
+YAHOO.widget.ContainerEffect.prototype.animateOut = function() {
+ this.beforeAnimateOutEvent.fire();
+ this.animOut.animate();
+};
+
+/**
+* The default onStart handler for the in-animation.
+* @method handleStartAnimateIn
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn = function(type, args, obj) { };
+/**
+* The default onTween handler for the in-animation.
+* @method handleTweenAnimateIn
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn = function(type, args, obj) { };
+/**
+* The default onComplete handler for the in-animation.
+* @method handleCompleteAnimateIn
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn = function(type, args, obj) { };
+
+/**
+* The default onStart handler for the out-animation.
+* @method handleStartAnimateOut
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut = function(type, args, obj) { };
+/**
+* The default onTween handler for the out-animation.
+* @method handleTweenAnimateOut
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut = function(type, args, obj) { };
+/**
+* The default onComplete handler for the out-animation.
+* @method handleCompleteAnimateOut
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut = function(type, args, obj) { };
+
+/**
+* Returns a string representation of the object.
+* @method toString
+* @return {String} The string representation of the ContainerEffect
+*/
+YAHOO.widget.ContainerEffect.prototype.toString = function() {
+ var output = "ContainerEffect";
+ if (this.overlay) {
+ output += " [" + this.overlay.toString() + "]";
+ }
+ return output;
+};
+
+/**
+* A pre-configured ContainerEffect instance that can be used for fading an overlay in and out.
+* @method FADE
+* @static
+* @param {Overlay} The Overlay object to animate
+* @param {Number} The duration of the animation
+* @return {ContainerEffect} The configured ContainerEffect object
+*/
+YAHOO.widget.ContainerEffect.FADE = function(overlay, dur) {
+ var fade = new YAHOO.widget.ContainerEffect(overlay, { attributes:{opacity: {from:0, to:1}}, duration:dur, method:YAHOO.util.Easing.easeIn }, { attributes:{opacity: {to:0}}, duration:dur, method:YAHOO.util.Easing.easeOut}, overlay.element );
+
+ fade.handleStartAnimateIn = function(type,args,obj) {
+ YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");
+
+ if (! obj.overlay.underlay) {
+ obj.overlay.cfg.refireEvent("underlay");
+ }
+
+ if (obj.overlay.underlay) {
+ obj.initialUnderlayOpacity = YAHOO.util.Dom.getStyle(obj.overlay.underlay, "opacity");
+ obj.overlay.underlay.style.filter = null;
+ }
+
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 0);
+ };
+
+ fade.handleCompleteAnimateIn = function(type,args,obj) {
+ YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");
+
+ if (obj.overlay.element.style.filter) {
+ obj.overlay.element.style.filter = null;
+ }
+
+ if (obj.overlay.underlay) {
+ YAHOO.util.Dom.setStyle(obj.overlay.underlay, "opacity", obj.initialUnderlayOpacity);
+ }
+
+ obj.overlay.cfg.refireEvent("iframe");
+ obj.animateInCompleteEvent.fire();
+ };
+
+ fade.handleStartAnimateOut = function(type, args, obj) {
+ YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");
+
+ if (obj.overlay.underlay) {
+ obj.overlay.underlay.style.filter = null;
+ }
+ };
+
+ fade.handleCompleteAnimateOut = function(type, args, obj) {
+ YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");
+ if (obj.overlay.element.style.filter) {
+ obj.overlay.element.style.filter = null;
+ }
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 1);
+
+ obj.overlay.cfg.refireEvent("iframe");
+
+ obj.animateOutCompleteEvent.fire();
+ };
+
+ fade.init();
+ return fade;
+};
+
+
+/**
+* A pre-configured ContainerEffect instance that can be used for sliding an overlay in and out.
+* @method SLIDE
+* @static
+* @param {Overlay} The Overlay object to animate
+* @param {Number} The duration of the animation
+* @return {ContainerEffect} The configured ContainerEffect object
+*/
+YAHOO.widget.ContainerEffect.SLIDE = function(overlay, dur) {
+ var x = overlay.cfg.getProperty("x") || YAHOO.util.Dom.getX(overlay.element);
+ var y = overlay.cfg.getProperty("y") || YAHOO.util.Dom.getY(overlay.element);
+
+ var clientWidth = YAHOO.util.Dom.getClientWidth();
+ var offsetWidth = overlay.element.offsetWidth;
+
+ var slide = new YAHOO.widget.ContainerEffect(overlay, {
+ attributes:{ points: { to:[x, y] } },
+ duration:dur,
+ method:YAHOO.util.Easing.easeIn
+ },
+ {
+ attributes:{ points: { to:[(clientWidth+25), y] } },
+ duration:dur,
+ method:YAHOO.util.Easing.easeOut
+ },
+ overlay.element,
+ YAHOO.util.Motion);
+
+
+ slide.handleStartAnimateIn = function(type,args,obj) {
+ obj.overlay.element.style.left = (-25-offsetWidth) + "px";
+ obj.overlay.element.style.top = y + "px";
+ };
+
+ slide.handleTweenAnimateIn = function(type, args, obj) {
+
+
+ var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
+
+ var currentX = pos[0];
+ var currentY = pos[1];
+
+ if (YAHOO.util.Dom.getStyle(obj.overlay.element, "visibility") == "hidden" && currentX < x) {
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");
+ }
+
+ obj.overlay.cfg.setProperty("xy", [currentX,currentY], true);
+ obj.overlay.cfg.refireEvent("iframe");
+ };
+
+ slide.handleCompleteAnimateIn = function(type, args, obj) {
+ obj.overlay.cfg.setProperty("xy", [x,y], true);
+ obj.startX = x;
+ obj.startY = y;
+ obj.overlay.cfg.refireEvent("iframe");
+ obj.animateInCompleteEvent.fire();
+ };
+
+ slide.handleStartAnimateOut = function(type, args, obj) {
+ var vw = YAHOO.util.Dom.getViewportWidth();
+
+ var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
+
+ var yso = pos[1];
+
+ var currentTo = obj.animOut.attributes.points.to;
+ obj.animOut.attributes.points.to = [(vw+25), yso];
+ };
+
+ slide.handleTweenAnimateOut = function(type, args, obj) {
+ var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
+
+ var xto = pos[0];
+ var yto = pos[1];
+
+ obj.overlay.cfg.setProperty("xy", [xto,yto], true);
+ obj.overlay.cfg.refireEvent("iframe");
+ };
+
+ slide.handleCompleteAnimateOut = function(type, args, obj) {
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");
+
+ obj.overlay.cfg.setProperty("xy", [x,y]);
+ obj.animateOutCompleteEvent.fire();
+ };
+
+ slide.init();
+ return slide;
};
\ No newline at end of file
diff --git a/thirdpartyjs/yui/container/container-min.js b/thirdpartyjs/yui/container/container-min.js
index 1e5ed5d..8654489 100644
--- a/thirdpartyjs/yui/container/container-min.js
+++ b/thirdpartyjs/yui/container/container-min.js
@@ -1,147 +1,147 @@
-/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt version: 0.12.0 */
-YAHOO.util.Config=function(owner){if(owner){this.init(owner);}};YAHOO.util.Config.prototype={owner:null,queueInProgress:false,checkBoolean:function(val){if(typeof val=='boolean'){return true;}else{return false;}},checkNumber:function(val){if(isNaN(val)){return false;}else{return true;}}};YAHOO.util.Config.prototype.init=function(owner){this.owner=owner;this.configChangedEvent=new YAHOO.util.CustomEvent("configChanged");this.queueInProgress=false;var config={};var initialConfig={};var eventQueue=[];var fireEvent=function(key,value){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){property.event.fire(value);}};this.addProperty=function(key,propertyObject){key=key.toLowerCase();config[key]=propertyObject;propertyObject.event=new YAHOO.util.CustomEvent(key);propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner,true);}
-this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}};this.getConfig=function(){var cfg={};for(var prop in config){var property=config[prop];if(typeof property!='undefined'&&property.event){cfg[prop]=property.value;}}
-return cfg;};this.getProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){return property.value;}else{return undefined;}};this.resetProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){if(initialConfig[key]&&initialConfig[key]!='undefined'){this.setProperty(key,initialConfig[key]);}
-return true;}else{return false;}};this.setProperty=function(key,value,silent){key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{var property=config[key];if(typeof property!='undefined'&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){fireEvent(key,value);this.configChangedEvent.fire([key,value]);}
-return true;}}else{return false;}}};this.queueProperty=function(key,value){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){if(typeof value!='undefined'&&property.validator&&!property.validator(value)){return false;}else{if(typeof value!='undefined'){property.value=value;}else{value=property.value;}
-var foundDuplicate=false;for(var i=0;irightConstraint){x=rightConstraint;}
-if(ybottomConstraint){y=bottomConstraint;}
-this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);};YAHOO.widget.Overlay.prototype.center=function(){var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.cfg.setProperty("xy",[parseInt(x,10),parseInt(y,10)]);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);};YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.syncPosition();me.cfg.refireEvent("iframe");me.cfg.refireEvent("context");},0);};YAHOO.widget.Overlay.prototype.destroy=function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}
-this.iframe=null;YAHOO.widget.Overlay.superclass.destroy.call(this);};YAHOO.widget.Overlay.prototype.toString=function(){return"Overlay "+this.id;};YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.scrollEnd){window.scrollEnd=-1;}
-clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){YAHOO.widget.Overlay.windowScrollEvent.fire();},1);}else{YAHOO.widget.Overlay.windowScrollEvent.fire();}};YAHOO.widget.Overlay.windowResizeHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.resizeEnd){window.resizeEnd=-1;}
-clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){YAHOO.widget.Overlay.windowResizeEvent.fire();},100);}else{YAHOO.widget.Overlay.windowResizeEvent.fire();}};YAHOO.widget.Overlay._initialized=null;if(YAHOO.widget.Overlay._initialized===null){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;}
-YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);};YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}
-this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;};this.focus=function(overlay){var o=this.find(overlay);if(o){this.blurAll();activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex,10)+2));}
-this.overlays.sort(this.compareZIndexDesc);}};this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent=null;o.blurEvent=null;o.focus=null;o.blur=null;}};this.blurAll=function(){activeOverlay=null;for(var o=0;o0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;ozIndex2){return-1;}else if(zIndex1";this.body.innerHTML+=formHTML;form=this.element.getElementsByTagName("FORM")[0];}
-this.firstFormElement=function(){for(var f=0;f=0;f--){var el=form.elements[f];if(el.focus){if(el.type&&el.type!="hidden"){return el;}}}
-return null;}();this.form=form;if(this.cfg.getProperty("modal")&&this.form){var me=this;var firstElement=this.firstFormElement||this.firstButton;if(firstElement){this.preventBackTab=new YAHOO.util.KeyListener(firstElement,{shift:true,keys:9},{fn:me.focusLast,scope:me,correctScope:true});this.showEvent.subscribe(this.preventBackTab.enable,this.preventBackTab,true);this.hideEvent.subscribe(this.preventBackTab.disable,this.preventBackTab,true);}
-var lastElement=this.lastButton||this.lastFormElement;if(lastElement){this.preventTabOut=new YAHOO.util.KeyListener(lastElement,{shift:false,keys:9},{fn:me.focusFirst,scope:me,correctScope:true});this.showEvent.subscribe(this.preventTabOut.enable,this.preventTabOut,true);this.hideEvent.subscribe(this.preventTabOut.disable,this.preventTabOut,true);}}};YAHOO.widget.Dialog.prototype.configButtons=function(type,args,obj){var buttons=args[0];if(buttons!="none"){this.buttonSpan=null;this.buttonSpan=document.createElement("SPAN");this.buttonSpan.className="button-group";for(var b=0;b";};YAHOO.widget.SimpleDialog.prototype.configIcon=function(type,args,obj){var icon=args[0];if(icon&&icon!="none"){var iconHTML=" ";this.body.innerHTML=iconHTML+this.body.innerHTML;}};YAHOO.widget.SimpleDialog.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);this.cfg.refireEvent("icon");}};YAHOO.widget.SimpleDialog.prototype.toString=function(){return"SimpleDialog "+this.id;};YAHOO.widget.ContainerEffect=function(overlay,attrIn,attrOut,targetElement,animClass){if(!animClass){animClass=YAHOO.util.Anim;}
-this.overlay=overlay;this.attrIn=attrIn;this.attrOut=attrOut;this.targetElement=targetElement||overlay.element;this.animClass=animClass;};YAHOO.widget.ContainerEffect.prototype.init=function(){this.beforeAnimateInEvent=new YAHOO.util.CustomEvent("beforeAnimateIn");this.beforeAnimateOutEvent=new YAHOO.util.CustomEvent("beforeAnimateOut");this.animateInCompleteEvent=new YAHOO.util.CustomEvent("animateInComplete");this.animateOutCompleteEvent=new YAHOO.util.CustomEvent("animateOutComplete");this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);};YAHOO.widget.ContainerEffect.prototype.animateIn=function(){this.beforeAnimateInEvent.fire();this.animIn.animate();};YAHOO.widget.ContainerEffect.prototype.animateOut=function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();};YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.toString=function(){var output="ContainerEffect";if(this.overlay){output+=" ["+this.overlay.toString()+"]";}
-return output;};YAHOO.widget.ContainerEffect.FADE=function(overlay,dur){var fade=new YAHOO.widget.ContainerEffect(overlay,{attributes:{opacity:{from:0,to:1}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{opacity:{to:0}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element);fade.handleStartAnimateIn=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(!obj.overlay.underlay){obj.overlay.cfg.refireEvent("underlay");}
-if(obj.overlay.underlay){obj.initialUnderlayOpacity=YAHOO.util.Dom.getStyle(obj.overlay.underlay,"opacity");obj.overlay.underlay.style.filter=null;}
-YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",0);};fade.handleCompleteAnimateIn=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
-if(obj.overlay.underlay){YAHOO.util.Dom.setStyle(obj.overlay.underlay,"opacity",obj.initialUnderlayOpacity);}
-obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};fade.handleStartAnimateOut=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(obj.overlay.underlay){obj.overlay.underlay.style.filter=null;}};fade.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
-YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",1);obj.overlay.cfg.refireEvent("iframe");obj.animateOutCompleteEvent.fire();};fade.init();return fade;};YAHOO.widget.ContainerEffect.SLIDE=function(overlay,dur){var x=overlay.cfg.getProperty("x")||YAHOO.util.Dom.getX(overlay.element);var y=overlay.cfg.getProperty("y")||YAHOO.util.Dom.getY(overlay.element);var clientWidth=YAHOO.util.Dom.getClientWidth();var offsetWidth=overlay.element.offsetWidth;var slide=new YAHOO.widget.ContainerEffect(overlay,{attributes:{points:{to:[x,y]}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{points:{to:[(clientWidth+25),y]}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element,YAHOO.util.Motion);slide.handleStartAnimateIn=function(type,args,obj){obj.overlay.element.style.left=(-25-offsetWidth)+"px";obj.overlay.element.style.top=y+"px";};slide.handleTweenAnimateIn=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var currentX=pos[0];var currentY=pos[1];if(YAHOO.util.Dom.getStyle(obj.overlay.element,"visibility")=="hidden"&¤tXrightConstraint){x=rightConstraint;}
+if(ybottomConstraint){y=bottomConstraint;}
+this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);};YAHOO.widget.Overlay.prototype.center=function(){var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.cfg.setProperty("xy",[parseInt(x,10),parseInt(y,10)]);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);};YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.syncPosition();me.cfg.refireEvent("iframe");me.cfg.refireEvent("context");},0);};YAHOO.widget.Overlay.prototype.destroy=function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}
+this.iframe=null;YAHOO.widget.Overlay.superclass.destroy.call(this);};YAHOO.widget.Overlay.prototype.toString=function(){return"Overlay "+this.id;};YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.scrollEnd){window.scrollEnd=-1;}
+clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){YAHOO.widget.Overlay.windowScrollEvent.fire();},1);}else{YAHOO.widget.Overlay.windowScrollEvent.fire();}};YAHOO.widget.Overlay.windowResizeHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.resizeEnd){window.resizeEnd=-1;}
+clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){YAHOO.widget.Overlay.windowResizeEvent.fire();},100);}else{YAHOO.widget.Overlay.windowResizeEvent.fire();}};YAHOO.widget.Overlay._initialized=null;if(YAHOO.widget.Overlay._initialized===null){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;}
+YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);};YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}
+this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;};this.focus=function(overlay){var o=this.find(overlay);if(o){this.blurAll();activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex,10)+2));}
+this.overlays.sort(this.compareZIndexDesc);}};this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent=null;o.blurEvent=null;o.focus=null;o.blur=null;}};this.blurAll=function(){activeOverlay=null;for(var o=0;o0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;ozIndex2){return-1;}else if(zIndex1";this.body.innerHTML+=formHTML;form=this.element.getElementsByTagName("FORM")[0];}
+this.firstFormElement=function(){for(var f=0;f=0;f--){var el=form.elements[f];if(el.focus){if(el.type&&el.type!="hidden"){return el;}}}
+return null;}();this.form=form;if(this.cfg.getProperty("modal")&&this.form){var me=this;var firstElement=this.firstFormElement||this.firstButton;if(firstElement){this.preventBackTab=new YAHOO.util.KeyListener(firstElement,{shift:true,keys:9},{fn:me.focusLast,scope:me,correctScope:true});this.showEvent.subscribe(this.preventBackTab.enable,this.preventBackTab,true);this.hideEvent.subscribe(this.preventBackTab.disable,this.preventBackTab,true);}
+var lastElement=this.lastButton||this.lastFormElement;if(lastElement){this.preventTabOut=new YAHOO.util.KeyListener(lastElement,{shift:false,keys:9},{fn:me.focusFirst,scope:me,correctScope:true});this.showEvent.subscribe(this.preventTabOut.enable,this.preventTabOut,true);this.hideEvent.subscribe(this.preventTabOut.disable,this.preventTabOut,true);}}};YAHOO.widget.Dialog.prototype.configButtons=function(type,args,obj){var buttons=args[0];if(buttons!="none"){this.buttonSpan=null;this.buttonSpan=document.createElement("SPAN");this.buttonSpan.className="button-group";for(var b=0;b";};YAHOO.widget.SimpleDialog.prototype.configIcon=function(type,args,obj){var icon=args[0];if(icon&&icon!="none"){var iconHTML=" ";this.body.innerHTML=iconHTML+this.body.innerHTML;}};YAHOO.widget.SimpleDialog.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);this.cfg.refireEvent("icon");}};YAHOO.widget.SimpleDialog.prototype.toString=function(){return"SimpleDialog "+this.id;};YAHOO.widget.ContainerEffect=function(overlay,attrIn,attrOut,targetElement,animClass){if(!animClass){animClass=YAHOO.util.Anim;}
+this.overlay=overlay;this.attrIn=attrIn;this.attrOut=attrOut;this.targetElement=targetElement||overlay.element;this.animClass=animClass;};YAHOO.widget.ContainerEffect.prototype.init=function(){this.beforeAnimateInEvent=new YAHOO.util.CustomEvent("beforeAnimateIn");this.beforeAnimateOutEvent=new YAHOO.util.CustomEvent("beforeAnimateOut");this.animateInCompleteEvent=new YAHOO.util.CustomEvent("animateInComplete");this.animateOutCompleteEvent=new YAHOO.util.CustomEvent("animateOutComplete");this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);};YAHOO.widget.ContainerEffect.prototype.animateIn=function(){this.beforeAnimateInEvent.fire();this.animIn.animate();};YAHOO.widget.ContainerEffect.prototype.animateOut=function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();};YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.toString=function(){var output="ContainerEffect";if(this.overlay){output+=" ["+this.overlay.toString()+"]";}
+return output;};YAHOO.widget.ContainerEffect.FADE=function(overlay,dur){var fade=new YAHOO.widget.ContainerEffect(overlay,{attributes:{opacity:{from:0,to:1}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{opacity:{to:0}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element);fade.handleStartAnimateIn=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(!obj.overlay.underlay){obj.overlay.cfg.refireEvent("underlay");}
+if(obj.overlay.underlay){obj.initialUnderlayOpacity=YAHOO.util.Dom.getStyle(obj.overlay.underlay,"opacity");obj.overlay.underlay.style.filter=null;}
+YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",0);};fade.handleCompleteAnimateIn=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
+if(obj.overlay.underlay){YAHOO.util.Dom.setStyle(obj.overlay.underlay,"opacity",obj.initialUnderlayOpacity);}
+obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};fade.handleStartAnimateOut=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(obj.overlay.underlay){obj.overlay.underlay.style.filter=null;}};fade.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
+YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",1);obj.overlay.cfg.refireEvent("iframe");obj.animateOutCompleteEvent.fire();};fade.init();return fade;};YAHOO.widget.ContainerEffect.SLIDE=function(overlay,dur){var x=overlay.cfg.getProperty("x")||YAHOO.util.Dom.getX(overlay.element);var y=overlay.cfg.getProperty("y")||YAHOO.util.Dom.getY(overlay.element);var clientWidth=YAHOO.util.Dom.getClientWidth();var offsetWidth=overlay.element.offsetWidth;var slide=new YAHOO.widget.ContainerEffect(overlay,{attributes:{points:{to:[x,y]}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{points:{to:[(clientWidth+25),y]}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element,YAHOO.util.Motion);slide.handleStartAnimateIn=function(type,args,obj){obj.overlay.element.style.left=(-25-offsetWidth)+"px";obj.overlay.element.style.top=y+"px";};slide.handleTweenAnimateIn=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var currentX=pos[0];var currentY=pos[1];if(YAHOO.util.Dom.getStyle(obj.overlay.element,"visibility")=="hidden"&¤tXOR
-* @param {HTMLElement} el The element representing the Module
-* @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
-*/
-YAHOO.widget.Module = function(el, userConfig) {
- if (el) {
- this.init(el, userConfig);
- }
-};
-
-/**
-* Constant representing the prefix path to use for non-secure images
-* @property YAHOO.widget.Module.IMG_ROOT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";
-
-/**
-* Constant representing the prefix path to use for securely served images
-* @property YAHOO.widget.Module.IMG_ROOT_SSL
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";
-
-/**
-* Constant for the default CSS class name that represents a Module
-* @property YAHOO.widget.Module.CSS_MODULE
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_MODULE = "module";
-
-/**
-* Constant representing the module header
-* @property YAHOO.widget.Module.CSS_HEADER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_HEADER = "hd";
-
-/**
-* Constant representing the module body
-* @property YAHOO.widget.Module.CSS_BODY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_BODY = "bd";
-
-/**
-* Constant representing the module footer
-* @property YAHOO.widget.Module.CSS_FOOTER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_FOOTER = "ft";
-
-/**
-* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size
-* @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
-
-YAHOO.widget.Module.prototype = {
- /**
- * The class's constructor function
- * @property contructor
- * @type Function
- */
- constructor : YAHOO.widget.Module,
-
- /**
- * The main module element that contains the header, body, and footer
- * @property element
- * @type HTMLElement
- */
- element : null,
-
- /**
- * The header element, denoted with CSS class "hd"
- * @property header
- * @type HTMLElement
- */
- header : null,
-
- /**
- * The body element, denoted with CSS class "bd"
- * @property body
- * @type HTMLElement
- */
- body : null,
-
- /**
- * The footer element, denoted with CSS class "ft"
- * @property footer
- * @type HTMLElement
- */
- footer : null,
-
- /**
- * The id of the element
- * @property id
- * @type String
- */
- id : null,
-
- /**
- * The String representing the image root
- * @property imageRoot
- * @type String
- */
- imageRoot : YAHOO.widget.Module.IMG_ROOT,
-
- /**
- * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
- * @method initEvents
- */
- initEvents : function() {
-
- /**
- * CustomEvent fired prior to class initalization.
- * @event beforeInitEvent
- * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
- */
- this.beforeInitEvent = new YAHOO.util.CustomEvent("beforeInit");
-
- /**
- * CustomEvent fired after class initalization.
- * @event initEvent
- * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
- */
- this.initEvent = new YAHOO.util.CustomEvent("init");
-
- /**
- * CustomEvent fired when the Module is appended to the DOM
- * @event appendEvent
- */
- this.appendEvent = new YAHOO.util.CustomEvent("append");
-
- /**
- * CustomEvent fired before the Module is rendered
- * @event beforeRenderEvent
- */
- this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
-
- /**
- * CustomEvent fired after the Module is rendered
- * @event renderEvent
- */
- this.renderEvent = new YAHOO.util.CustomEvent("render");
-
- /**
- * CustomEvent fired when the header content of the Module is modified
- * @event changeHeaderEvent
- * @param {String/HTMLElement} content String/element representing the new header content
- */
- this.changeHeaderEvent = new YAHOO.util.CustomEvent("changeHeader");
-
- /**
- * CustomEvent fired when the body content of the Module is modified
- * @event changeBodyEvent
- * @param {String/HTMLElement} content String/element representing the new body content
- */
- this.changeBodyEvent = new YAHOO.util.CustomEvent("changeBody");
-
- /**
- * CustomEvent fired when the footer content of the Module is modified
- * @event changeFooterEvent
- * @param {String/HTMLElement} content String/element representing the new footer content
- */
- this.changeFooterEvent = new YAHOO.util.CustomEvent("changeFooter");
-
- /**
- * CustomEvent fired when the content of the Module is modified
- * @event changeContentEvent
- */
- this.changeContentEvent = new YAHOO.util.CustomEvent("changeContent");
-
- /**
- * CustomEvent fired when the Module is destroyed
- * @event destroyEvent
- */
- this.destroyEvent = new YAHOO.util.CustomEvent("destroy");
-
- /**
- * CustomEvent fired before the Module is shown
- * @event beforeShowEvent
- */
- this.beforeShowEvent = new YAHOO.util.CustomEvent("beforeShow");
-
- /**
- * CustomEvent fired after the Module is shown
- * @event showEvent
- */
- this.showEvent = new YAHOO.util.CustomEvent("show");
-
- /**
- * CustomEvent fired before the Module is hidden
- * @event beforeHideEvent
- */
- this.beforeHideEvent = new YAHOO.util.CustomEvent("beforeHide");
-
- /**
- * CustomEvent fired after the Module is hidden
- * @event hideEvent
- */
- this.hideEvent = new YAHOO.util.CustomEvent("hide");
- },
-
- /**
- * String representing the current user-agent platform
- * @property platform
- * @type String
- */
- platform : function() {
- var ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {
- return "windows";
- } else if (ua.indexOf("macintosh") != -1) {
- return "mac";
- } else {
- return false;
- }
- }(),
-
- /**
- * String representing the current user-agent browser
- * @property browser
- * @type String
- */
- browser : function() {
- var ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
- return 'opera';
- } else if (ua.indexOf('msie 7')!=-1) { // IE7
- return 'ie7';
- } else if (ua.indexOf('msie') !=-1) { // IE
- return 'ie';
- } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
- return 'safari';
- } else if (ua.indexOf('gecko') != -1) { // Gecko
- return 'gecko';
- } else {
- return false;
- }
- }(),
-
- /**
- * Boolean representing whether or not the current browsing context is secure (https)
- * @property isSecure
- * @type Boolean
- */
- isSecure : function() {
- if (window.location.href.toLowerCase().indexOf("https") === 0) {
- return true;
- } else {
- return false;
- }
- }(),
-
- /**
- * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
- */
- initDefaultConfig : function() {
- // Add properties //
-
- /**
- * Specifies whether the Module is visible on the page.
- * @config visible
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );
-
- /**
- * Object or array of objects representing the ContainerEffect classes that are active for animating the container.
- * @config effect
- * @type Object
- * @default null
- */
- this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );
-
- /**
- * Specifies whether to create a special proxy iframe to monitor for user font resizing in the document
- * @config monitorresize
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );
- },
-
- /**
- * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
- * @method init
- * @param {String} el The element ID representing the Module OR
- * @param {HTMLElement} el The element representing the Module
- * @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
- */
- init : function(el, userConfig) {
-
- this.initEvents();
-
- this.beforeInitEvent.fire(YAHOO.widget.Module);
-
- /**
- * The Module's Config object used for monitoring configuration properties.
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- if (this.isSecure) {
- this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;
- }
-
- if (typeof el == "string") {
- var elId = el;
-
- el = document.getElementById(el);
- if (! el) {
- el = document.createElement("DIV");
- el.id = elId;
- }
- }
-
- this.element = el;
-
- if (el.id) {
- this.id = el.id;
- }
-
- var childNodes = this.element.childNodes;
-
- if (childNodes) {
- for (var i=0;iOR
- * @param {HTMLElement} headerContent The HTMLElement to append to the header
- */
- setHeader : function(headerContent) {
- if (! this.header) {
- this.header = document.createElement("DIV");
- this.header.className = YAHOO.widget.Module.CSS_HEADER;
- }
-
- if (typeof headerContent == "string") {
- this.header.innerHTML = headerContent;
- } else {
- this.header.innerHTML = "";
- this.header.appendChild(headerContent);
- }
-
- this.changeHeaderEvent.fire(headerContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the header. If no header is present, one will be automatically created.
- * @method appendToHeader
- * @param {HTMLElement} element The element to append to the header
- */
- appendToHeader : function(element) {
- if (! this.header) {
- this.header = document.createElement("DIV");
- this.header.className = YAHOO.widget.Module.CSS_HEADER;
- }
-
- this.header.appendChild(element);
- this.changeHeaderEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.
- * @method setBody
- * @param {String} bodyContent The HTML used to set the body OR
- * @param {HTMLElement} bodyContent The HTMLElement to append to the body
- */
- setBody : function(bodyContent) {
- if (! this.body) {
- this.body = document.createElement("DIV");
- this.body.className = YAHOO.widget.Module.CSS_BODY;
- }
-
- if (typeof bodyContent == "string")
- {
- this.body.innerHTML = bodyContent;
- } else {
- this.body.innerHTML = "";
- this.body.appendChild(bodyContent);
- }
-
- this.changeBodyEvent.fire(bodyContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the body. If no body is present, one will be automatically created.
- * @method appendToBody
- * @param {HTMLElement} element The element to append to the body
- */
- appendToBody : function(element) {
- if (! this.body) {
- this.body = document.createElement("DIV");
- this.body.className = YAHOO.widget.Module.CSS_BODY;
- }
-
- this.body.appendChild(element);
- this.changeBodyEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.
- * @method setFooter
- * @param {String} footerContent The HTML used to set the footer OR
- * @param {HTMLElement} footerContent The HTMLElement to append to the footer
- */
- setFooter : function(footerContent) {
- if (! this.footer) {
- this.footer = document.createElement("DIV");
- this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
- }
-
- if (typeof footerContent == "string") {
- this.footer.innerHTML = footerContent;
- } else {
- this.footer.innerHTML = "";
- this.footer.appendChild(footerContent);
- }
-
- this.changeFooterEvent.fire(footerContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the footer. If no footer is present, one will be automatically created.
- * @method appendToFooter
- * @param {HTMLElement} element The element to append to the footer
- */
- appendToFooter : function(element) {
- if (! this.footer) {
- this.footer = document.createElement("DIV");
- this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
- }
-
- this.footer.appendChild(element);
- this.changeFooterEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.
- * @method render
- * @param {String} appendToNode The element id to which the Module should be appended to prior to rendering OR
- * @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
- * @param {HTMLElement} moduleElement OPTIONAL. The element that represents the actual Standard Module container.
- * @return {Boolean} Success or failure of the render
- */
- render : function(appendToNode, moduleElement) {
- this.beforeRenderEvent.fire();
-
- if (! moduleElement) {
- moduleElement = this.element;
- }
-
- var me = this;
- var appendTo = function(element) {
- if (typeof element == "string") {
- element = document.getElementById(element);
- }
-
- if (element) {
- element.appendChild(me.element);
- me.appendEvent.fire();
- }
- };
-
- if (appendToNode) {
- appendTo(appendToNode);
- } else { // No node was passed in. If the element is not pre-marked up, this fails
- if (! YAHOO.util.Dom.inDocument(this.element)) {
- return false;
- }
- }
-
- // Need to get everything into the DOM if it isn't already
-
- if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {
- // There is a header, but it's not in the DOM yet... need to add it
- var firstChild = moduleElement.firstChild;
- if (firstChild) { // Insert before first child if exists
- moduleElement.insertBefore(this.header, firstChild);
- } else { // Append to empty body because there are no children
- moduleElement.appendChild(this.header);
- }
- }
-
- if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {
- // There is a body, but it's not in the DOM yet... need to add it
- if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM
- moduleElement.insertBefore(this.body, this.footer);
- } else { // Append to element because there is no footer
- moduleElement.appendChild(this.body);
- }
- }
-
- if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {
- // There is a footer, but it's not in the DOM yet... need to add it
- moduleElement.appendChild(this.footer);
- }
-
- this.renderEvent.fire();
- return true;
- },
-
- /**
- * Removes the Module element from the DOM and sets all child elements to null.
- * @method destroy
- */
- destroy : function() {
- if (this.element) {
- var parent = this.element.parentNode;
- }
- if (parent) {
- parent.removeChild(this.element);
- }
-
- this.element = null;
- this.header = null;
- this.body = null;
- this.footer = null;
-
- this.destroyEvent.fire();
- },
-
- /**
- * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.
- * @method show
- */
- show : function() {
- this.cfg.setProperty("visible", true);
- },
-
- /**
- * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.
- * @method hide
- */
- hide : function() {
- this.cfg.setProperty("visible", false);
- },
-
- // BUILT-IN EVENT HANDLERS FOR MODULE //
-
- /**
- * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".
- * This method is responsible for firing showEvent and hideEvent.
- * @param {String} type The CustomEvent type (usually the property name)
- * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
- * @method configVisible
- */
- configVisible : function(type, args, obj) {
- var visible = args[0];
- if (visible) {
- this.beforeShowEvent.fire();
- YAHOO.util.Dom.setStyle(this.element, "display", "block");
- this.showEvent.fire();
- } else {
- this.beforeHideEvent.fire();
- YAHOO.util.Dom.setStyle(this.element, "display", "none");
- this.hideEvent.fire();
- }
- },
-
- /**
- * Default event handler for the "monitorresize" configuration property
- * @param {String} type The CustomEvent type (usually the property name)
- * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
- * @method configMonitorResize
- */
- configMonitorResize : function(type, args, obj) {
- var monitor = args[0];
- if (monitor) {
- this.initResizeMonitor();
- } else {
- YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);
- this.resizeMonitor = null;
- }
- }
-};
-
-/**
-* Returns a String representation of the Object.
-* @method toString
-* @return {String} The string representation of the Module
-*/
-YAHOO.widget.Module.prototype.toString = function() {
- return "Module " + this.id;
-};
-
-/**
-* Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.
-* @class Overlay
-* @namespace YAHOO.widget
-* @extends YAHOO.widget.Module
-* @param {String} el The element ID representing the Overlay OR
-* @param {HTMLElement} el The element representing the Overlay
-* @param {Object} userConfig The configuration object literal containing 10/23/2006the configuration that should be set for this Overlay. See configuration documentation for more details.
-* @constructor
-*/
-YAHOO.widget.Overlay = function(el, userConfig) {
- YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);
-
-/**
-* The URL that will be placed in the iframe
-* @property YAHOO.widget.Overlay.IFRAME_SRC
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"
-
-/**
-* Constant representing the top left corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.TOP_LEFT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.TOP_LEFT = "tl";
-
-/**
-* Constant representing the top right corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.TOP_RIGHT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.TOP_RIGHT = "tr";
-
-/**
-* Constant representing the top bottom left corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.BOTTOM_LEFT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";
-
-/**
-* Constant representing the bottom right corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.BOTTOM_RIGHT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";
-
-/**
-* Constant representing the default CSS class used for an Overlay
-* @property YAHOO.widget.Overlay.CSS_OVERLAY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";
-
-/**
-* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
-* @method init
-* @param {String} el The element ID representing the Overlay OR
-* @param {HTMLElement} el The element representing the Overlay
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
-*/
-YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {
- YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
-
- this.beforeInitEvent.fire(YAHOO.widget.Overlay);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- if (this.platform == "mac" && this.browser == "gecko") {
- if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {
- this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);
- }
- if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {
- this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);
- }
- }
-
- this.initEvent.fire(YAHOO.widget.Overlay);
-};
-
-/**
-* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.
-* @method initEvents
-*/
-YAHOO.widget.Overlay.prototype.initEvents = function() {
- YAHOO.widget.Overlay.superclass.initEvents.call(this);
-
- /**
- * CustomEvent fired before the Overlay is moved.
- * @event beforeMoveEvent
- * @param {Number} x x coordinate
- * @param {Number} y y coordinate
- */
- this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);
-
- /**
- * CustomEvent fired after the Overlay is moved.
- * @event moveEvent
- * @param {Number} x x coordinate
- * @param {Number} y y coordinate
- */
- this.moveEvent = new YAHOO.util.CustomEvent("move", this);
-};
-
-/**
-* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
-* @method initDefaultConfig
-*/
-YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {
- YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);
-
- // Add overlay config properties //
-
- /**
- * The absolute x-coordinate position of the Overlay
- * @config x
- * @type Number
- * @default null
- */
- this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * The absolute y-coordinate position of the Overlay
- * @config y
- * @type Number
- * @default null
- */
- this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * An array with the absolute x and y positions of the Overlay
- * @config xy
- * @type Number[]
- * @default null
- */
- this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * The array of context arguments for context-sensitive positioning. The format is: [id or element, element corner, context corner]. For example, setting this property to ["img1", "tl", "bl"] would align the Overlay's top left corner to the context element's bottom left corner.
- * @config context
- * @type Array
- * @default null
- */
- this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * True if the Overlay should be anchored to the center of the viewport.
- * @config fixedcenter
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );
-
- /**
- * CSS width of the Overlay.
- * @config width
- * @type String
- * @default null
- */
- this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * CSS height of the Overlay.
- * @config height
- * @type String
- * @default null
- */
- this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * CSS z-index of the Overlay.
- * @config zIndex
- * @type Number
- * @default null
- */
- this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );
-
- /**
- * True if the Overlay should be prevented from being positioned out of the viewport.
- * @config constraintoviewport
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );
-
- /**
- * True if the Overlay should have an IFRAME shim (for correcting the select z-index bug in IE6 and below).
- * @config iframe
- * @type Boolean
- * @default true for IE6 and below, false for all others
- */
- this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );
-};
-
-/**
-* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);
-* @method moveTo
-* @param {Number} x The Overlay's new x position
-* @param {Number} y The Overlay's new y position
-*/
-YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {
- this.cfg.setProperty("xy",[x,y]);
-};
-
-/**
-* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
-* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
-* @method hideMacGeckoScrollbars
-*/
-YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {
- YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");
- YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");
-};
-
-/**
-* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
-* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
-* @method showMacGeckoScrollbars
-*/
-YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {
- YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");
- YAHOO.util.Dom.addClass(this.element, "show-scrollbars");
-};
-
-// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.
-* @method configVisible
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {
- var visible = args[0];
-
- var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");
-
- if (currentVis == "inherit") {
- var e = this.element.parentNode;
- while (e.nodeType != 9 && e.nodeType != 11) {
- currentVis = YAHOO.util.Dom.getStyle(e, "visibility");
- if (currentVis != "inherit") { break; }
- e = e.parentNode;
- }
- if (currentVis == "inherit") {
- currentVis = "visible";
- }
- }
-
- var effect = this.cfg.getProperty("effect");
-
- var effectInstances = [];
- if (effect) {
- if (effect instanceof Array) {
- for (var i=0;i rightConstraint) {
- x = rightConstraint;
- }
-
- if (y < topConstraint) {
- y = topConstraint;
- } else if (y > bottomConstraint) {
- y = bottomConstraint;
- }
-
- this.cfg.setProperty("x", x, true);
- this.cfg.setProperty("y", y, true);
- this.cfg.setProperty("xy", [x,y], true);
-};
-
-/**
-* Centers the container in the viewport.
-* @method center
-*/
-YAHOO.widget.Overlay.prototype.center = function() {
- var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
- var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
-
- var viewPortWidth = YAHOO.util.Dom.getClientWidth();
- var viewPortHeight = YAHOO.util.Dom.getClientHeight();
-
- var elementWidth = this.element.offsetWidth;
- var elementHeight = this.element.offsetHeight;
-
- var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;
- var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;
-
- this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
-
- this.cfg.refireEvent("iframe");
-};
-
-/**
-* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.
-* @method syncPosition
-*/
-YAHOO.widget.Overlay.prototype.syncPosition = function() {
- var pos = YAHOO.util.Dom.getXY(this.element);
- this.cfg.setProperty("x", pos[0], true);
- this.cfg.setProperty("y", pos[1], true);
- this.cfg.setProperty("xy", pos, true);
-};
-
-/**
-* Event handler fired when the resize monitor element is resized.
-* @method onDomResize
-* @param {DOMEvent} e The resize DOM event
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {
- YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);
- var me = this;
- setTimeout(function() {
- me.syncPosition();
- me.cfg.refireEvent("iframe");
- me.cfg.refireEvent("context");
- }, 0);
-};
-
-/**
-* Removes the Overlay element from the DOM and sets all child elements to null.
-* @method destroy
-*/
-YAHOO.widget.Overlay.prototype.destroy = function() {
- if (this.iframe) {
- this.iframe.parentNode.removeChild(this.iframe);
- }
-
- this.iframe = null;
-
- YAHOO.widget.Overlay.superclass.destroy.call(this);
-};
-
-/**
-* Returns a String representation of the object.
-* @method toString
-* @return {String} The string representation of the Overlay.
-*/
-YAHOO.widget.Overlay.prototype.toString = function() {
- return "Overlay " + this.id;
-};
-
-/**
-* A singleton CustomEvent used for reacting to the DOM event for window scroll
-* @event YAHOO.widget.Overlay.windowScrollEvent
-*/
-YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");
-
-/**
-* A singleton CustomEvent used for reacting to the DOM event for window resize
-* @event YAHOO.widget.Overlay.windowResizeEvent
-*/
-YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");
-
-/**
-* The DOM event handler used to fire the CustomEvent for window scroll
-* @method YAHOO.widget.Overlay.windowScrollHandler
-* @static
-* @param {DOMEvent} e The DOM scroll event
-*/
-YAHOO.widget.Overlay.windowScrollHandler = function(e) {
- if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
- if (! window.scrollEnd) {
- window.scrollEnd = -1;
- }
- clearTimeout(window.scrollEnd);
- window.scrollEnd = setTimeout(function() { YAHOO.widget.Overlay.windowScrollEvent.fire(); }, 1);
- } else {
- YAHOO.widget.Overlay.windowScrollEvent.fire();
- }
-};
-
-/**
-* The DOM event handler used to fire the CustomEvent for window resize
-* @method YAHOO.widget.Overlay.windowResizeHandler
-* @static
-* @param {DOMEvent} e The DOM resize event
-*/
-YAHOO.widget.Overlay.windowResizeHandler = function(e) {
- if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
- if (! window.resizeEnd) {
- window.resizeEnd = -1;
- }
- clearTimeout(window.resizeEnd);
- window.resizeEnd = setTimeout(function() { YAHOO.widget.Overlay.windowResizeEvent.fire(); }, 100);
- } else {
- YAHOO.widget.Overlay.windowResizeEvent.fire();
- }
-};
-
-/**
-* A boolean that indicated whether the window resize and scroll events have already been subscribed to.
-* @property YAHOO.widget.Overlay._initialized
-* @private
-* @type Boolean
-*/
-YAHOO.widget.Overlay._initialized = null;
-
-if (YAHOO.widget.Overlay._initialized === null) {
- YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);
- YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);
-
- YAHOO.widget.Overlay._initialized = true;
-}
-
-/**
-* OverlayManager is used for maintaining the focus status of multiple Overlays.* @namespace YAHOO.widget
-* @namespace YAHOO.widget
-* @class OverlayManager
-* @constructor
-* @param {Array} overlays Optional. A collection of Overlays to register with the manager.
-* @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
-*/
-YAHOO.widget.OverlayManager = function(userConfig) {
- this.init(userConfig);
-};
-
-/**
-* The CSS class representing a focused Overlay
-* @property YAHOO.widget.OverlayManager.CSS_FOCUSED
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";
-
-YAHOO.widget.OverlayManager.prototype = {
- /**
- * The class's constructor function
- * @property contructor
- * @type Function
- */
- constructor : YAHOO.widget.OverlayManager,
-
- /**
- * The array of Overlays that are currently registered
- * @property overlays
- * @type YAHOO.widget.Overlay[]
- */
- overlays : null,
-
- /**
- * Initializes the default configuration of the OverlayManager
- * @method initDefaultConfig
- */
- initDefaultConfig : function() {
- /**
- * The collection of registered Overlays in use by the OverlayManager
- * @config overlays
- * @type YAHOO.widget.Overlay[]
- * @default null
- */
- this.cfg.addProperty("overlays", { suppressEvent:true } );
-
- /**
- * The default DOM event that should be used to focus an Overlay
- * @config focusevent
- * @type String
- * @default "mousedown"
- */
- this.cfg.addProperty("focusevent", { value:"mousedown" } );
- },
-
- /**
- * Initializes the OverlayManager
- * @method init
- * @param {YAHOO.widget.Overlay[]} overlays Optional. A collection of Overlays to register with the manager.
- * @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
- */
- init : function(userConfig) {
- /**
- * The OverlayManager's Config object used for monitoring configuration properties.
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- this.initDefaultConfig();
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
- this.cfg.fireQueue();
-
- /**
- * The currently activated Overlay
- * @property activeOverlay
- * @private
- * @type YAHOO.widget.Overlay
- */
- var activeOverlay = null;
-
- /**
- * Returns the currently focused Overlay
- * @method getActive
- * @return {YAHOO.widget.Overlay} The currently focused Overlay
- */
- this.getActive = function() {
- return activeOverlay;
- };
-
- /**
- * Focuses the specified Overlay
- * @method focus
- * @param {YAHOO.widget.Overlay} overlay The Overlay to focus
- * @param {String} overlay The id of the Overlay to focus
- */
- this.focus = function(overlay) {
- var o = this.find(overlay);
- if (o) {
- this.blurAll();
- activeOverlay = o;
- YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);
- this.overlays.sort(this.compareZIndexDesc);
- var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");
- if (! isNaN(topZIndex) && this.overlays[0] != overlay) {
- activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex, 10) + 2));
- }
- this.overlays.sort(this.compareZIndexDesc);
- }
- };
-
- /**
- * Removes the specified Overlay from the manager
- * @method remove
- * @param {YAHOO.widget.Overlay} overlay The Overlay to remove
- * @param {String} overlay The id of the Overlay to remove
- */
- this.remove = function(overlay) {
- var o = this.find(overlay);
- if (o) {
- var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");
- o.cfg.setProperty("zIndex", -1000, true);
- this.overlays.sort(this.compareZIndexDesc);
- this.overlays = this.overlays.slice(0, this.overlays.length-1);
- o.cfg.setProperty("zIndex", originalZ, true);
-
- o.cfg.setProperty("manager", null);
- o.focusEvent = null;
- o.blurEvent = null;
- o.focus = null;
- o.blur = null;
- }
- };
-
- /**
- * Removes focus from all registered Overlays in the manager
- * @method blurAll
- */
- this.blurAll = function() {
- activeOverlay = null;
- for (var o=0;o 0) {
- return true;
- }
- } else {
- return false;
- }
- },
-
- /**
- * Attempts to locate an Overlay by instance or ID.
- * @method find
- * @param {YAHOO.widget.Overlay} overlay An Overlay to locate within the manager
- * @param {String} overlay An Overlay id to locate within the manager
- * @return {YAHOO.widget.Overlay} The requested Overlay, if found, or null if it cannot be located.
- */
- find : function(overlay) {
- if (overlay instanceof YAHOO.widget.Overlay) {
- for (var o=0;o zIndex2) {
- return -1;
- } else if (zIndex1 < zIndex2) {
- return 1;
- } else {
- return 0;
- }
- },
-
- /**
- * Shows all Overlays in the manager.
- * @method showAll
- */
- showAll : function() {
- for (var o=0;oOR
-* @param {HTMLElement} el The element representing the Tooltip
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
-*/
-YAHOO.widget.Tooltip = function(el, userConfig) {
- YAHOO.widget.Tooltip.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.Tooltip, YAHOO.widget.Overlay);
-
-/**
-* Constant representing the Tooltip CSS class
-* @property YAHOO.widget.Tooltip.CSS_TOOLTIP
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Tooltip.CSS_TOOLTIP = "tt";
-
-/**
-* The Tooltip initialization method. This method is automatically called by the constructor. A Tooltip is automatically rendered by the init method, and it also is set to be invisible by default, and constrained to viewport by default as well.
-* @method init
-* @param {String} el The element ID representing the Tooltip OR
-* @param {HTMLElement} el The element representing the Tooltip
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Tooltip. See configuration documentation for more details.
-*/
-YAHOO.widget.Tooltip.prototype.init = function(el, userConfig) {
- if (document.readyState && document.readyState != "complete") {
- var deferredInit = function() {
- this.init(el, userConfig);
- };
- YAHOO.util.Event.addListener(window, "load", deferredInit, this, true);
- } else {
- YAHOO.widget.Tooltip.superclass.init.call(this, el);
-
- this.beforeInitEvent.fire(YAHOO.widget.Tooltip);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Tooltip.CSS_TOOLTIP);
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- this.cfg.queueProperty("visible",false);
- this.cfg.queueProperty("constraintoviewport",true);
-
- this.setBody("");
- this.render(this.cfg.getProperty("container"));
-
- this.initEvent.fire(YAHOO.widget.Tooltip);
- }
-};
-
-/**
-* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
-* @method initDefaultConfig
-*/
-YAHOO.widget.Tooltip.prototype.initDefaultConfig = function() {
- YAHOO.widget.Tooltip.superclass.initDefaultConfig.call(this);
-
- /**
- * Specifies whether the Tooltip should be kept from overlapping its context element.
- * @config preventoverlap
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("preventoverlap", { value:true, validator:this.cfg.checkBoolean, supercedes:["x","y","xy"] } );
-
- /**
- * The number of milliseconds to wait before showing a Tooltip on mouseover.
- * @config showdelay
- * @type Number
- * @default 200
- */
- this.cfg.addProperty("showdelay", { value:200, handler:this.configShowDelay, validator:this.cfg.checkNumber } );
-
- /**
- * The number of milliseconds to wait before automatically dismissing a Tooltip after the mouse has been resting on the context element.
- * @config autodismissdelay
- * @type Number
- * @default 5000
- */
- this.cfg.addProperty("autodismissdelay", { value:5000, handler:this.configAutoDismissDelay, validator:this.cfg.checkNumber } );
-
- /**
- * The number of milliseconds to wait before hiding a Tooltip on mouseover.
- * @config hidedelay
- * @type Number
- * @default 250
- */
- this.cfg.addProperty("hidedelay", { value:250, handler:this.configHideDelay, validator:this.cfg.checkNumber } );
-
- /**
- * Specifies the Tooltip's text.
- * @config text
- * @type String
- * @default null
- */
- this.cfg.addProperty("text", { handler:this.configText, suppressEvent:true } );
-
- /**
- * Specifies the container element that the Tooltip's markup should be rendered into.
- * @config container
- * @type HTMLElement/String
- * @default document.body
- */
- this.cfg.addProperty("container", { value:document.body, handler:this.configContainer } );
-
- /**
- * Specifies the element or elements that the Tooltip should be anchored to on mouseover.
- * @config context
- * @type HTMLElement[]/String[]
- * @default null
- */
-
-};
-
-// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* The default event handler fired when the "text" property is changed.
-* @method configText
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Tooltip.prototype.configText = function(type, args, obj) {
- var text = args[0];
- if (text) {
- this.setBody(text);
- }
-};
-
-/**
-* The default event handler fired when the "container" property is changed.
-* @method configContainer
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Tooltip.prototype.configContainer = function(type, args, obj) {
- var container = args[0];
- if (typeof container == 'string') {
- this.cfg.setProperty("container", document.getElementById(container), true);
- }
-};
-
-/**
-* The default event handler fired when the "context" property is changed.
-* @method configContext
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Tooltip.prototype.configContext = function(type, args, obj) {
- var context = args[0];
- if (context) {
-
- // Normalize parameter into an array
- if (! (context instanceof Array)) {
- if (typeof context == "string") {
- this.cfg.setProperty("context", [document.getElementById(context)], true);
- } else { // Assuming this is an element
- this.cfg.setProperty("context", [context], true);
- }
- context = this.cfg.getProperty("context");
- }
-
-
- // Remove any existing mouseover/mouseout listeners
- if (this._context) {
- for (var c=0;cOR
-* @param {HTMLElement} el The element representing the Panel
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Panel. See configuration documentation for more details.
-*/
-YAHOO.widget.Panel = function(el, userConfig) {
- YAHOO.widget.Panel.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.Panel, YAHOO.widget.Overlay);
-
-/**
-* Constant representing the default CSS class used for a Panel
-* @property YAHOO.widget.Panel.CSS_PANEL
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Panel.CSS_PANEL = "panel";
-
-/**
-* Constant representing the default CSS class used for a Panel's wrapping container
-* @property YAHOO.widget.Panel.CSS_PANEL_CONTAINER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Panel.CSS_PANEL_CONTAINER = "panel-container";
-
-/**
-* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
-* @method init
-* @param {String} el The element ID representing the Overlay OR
-* @param {HTMLElement} el The element representing the Overlay
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
-*/
-YAHOO.widget.Panel.prototype.init = function(el, userConfig) {
- YAHOO.widget.Panel.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
-
- this.beforeInitEvent.fire(YAHOO.widget.Panel);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Panel.CSS_PANEL);
-
- this.buildWrapper();
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- this.beforeRenderEvent.subscribe(function() {
- var draggable = this.cfg.getProperty("draggable");
- if (draggable) {
- if (! this.header) {
- this.setHeader(" ");
- }
- }
- }, this, true);
-
- var me = this;
-
- this.showMaskEvent.subscribe(function() {
- var checkFocusable = function(el) {
- if (el.tagName == "A" || el.tagName == "BUTTON" || el.tagName == "SELECT" || el.tagName == "INPUT" || el.tagName == "TEXTAREA" || el.tagName == "FORM") {
- if (! YAHOO.util.Dom.isAncestor(me.element, el)) {
- YAHOO.util.Event.addListener(el, "focus", el.blur);
- return true;
- }
- } else {
- return false;
- }
- };
-
- this.focusableElements = YAHOO.util.Dom.getElementsBy(checkFocusable);
- }, this, true);
-
- this.hideMaskEvent.subscribe(function() {
- for (var i=0;iOR
-* @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
-* @return {boolean} Success or failure of the render
-*/
-YAHOO.widget.Panel.prototype.render = function(appendToNode) {
- return YAHOO.widget.Panel.superclass.render.call(this, appendToNode, this.innerElement);
-};
-
-/**
-* Returns a String representation of the object.
-* @method toString
-* @return {String} The string representation of the Panel.
-*/
-YAHOO.widget.Panel.prototype.toString = function() {
- return "Panel " + this.id;
-};
-
-/**
-* Dialog is an implementation of Panel that can be used to submit form data. Built-in functionality for buttons with event handlers is included, and button sets can be build dynamically, or the preincluded ones for Submit/Cancel and OK/Cancel can be utilized. Forms can be processed in 3 ways -- via an asynchronous Connection utility call, a simple form POST or GET, or manually.
-* @namespace YAHOO.widget
-* @class Dialog
-* @extends YAHOO.widget.Panel
-* @constructor
-* @param {String} el The element ID representing the Dialog OR
-* @param {HTMLElement} el The element representing the Dialog
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.
-*/
-YAHOO.widget.Dialog = function(el, userConfig) {
- YAHOO.widget.Dialog.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.Dialog, YAHOO.widget.Panel);
-
-/**
-* Constant representing the default CSS class used for a Dialog
-* @property YAHOO.widget.Dialog.CSS_DIALOG
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Dialog.CSS_DIALOG = "dialog";
-
-/**
-* Initializes the class's configurable properties which can be changed using the Dialog's Config object (cfg).
-* @method initDefaultConfig
-*/
-YAHOO.widget.Dialog.prototype.initDefaultConfig = function() {
- YAHOO.widget.Dialog.superclass.initDefaultConfig.call(this);
-
- /**
- * The internally maintained callback object for use with the Connection utility
- * @property callback
- * @type Object
- */
- this.callback = {
- /**
- * The function to execute upon success of the Connection submission
- * @property callback.success
- * @type Function
- */
- success : null,
- /**
- * The function to execute upon failure of the Connection submission
- * @property callback.failure
- * @type Function
- */
- failure : null,
- /**
- * The arbitraty argument or arguments to pass to the Connection callback functions
- * @property callback.argument
- * @type Object
- */
- argument: null
- };
-
- // Add form dialog config properties //
-
- /**
- * The method to use for posting the Dialog's form. Possible values are "async", "form", and "manual".
- * @config postmethod
- * @type String
- * @default async
- */
- this.cfg.addProperty("postmethod", { value:"async", validator:function(val) {
- if (val != "form" && val != "async" && val != "none" && val != "manual") {
- return false;
- } else {
- return true;
- }
- } });
-
- /**
- * Object literal(s) defining the buttons for the Dialog's footer.
- * @config buttons
- * @type Object[]
- * @default "none"
- */
- this.cfg.addProperty("buttons", { value:"none", handler:this.configButtons } );
-};
-
-/**
-* Initializes the custom events for Dialog which are fired automatically at appropriate times by the Dialog class.
-* @method initEvents
-*/
-YAHOO.widget.Dialog.prototype.initEvents = function() {
- YAHOO.widget.Dialog.superclass.initEvents.call(this);
-
- /**
- * CustomEvent fired prior to submission
- * @event beforeSumitEvent
- */
- this.beforeSubmitEvent = new YAHOO.util.CustomEvent("beforeSubmit");
-
- /**
- * CustomEvent fired after submission
- * @event submitEvent
- */
- this.submitEvent = new YAHOO.util.CustomEvent("submit");
-
- /**
- * CustomEvent fired prior to manual submission
- * @event manualSubmitEvent
- */
- this.manualSubmitEvent = new YAHOO.util.CustomEvent("manualSubmit");
-
- /**
- * CustomEvent fired prior to asynchronous submission
- * @event asyncSubmitEvent
- */
- this.asyncSubmitEvent = new YAHOO.util.CustomEvent("asyncSubmit");
-
- /**
- * CustomEvent fired prior to form-based submission
- * @event formSubmitEvent
- */
- this.formSubmitEvent = new YAHOO.util.CustomEvent("formSubmit");
-
- /**
- * CustomEvent fired after cancel
- * @event cancelEvent
- */
- this.cancelEvent = new YAHOO.util.CustomEvent("cancel");
-};
-
-/**
-* The Dialog initialization method, which is executed for Dialog and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
-* @method init
-* @param {String} el The element ID representing the Dialog OR
-* @param {HTMLElement} el The element representing the Dialog
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.
-*/
-YAHOO.widget.Dialog.prototype.init = function(el, userConfig) {
- YAHOO.widget.Dialog.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
-
- this.beforeInitEvent.fire(YAHOO.widget.Dialog);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Dialog.CSS_DIALOG);
-
- this.cfg.setProperty("visible", false);
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- this.renderEvent.subscribe(this.registerForm, this, true);
-
- this.showEvent.subscribe(this.focusFirst, this, true);
- this.beforeHideEvent.subscribe(this.blurButtons, this, true);
-
- this.beforeRenderEvent.subscribe(function() {
- var buttonCfg = this.cfg.getProperty("buttons");
- if (buttonCfg && buttonCfg != "none") {
- if (! this.footer) {
- this.setFooter("");
- }
- }
- }, this, true);
-
- this.initEvent.fire(YAHOO.widget.Dialog);
-};
-
-/**
-* Performs the submission of the Dialog form depending on the value of "postmethod" property.
-* @method doSubmit
-*/
-YAHOO.widget.Dialog.prototype.doSubmit = function() {
- var pm = this.cfg.getProperty("postmethod");
- switch (pm) {
- case "async":
- var method = this.form.getAttribute("method") || 'POST';
- method = method.toUpperCase();
- YAHOO.util.Connect.setForm(this.form);
- var cObj = YAHOO.util.Connect.asyncRequest(method, this.form.getAttribute("action"), this.callback);
- this.asyncSubmitEvent.fire();
- break;
- case "form":
- this.form.submit();
- this.formSubmitEvent.fire();
- break;
- case "none":
- case "manual":
- this.manualSubmitEvent.fire();
- break;
- }
-};
-
-/**
-* Prepares the Dialog's internal FORM object, creating one if one is not currently present.
-* @method registerForm
-*/
-YAHOO.widget.Dialog.prototype.registerForm = function() {
- var form = this.element.getElementsByTagName("FORM")[0];
-
- if (! form) {
- var formHTML = "";
- this.body.innerHTML += formHTML;
- form = this.element.getElementsByTagName("FORM")[0];
- }
-
- this.firstFormElement = function() {
- for (var f=0;f=0;f-- ) {
- var el = form.elements[f];
- if (el.focus) {
- if (el.type && el.type != "hidden") {
- return el;
- }
- }
- }
- return null;
- }();
-
- this.form = form;
-
- if (this.cfg.getProperty("modal") && this.form) {
-
- var me = this;
-
- var firstElement = this.firstFormElement || this.firstButton;
- if (firstElement) {
- this.preventBackTab = new YAHOO.util.KeyListener(firstElement, { shift:true, keys:9 }, {fn:me.focusLast, scope:me, correctScope:true} );
- this.showEvent.subscribe(this.preventBackTab.enable, this.preventBackTab, true);
- this.hideEvent.subscribe(this.preventBackTab.disable, this.preventBackTab, true);
- }
-
- var lastElement = this.lastButton || this.lastFormElement;
- if (lastElement) {
- this.preventTabOut = new YAHOO.util.KeyListener(lastElement, { shift:false, keys:9 }, {fn:me.focusFirst, scope:me, correctScope:true} );
- this.showEvent.subscribe(this.preventTabOut.enable, this.preventTabOut, true);
- this.hideEvent.subscribe(this.preventTabOut.disable, this.preventTabOut, true);
- }
- }
-};
-
-// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* The default event handler for the "buttons" configuration property
-* @method configButtons
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Dialog.prototype.configButtons = function(type, args, obj) {
- var buttons = args[0];
- if (buttons != "none") {
- this.buttonSpan = null;
- this.buttonSpan = document.createElement("SPAN");
- this.buttonSpan.className = "button-group";
-
- for (var b=0;bOR
-* @param {HTMLElement} el The element representing the SimpleDialog
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.
-*/
-YAHOO.widget.SimpleDialog = function(el, userConfig) {
- YAHOO.widget.SimpleDialog.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.SimpleDialog, YAHOO.widget.Dialog);
-
-/**
-* Constant for the standard network icon for a blocking action
-* @property YAHOO.widget.SimpleDialog.ICON_BLOCK
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_BLOCK = "nt/ic/ut/bsc/blck16_1.gif";
-
-/**
-* Constant for the standard network icon for alarm
-* @property YAHOO.widget.SimpleDialog.ICON_ALARM
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_ALARM = "nt/ic/ut/bsc/alrt16_1.gif";
-
-/**
-* Constant for the standard network icon for help
-* @property YAHOO.widget.SimpleDialog.ICON_HELP
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_HELP = "nt/ic/ut/bsc/hlp16_1.gif";
-
-/**
-* Constant for the standard network icon for info
-* @property YAHOO.widget.SimpleDialog.ICON_INFO
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_INFO = "nt/ic/ut/bsc/info16_1.gif";
-
-/**
-* Constant for the standard network icon for warn
-* @property YAHOO.widget.SimpleDialog.ICON_WARN
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_WARN = "nt/ic/ut/bsc/warn16_1.gif";
-
-/**
-* Constant for the standard network icon for a tip
-* @property YAHOO.widget.SimpleDialog.ICON_TIP
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.ICON_TIP = "nt/ic/ut/bsc/tip16_1.gif";
-
-/**
-* Constant representing the default CSS class used for a SimpleDialog
-* @property YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG = "simple-dialog";
-
-/**
-* Initializes the class's configurable properties which can be changed using the SimpleDialog's Config object (cfg).
-* @method initDefaultConfig
-*/
-YAHOO.widget.SimpleDialog.prototype.initDefaultConfig = function() {
- YAHOO.widget.SimpleDialog.superclass.initDefaultConfig.call(this);
-
- // Add dialog config properties //
-
- /**
- * Sets the informational icon for the SimpleDialog
- * @config icon
- * @type String
- * @default "none"
- */
- this.cfg.addProperty("icon", { value:"none", handler:this.configIcon, suppressEvent:true } );
-
- /**
- * Sets the text for the SimpleDialog
- * @config text
- * @type String
- * @default ""
- */
- this.cfg.addProperty("text", { value:"", handler:this.configText, suppressEvent:true, supercedes:["icon"] } );
-};
-
-
-/**
-* The SimpleDialog initialization method, which is executed for SimpleDialog and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
-* @method init
-* @param {String} el The element ID representing the SimpleDialog OR
-* @param {HTMLElement} el The element representing the SimpleDialog
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.
-*/
-YAHOO.widget.SimpleDialog.prototype.init = function(el, userConfig) {
- YAHOO.widget.SimpleDialog.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
-
- this.beforeInitEvent.fire(YAHOO.widget.SimpleDialog);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG);
-
- this.cfg.queueProperty("postmethod", "manual");
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- this.beforeRenderEvent.subscribe(function() {
- if (! this.body) {
- this.setBody("");
- }
- }, this, true);
-
- this.initEvent.fire(YAHOO.widget.SimpleDialog);
-
-};
-/**
-* Prepares the SimpleDialog's internal FORM object, creating one if one is not currently present, and adding the value hidden field.
-* @method registerForm
-*/
-YAHOO.widget.SimpleDialog.prototype.registerForm = function() {
- YAHOO.widget.SimpleDialog.superclass.registerForm.call(this);
- this.form.innerHTML += " ";
-};
-
-// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* Fired when the "icon" property is set.
-* @method configIcon
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.SimpleDialog.prototype.configIcon = function(type,args,obj) {
- var icon = args[0];
- if (icon && icon != "none") {
- var iconHTML = " ";
- this.body.innerHTML = iconHTML + this.body.innerHTML;
- }
-};
-
-/**
-* Fired when the "text" property is set.
-* @method configText
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.SimpleDialog.prototype.configText = function(type,args,obj) {
- var text = args[0];
- if (text) {
- this.setBody(text);
- this.cfg.refireEvent("icon");
- }
-};
-// END BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* Returns a string representation of the object.
-* @method toString
-* @return {String} The string representation of the SimpleDialog
-*/
-YAHOO.widget.SimpleDialog.prototype.toString = function() {
- return "SimpleDialog " + this.id;
-};
-
-/**
-* ContainerEffect encapsulates animation transitions that are executed when an Overlay is shown or hidden.
-* @namespace YAHOO.widget
-* @class ContainerEffect
-* @constructor
-* @param {YAHOO.widget.Overlay} overlay The Overlay that the animation should be associated with
-* @param {Object} attrIn The object literal representing the animation arguments to be used for the animate-in transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(Number), and method(i.e. YAHOO.util.Easing.easeIn).
-* @param {Object} attrOut The object literal representing the animation arguments to be used for the animate-out transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(Number), and method(i.e. YAHOO.util.Easing.easeIn).
-* @param {HTMLElement} targetElement Optional. The target element that should be animated during the transition. Defaults to overlay.element.
-* @param {class} Optional. The animation class to instantiate. Defaults to YAHOO.util.Anim. Other options include YAHOO.util.Motion.
-*/
-YAHOO.widget.ContainerEffect = function(overlay, attrIn, attrOut, targetElement, animClass) {
- if (! animClass) {
- animClass = YAHOO.util.Anim;
- }
-
- /**
- * The overlay to animate
- * @property overlay
- * @type YAHOO.widget.Overlay
- */
- this.overlay = overlay;
- /**
- * The animation attributes to use when transitioning into view
- * @property attrIn
- * @type Object
- */
- this.attrIn = attrIn;
- /**
- * The animation attributes to use when transitioning out of view
- * @property attrOut
- * @type Object
- */
- this.attrOut = attrOut;
- /**
- * The target element to be animated
- * @property targetElement
- * @type HTMLElement
- */
- this.targetElement = targetElement || overlay.element;
- /**
- * The animation class to use for animating the overlay
- * @property animClass
- * @type class
- */
- this.animClass = animClass;
-};
-
-/**
-* Initializes the animation classes and events.
-* @method init
-*/
-YAHOO.widget.ContainerEffect.prototype.init = function() {
- this.beforeAnimateInEvent = new YAHOO.util.CustomEvent("beforeAnimateIn");
- this.beforeAnimateOutEvent = new YAHOO.util.CustomEvent("beforeAnimateOut");
-
- this.animateInCompleteEvent = new YAHOO.util.CustomEvent("animateInComplete");
- this.animateOutCompleteEvent = new YAHOO.util.CustomEvent("animateOutComplete");
-
- this.animIn = new this.animClass(this.targetElement, this.attrIn.attributes, this.attrIn.duration, this.attrIn.method);
- this.animIn.onStart.subscribe(this.handleStartAnimateIn, this);
- this.animIn.onTween.subscribe(this.handleTweenAnimateIn, this);
- this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn, this);
-
- this.animOut = new this.animClass(this.targetElement, this.attrOut.attributes, this.attrOut.duration, this.attrOut.method);
- this.animOut.onStart.subscribe(this.handleStartAnimateOut, this);
- this.animOut.onTween.subscribe(this.handleTweenAnimateOut, this);
- this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut, this);
-};
-
-/**
-* Triggers the in-animation.
-* @method animateIn
-*/
-YAHOO.widget.ContainerEffect.prototype.animateIn = function() {
- this.beforeAnimateInEvent.fire();
- this.animIn.animate();
-};
-
-/**
-* Triggers the out-animation.
-* @method animateOut
-*/
-YAHOO.widget.ContainerEffect.prototype.animateOut = function() {
- this.beforeAnimateOutEvent.fire();
- this.animOut.animate();
-};
-
-/**
-* The default onStart handler for the in-animation.
-* @method handleStartAnimateIn
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn = function(type, args, obj) { };
-/**
-* The default onTween handler for the in-animation.
-* @method handleTweenAnimateIn
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn = function(type, args, obj) { };
-/**
-* The default onComplete handler for the in-animation.
-* @method handleCompleteAnimateIn
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn = function(type, args, obj) { };
-
-/**
-* The default onStart handler for the out-animation.
-* @method handleStartAnimateOut
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut = function(type, args, obj) { };
-/**
-* The default onTween handler for the out-animation.
-* @method handleTweenAnimateOut
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut = function(type, args, obj) { };
-/**
-* The default onComplete handler for the out-animation.
-* @method handleCompleteAnimateOut
-* @param {String} type The CustomEvent type
-* @param {Object[]} args The CustomEvent arguments
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut = function(type, args, obj) { };
-
-/**
-* Returns a string representation of the object.
-* @method toString
-* @return {String} The string representation of the ContainerEffect
-*/
-YAHOO.widget.ContainerEffect.prototype.toString = function() {
- var output = "ContainerEffect";
- if (this.overlay) {
- output += " [" + this.overlay.toString() + "]";
- }
- return output;
-};
-
-/**
-* A pre-configured ContainerEffect instance that can be used for fading an overlay in and out.
-* @method FADE
-* @static
-* @param {Overlay} The Overlay object to animate
-* @param {Number} The duration of the animation
-* @return {ContainerEffect} The configured ContainerEffect object
-*/
-YAHOO.widget.ContainerEffect.FADE = function(overlay, dur) {
- var fade = new YAHOO.widget.ContainerEffect(overlay, { attributes:{opacity: {from:0, to:1}}, duration:dur, method:YAHOO.util.Easing.easeIn }, { attributes:{opacity: {to:0}}, duration:dur, method:YAHOO.util.Easing.easeOut}, overlay.element );
-
- fade.handleStartAnimateIn = function(type,args,obj) {
- YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");
-
- if (! obj.overlay.underlay) {
- obj.overlay.cfg.refireEvent("underlay");
- }
-
- if (obj.overlay.underlay) {
- obj.initialUnderlayOpacity = YAHOO.util.Dom.getStyle(obj.overlay.underlay, "opacity");
- obj.overlay.underlay.style.filter = null;
- }
-
- YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");
- YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 0);
- };
-
- fade.handleCompleteAnimateIn = function(type,args,obj) {
- YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");
-
- if (obj.overlay.element.style.filter) {
- obj.overlay.element.style.filter = null;
- }
-
- if (obj.overlay.underlay) {
- YAHOO.util.Dom.setStyle(obj.overlay.underlay, "opacity", obj.initialUnderlayOpacity);
- }
-
- obj.overlay.cfg.refireEvent("iframe");
- obj.animateInCompleteEvent.fire();
- };
-
- fade.handleStartAnimateOut = function(type, args, obj) {
- YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");
-
- if (obj.overlay.underlay) {
- obj.overlay.underlay.style.filter = null;
- }
- };
-
- fade.handleCompleteAnimateOut = function(type, args, obj) {
- YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");
- if (obj.overlay.element.style.filter) {
- obj.overlay.element.style.filter = null;
- }
- YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");
- YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 1);
-
- obj.overlay.cfg.refireEvent("iframe");
-
- obj.animateOutCompleteEvent.fire();
- };
-
- fade.init();
- return fade;
-};
-
-
-/**
-* A pre-configured ContainerEffect instance that can be used for sliding an overlay in and out.
-* @method SLIDE
-* @static
-* @param {Overlay} The Overlay object to animate
-* @param {Number} The duration of the animation
-* @return {ContainerEffect} The configured ContainerEffect object
-*/
-YAHOO.widget.ContainerEffect.SLIDE = function(overlay, dur) {
- var x = overlay.cfg.getProperty("x") || YAHOO.util.Dom.getX(overlay.element);
- var y = overlay.cfg.getProperty("y") || YAHOO.util.Dom.getY(overlay.element);
-
- var clientWidth = YAHOO.util.Dom.getClientWidth();
- var offsetWidth = overlay.element.offsetWidth;
-
- var slide = new YAHOO.widget.ContainerEffect(overlay, {
- attributes:{ points: { to:[x, y] } },
- duration:dur,
- method:YAHOO.util.Easing.easeIn
- },
- {
- attributes:{ points: { to:[(clientWidth+25), y] } },
- duration:dur,
- method:YAHOO.util.Easing.easeOut
- },
- overlay.element,
- YAHOO.util.Motion);
-
-
- slide.handleStartAnimateIn = function(type,args,obj) {
- obj.overlay.element.style.left = (-25-offsetWidth) + "px";
- obj.overlay.element.style.top = y + "px";
- };
-
- slide.handleTweenAnimateIn = function(type, args, obj) {
-
-
- var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
-
- var currentX = pos[0];
- var currentY = pos[1];
-
- if (YAHOO.util.Dom.getStyle(obj.overlay.element, "visibility") == "hidden" && currentX < x) {
- YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");
- }
-
- obj.overlay.cfg.setProperty("xy", [currentX,currentY], true);
- obj.overlay.cfg.refireEvent("iframe");
- };
-
- slide.handleCompleteAnimateIn = function(type, args, obj) {
- obj.overlay.cfg.setProperty("xy", [x,y], true);
- obj.startX = x;
- obj.startY = y;
- obj.overlay.cfg.refireEvent("iframe");
- obj.animateInCompleteEvent.fire();
- };
-
- slide.handleStartAnimateOut = function(type, args, obj) {
- var vw = YAHOO.util.Dom.getViewportWidth();
-
- var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
-
- var yso = pos[1];
-
- var currentTo = obj.animOut.attributes.points.to;
- obj.animOut.attributes.points.to = [(vw+25), yso];
- };
-
- slide.handleTweenAnimateOut = function(type, args, obj) {
- var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
-
- var xto = pos[0];
- var yto = pos[1];
-
- obj.overlay.cfg.setProperty("xy", [xto,yto], true);
- obj.overlay.cfg.refireEvent("iframe");
- };
-
- slide.handleCompleteAnimateOut = function(type, args, obj) {
- YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");
-
- obj.overlay.cfg.setProperty("xy", [x,y]);
- obj.animateOutCompleteEvent.fire();
- };
-
- slide.init();
- return slide;
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version 0.12.0
+*/
+
+/**
+* Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.
+* @class YAHOO.util.Config
+* @constructor
+* @param {Object} owner The owner Object to which this Config Object belongs
+*/
+YAHOO.util.Config = function(owner) {
+ if (owner) {
+ this.init(owner);
+ }
+};
+
+YAHOO.util.Config.prototype = {
+
+ /**
+ * Object reference to the owner of this Config Object
+ * @property owner
+ * @type Object
+ */
+ owner : null,
+
+ /**
+ * Boolean flag that specifies whether a queue is currently being executed
+ * @property queueInProgress
+ * @type Boolean
+ */
+ queueInProgress : false,
+
+
+ /**
+ * Validates that the value passed in is a Boolean.
+ * @method checkBoolean
+ * @param {Object} val The value to validate
+ * @return {Boolean} true, if the value is valid
+ */
+ checkBoolean: function(val) {
+ if (typeof val == 'boolean') {
+ return true;
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Validates that the value passed in is a number.
+ * @method checkNumber
+ * @param {Object} val The value to validate
+ * @return {Boolean} true, if the value is valid
+ */
+ checkNumber: function(val) {
+ if (isNaN(val)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+};
+
+
+/**
+* Initializes the configuration Object and all of its local members.
+* @method init
+* @param {Object} owner The owner Object to which this Config Object belongs
+*/
+YAHOO.util.Config.prototype.init = function(owner) {
+
+ this.owner = owner;
+
+ /**
+ * Object reference to the owner of this Config Object
+ * @event configChangedEvent
+ */
+ this.configChangedEvent = new YAHOO.util.CustomEvent("configChanged");
+
+ this.queueInProgress = false;
+
+ /* Private Members */
+
+ /**
+ * Maintains the local collection of configuration property objects and their specified values
+ * @property config
+ * @private
+ * @type Object
+ */
+ var config = {};
+
+ /**
+ * Maintains the local collection of configuration property objects as they were initially applied.
+ * This object is used when resetting a property.
+ * @property initialConfig
+ * @private
+ * @type Object
+ */
+ var initialConfig = {};
+
+ /**
+ * Maintains the local, normalized CustomEvent queue
+ * @property eventQueue
+ * @private
+ * @type Object
+ */
+ var eventQueue = [];
+
+ /**
+ * Fires a configuration property event using the specified value.
+ * @method fireEvent
+ * @private
+ * @param {String} key The configuration property's name
+ * @param {value} Object The value of the correct type for the property
+ */
+ var fireEvent = function( key, value ) {
+ key = key.toLowerCase();
+
+ var property = config[key];
+
+ if (typeof property != 'undefined' && property.event) {
+ property.event.fire(value);
+ }
+ };
+ /* End Private Members */
+
+ /**
+ * Adds a property to the Config Object's private config hash.
+ * @method addProperty
+ * @param {String} key The configuration property's name
+ * @param {Object} propertyObject The Object containing all of this property's arguments
+ */
+ this.addProperty = function( key, propertyObject ) {
+ key = key.toLowerCase();
+
+ config[key] = propertyObject;
+
+ propertyObject.event = new YAHOO.util.CustomEvent(key);
+ propertyObject.key = key;
+
+ if (propertyObject.handler) {
+ propertyObject.event.subscribe(propertyObject.handler, this.owner, true);
+ }
+
+ this.setProperty(key, propertyObject.value, true);
+
+ if (! propertyObject.suppressEvent) {
+ this.queueProperty(key, propertyObject.value);
+ }
+ };
+
+ /**
+ * Returns a key-value configuration map of the values currently set in the Config Object.
+ * @method getConfig
+ * @return {Object} The current config, represented in a key-value map
+ */
+ this.getConfig = function() {
+ var cfg = {};
+
+ for (var prop in config) {
+ var property = config[prop];
+ if (typeof property != 'undefined' && property.event) {
+ cfg[prop] = property.value;
+ }
+ }
+
+ return cfg;
+ };
+
+ /**
+ * Returns the value of specified property.
+ * @method getProperty
+ * @param {String} key The name of the property
+ * @return {Object} The value of the specified property
+ */
+ this.getProperty = function(key) {
+ key = key.toLowerCase();
+
+ var property = config[key];
+ if (typeof property != 'undefined' && property.event) {
+ return property.value;
+ } else {
+ return undefined;
+ }
+ };
+
+ /**
+ * Resets the specified property's value to its initial value.
+ * @method resetProperty
+ * @param {String} key The name of the property
+ * @return {Boolean} True is the property was reset, false if not
+ */
+ this.resetProperty = function(key) {
+ key = key.toLowerCase();
+
+ var property = config[key];
+ if (typeof property != 'undefined' && property.event) {
+ if (initialConfig[key] && initialConfig[key] != 'undefined') {
+ this.setProperty(key, initialConfig[key]);
+ }
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ /**
+ * Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.
+ * @method setProperty
+ * @param {String} key The name of the property
+ * @param {String} value The value to set the property to
+ * @param {Boolean} silent Whether the value should be set silently, without firing the property event.
+ * @return {Boolean} True, if the set was successful, false if it failed.
+ */
+ this.setProperty = function(key, value, silent) {
+ key = key.toLowerCase();
+
+ if (this.queueInProgress && ! silent) {
+ this.queueProperty(key,value); // Currently running through a queue...
+ return true;
+ } else {
+ var property = config[key];
+ if (typeof property != 'undefined' && property.event) {
+ if (property.validator && ! property.validator(value)) { // validator
+ return false;
+ } else {
+ property.value = value;
+ if (! silent) {
+ fireEvent(key, value);
+ this.configChangedEvent.fire([key, value]);
+ }
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+ };
+
+ /**
+ * Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is
+ * moved from its current position to the end of the queue.
+ * @method queueProperty
+ * @param {String} key The name of the property
+ * @param {String} value The value to set the property to
+ * @return {Boolean} true, if the set was successful, false if it failed.
+ */
+ this.queueProperty = function(key, value) {
+ key = key.toLowerCase();
+
+ var property = config[key];
+
+ if (typeof property != 'undefined' && property.event) {
+ if (typeof value != 'undefined' && property.validator && ! property.validator(value)) { // validator
+ return false;
+ } else {
+
+ if (typeof value != 'undefined') {
+ property.value = value;
+ } else {
+ value = property.value;
+ }
+
+ var foundDuplicate = false;
+
+ for (var i=0;iOR
+* @param {HTMLElement} el The element representing the Module
+* @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
+*/
+YAHOO.widget.Module = function(el, userConfig) {
+ if (el) {
+ this.init(el, userConfig);
+ }
+};
+
+/**
+* Constant representing the prefix path to use for non-secure images
+* @property YAHOO.widget.Module.IMG_ROOT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";
+
+/**
+* Constant representing the prefix path to use for securely served images
+* @property YAHOO.widget.Module.IMG_ROOT_SSL
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";
+
+/**
+* Constant for the default CSS class name that represents a Module
+* @property YAHOO.widget.Module.CSS_MODULE
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_MODULE = "module";
+
+/**
+* Constant representing the module header
+* @property YAHOO.widget.Module.CSS_HEADER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_HEADER = "hd";
+
+/**
+* Constant representing the module body
+* @property YAHOO.widget.Module.CSS_BODY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_BODY = "bd";
+
+/**
+* Constant representing the module footer
+* @property YAHOO.widget.Module.CSS_FOOTER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_FOOTER = "ft";
+
+/**
+* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size
+* @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
+
+YAHOO.widget.Module.prototype = {
+ /**
+ * The class's constructor function
+ * @property contructor
+ * @type Function
+ */
+ constructor : YAHOO.widget.Module,
+
+ /**
+ * The main module element that contains the header, body, and footer
+ * @property element
+ * @type HTMLElement
+ */
+ element : null,
+
+ /**
+ * The header element, denoted with CSS class "hd"
+ * @property header
+ * @type HTMLElement
+ */
+ header : null,
+
+ /**
+ * The body element, denoted with CSS class "bd"
+ * @property body
+ * @type HTMLElement
+ */
+ body : null,
+
+ /**
+ * The footer element, denoted with CSS class "ft"
+ * @property footer
+ * @type HTMLElement
+ */
+ footer : null,
+
+ /**
+ * The id of the element
+ * @property id
+ * @type String
+ */
+ id : null,
+
+ /**
+ * The String representing the image root
+ * @property imageRoot
+ * @type String
+ */
+ imageRoot : YAHOO.widget.Module.IMG_ROOT,
+
+ /**
+ * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
+ * @method initEvents
+ */
+ initEvents : function() {
+
+ /**
+ * CustomEvent fired prior to class initalization.
+ * @event beforeInitEvent
+ * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
+ */
+ this.beforeInitEvent = new YAHOO.util.CustomEvent("beforeInit");
+
+ /**
+ * CustomEvent fired after class initalization.
+ * @event initEvent
+ * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
+ */
+ this.initEvent = new YAHOO.util.CustomEvent("init");
+
+ /**
+ * CustomEvent fired when the Module is appended to the DOM
+ * @event appendEvent
+ */
+ this.appendEvent = new YAHOO.util.CustomEvent("append");
+
+ /**
+ * CustomEvent fired before the Module is rendered
+ * @event beforeRenderEvent
+ */
+ this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
+
+ /**
+ * CustomEvent fired after the Module is rendered
+ * @event renderEvent
+ */
+ this.renderEvent = new YAHOO.util.CustomEvent("render");
+
+ /**
+ * CustomEvent fired when the header content of the Module is modified
+ * @event changeHeaderEvent
+ * @param {String/HTMLElement} content String/element representing the new header content
+ */
+ this.changeHeaderEvent = new YAHOO.util.CustomEvent("changeHeader");
+
+ /**
+ * CustomEvent fired when the body content of the Module is modified
+ * @event changeBodyEvent
+ * @param {String/HTMLElement} content String/element representing the new body content
+ */
+ this.changeBodyEvent = new YAHOO.util.CustomEvent("changeBody");
+
+ /**
+ * CustomEvent fired when the footer content of the Module is modified
+ * @event changeFooterEvent
+ * @param {String/HTMLElement} content String/element representing the new footer content
+ */
+ this.changeFooterEvent = new YAHOO.util.CustomEvent("changeFooter");
+
+ /**
+ * CustomEvent fired when the content of the Module is modified
+ * @event changeContentEvent
+ */
+ this.changeContentEvent = new YAHOO.util.CustomEvent("changeContent");
+
+ /**
+ * CustomEvent fired when the Module is destroyed
+ * @event destroyEvent
+ */
+ this.destroyEvent = new YAHOO.util.CustomEvent("destroy");
+
+ /**
+ * CustomEvent fired before the Module is shown
+ * @event beforeShowEvent
+ */
+ this.beforeShowEvent = new YAHOO.util.CustomEvent("beforeShow");
+
+ /**
+ * CustomEvent fired after the Module is shown
+ * @event showEvent
+ */
+ this.showEvent = new YAHOO.util.CustomEvent("show");
+
+ /**
+ * CustomEvent fired before the Module is hidden
+ * @event beforeHideEvent
+ */
+ this.beforeHideEvent = new YAHOO.util.CustomEvent("beforeHide");
+
+ /**
+ * CustomEvent fired after the Module is hidden
+ * @event hideEvent
+ */
+ this.hideEvent = new YAHOO.util.CustomEvent("hide");
+ },
+
+ /**
+ * String representing the current user-agent platform
+ * @property platform
+ * @type String
+ */
+ platform : function() {
+ var ua = navigator.userAgent.toLowerCase();
+ if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {
+ return "windows";
+ } else if (ua.indexOf("macintosh") != -1) {
+ return "mac";
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * String representing the current user-agent browser
+ * @property browser
+ * @type String
+ */
+ browser : function() {
+ var ua = navigator.userAgent.toLowerCase();
+ if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
+ return 'opera';
+ } else if (ua.indexOf('msie 7')!=-1) { // IE7
+ return 'ie7';
+ } else if (ua.indexOf('msie') !=-1) { // IE
+ return 'ie';
+ } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
+ return 'safari';
+ } else if (ua.indexOf('gecko') != -1) { // Gecko
+ return 'gecko';
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * Boolean representing whether or not the current browsing context is secure (https)
+ * @property isSecure
+ * @type Boolean
+ */
+ isSecure : function() {
+ if (window.location.href.toLowerCase().indexOf("https") === 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
+ */
+ initDefaultConfig : function() {
+ // Add properties //
+
+ /**
+ * Specifies whether the Module is visible on the page.
+ * @config visible
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );
+
+ /**
+ * Object or array of objects representing the ContainerEffect classes that are active for animating the container.
+ * @config effect
+ * @type Object
+ * @default null
+ */
+ this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );
+
+ /**
+ * Specifies whether to create a special proxy iframe to monitor for user font resizing in the document
+ * @config monitorresize
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );
+ },
+
+ /**
+ * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+ * @method init
+ * @param {String} el The element ID representing the Module OR
+ * @param {HTMLElement} el The element representing the Module
+ * @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
+ */
+ init : function(el, userConfig) {
+
+ this.initEvents();
+
+ this.beforeInitEvent.fire(YAHOO.widget.Module);
+
+ /**
+ * The Module's Config object used for monitoring configuration properties.
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ if (this.isSecure) {
+ this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;
+ }
+
+ if (typeof el == "string") {
+ var elId = el;
+
+ el = document.getElementById(el);
+ if (! el) {
+ el = document.createElement("DIV");
+ el.id = elId;
+ }
+ }
+
+ this.element = el;
+
+ if (el.id) {
+ this.id = el.id;
+ }
+
+ var childNodes = this.element.childNodes;
+
+ if (childNodes) {
+ for (var i=0;iOR
+ * @param {HTMLElement} headerContent The HTMLElement to append to the header
+ */
+ setHeader : function(headerContent) {
+ if (! this.header) {
+ this.header = document.createElement("DIV");
+ this.header.className = YAHOO.widget.Module.CSS_HEADER;
+ }
+
+ if (typeof headerContent == "string") {
+ this.header.innerHTML = headerContent;
+ } else {
+ this.header.innerHTML = "";
+ this.header.appendChild(headerContent);
+ }
+
+ this.changeHeaderEvent.fire(headerContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the header. If no header is present, one will be automatically created.
+ * @method appendToHeader
+ * @param {HTMLElement} element The element to append to the header
+ */
+ appendToHeader : function(element) {
+ if (! this.header) {
+ this.header = document.createElement("DIV");
+ this.header.className = YAHOO.widget.Module.CSS_HEADER;
+ }
+
+ this.header.appendChild(element);
+ this.changeHeaderEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.
+ * @method setBody
+ * @param {String} bodyContent The HTML used to set the body OR
+ * @param {HTMLElement} bodyContent The HTMLElement to append to the body
+ */
+ setBody : function(bodyContent) {
+ if (! this.body) {
+ this.body = document.createElement("DIV");
+ this.body.className = YAHOO.widget.Module.CSS_BODY;
+ }
+
+ if (typeof bodyContent == "string")
+ {
+ this.body.innerHTML = bodyContent;
+ } else {
+ this.body.innerHTML = "";
+ this.body.appendChild(bodyContent);
+ }
+
+ this.changeBodyEvent.fire(bodyContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the body. If no body is present, one will be automatically created.
+ * @method appendToBody
+ * @param {HTMLElement} element The element to append to the body
+ */
+ appendToBody : function(element) {
+ if (! this.body) {
+ this.body = document.createElement("DIV");
+ this.body.className = YAHOO.widget.Module.CSS_BODY;
+ }
+
+ this.body.appendChild(element);
+ this.changeBodyEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.
+ * @method setFooter
+ * @param {String} footerContent The HTML used to set the footer OR
+ * @param {HTMLElement} footerContent The HTMLElement to append to the footer
+ */
+ setFooter : function(footerContent) {
+ if (! this.footer) {
+ this.footer = document.createElement("DIV");
+ this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
+ }
+
+ if (typeof footerContent == "string") {
+ this.footer.innerHTML = footerContent;
+ } else {
+ this.footer.innerHTML = "";
+ this.footer.appendChild(footerContent);
+ }
+
+ this.changeFooterEvent.fire(footerContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the footer. If no footer is present, one will be automatically created.
+ * @method appendToFooter
+ * @param {HTMLElement} element The element to append to the footer
+ */
+ appendToFooter : function(element) {
+ if (! this.footer) {
+ this.footer = document.createElement("DIV");
+ this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
+ }
+
+ this.footer.appendChild(element);
+ this.changeFooterEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.
+ * @method render
+ * @param {String} appendToNode The element id to which the Module should be appended to prior to rendering OR
+ * @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
+ * @param {HTMLElement} moduleElement OPTIONAL. The element that represents the actual Standard Module container.
+ * @return {Boolean} Success or failure of the render
+ */
+ render : function(appendToNode, moduleElement) {
+ this.beforeRenderEvent.fire();
+
+ if (! moduleElement) {
+ moduleElement = this.element;
+ }
+
+ var me = this;
+ var appendTo = function(element) {
+ if (typeof element == "string") {
+ element = document.getElementById(element);
+ }
+
+ if (element) {
+ element.appendChild(me.element);
+ me.appendEvent.fire();
+ }
+ };
+
+ if (appendToNode) {
+ appendTo(appendToNode);
+ } else { // No node was passed in. If the element is not pre-marked up, this fails
+ if (! YAHOO.util.Dom.inDocument(this.element)) {
+ return false;
+ }
+ }
+
+ // Need to get everything into the DOM if it isn't already
+
+ if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {
+ // There is a header, but it's not in the DOM yet... need to add it
+ var firstChild = moduleElement.firstChild;
+ if (firstChild) { // Insert before first child if exists
+ moduleElement.insertBefore(this.header, firstChild);
+ } else { // Append to empty body because there are no children
+ moduleElement.appendChild(this.header);
+ }
+ }
+
+ if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {
+ // There is a body, but it's not in the DOM yet... need to add it
+ if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM
+ moduleElement.insertBefore(this.body, this.footer);
+ } else { // Append to element because there is no footer
+ moduleElement.appendChild(this.body);
+ }
+ }
+
+ if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {
+ // There is a footer, but it's not in the DOM yet... need to add it
+ moduleElement.appendChild(this.footer);
+ }
+
+ this.renderEvent.fire();
+ return true;
+ },
+
+ /**
+ * Removes the Module element from the DOM and sets all child elements to null.
+ * @method destroy
+ */
+ destroy : function() {
+ if (this.element) {
+ var parent = this.element.parentNode;
+ }
+ if (parent) {
+ parent.removeChild(this.element);
+ }
+
+ this.element = null;
+ this.header = null;
+ this.body = null;
+ this.footer = null;
+
+ this.destroyEvent.fire();
+ },
+
+ /**
+ * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.
+ * @method show
+ */
+ show : function() {
+ this.cfg.setProperty("visible", true);
+ },
+
+ /**
+ * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.
+ * @method hide
+ */
+ hide : function() {
+ this.cfg.setProperty("visible", false);
+ },
+
+ // BUILT-IN EVENT HANDLERS FOR MODULE //
+
+ /**
+ * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".
+ * This method is responsible for firing showEvent and hideEvent.
+ * @param {String} type The CustomEvent type (usually the property name)
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+ * @method configVisible
+ */
+ configVisible : function(type, args, obj) {
+ var visible = args[0];
+ if (visible) {
+ this.beforeShowEvent.fire();
+ YAHOO.util.Dom.setStyle(this.element, "display", "block");
+ this.showEvent.fire();
+ } else {
+ this.beforeHideEvent.fire();
+ YAHOO.util.Dom.setStyle(this.element, "display", "none");
+ this.hideEvent.fire();
+ }
+ },
+
+ /**
+ * Default event handler for the "monitorresize" configuration property
+ * @param {String} type The CustomEvent type (usually the property name)
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+ * @method configMonitorResize
+ */
+ configMonitorResize : function(type, args, obj) {
+ var monitor = args[0];
+ if (monitor) {
+ this.initResizeMonitor();
+ } else {
+ YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);
+ this.resizeMonitor = null;
+ }
+ }
+};
+
+/**
+* Returns a String representation of the Object.
+* @method toString
+* @return {String} The string representation of the Module
+*/
+YAHOO.widget.Module.prototype.toString = function() {
+ return "Module " + this.id;
+};
+
+/**
+* Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.
+* @class Overlay
+* @namespace YAHOO.widget
+* @extends YAHOO.widget.Module
+* @param {String} el The element ID representing the Overlay OR
+* @param {HTMLElement} el The element representing the Overlay
+* @param {Object} userConfig The configuration object literal containing 10/23/2006the configuration that should be set for this Overlay. See configuration documentation for more details.
+* @constructor
+*/
+YAHOO.widget.Overlay = function(el, userConfig) {
+ YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);
+
+/**
+* The URL that will be placed in the iframe
+* @property YAHOO.widget.Overlay.IFRAME_SRC
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"
+
+/**
+* Constant representing the top left corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.TOP_LEFT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.TOP_LEFT = "tl";
+
+/**
+* Constant representing the top right corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.TOP_RIGHT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.TOP_RIGHT = "tr";
+
+/**
+* Constant representing the top bottom left corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.BOTTOM_LEFT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";
+
+/**
+* Constant representing the bottom right corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.BOTTOM_RIGHT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";
+
+/**
+* Constant representing the default CSS class used for an Overlay
+* @property YAHOO.widget.Overlay.CSS_OVERLAY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";
+
+/**
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+* @method init
+* @param {String} el The element ID representing the Overlay OR
+* @param {HTMLElement} el The element representing the Overlay
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
+*/
+YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {
+ YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
+
+ this.beforeInitEvent.fire(YAHOO.widget.Overlay);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ if (this.platform == "mac" && this.browser == "gecko") {
+ if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {
+ this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);
+ }
+ if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {
+ this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);
+ }
+ }
+
+ this.initEvent.fire(YAHOO.widget.Overlay);
+};
+
+/**
+* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.
+* @method initEvents
+*/
+YAHOO.widget.Overlay.prototype.initEvents = function() {
+ YAHOO.widget.Overlay.superclass.initEvents.call(this);
+
+ /**
+ * CustomEvent fired before the Overlay is moved.
+ * @event beforeMoveEvent
+ * @param {Number} x x coordinate
+ * @param {Number} y y coordinate
+ */
+ this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);
+
+ /**
+ * CustomEvent fired after the Overlay is moved.
+ * @event moveEvent
+ * @param {Number} x x coordinate
+ * @param {Number} y y coordinate
+ */
+ this.moveEvent = new YAHOO.util.CustomEvent("move", this);
+};
+
+/**
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
+* @method initDefaultConfig
+*/
+YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {
+ YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);
+
+ // Add overlay config properties //
+
+ /**
+ * The absolute x-coordinate position of the Overlay
+ * @config x
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * The absolute y-coordinate position of the Overlay
+ * @config y
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * An array with the absolute x and y positions of the Overlay
+ * @config xy
+ * @type Number[]
+ * @default null
+ */
+ this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * The array of context arguments for context-sensitive positioning. The format is: [id or element, element corner, context corner]. For example, setting this property to ["img1", "tl", "bl"] would align the Overlay's top left corner to the context element's bottom left corner.
+ * @config context
+ * @type Array
+ * @default null
+ */
+ this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * True if the Overlay should be anchored to the center of the viewport.
+ * @config fixedcenter
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );
+
+ /**
+ * CSS width of the Overlay.
+ * @config width
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * CSS height of the Overlay.
+ * @config height
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * CSS z-index of the Overlay.
+ * @config zIndex
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );
+
+ /**
+ * True if the Overlay should be prevented from being positioned out of the viewport.
+ * @config constraintoviewport
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );
+
+ /**
+ * True if the Overlay should have an IFRAME shim (for correcting the select z-index bug in IE6 and below).
+ * @config iframe
+ * @type Boolean
+ * @default true for IE6 and below, false for all others
+ */
+ this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );
+};
+
+/**
+* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);
+* @method moveTo
+* @param {Number} x The Overlay's new x position
+* @param {Number} y The Overlay's new y position
+*/
+YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {
+ this.cfg.setProperty("xy",[x,y]);
+};
+
+/**
+* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
+* @method hideMacGeckoScrollbars
+*/
+YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {
+ YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");
+ YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");
+};
+
+/**
+* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
+* @method showMacGeckoScrollbars
+*/
+YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {
+ YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");
+ YAHOO.util.Dom.addClass(this.element, "show-scrollbars");
+};
+
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.
+* @method configVisible
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {
+ var visible = args[0];
+
+ var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");
+
+ if (currentVis == "inherit") {
+ var e = this.element.parentNode;
+ while (e.nodeType != 9 && e.nodeType != 11) {
+ currentVis = YAHOO.util.Dom.getStyle(e, "visibility");
+ if (currentVis != "inherit") { break; }
+ e = e.parentNode;
+ }
+ if (currentVis == "inherit") {
+ currentVis = "visible";
+ }
+ }
+
+ var effect = this.cfg.getProperty("effect");
+
+ var effectInstances = [];
+ if (effect) {
+ if (effect instanceof Array) {
+ for (var i=0;i rightConstraint) {
+ x = rightConstraint;
+ }
+
+ if (y < topConstraint) {
+ y = topConstraint;
+ } else if (y > bottomConstraint) {
+ y = bottomConstraint;
+ }
+
+ this.cfg.setProperty("x", x, true);
+ this.cfg.setProperty("y", y, true);
+ this.cfg.setProperty("xy", [x,y], true);
+};
+
+/**
+* Centers the container in the viewport.
+* @method center
+*/
+YAHOO.widget.Overlay.prototype.center = function() {
+ var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+ var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+
+ var viewPortWidth = YAHOO.util.Dom.getClientWidth();
+ var viewPortHeight = YAHOO.util.Dom.getClientHeight();
+
+ var elementWidth = this.element.offsetWidth;
+ var elementHeight = this.element.offsetHeight;
+
+ var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;
+ var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;
+
+ this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
+
+ this.cfg.refireEvent("iframe");
+};
+
+/**
+* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.
+* @method syncPosition
+*/
+YAHOO.widget.Overlay.prototype.syncPosition = function() {
+ var pos = YAHOO.util.Dom.getXY(this.element);
+ this.cfg.setProperty("x", pos[0], true);
+ this.cfg.setProperty("y", pos[1], true);
+ this.cfg.setProperty("xy", pos, true);
+};
+
+/**
+* Event handler fired when the resize monitor element is resized.
+* @method onDomResize
+* @param {DOMEvent} e The resize DOM event
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {
+ YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);
+ var me = this;
+ setTimeout(function() {
+ me.syncPosition();
+ me.cfg.refireEvent("iframe");
+ me.cfg.refireEvent("context");
+ }, 0);
+};
+
+/**
+* Removes the Overlay element from the DOM and sets all child elements to null.
+* @method destroy
+*/
+YAHOO.widget.Overlay.prototype.destroy = function() {
+ if (this.iframe) {
+ this.iframe.parentNode.removeChild(this.iframe);
+ }
+
+ this.iframe = null;
+
+ YAHOO.widget.Overlay.superclass.destroy.call(this);
+};
+
+/**
+* Returns a String representation of the object.
+* @method toString
+* @return {String} The string representation of the Overlay.
+*/
+YAHOO.widget.Overlay.prototype.toString = function() {
+ return "Overlay " + this.id;
+};
+
+/**
+* A singleton CustomEvent used for reacting to the DOM event for window scroll
+* @event YAHOO.widget.Overlay.windowScrollEvent
+*/
+YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");
+
+/**
+* A singleton CustomEvent used for reacting to the DOM event for window resize
+* @event YAHOO.widget.Overlay.windowResizeEvent
+*/
+YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");
+
+/**
+* The DOM event handler used to fire the CustomEvent for window scroll
+* @method YAHOO.widget.Overlay.windowScrollHandler
+* @static
+* @param {DOMEvent} e The DOM scroll event
+*/
+YAHOO.widget.Overlay.windowScrollHandler = function(e) {
+ if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
+ if (! window.scrollEnd) {
+ window.scrollEnd = -1;
+ }
+ clearTimeout(window.scrollEnd);
+ window.scrollEnd = setTimeout(function() { YAHOO.widget.Overlay.windowScrollEvent.fire(); }, 1);
+ } else {
+ YAHOO.widget.Overlay.windowScrollEvent.fire();
+ }
+};
+
+/**
+* The DOM event handler used to fire the CustomEvent for window resize
+* @method YAHOO.widget.Overlay.windowResizeHandler
+* @static
+* @param {DOMEvent} e The DOM resize event
+*/
+YAHOO.widget.Overlay.windowResizeHandler = function(e) {
+ if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
+ if (! window.resizeEnd) {
+ window.resizeEnd = -1;
+ }
+ clearTimeout(window.resizeEnd);
+ window.resizeEnd = setTimeout(function() { YAHOO.widget.Overlay.windowResizeEvent.fire(); }, 100);
+ } else {
+ YAHOO.widget.Overlay.windowResizeEvent.fire();
+ }
+};
+
+/**
+* A boolean that indicated whether the window resize and scroll events have already been subscribed to.
+* @property YAHOO.widget.Overlay._initialized
+* @private
+* @type Boolean
+*/
+YAHOO.widget.Overlay._initialized = null;
+
+if (YAHOO.widget.Overlay._initialized === null) {
+ YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);
+ YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);
+
+ YAHOO.widget.Overlay._initialized = true;
+}
+
+/**
+* OverlayManager is used for maintaining the focus status of multiple Overlays.* @namespace YAHOO.widget
+* @namespace YAHOO.widget
+* @class OverlayManager
+* @constructor
+* @param {Array} overlays Optional. A collection of Overlays to register with the manager.
+* @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
+*/
+YAHOO.widget.OverlayManager = function(userConfig) {
+ this.init(userConfig);
+};
+
+/**
+* The CSS class representing a focused Overlay
+* @property YAHOO.widget.OverlayManager.CSS_FOCUSED
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";
+
+YAHOO.widget.OverlayManager.prototype = {
+ /**
+ * The class's constructor function
+ * @property contructor
+ * @type Function
+ */
+ constructor : YAHOO.widget.OverlayManager,
+
+ /**
+ * The array of Overlays that are currently registered
+ * @property overlays
+ * @type YAHOO.widget.Overlay[]
+ */
+ overlays : null,
+
+ /**
+ * Initializes the default configuration of the OverlayManager
+ * @method initDefaultConfig
+ */
+ initDefaultConfig : function() {
+ /**
+ * The collection of registered Overlays in use by the OverlayManager
+ * @config overlays
+ * @type YAHOO.widget.Overlay[]
+ * @default null
+ */
+ this.cfg.addProperty("overlays", { suppressEvent:true } );
+
+ /**
+ * The default DOM event that should be used to focus an Overlay
+ * @config focusevent
+ * @type String
+ * @default "mousedown"
+ */
+ this.cfg.addProperty("focusevent", { value:"mousedown" } );
+ },
+
+ /**
+ * Initializes the OverlayManager
+ * @method init
+ * @param {YAHOO.widget.Overlay[]} overlays Optional. A collection of Overlays to register with the manager.
+ * @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
+ */
+ init : function(userConfig) {
+ /**
+ * The OverlayManager's Config object used for monitoring configuration properties.
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ this.initDefaultConfig();
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+ this.cfg.fireQueue();
+
+ /**
+ * The currently activated Overlay
+ * @property activeOverlay
+ * @private
+ * @type YAHOO.widget.Overlay
+ */
+ var activeOverlay = null;
+
+ /**
+ * Returns the currently focused Overlay
+ * @method getActive
+ * @return {YAHOO.widget.Overlay} The currently focused Overlay
+ */
+ this.getActive = function() {
+ return activeOverlay;
+ };
+
+ /**
+ * Focuses the specified Overlay
+ * @method focus
+ * @param {YAHOO.widget.Overlay} overlay The Overlay to focus
+ * @param {String} overlay The id of the Overlay to focus
+ */
+ this.focus = function(overlay) {
+ var o = this.find(overlay);
+ if (o) {
+ this.blurAll();
+ activeOverlay = o;
+ YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);
+ this.overlays.sort(this.compareZIndexDesc);
+ var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");
+ if (! isNaN(topZIndex) && this.overlays[0] != overlay) {
+ activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex, 10) + 2));
+ }
+ this.overlays.sort(this.compareZIndexDesc);
+ }
+ };
+
+ /**
+ * Removes the specified Overlay from the manager
+ * @method remove
+ * @param {YAHOO.widget.Overlay} overlay The Overlay to remove
+ * @param {String} overlay The id of the Overlay to remove
+ */
+ this.remove = function(overlay) {
+ var o = this.find(overlay);
+ if (o) {
+ var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");
+ o.cfg.setProperty("zIndex", -1000, true);
+ this.overlays.sort(this.compareZIndexDesc);
+ this.overlays = this.overlays.slice(0, this.overlays.length-1);
+ o.cfg.setProperty("zIndex", originalZ, true);
+
+ o.cfg.setProperty("manager", null);
+ o.focusEvent = null;
+ o.blurEvent = null;
+ o.focus = null;
+ o.blur = null;
+ }
+ };
+
+ /**
+ * Removes focus from all registered Overlays in the manager
+ * @method blurAll
+ */
+ this.blurAll = function() {
+ activeOverlay = null;
+ for (var o=0;o 0) {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Attempts to locate an Overlay by instance or ID.
+ * @method find
+ * @param {YAHOO.widget.Overlay} overlay An Overlay to locate within the manager
+ * @param {String} overlay An Overlay id to locate within the manager
+ * @return {YAHOO.widget.Overlay} The requested Overlay, if found, or null if it cannot be located.
+ */
+ find : function(overlay) {
+ if (overlay instanceof YAHOO.widget.Overlay) {
+ for (var o=0;o zIndex2) {
+ return -1;
+ } else if (zIndex1 < zIndex2) {
+ return 1;
+ } else {
+ return 0;
+ }
+ },
+
+ /**
+ * Shows all Overlays in the manager.
+ * @method showAll
+ */
+ showAll : function() {
+ for (var o=0;oOR
+* @param {HTMLElement} el The element representing the Tooltip
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
+*/
+YAHOO.widget.Tooltip = function(el, userConfig) {
+ YAHOO.widget.Tooltip.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.Tooltip, YAHOO.widget.Overlay);
+
+/**
+* Constant representing the Tooltip CSS class
+* @property YAHOO.widget.Tooltip.CSS_TOOLTIP
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Tooltip.CSS_TOOLTIP = "tt";
+
+/**
+* The Tooltip initialization method. This method is automatically called by the constructor. A Tooltip is automatically rendered by the init method, and it also is set to be invisible by default, and constrained to viewport by default as well.
+* @method init
+* @param {String} el The element ID representing the Tooltip OR
+* @param {HTMLElement} el The element representing the Tooltip
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Tooltip. See configuration documentation for more details.
+*/
+YAHOO.widget.Tooltip.prototype.init = function(el, userConfig) {
+ if (document.readyState && document.readyState != "complete") {
+ var deferredInit = function() {
+ this.init(el, userConfig);
+ };
+ YAHOO.util.Event.addListener(window, "load", deferredInit, this, true);
+ } else {
+ YAHOO.widget.Tooltip.superclass.init.call(this, el);
+
+ this.beforeInitEvent.fire(YAHOO.widget.Tooltip);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Tooltip.CSS_TOOLTIP);
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ this.cfg.queueProperty("visible",false);
+ this.cfg.queueProperty("constraintoviewport",true);
+
+ this.setBody("");
+ this.render(this.cfg.getProperty("container"));
+
+ this.initEvent.fire(YAHOO.widget.Tooltip);
+ }
+};
+
+/**
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
+* @method initDefaultConfig
+*/
+YAHOO.widget.Tooltip.prototype.initDefaultConfig = function() {
+ YAHOO.widget.Tooltip.superclass.initDefaultConfig.call(this);
+
+ /**
+ * Specifies whether the Tooltip should be kept from overlapping its context element.
+ * @config preventoverlap
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("preventoverlap", { value:true, validator:this.cfg.checkBoolean, supercedes:["x","y","xy"] } );
+
+ /**
+ * The number of milliseconds to wait before showing a Tooltip on mouseover.
+ * @config showdelay
+ * @type Number
+ * @default 200
+ */
+ this.cfg.addProperty("showdelay", { value:200, handler:this.configShowDelay, validator:this.cfg.checkNumber } );
+
+ /**
+ * The number of milliseconds to wait before automatically dismissing a Tooltip after the mouse has been resting on the context element.
+ * @config autodismissdelay
+ * @type Number
+ * @default 5000
+ */
+ this.cfg.addProperty("autodismissdelay", { value:5000, handler:this.configAutoDismissDelay, validator:this.cfg.checkNumber } );
+
+ /**
+ * The number of milliseconds to wait before hiding a Tooltip on mouseover.
+ * @config hidedelay
+ * @type Number
+ * @default 250
+ */
+ this.cfg.addProperty("hidedelay", { value:250, handler:this.configHideDelay, validator:this.cfg.checkNumber } );
+
+ /**
+ * Specifies the Tooltip's text.
+ * @config text
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("text", { handler:this.configText, suppressEvent:true } );
+
+ /**
+ * Specifies the container element that the Tooltip's markup should be rendered into.
+ * @config container
+ * @type HTMLElement/String
+ * @default document.body
+ */
+ this.cfg.addProperty("container", { value:document.body, handler:this.configContainer } );
+
+ /**
+ * Specifies the element or elements that the Tooltip should be anchored to on mouseover.
+ * @config context
+ * @type HTMLElement[]/String[]
+ * @default null
+ */
+
+};
+
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* The default event handler fired when the "text" property is changed.
+* @method configText
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Tooltip.prototype.configText = function(type, args, obj) {
+ var text = args[0];
+ if (text) {
+ this.setBody(text);
+ }
+};
+
+/**
+* The default event handler fired when the "container" property is changed.
+* @method configContainer
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Tooltip.prototype.configContainer = function(type, args, obj) {
+ var container = args[0];
+ if (typeof container == 'string') {
+ this.cfg.setProperty("container", document.getElementById(container), true);
+ }
+};
+
+/**
+* The default event handler fired when the "context" property is changed.
+* @method configContext
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Tooltip.prototype.configContext = function(type, args, obj) {
+ var context = args[0];
+ if (context) {
+
+ // Normalize parameter into an array
+ if (! (context instanceof Array)) {
+ if (typeof context == "string") {
+ this.cfg.setProperty("context", [document.getElementById(context)], true);
+ } else { // Assuming this is an element
+ this.cfg.setProperty("context", [context], true);
+ }
+ context = this.cfg.getProperty("context");
+ }
+
+
+ // Remove any existing mouseover/mouseout listeners
+ if (this._context) {
+ for (var c=0;cOR
+* @param {HTMLElement} el The element representing the Panel
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Panel. See configuration documentation for more details.
+*/
+YAHOO.widget.Panel = function(el, userConfig) {
+ YAHOO.widget.Panel.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.Panel, YAHOO.widget.Overlay);
+
+/**
+* Constant representing the default CSS class used for a Panel
+* @property YAHOO.widget.Panel.CSS_PANEL
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Panel.CSS_PANEL = "panel";
+
+/**
+* Constant representing the default CSS class used for a Panel's wrapping container
+* @property YAHOO.widget.Panel.CSS_PANEL_CONTAINER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Panel.CSS_PANEL_CONTAINER = "panel-container";
+
+/**
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+* @method init
+* @param {String} el The element ID representing the Overlay OR
+* @param {HTMLElement} el The element representing the Overlay
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
+*/
+YAHOO.widget.Panel.prototype.init = function(el, userConfig) {
+ YAHOO.widget.Panel.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
+
+ this.beforeInitEvent.fire(YAHOO.widget.Panel);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Panel.CSS_PANEL);
+
+ this.buildWrapper();
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ this.beforeRenderEvent.subscribe(function() {
+ var draggable = this.cfg.getProperty("draggable");
+ if (draggable) {
+ if (! this.header) {
+ this.setHeader(" ");
+ }
+ }
+ }, this, true);
+
+ var me = this;
+
+ this.showMaskEvent.subscribe(function() {
+ var checkFocusable = function(el) {
+ if (el.tagName == "A" || el.tagName == "BUTTON" || el.tagName == "SELECT" || el.tagName == "INPUT" || el.tagName == "TEXTAREA" || el.tagName == "FORM") {
+ if (! YAHOO.util.Dom.isAncestor(me.element, el)) {
+ YAHOO.util.Event.addListener(el, "focus", el.blur);
+ return true;
+ }
+ } else {
+ return false;
+ }
+ };
+
+ this.focusableElements = YAHOO.util.Dom.getElementsBy(checkFocusable);
+ }, this, true);
+
+ this.hideMaskEvent.subscribe(function() {
+ for (var i=0;iOR
+* @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
+* @return {boolean} Success or failure of the render
+*/
+YAHOO.widget.Panel.prototype.render = function(appendToNode) {
+ return YAHOO.widget.Panel.superclass.render.call(this, appendToNode, this.innerElement);
+};
+
+/**
+* Returns a String representation of the object.
+* @method toString
+* @return {String} The string representation of the Panel.
+*/
+YAHOO.widget.Panel.prototype.toString = function() {
+ return "Panel " + this.id;
+};
+
+/**
+* Dialog is an implementation of Panel that can be used to submit form data. Built-in functionality for buttons with event handlers is included, and button sets can be build dynamically, or the preincluded ones for Submit/Cancel and OK/Cancel can be utilized. Forms can be processed in 3 ways -- via an asynchronous Connection utility call, a simple form POST or GET, or manually.
+* @namespace YAHOO.widget
+* @class Dialog
+* @extends YAHOO.widget.Panel
+* @constructor
+* @param {String} el The element ID representing the Dialog OR
+* @param {HTMLElement} el The element representing the Dialog
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.
+*/
+YAHOO.widget.Dialog = function(el, userConfig) {
+ YAHOO.widget.Dialog.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.Dialog, YAHOO.widget.Panel);
+
+/**
+* Constant representing the default CSS class used for a Dialog
+* @property YAHOO.widget.Dialog.CSS_DIALOG
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Dialog.CSS_DIALOG = "dialog";
+
+/**
+* Initializes the class's configurable properties which can be changed using the Dialog's Config object (cfg).
+* @method initDefaultConfig
+*/
+YAHOO.widget.Dialog.prototype.initDefaultConfig = function() {
+ YAHOO.widget.Dialog.superclass.initDefaultConfig.call(this);
+
+ /**
+ * The internally maintained callback object for use with the Connection utility
+ * @property callback
+ * @type Object
+ */
+ this.callback = {
+ /**
+ * The function to execute upon success of the Connection submission
+ * @property callback.success
+ * @type Function
+ */
+ success : null,
+ /**
+ * The function to execute upon failure of the Connection submission
+ * @property callback.failure
+ * @type Function
+ */
+ failure : null,
+ /**
+ * The arbitraty argument or arguments to pass to the Connection callback functions
+ * @property callback.argument
+ * @type Object
+ */
+ argument: null
+ };
+
+ // Add form dialog config properties //
+
+ /**
+ * The method to use for posting the Dialog's form. Possible values are "async", "form", and "manual".
+ * @config postmethod
+ * @type String
+ * @default async
+ */
+ this.cfg.addProperty("postmethod", { value:"async", validator:function(val) {
+ if (val != "form" && val != "async" && val != "none" && val != "manual") {
+ return false;
+ } else {
+ return true;
+ }
+ } });
+
+ /**
+ * Object literal(s) defining the buttons for the Dialog's footer.
+ * @config buttons
+ * @type Object[]
+ * @default "none"
+ */
+ this.cfg.addProperty("buttons", { value:"none", handler:this.configButtons } );
+};
+
+/**
+* Initializes the custom events for Dialog which are fired automatically at appropriate times by the Dialog class.
+* @method initEvents
+*/
+YAHOO.widget.Dialog.prototype.initEvents = function() {
+ YAHOO.widget.Dialog.superclass.initEvents.call(this);
+
+ /**
+ * CustomEvent fired prior to submission
+ * @event beforeSumitEvent
+ */
+ this.beforeSubmitEvent = new YAHOO.util.CustomEvent("beforeSubmit");
+
+ /**
+ * CustomEvent fired after submission
+ * @event submitEvent
+ */
+ this.submitEvent = new YAHOO.util.CustomEvent("submit");
+
+ /**
+ * CustomEvent fired prior to manual submission
+ * @event manualSubmitEvent
+ */
+ this.manualSubmitEvent = new YAHOO.util.CustomEvent("manualSubmit");
+
+ /**
+ * CustomEvent fired prior to asynchronous submission
+ * @event asyncSubmitEvent
+ */
+ this.asyncSubmitEvent = new YAHOO.util.CustomEvent("asyncSubmit");
+
+ /**
+ * CustomEvent fired prior to form-based submission
+ * @event formSubmitEvent
+ */
+ this.formSubmitEvent = new YAHOO.util.CustomEvent("formSubmit");
+
+ /**
+ * CustomEvent fired after cancel
+ * @event cancelEvent
+ */
+ this.cancelEvent = new YAHOO.util.CustomEvent("cancel");
+};
+
+/**
+* The Dialog initialization method, which is executed for Dialog and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+* @method init
+* @param {String} el The element ID representing the Dialog OR
+* @param {HTMLElement} el The element representing the Dialog
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.
+*/
+YAHOO.widget.Dialog.prototype.init = function(el, userConfig) {
+ YAHOO.widget.Dialog.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
+
+ this.beforeInitEvent.fire(YAHOO.widget.Dialog);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Dialog.CSS_DIALOG);
+
+ this.cfg.setProperty("visible", false);
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ this.renderEvent.subscribe(this.registerForm, this, true);
+
+ this.showEvent.subscribe(this.focusFirst, this, true);
+ this.beforeHideEvent.subscribe(this.blurButtons, this, true);
+
+ this.beforeRenderEvent.subscribe(function() {
+ var buttonCfg = this.cfg.getProperty("buttons");
+ if (buttonCfg && buttonCfg != "none") {
+ if (! this.footer) {
+ this.setFooter("");
+ }
+ }
+ }, this, true);
+
+ this.initEvent.fire(YAHOO.widget.Dialog);
+};
+
+/**
+* Performs the submission of the Dialog form depending on the value of "postmethod" property.
+* @method doSubmit
+*/
+YAHOO.widget.Dialog.prototype.doSubmit = function() {
+ var pm = this.cfg.getProperty("postmethod");
+ switch (pm) {
+ case "async":
+ var method = this.form.getAttribute("method") || 'POST';
+ method = method.toUpperCase();
+ YAHOO.util.Connect.setForm(this.form);
+ var cObj = YAHOO.util.Connect.asyncRequest(method, this.form.getAttribute("action"), this.callback);
+ this.asyncSubmitEvent.fire();
+ break;
+ case "form":
+ this.form.submit();
+ this.formSubmitEvent.fire();
+ break;
+ case "none":
+ case "manual":
+ this.manualSubmitEvent.fire();
+ break;
+ }
+};
+
+/**
+* Prepares the Dialog's internal FORM object, creating one if one is not currently present.
+* @method registerForm
+*/
+YAHOO.widget.Dialog.prototype.registerForm = function() {
+ var form = this.element.getElementsByTagName("FORM")[0];
+
+ if (! form) {
+ var formHTML = "";
+ this.body.innerHTML += formHTML;
+ form = this.element.getElementsByTagName("FORM")[0];
+ }
+
+ this.firstFormElement = function() {
+ for (var f=0;f=0;f-- ) {
+ var el = form.elements[f];
+ if (el.focus) {
+ if (el.type && el.type != "hidden") {
+ return el;
+ }
+ }
+ }
+ return null;
+ }();
+
+ this.form = form;
+
+ if (this.cfg.getProperty("modal") && this.form) {
+
+ var me = this;
+
+ var firstElement = this.firstFormElement || this.firstButton;
+ if (firstElement) {
+ this.preventBackTab = new YAHOO.util.KeyListener(firstElement, { shift:true, keys:9 }, {fn:me.focusLast, scope:me, correctScope:true} );
+ this.showEvent.subscribe(this.preventBackTab.enable, this.preventBackTab, true);
+ this.hideEvent.subscribe(this.preventBackTab.disable, this.preventBackTab, true);
+ }
+
+ var lastElement = this.lastButton || this.lastFormElement;
+ if (lastElement) {
+ this.preventTabOut = new YAHOO.util.KeyListener(lastElement, { shift:false, keys:9 }, {fn:me.focusFirst, scope:me, correctScope:true} );
+ this.showEvent.subscribe(this.preventTabOut.enable, this.preventTabOut, true);
+ this.hideEvent.subscribe(this.preventTabOut.disable, this.preventTabOut, true);
+ }
+ }
+};
+
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* The default event handler for the "buttons" configuration property
+* @method configButtons
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Dialog.prototype.configButtons = function(type, args, obj) {
+ var buttons = args[0];
+ if (buttons != "none") {
+ this.buttonSpan = null;
+ this.buttonSpan = document.createElement("SPAN");
+ this.buttonSpan.className = "button-group";
+
+ for (var b=0;bOR
+* @param {HTMLElement} el The element representing the SimpleDialog
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.
+*/
+YAHOO.widget.SimpleDialog = function(el, userConfig) {
+ YAHOO.widget.SimpleDialog.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.SimpleDialog, YAHOO.widget.Dialog);
+
+/**
+* Constant for the standard network icon for a blocking action
+* @property YAHOO.widget.SimpleDialog.ICON_BLOCK
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_BLOCK = "nt/ic/ut/bsc/blck16_1.gif";
+
+/**
+* Constant for the standard network icon for alarm
+* @property YAHOO.widget.SimpleDialog.ICON_ALARM
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_ALARM = "nt/ic/ut/bsc/alrt16_1.gif";
+
+/**
+* Constant for the standard network icon for help
+* @property YAHOO.widget.SimpleDialog.ICON_HELP
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_HELP = "nt/ic/ut/bsc/hlp16_1.gif";
+
+/**
+* Constant for the standard network icon for info
+* @property YAHOO.widget.SimpleDialog.ICON_INFO
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_INFO = "nt/ic/ut/bsc/info16_1.gif";
+
+/**
+* Constant for the standard network icon for warn
+* @property YAHOO.widget.SimpleDialog.ICON_WARN
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_WARN = "nt/ic/ut/bsc/warn16_1.gif";
+
+/**
+* Constant for the standard network icon for a tip
+* @property YAHOO.widget.SimpleDialog.ICON_TIP
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.ICON_TIP = "nt/ic/ut/bsc/tip16_1.gif";
+
+/**
+* Constant representing the default CSS class used for a SimpleDialog
+* @property YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG = "simple-dialog";
+
+/**
+* Initializes the class's configurable properties which can be changed using the SimpleDialog's Config object (cfg).
+* @method initDefaultConfig
+*/
+YAHOO.widget.SimpleDialog.prototype.initDefaultConfig = function() {
+ YAHOO.widget.SimpleDialog.superclass.initDefaultConfig.call(this);
+
+ // Add dialog config properties //
+
+ /**
+ * Sets the informational icon for the SimpleDialog
+ * @config icon
+ * @type String
+ * @default "none"
+ */
+ this.cfg.addProperty("icon", { value:"none", handler:this.configIcon, suppressEvent:true } );
+
+ /**
+ * Sets the text for the SimpleDialog
+ * @config text
+ * @type String
+ * @default ""
+ */
+ this.cfg.addProperty("text", { value:"", handler:this.configText, suppressEvent:true, supercedes:["icon"] } );
+};
+
+
+/**
+* The SimpleDialog initialization method, which is executed for SimpleDialog and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+* @method init
+* @param {String} el The element ID representing the SimpleDialog OR
+* @param {HTMLElement} el The element representing the SimpleDialog
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.
+*/
+YAHOO.widget.SimpleDialog.prototype.init = function(el, userConfig) {
+ YAHOO.widget.SimpleDialog.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
+
+ this.beforeInitEvent.fire(YAHOO.widget.SimpleDialog);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG);
+
+ this.cfg.queueProperty("postmethod", "manual");
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ this.beforeRenderEvent.subscribe(function() {
+ if (! this.body) {
+ this.setBody("");
+ }
+ }, this, true);
+
+ this.initEvent.fire(YAHOO.widget.SimpleDialog);
+
+};
+/**
+* Prepares the SimpleDialog's internal FORM object, creating one if one is not currently present, and adding the value hidden field.
+* @method registerForm
+*/
+YAHOO.widget.SimpleDialog.prototype.registerForm = function() {
+ YAHOO.widget.SimpleDialog.superclass.registerForm.call(this);
+ this.form.innerHTML += " ";
+};
+
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* Fired when the "icon" property is set.
+* @method configIcon
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.SimpleDialog.prototype.configIcon = function(type,args,obj) {
+ var icon = args[0];
+ if (icon && icon != "none") {
+ var iconHTML = " ";
+ this.body.innerHTML = iconHTML + this.body.innerHTML;
+ }
+};
+
+/**
+* Fired when the "text" property is set.
+* @method configText
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.SimpleDialog.prototype.configText = function(type,args,obj) {
+ var text = args[0];
+ if (text) {
+ this.setBody(text);
+ this.cfg.refireEvent("icon");
+ }
+};
+// END BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* Returns a string representation of the object.
+* @method toString
+* @return {String} The string representation of the SimpleDialog
+*/
+YAHOO.widget.SimpleDialog.prototype.toString = function() {
+ return "SimpleDialog " + this.id;
+};
+
+/**
+* ContainerEffect encapsulates animation transitions that are executed when an Overlay is shown or hidden.
+* @namespace YAHOO.widget
+* @class ContainerEffect
+* @constructor
+* @param {YAHOO.widget.Overlay} overlay The Overlay that the animation should be associated with
+* @param {Object} attrIn The object literal representing the animation arguments to be used for the animate-in transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(Number), and method(i.e. YAHOO.util.Easing.easeIn).
+* @param {Object} attrOut The object literal representing the animation arguments to be used for the animate-out transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(Number), and method(i.e. YAHOO.util.Easing.easeIn).
+* @param {HTMLElement} targetElement Optional. The target element that should be animated during the transition. Defaults to overlay.element.
+* @param {class} Optional. The animation class to instantiate. Defaults to YAHOO.util.Anim. Other options include YAHOO.util.Motion.
+*/
+YAHOO.widget.ContainerEffect = function(overlay, attrIn, attrOut, targetElement, animClass) {
+ if (! animClass) {
+ animClass = YAHOO.util.Anim;
+ }
+
+ /**
+ * The overlay to animate
+ * @property overlay
+ * @type YAHOO.widget.Overlay
+ */
+ this.overlay = overlay;
+ /**
+ * The animation attributes to use when transitioning into view
+ * @property attrIn
+ * @type Object
+ */
+ this.attrIn = attrIn;
+ /**
+ * The animation attributes to use when transitioning out of view
+ * @property attrOut
+ * @type Object
+ */
+ this.attrOut = attrOut;
+ /**
+ * The target element to be animated
+ * @property targetElement
+ * @type HTMLElement
+ */
+ this.targetElement = targetElement || overlay.element;
+ /**
+ * The animation class to use for animating the overlay
+ * @property animClass
+ * @type class
+ */
+ this.animClass = animClass;
+};
+
+/**
+* Initializes the animation classes and events.
+* @method init
+*/
+YAHOO.widget.ContainerEffect.prototype.init = function() {
+ this.beforeAnimateInEvent = new YAHOO.util.CustomEvent("beforeAnimateIn");
+ this.beforeAnimateOutEvent = new YAHOO.util.CustomEvent("beforeAnimateOut");
+
+ this.animateInCompleteEvent = new YAHOO.util.CustomEvent("animateInComplete");
+ this.animateOutCompleteEvent = new YAHOO.util.CustomEvent("animateOutComplete");
+
+ this.animIn = new this.animClass(this.targetElement, this.attrIn.attributes, this.attrIn.duration, this.attrIn.method);
+ this.animIn.onStart.subscribe(this.handleStartAnimateIn, this);
+ this.animIn.onTween.subscribe(this.handleTweenAnimateIn, this);
+ this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn, this);
+
+ this.animOut = new this.animClass(this.targetElement, this.attrOut.attributes, this.attrOut.duration, this.attrOut.method);
+ this.animOut.onStart.subscribe(this.handleStartAnimateOut, this);
+ this.animOut.onTween.subscribe(this.handleTweenAnimateOut, this);
+ this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut, this);
+};
+
+/**
+* Triggers the in-animation.
+* @method animateIn
+*/
+YAHOO.widget.ContainerEffect.prototype.animateIn = function() {
+ this.beforeAnimateInEvent.fire();
+ this.animIn.animate();
+};
+
+/**
+* Triggers the out-animation.
+* @method animateOut
+*/
+YAHOO.widget.ContainerEffect.prototype.animateOut = function() {
+ this.beforeAnimateOutEvent.fire();
+ this.animOut.animate();
+};
+
+/**
+* The default onStart handler for the in-animation.
+* @method handleStartAnimateIn
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn = function(type, args, obj) { };
+/**
+* The default onTween handler for the in-animation.
+* @method handleTweenAnimateIn
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn = function(type, args, obj) { };
+/**
+* The default onComplete handler for the in-animation.
+* @method handleCompleteAnimateIn
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn = function(type, args, obj) { };
+
+/**
+* The default onStart handler for the out-animation.
+* @method handleStartAnimateOut
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut = function(type, args, obj) { };
+/**
+* The default onTween handler for the out-animation.
+* @method handleTweenAnimateOut
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut = function(type, args, obj) { };
+/**
+* The default onComplete handler for the out-animation.
+* @method handleCompleteAnimateOut
+* @param {String} type The CustomEvent type
+* @param {Object[]} args The CustomEvent arguments
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut = function(type, args, obj) { };
+
+/**
+* Returns a string representation of the object.
+* @method toString
+* @return {String} The string representation of the ContainerEffect
+*/
+YAHOO.widget.ContainerEffect.prototype.toString = function() {
+ var output = "ContainerEffect";
+ if (this.overlay) {
+ output += " [" + this.overlay.toString() + "]";
+ }
+ return output;
+};
+
+/**
+* A pre-configured ContainerEffect instance that can be used for fading an overlay in and out.
+* @method FADE
+* @static
+* @param {Overlay} The Overlay object to animate
+* @param {Number} The duration of the animation
+* @return {ContainerEffect} The configured ContainerEffect object
+*/
+YAHOO.widget.ContainerEffect.FADE = function(overlay, dur) {
+ var fade = new YAHOO.widget.ContainerEffect(overlay, { attributes:{opacity: {from:0, to:1}}, duration:dur, method:YAHOO.util.Easing.easeIn }, { attributes:{opacity: {to:0}}, duration:dur, method:YAHOO.util.Easing.easeOut}, overlay.element );
+
+ fade.handleStartAnimateIn = function(type,args,obj) {
+ YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");
+
+ if (! obj.overlay.underlay) {
+ obj.overlay.cfg.refireEvent("underlay");
+ }
+
+ if (obj.overlay.underlay) {
+ obj.initialUnderlayOpacity = YAHOO.util.Dom.getStyle(obj.overlay.underlay, "opacity");
+ obj.overlay.underlay.style.filter = null;
+ }
+
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 0);
+ };
+
+ fade.handleCompleteAnimateIn = function(type,args,obj) {
+ YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");
+
+ if (obj.overlay.element.style.filter) {
+ obj.overlay.element.style.filter = null;
+ }
+
+ if (obj.overlay.underlay) {
+ YAHOO.util.Dom.setStyle(obj.overlay.underlay, "opacity", obj.initialUnderlayOpacity);
+ }
+
+ obj.overlay.cfg.refireEvent("iframe");
+ obj.animateInCompleteEvent.fire();
+ };
+
+ fade.handleStartAnimateOut = function(type, args, obj) {
+ YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");
+
+ if (obj.overlay.underlay) {
+ obj.overlay.underlay.style.filter = null;
+ }
+ };
+
+ fade.handleCompleteAnimateOut = function(type, args, obj) {
+ YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");
+ if (obj.overlay.element.style.filter) {
+ obj.overlay.element.style.filter = null;
+ }
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 1);
+
+ obj.overlay.cfg.refireEvent("iframe");
+
+ obj.animateOutCompleteEvent.fire();
+ };
+
+ fade.init();
+ return fade;
+};
+
+
+/**
+* A pre-configured ContainerEffect instance that can be used for sliding an overlay in and out.
+* @method SLIDE
+* @static
+* @param {Overlay} The Overlay object to animate
+* @param {Number} The duration of the animation
+* @return {ContainerEffect} The configured ContainerEffect object
+*/
+YAHOO.widget.ContainerEffect.SLIDE = function(overlay, dur) {
+ var x = overlay.cfg.getProperty("x") || YAHOO.util.Dom.getX(overlay.element);
+ var y = overlay.cfg.getProperty("y") || YAHOO.util.Dom.getY(overlay.element);
+
+ var clientWidth = YAHOO.util.Dom.getClientWidth();
+ var offsetWidth = overlay.element.offsetWidth;
+
+ var slide = new YAHOO.widget.ContainerEffect(overlay, {
+ attributes:{ points: { to:[x, y] } },
+ duration:dur,
+ method:YAHOO.util.Easing.easeIn
+ },
+ {
+ attributes:{ points: { to:[(clientWidth+25), y] } },
+ duration:dur,
+ method:YAHOO.util.Easing.easeOut
+ },
+ overlay.element,
+ YAHOO.util.Motion);
+
+
+ slide.handleStartAnimateIn = function(type,args,obj) {
+ obj.overlay.element.style.left = (-25-offsetWidth) + "px";
+ obj.overlay.element.style.top = y + "px";
+ };
+
+ slide.handleTweenAnimateIn = function(type, args, obj) {
+
+
+ var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
+
+ var currentX = pos[0];
+ var currentY = pos[1];
+
+ if (YAHOO.util.Dom.getStyle(obj.overlay.element, "visibility") == "hidden" && currentX < x) {
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");
+ }
+
+ obj.overlay.cfg.setProperty("xy", [currentX,currentY], true);
+ obj.overlay.cfg.refireEvent("iframe");
+ };
+
+ slide.handleCompleteAnimateIn = function(type, args, obj) {
+ obj.overlay.cfg.setProperty("xy", [x,y], true);
+ obj.startX = x;
+ obj.startY = y;
+ obj.overlay.cfg.refireEvent("iframe");
+ obj.animateInCompleteEvent.fire();
+ };
+
+ slide.handleStartAnimateOut = function(type, args, obj) {
+ var vw = YAHOO.util.Dom.getViewportWidth();
+
+ var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
+
+ var yso = pos[1];
+
+ var currentTo = obj.animOut.attributes.points.to;
+ obj.animOut.attributes.points.to = [(vw+25), yso];
+ };
+
+ slide.handleTweenAnimateOut = function(type, args, obj) {
+ var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
+
+ var xto = pos[0];
+ var yto = pos[1];
+
+ obj.overlay.cfg.setProperty("xy", [xto,yto], true);
+ obj.overlay.cfg.refireEvent("iframe");
+ };
+
+ slide.handleCompleteAnimateOut = function(type, args, obj) {
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");
+
+ obj.overlay.cfg.setProperty("xy", [x,y]);
+ obj.animateOutCompleteEvent.fire();
+ };
+
+ slide.init();
+ return slide;
};
\ No newline at end of file
diff --git a/thirdpartyjs/yui/container/container_core-debug.js b/thirdpartyjs/yui/container/container_core-debug.js
index 82a5099..dfc0362 100644
--- a/thirdpartyjs/yui/container/container_core-debug.js
+++ b/thirdpartyjs/yui/container/container_core-debug.js
@@ -1,2911 +1,2911 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-/**
-* Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.
-* @class YAHOO.util.Config
-* @constructor
-* @param {Object} owner The owner Object to which this Config Object belongs
-*/
-YAHOO.util.Config = function(owner) {
- if (owner) {
- this.init(owner);
- } else {
- YAHOO.log("No owner specified for Config object", "error");
- }
-};
-
-YAHOO.util.Config.prototype = {
-
- /**
- * Object reference to the owner of this Config Object
- * @property owner
- * @type Object
- */
- owner : null,
-
- /**
- * Boolean flag that specifies whether a queue is currently being executed
- * @property queueInProgress
- * @type Boolean
- */
- queueInProgress : false,
-
-
- /**
- * Validates that the value passed in is a Boolean.
- * @method checkBoolean
- * @param {Object} val The value to validate
- * @return {Boolean} true, if the value is valid
- */
- checkBoolean: function(val) {
- if (typeof val == 'boolean') {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Validates that the value passed in is a number.
- * @method checkNumber
- * @param {Object} val The value to validate
- * @return {Boolean} true, if the value is valid
- */
- checkNumber: function(val) {
- if (isNaN(val)) {
- return false;
- } else {
- return true;
- }
- }
-};
-
-
-/**
-* Initializes the configuration Object and all of its local members.
-* @method init
-* @param {Object} owner The owner Object to which this Config Object belongs
-*/
-YAHOO.util.Config.prototype.init = function(owner) {
-
- this.owner = owner;
-
- /**
- * Object reference to the owner of this Config Object
- * @event configChangedEvent
- */
- this.configChangedEvent = new YAHOO.util.CustomEvent("configChanged");
- this.queueInProgress = false;
-
- /* Private Members */
-
- /**
- * Maintains the local collection of configuration property objects and their specified values
- * @property config
- * @private
- * @type Object
- */
- var config = {};
-
- /**
- * Maintains the local collection of configuration property objects as they were initially applied.
- * This object is used when resetting a property.
- * @property initialConfig
- * @private
- * @type Object
- */
- var initialConfig = {};
-
- /**
- * Maintains the local, normalized CustomEvent queue
- * @property eventQueue
- * @private
- * @type Object
- */
- var eventQueue = [];
-
- /**
- * Fires a configuration property event using the specified value.
- * @method fireEvent
- * @private
- * @param {String} key The configuration property's name
- * @param {value} Object The value of the correct type for the property
- */
- var fireEvent = function( key, value ) {
- YAHOO.log("Firing Config event: " + key + "=" + value, "info");
-
- key = key.toLowerCase();
-
- var property = config[key];
-
- if (typeof property != 'undefined' && property.event) {
- property.event.fire(value);
- }
- };
- /* End Private Members */
-
- /**
- * Adds a property to the Config Object's private config hash.
- * @method addProperty
- * @param {String} key The configuration property's name
- * @param {Object} propertyObject The Object containing all of this property's arguments
- */
- this.addProperty = function( key, propertyObject ) {
- key = key.toLowerCase();
-
- YAHOO.log("Added property: " + key, "info");
-
- config[key] = propertyObject;
-
- propertyObject.event = new YAHOO.util.CustomEvent(key);
- propertyObject.key = key;
-
- if (propertyObject.handler) {
- propertyObject.event.subscribe(propertyObject.handler, this.owner, true);
- }
-
- this.setProperty(key, propertyObject.value, true);
-
- if (! propertyObject.suppressEvent) {
- this.queueProperty(key, propertyObject.value);
- }
- };
-
- /**
- * Returns a key-value configuration map of the values currently set in the Config Object.
- * @method getConfig
- * @return {Object} The current config, represented in a key-value map
- */
- this.getConfig = function() {
- var cfg = {};
-
- for (var prop in config) {
- var property = config[prop];
- if (typeof property != 'undefined' && property.event) {
- cfg[prop] = property.value;
- }
- }
-
- return cfg;
- };
-
- /**
- * Returns the value of specified property.
- * @method getProperty
- * @param {String} key The name of the property
- * @return {Object} The value of the specified property
- */
- this.getProperty = function(key) {
- key = key.toLowerCase();
-
- var property = config[key];
- if (typeof property != 'undefined' && property.event) {
- return property.value;
- } else {
- return undefined;
- }
- };
-
- /**
- * Resets the specified property's value to its initial value.
- * @method resetProperty
- * @param {String} key The name of the property
- * @return {Boolean} True is the property was reset, false if not
- */
- this.resetProperty = function(key) {
- key = key.toLowerCase();
-
- var property = config[key];
- if (typeof property != 'undefined' && property.event) {
- if (initialConfig[key] && initialConfig[key] != 'undefined') {
- this.setProperty(key, initialConfig[key]);
- }
- return true;
- } else {
- return false;
- }
- };
-
- /**
- * Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.
- * @method setProperty
- * @param {String} key The name of the property
- * @param {String} value The value to set the property to
- * @param {Boolean} silent Whether the value should be set silently, without firing the property event.
- * @return {Boolean} True, if the set was successful, false if it failed.
- */
- this.setProperty = function(key, value, silent) {
- key = key.toLowerCase();
-
- YAHOO.log("setProperty: " + key + "=" + value, "info");
-
- if (this.queueInProgress && ! silent) {
- this.queueProperty(key,value); // Currently running through a queue...
- return true;
- } else {
- var property = config[key];
- if (typeof property != 'undefined' && property.event) {
- if (property.validator && ! property.validator(value)) { // validator
- return false;
- } else {
- property.value = value;
- if (! silent) {
- fireEvent(key, value);
- this.configChangedEvent.fire([key, value]);
- }
- return true;
- }
- } else {
- return false;
- }
- }
- };
-
- /**
- * Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is
- * moved from its current position to the end of the queue.
- * @method queueProperty
- * @param {String} key The name of the property
- * @param {String} value The value to set the property to
- * @return {Boolean} true, if the set was successful, false if it failed.
- */
- this.queueProperty = function(key, value) {
- key = key.toLowerCase();
-
- YAHOO.log("queueProperty: " + key + "=" + value, "info");
-
- var property = config[key];
-
- if (typeof property != 'undefined' && property.event) {
- if (typeof value != 'undefined' && property.validator && ! property.validator(value)) { // validator
- return false;
- } else {
-
- if (typeof value != 'undefined') {
- property.value = value;
- } else {
- value = property.value;
- }
-
- var foundDuplicate = false;
-
- for (var i=0;iOR
-* @param {HTMLElement} el The element representing the Module
-* @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
-*/
-YAHOO.widget.Module = function(el, userConfig) {
- if (el) {
- this.init(el, userConfig);
- } else {
- YAHOO.log("No element or element ID specified for Module instantiation", "error");
- }
-};
-
-/**
-* Constant representing the prefix path to use for non-secure images
-* @property YAHOO.widget.Module.IMG_ROOT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";
-
-/**
-* Constant representing the prefix path to use for securely served images
-* @property YAHOO.widget.Module.IMG_ROOT_SSL
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";
-
-/**
-* Constant for the default CSS class name that represents a Module
-* @property YAHOO.widget.Module.CSS_MODULE
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_MODULE = "module";
-
-/**
-* Constant representing the module header
-* @property YAHOO.widget.Module.CSS_HEADER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_HEADER = "hd";
-
-/**
-* Constant representing the module body
-* @property YAHOO.widget.Module.CSS_BODY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_BODY = "bd";
-
-/**
-* Constant representing the module footer
-* @property YAHOO.widget.Module.CSS_FOOTER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_FOOTER = "ft";
-
-/**
-* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size
-* @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
-
-YAHOO.widget.Module.prototype = {
-
- /**
- * The class's constructor function
- * @property contructor
- * @type Function
- */
- constructor : YAHOO.widget.Module,
-
- /**
- * The main module element that contains the header, body, and footer
- * @property element
- * @type HTMLElement
- */
- element : null,
-
- /**
- * The header element, denoted with CSS class "hd"
- * @property header
- * @type HTMLElement
- */
- header : null,
-
- /**
- * The body element, denoted with CSS class "bd"
- * @property body
- * @type HTMLElement
- */
- body : null,
-
- /**
- * The footer element, denoted with CSS class "ft"
- * @property footer
- * @type HTMLElement
- */
- footer : null,
-
- /**
- * The id of the element
- * @property id
- * @type String
- */
- id : null,
-
- /**
- * The String representing the image root
- * @property imageRoot
- * @type String
- */
- imageRoot : YAHOO.widget.Module.IMG_ROOT,
-
- /**
- * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
- * @method initEvents
- */
- initEvents : function() {
-
- /**
- * CustomEvent fired prior to class initalization.
- * @event beforeInitEvent
- * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
- */
- this.beforeInitEvent = new YAHOO.util.CustomEvent("beforeInit");
-
- /**
- * CustomEvent fired after class initalization.
- * @event initEvent
- * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
- */
- this.initEvent = new YAHOO.util.CustomEvent("init");
-
- /**
- * CustomEvent fired when the Module is appended to the DOM
- * @event appendEvent
- */
- this.appendEvent = new YAHOO.util.CustomEvent("append");
-
- /**
- * CustomEvent fired before the Module is rendered
- * @event beforeRenderEvent
- */
- this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
-
- /**
- * CustomEvent fired after the Module is rendered
- * @event renderEvent
- */
- this.renderEvent = new YAHOO.util.CustomEvent("render");
-
- /**
- * CustomEvent fired when the header content of the Module is modified
- * @event changeHeaderEvent
- * @param {String/HTMLElement} content String/element representing the new header content
- */
- this.changeHeaderEvent = new YAHOO.util.CustomEvent("changeHeader");
-
- /**
- * CustomEvent fired when the body content of the Module is modified
- * @event changeBodyEvent
- * @param {String/HTMLElement} content String/element representing the new body content
- */
- this.changeBodyEvent = new YAHOO.util.CustomEvent("changeBody");
-
- /**
- * CustomEvent fired when the footer content of the Module is modified
- * @event changeFooterEvent
- * @param {String/HTMLElement} content String/element representing the new footer content
- */
- this.changeFooterEvent = new YAHOO.util.CustomEvent("changeFooter");
-
- /**
- * CustomEvent fired when the content of the Module is modified
- * @event changeContentEvent
- */
- this.changeContentEvent = new YAHOO.util.CustomEvent("changeContent");
-
- /**
- * CustomEvent fired when the Module is destroyed
- * @event destroyEvent
- */
- this.destroyEvent = new YAHOO.util.CustomEvent("destroy");
-
- /**
- * CustomEvent fired before the Module is shown
- * @event beforeShowEvent
- */
- this.beforeShowEvent = new YAHOO.util.CustomEvent("beforeShow");
-
- /**
- * CustomEvent fired after the Module is shown
- * @event showEvent
- */
- this.showEvent = new YAHOO.util.CustomEvent("show");
-
- /**
- * CustomEvent fired before the Module is hidden
- * @event beforeHideEvent
- */
- this.beforeHideEvent = new YAHOO.util.CustomEvent("beforeHide");
-
- /**
- * CustomEvent fired after the Module is hidden
- * @event hideEvent
- */
- this.hideEvent = new YAHOO.util.CustomEvent("hide");
- },
-
- /**
- * String representing the current user-agent platform
- * @property platform
- * @type String
- */
- platform : function() {
- var ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {
- return "windows";
- } else if (ua.indexOf("macintosh") != -1) {
- return "mac";
- } else {
- return false;
- }
- }(),
-
- /**
- * String representing the current user-agent browser
- * @property browser
- * @type String
- */
- browser : function() {
- var ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
- return 'opera';
- } else if (ua.indexOf('msie 7')!=-1) { // IE7
- return 'ie7';
- } else if (ua.indexOf('msie') !=-1) { // IE
- return 'ie';
- } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
- return 'safari';
- } else if (ua.indexOf('gecko') != -1) { // Gecko
- return 'gecko';
- } else {
- return false;
- }
- }(),
-
- /**
- * Boolean representing whether or not the current browsing context is secure (https)
- * @property isSecure
- * @type Boolean
- */
- isSecure : function() {
- if (window.location.href.toLowerCase().indexOf("https") === 0) {
- return true;
- } else {
- return false;
- }
- }(),
-
- /**
- * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
- */
- initDefaultConfig : function() {
- // Add properties //
-
- /**
- * Specifies whether the Module is visible on the page.
- * @config visible
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );
-
- /**
- * Object or array of objects representing the ContainerEffect classes that are active for animating the container.
- * @config effect
- * @type Object
- * @default null
- */
- this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );
-
- /**
- * Specifies whether to create a special proxy iframe to monitor for user font resizing in the document
- * @config monitorresize
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );
- },
-
- /**
- * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
- * @method init
- * @param {String} el The element ID representing the Module OR
- * @param {HTMLElement} el The element representing the Module
- * @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
- */
- init : function(el, userConfig) {
-
- this.initEvents();
-
- this.beforeInitEvent.fire(YAHOO.widget.Module);
-
- /**
- * The Module's Config object used for monitoring configuration properties.
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- if (this.isSecure) {
- this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;
- }
-
- if (typeof el == "string") {
- var elId = el;
-
- el = document.getElementById(el);
- if (! el) {
- el = document.createElement("DIV");
- el.id = elId;
- }
- }
-
- this.element = el;
-
- if (el.id) {
- this.id = el.id;
- }
-
- var childNodes = this.element.childNodes;
-
- if (childNodes) {
- for (var i=0;iOR
- * @param {HTMLElement} headerContent The HTMLElement to append to the header
- */
- setHeader : function(headerContent) {
- if (! this.header) {
- this.header = document.createElement("DIV");
- this.header.className = YAHOO.widget.Module.CSS_HEADER;
- }
-
- if (typeof headerContent == "string") {
- this.header.innerHTML = headerContent;
- } else {
- this.header.innerHTML = "";
- this.header.appendChild(headerContent);
- }
-
- this.changeHeaderEvent.fire(headerContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the header. If no header is present, one will be automatically created.
- * @method appendToHeader
- * @param {HTMLElement} element The element to append to the header
- */
- appendToHeader : function(element) {
- if (! this.header) {
- this.header = document.createElement("DIV");
- this.header.className = YAHOO.widget.Module.CSS_HEADER;
- }
-
- this.header.appendChild(element);
- this.changeHeaderEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.
- * @method setBody
- * @param {String} bodyContent The HTML used to set the body OR
- * @param {HTMLElement} bodyContent The HTMLElement to append to the body
- */
- setBody : function(bodyContent) {
- if (! this.body) {
- this.body = document.createElement("DIV");
- this.body.className = YAHOO.widget.Module.CSS_BODY;
- }
-
- if (typeof bodyContent == "string")
- {
- this.body.innerHTML = bodyContent;
- } else {
- this.body.innerHTML = "";
- this.body.appendChild(bodyContent);
- }
-
- this.changeBodyEvent.fire(bodyContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the body. If no body is present, one will be automatically created.
- * @method appendToBody
- * @param {HTMLElement} element The element to append to the body
- */
- appendToBody : function(element) {
- if (! this.body) {
- this.body = document.createElement("DIV");
- this.body.className = YAHOO.widget.Module.CSS_BODY;
- }
-
- this.body.appendChild(element);
- this.changeBodyEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.
- * @method setFooter
- * @param {String} footerContent The HTML used to set the footer OR
- * @param {HTMLElement} footerContent The HTMLElement to append to the footer
- */
- setFooter : function(footerContent) {
- if (! this.footer) {
- this.footer = document.createElement("DIV");
- this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
- }
-
- if (typeof footerContent == "string") {
- this.footer.innerHTML = footerContent;
- } else {
- this.footer.innerHTML = "";
- this.footer.appendChild(footerContent);
- }
-
- this.changeFooterEvent.fire(footerContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the footer. If no footer is present, one will be automatically created.
- * @method appendToFooter
- * @param {HTMLElement} element The element to append to the footer
- */
- appendToFooter : function(element) {
- if (! this.footer) {
- this.footer = document.createElement("DIV");
- this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
- }
-
- this.footer.appendChild(element);
- this.changeFooterEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.
- * @method render
- * @param {String} appendToNode The element id to which the Module should be appended to prior to rendering OR
- * @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
- * @param {HTMLElement} moduleElement OPTIONAL. The element that represents the actual Standard Module container.
- * @return {Boolean} Success or failure of the render
- */
- render : function(appendToNode, moduleElement) {
- this.beforeRenderEvent.fire();
-
- if (! moduleElement) {
- moduleElement = this.element;
- }
-
- var me = this;
- var appendTo = function(element) {
- if (typeof element == "string") {
- element = document.getElementById(element);
- }
-
- if (element) {
- element.appendChild(me.element);
- me.appendEvent.fire();
- }
- };
-
- if (appendToNode) {
- appendTo(appendToNode);
- } else { // No node was passed in. If the element is not pre-marked up, this fails
- if (! YAHOO.util.Dom.inDocument(this.element)) {
- YAHOO.log("Render failed. Must specify appendTo node if Module isn't already in the DOM.", "error");
- return false;
- }
- }
-
- // Need to get everything into the DOM if it isn't already
-
- if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {
- // There is a header, but it's not in the DOM yet... need to add it
- var firstChild = moduleElement.firstChild;
- if (firstChild) { // Insert before first child if exists
- moduleElement.insertBefore(this.header, firstChild);
- } else { // Append to empty body because there are no children
- moduleElement.appendChild(this.header);
- }
- }
-
- if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {
- // There is a body, but it's not in the DOM yet... need to add it
- if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM
- moduleElement.insertBefore(this.body, this.footer);
- } else { // Append to element because there is no footer
- moduleElement.appendChild(this.body);
- }
- }
-
- if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {
- // There is a footer, but it's not in the DOM yet... need to add it
- moduleElement.appendChild(this.footer);
- }
-
- this.renderEvent.fire();
- return true;
- },
-
- /**
- * Removes the Module element from the DOM and sets all child elements to null.
- * @method destroy
- */
- destroy : function() {
- if (this.element) {
- var parent = this.element.parentNode;
- }
- if (parent) {
- parent.removeChild(this.element);
- }
-
- this.element = null;
- this.header = null;
- this.body = null;
- this.footer = null;
-
- this.destroyEvent.fire();
- },
-
- /**
- * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.
- * @method show
- */
- show : function() {
- this.cfg.setProperty("visible", true);
- },
-
- /**
- * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.
- * @method hide
- */
- hide : function() {
- this.cfg.setProperty("visible", false);
- },
-
- // BUILT-IN EVENT HANDLERS FOR MODULE //
-
- /**
- * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".
- * This method is responsible for firing showEvent and hideEvent.
- * @param {String} type The CustomEvent type (usually the property name)
- * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
- * @method configVisible
- */
- configVisible : function(type, args, obj) {
- var visible = args[0];
- if (visible) {
- this.beforeShowEvent.fire();
- YAHOO.util.Dom.setStyle(this.element, "display", "block");
- this.showEvent.fire();
- } else {
- this.beforeHideEvent.fire();
- YAHOO.util.Dom.setStyle(this.element, "display", "none");
- this.hideEvent.fire();
- }
- },
-
- /**
- * Default event handler for the "monitorresize" configuration property
- * @param {String} type The CustomEvent type (usually the property name)
- * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
- * @method configMonitorResize
- */
- configMonitorResize : function(type, args, obj) {
- var monitor = args[0];
- if (monitor) {
- this.initResizeMonitor();
- } else {
- YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);
- this.resizeMonitor = null;
- }
- }
-};
-
-/**
-* Returns a String representation of the Object.
-* @method toString
-* @return {String} The string representation of the Module
-*/
-YAHOO.widget.Module.prototype.toString = function() {
- return "Module " + this.id;
-};
-
-/**
-* Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.
-* @class Overlay
-* @namespace YAHOO.widget
-* @extends YAHOO.widget.Module
-* @param {String} el The element ID representing the Overlay OR
-* @param {HTMLElement} el The element representing the Overlay
-* @param {Object} userConfig The configuration object literal containing 10/23/2006the configuration that should be set for this Overlay. See configuration documentation for more details.
-* @constructor
-*/
-YAHOO.widget.Overlay = function(el, userConfig) {
- YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);
-
-/**
-* The URL that will be placed in the iframe
-* @property YAHOO.widget.Overlay.IFRAME_SRC
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"
-
-/**
-* Constant representing the top left corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.TOP_LEFT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.TOP_LEFT = "tl";
-
-/**
-* Constant representing the top right corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.TOP_RIGHT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.TOP_RIGHT = "tr";
-
-/**
-* Constant representing the top bottom left corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.BOTTOM_LEFT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";
-
-/**
-* Constant representing the bottom right corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.BOTTOM_RIGHT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";
-
-/**
-* Constant representing the default CSS class used for an Overlay
-* @property YAHOO.widget.Overlay.CSS_OVERLAY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";
-
-/**
-* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
-* @method init
-* @param {String} el The element ID representing the Overlay OR
-* @param {HTMLElement} el The element representing the Overlay
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
-*/
-YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {
- YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
-
- this.beforeInitEvent.fire(YAHOO.widget.Overlay);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- if (this.platform == "mac" && this.browser == "gecko") {
- if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {
- this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);
- }
- if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {
- this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);
- }
- }
-
- this.initEvent.fire(YAHOO.widget.Overlay);
-
-};
-
-/**
-* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.
-* @method initEvents
-*/
-YAHOO.widget.Overlay.prototype.initEvents = function() {
- YAHOO.widget.Overlay.superclass.initEvents.call(this);
-
- /**
- * CustomEvent fired before the Overlay is moved.
- * @event beforeMoveEvent
- * @param {Number} x x coordinate
- * @param {Number} y y coordinate
- */
- this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);
-
- /**
- * CustomEvent fired after the Overlay is moved.
- * @event moveEvent
- * @param {Number} x x coordinate
- * @param {Number} y y coordinate
- */
- this.moveEvent = new YAHOO.util.CustomEvent("move", this);
-};
-
-/**
-* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
-* @method initDefaultConfig
-*/
-YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {
- YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);
-
- // Add overlay config properties //
-
- /**
- * The absolute x-coordinate position of the Overlay
- * @config x
- * @type Number
- * @default null
- */
- this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * The absolute y-coordinate position of the Overlay
- * @config y
- * @type Number
- * @default null
- */
- this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * An array with the absolute x and y positions of the Overlay
- * @config xy
- * @type Number[]
- * @default null
- */
- this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * The array of context arguments for context-sensitive positioning. The format is: [id or element, element corner, context corner]. For example, setting this property to ["img1", "tl", "bl"] would align the Overlay's top left corner to the context element's bottom left corner.
- * @config context
- * @type Array
- * @default null
- */
- this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * True if the Overlay should be anchored to the center of the viewport.
- * @config fixedcenter
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );
-
- /**
- * CSS width of the Overlay.
- * @config width
- * @type String
- * @default null
- */
- this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * CSS height of the Overlay.
- * @config height
- * @type String
- * @default null
- */
- this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * CSS z-index of the Overlay.
- * @config zIndex
- * @type Number
- * @default null
- */
- this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );
-
- /**
- * True if the Overlay should be prevented from being positioned out of the viewport.
- * @config constraintoviewport
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );
-
- /**
- * True if the Overlay should have an IFRAME shim (for correcting the select z-index bug in IE6 and below).
- * @config iframe
- * @type Boolean
- * @default true for IE6 and below, false for all others
- */
- this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );
-};
-
-/**
-* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);
-* @method moveTo
-* @param {Number} x The Overlay's new x position
-* @param {Number} y The Overlay's new y position
-*/
-YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {
- this.cfg.setProperty("xy",[x,y]);
-};
-
-/**
-* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
-* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
-* @method hideMacGeckoScrollbars
-*/
-YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {
- YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");
- YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");
-};
-
-/**
-* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
-* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
-* @method showMacGeckoScrollbars
-*/
-YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {
- YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");
- YAHOO.util.Dom.addClass(this.element, "show-scrollbars");
-};
-
-// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.
-* @method configVisible
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {
- var visible = args[0];
- var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");
-
- if (currentVis == "inherit") {
- var e = this.element.parentNode;
- while (e.nodeType != 9 && e.nodeType != 11) {
- currentVis = YAHOO.util.Dom.getStyle(e, "visibility");
- if (currentVis != "inherit") { break; }
- e = e.parentNode;
- }
- if (currentVis == "inherit") {
- currentVis = "visible";
- }
- }
-
- var effect = this.cfg.getProperty("effect");
-
- var effectInstances = [];
- if (effect) {
- if (effect instanceof Array) {
- for (var i=0;i rightConstraint) {
- x = rightConstraint;
- }
-
- if (y < topConstraint) {
- y = topConstraint;
- } else if (y > bottomConstraint) {
- y = bottomConstraint;
- }
-
- this.cfg.setProperty("x", x, true);
- this.cfg.setProperty("y", y, true);
- this.cfg.setProperty("xy", [x,y], true);
-};
-
-/**
-* Centers the container in the viewport.
-* @method center
-*/
-YAHOO.widget.Overlay.prototype.center = function() {
- var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
- var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
-
- var viewPortWidth = YAHOO.util.Dom.getClientWidth();
- var viewPortHeight = YAHOO.util.Dom.getClientHeight();
-
- var elementWidth = this.element.offsetWidth;
- var elementHeight = this.element.offsetHeight;
-
- var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;
- var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;
-
- this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
-
- this.cfg.refireEvent("iframe");
-};
-
-/**
-* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.
-* @method syncPosition
-*/
-YAHOO.widget.Overlay.prototype.syncPosition = function() {
- var pos = YAHOO.util.Dom.getXY(this.element);
- this.cfg.setProperty("x", pos[0], true);
- this.cfg.setProperty("y", pos[1], true);
- this.cfg.setProperty("xy", pos, true);
-};
-
-/**
-* Event handler fired when the resize monitor element is resized.
-* @method onDomResize
-* @param {DOMEvent} e The resize DOM event
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {
- YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);
- var me = this;
- setTimeout(function() {
- me.syncPosition();
- me.cfg.refireEvent("iframe");
- me.cfg.refireEvent("context");
- }, 0);
-};
-
-/**
-* Removes the Overlay element from the DOM and sets all child elements to null.
-* @method destroy
-*/
-YAHOO.widget.Overlay.prototype.destroy = function() {
- if (this.iframe) {
- this.iframe.parentNode.removeChild(this.iframe);
- }
-
- this.iframe = null;
-
- YAHOO.widget.Overlay.superclass.destroy.call(this);
-};
-
-/**
-* Returns a String representation of the object.
-* @method toString
-* @return {String} The string representation of the Overlay.
-*/
-YAHOO.widget.Overlay.prototype.toString = function() {
- return "Overlay " + this.id;
-};
-
-/**
-* A singleton CustomEvent used for reacting to the DOM event for window scroll
-* @event YAHOO.widget.Overlay.windowScrollEvent
-*/
-YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");
-
-/**
-* A singleton CustomEvent used for reacting to the DOM event for window resize
-* @event YAHOO.widget.Overlay.windowResizeEvent
-*/
-YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");
-
-/**
-* The DOM event handler used to fire the CustomEvent for window scroll
-* @method YAHOO.widget.Overlay.windowScrollHandler
-* @static
-* @param {DOMEvent} e The DOM scroll event
-*/
-YAHOO.widget.Overlay.windowScrollHandler = function(e) {
- if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
- if (! window.scrollEnd) {
- window.scrollEnd = -1;
- }
- clearTimeout(window.scrollEnd);
- window.scrollEnd = setTimeout(function() { YAHOO.widget.Overlay.windowScrollEvent.fire(); }, 1);
- } else {
- YAHOO.widget.Overlay.windowScrollEvent.fire();
- }
-};
-
-/**
-* The DOM event handler used to fire the CustomEvent for window resize
-* @method YAHOO.widget.Overlay.windowResizeHandler
-* @static
-* @param {DOMEvent} e The DOM resize event
-*/
-YAHOO.widget.Overlay.windowResizeHandler = function(e) {
- if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
- if (! window.resizeEnd) {
- window.resizeEnd = -1;
- }
- clearTimeout(window.resizeEnd);
- window.resizeEnd = setTimeout(function() { YAHOO.widget.Overlay.windowResizeEvent.fire(); }, 100);
- } else {
- YAHOO.widget.Overlay.windowResizeEvent.fire();
- }
-};
-
-/**
-* A boolean that indicated whether the window resize and scroll events have already been subscribed to.
-* @property YAHOO.widget.Overlay._initialized
-* @private
-* @type Boolean
-*/
-YAHOO.widget.Overlay._initialized = null;
-
-if (YAHOO.widget.Overlay._initialized === null) {
- YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);
- YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);
-
- YAHOO.widget.Overlay._initialized = true;
-}
-
-/**
-* OverlayManager is used for maintaining the focus status of multiple Overlays.* @namespace YAHOO.widget
-* @namespace YAHOO.widget
-* @class OverlayManager
-* @constructor
-* @param {Array} overlays Optional. A collection of Overlays to register with the manager.
-* @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
-*/
-YAHOO.widget.OverlayManager = function(userConfig) {
- this.init(userConfig);
-};
-
-/**
-* The CSS class representing a focused Overlay
-* @property YAHOO.widget.OverlayManager.CSS_FOCUSED
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";
-
-YAHOO.widget.OverlayManager.prototype = {
- /**
- * The class's constructor function
- * @property contructor
- * @type Function
- */
- constructor : YAHOO.widget.OverlayManager,
-
- /**
- * The array of Overlays that are currently registered
- * @property overlays
- * @type YAHOO.widget.Overlay[]
- */
- overlays : null,
-
- /**
- * Initializes the default configuration of the OverlayManager
- * @method initDefaultConfig
- */
- initDefaultConfig : function() {
- /**
- * The collection of registered Overlays in use by the OverlayManager
- * @config overlays
- * @type YAHOO.widget.Overlay[]
- * @default null
- */
- this.cfg.addProperty("overlays", { suppressEvent:true } );
-
- /**
- * The default DOM event that should be used to focus an Overlay
- * @config focusevent
- * @type String
- * @default "mousedown"
- */
- this.cfg.addProperty("focusevent", { value:"mousedown" } );
- },
-
- /**
- * Initializes the OverlayManager
- * @method init
- * @param {YAHOO.widget.Overlay[]} overlays Optional. A collection of Overlays to register with the manager.
- * @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
- */
- init : function(userConfig) {
- /**
- * The OverlayManager's Config object used for monitoring configuration properties.
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- this.initDefaultConfig();
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
- this.cfg.fireQueue();
-
- /**
- * The currently activated Overlay
- * @property activeOverlay
- * @private
- * @type YAHOO.widget.Overlay
- */
- var activeOverlay = null;
-
- /**
- * Returns the currently focused Overlay
- * @method getActive
- * @return {YAHOO.widget.Overlay} The currently focused Overlay
- */
- this.getActive = function() {
- return activeOverlay;
- };
-
- /**
- * Focuses the specified Overlay
- * @method focus
- * @param {YAHOO.widget.Overlay} overlay The Overlay to focus
- * @param {String} overlay The id of the Overlay to focus
- */
- this.focus = function(overlay) {
- var o = this.find(overlay);
- if (o) {
- this.blurAll();
- activeOverlay = o;
- YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);
- this.overlays.sort(this.compareZIndexDesc);
- var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");
- if (! isNaN(topZIndex) && this.overlays[0] != overlay) {
- activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex, 10) + 2));
- }
- this.overlays.sort(this.compareZIndexDesc);
- }
- };
-
- /**
- * Removes the specified Overlay from the manager
- * @method remove
- * @param {YAHOO.widget.Overlay} overlay The Overlay to remove
- * @param {String} overlay The id of the Overlay to remove
- */
- this.remove = function(overlay) {
- var o = this.find(overlay);
- if (o) {
- var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");
- o.cfg.setProperty("zIndex", -1000, true);
- this.overlays.sort(this.compareZIndexDesc);
- this.overlays = this.overlays.slice(0, this.overlays.length-1);
- o.cfg.setProperty("zIndex", originalZ, true);
-
- o.cfg.setProperty("manager", null);
- o.focusEvent = null;
- o.blurEvent = null;
- o.focus = null;
- o.blur = null;
- }
- };
-
- /**
- * Removes focus from all registered Overlays in the manager
- * @method blurAll
- */
- this.blurAll = function() {
- activeOverlay = null;
- for (var o=0;o 0) {
- return true;
- }
- } else {
- return false;
- }
- },
-
- /**
- * Attempts to locate an Overlay by instance or ID.
- * @method find
- * @param {YAHOO.widget.Overlay} overlay An Overlay to locate within the manager
- * @param {String} overlay An Overlay id to locate within the manager
- * @return {YAHOO.widget.Overlay} The requested Overlay, if found, or null if it cannot be located.
- */
- find : function(overlay) {
- if (overlay instanceof YAHOO.widget.Overlay) {
- for (var o=0;o zIndex2) {
- return -1;
- } else if (zIndex1 < zIndex2) {
- return 1;
- } else {
- return 0;
- }
- },
-
- /**
- * Shows all Overlays in the manager.
- * @method showAll
- */
- showAll : function() {
- for (var o=0;oOR
+* @param {HTMLElement} el The element representing the Module
+* @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
+*/
+YAHOO.widget.Module = function(el, userConfig) {
+ if (el) {
+ this.init(el, userConfig);
+ } else {
+ YAHOO.log("No element or element ID specified for Module instantiation", "error");
+ }
+};
+
+/**
+* Constant representing the prefix path to use for non-secure images
+* @property YAHOO.widget.Module.IMG_ROOT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";
+
+/**
+* Constant representing the prefix path to use for securely served images
+* @property YAHOO.widget.Module.IMG_ROOT_SSL
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";
+
+/**
+* Constant for the default CSS class name that represents a Module
+* @property YAHOO.widget.Module.CSS_MODULE
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_MODULE = "module";
+
+/**
+* Constant representing the module header
+* @property YAHOO.widget.Module.CSS_HEADER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_HEADER = "hd";
+
+/**
+* Constant representing the module body
+* @property YAHOO.widget.Module.CSS_BODY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_BODY = "bd";
+
+/**
+* Constant representing the module footer
+* @property YAHOO.widget.Module.CSS_FOOTER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_FOOTER = "ft";
+
+/**
+* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size
+* @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
+
+YAHOO.widget.Module.prototype = {
+
+ /**
+ * The class's constructor function
+ * @property contructor
+ * @type Function
+ */
+ constructor : YAHOO.widget.Module,
+
+ /**
+ * The main module element that contains the header, body, and footer
+ * @property element
+ * @type HTMLElement
+ */
+ element : null,
+
+ /**
+ * The header element, denoted with CSS class "hd"
+ * @property header
+ * @type HTMLElement
+ */
+ header : null,
+
+ /**
+ * The body element, denoted with CSS class "bd"
+ * @property body
+ * @type HTMLElement
+ */
+ body : null,
+
+ /**
+ * The footer element, denoted with CSS class "ft"
+ * @property footer
+ * @type HTMLElement
+ */
+ footer : null,
+
+ /**
+ * The id of the element
+ * @property id
+ * @type String
+ */
+ id : null,
+
+ /**
+ * The String representing the image root
+ * @property imageRoot
+ * @type String
+ */
+ imageRoot : YAHOO.widget.Module.IMG_ROOT,
+
+ /**
+ * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
+ * @method initEvents
+ */
+ initEvents : function() {
+
+ /**
+ * CustomEvent fired prior to class initalization.
+ * @event beforeInitEvent
+ * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
+ */
+ this.beforeInitEvent = new YAHOO.util.CustomEvent("beforeInit");
+
+ /**
+ * CustomEvent fired after class initalization.
+ * @event initEvent
+ * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
+ */
+ this.initEvent = new YAHOO.util.CustomEvent("init");
+
+ /**
+ * CustomEvent fired when the Module is appended to the DOM
+ * @event appendEvent
+ */
+ this.appendEvent = new YAHOO.util.CustomEvent("append");
+
+ /**
+ * CustomEvent fired before the Module is rendered
+ * @event beforeRenderEvent
+ */
+ this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
+
+ /**
+ * CustomEvent fired after the Module is rendered
+ * @event renderEvent
+ */
+ this.renderEvent = new YAHOO.util.CustomEvent("render");
+
+ /**
+ * CustomEvent fired when the header content of the Module is modified
+ * @event changeHeaderEvent
+ * @param {String/HTMLElement} content String/element representing the new header content
+ */
+ this.changeHeaderEvent = new YAHOO.util.CustomEvent("changeHeader");
+
+ /**
+ * CustomEvent fired when the body content of the Module is modified
+ * @event changeBodyEvent
+ * @param {String/HTMLElement} content String/element representing the new body content
+ */
+ this.changeBodyEvent = new YAHOO.util.CustomEvent("changeBody");
+
+ /**
+ * CustomEvent fired when the footer content of the Module is modified
+ * @event changeFooterEvent
+ * @param {String/HTMLElement} content String/element representing the new footer content
+ */
+ this.changeFooterEvent = new YAHOO.util.CustomEvent("changeFooter");
+
+ /**
+ * CustomEvent fired when the content of the Module is modified
+ * @event changeContentEvent
+ */
+ this.changeContentEvent = new YAHOO.util.CustomEvent("changeContent");
+
+ /**
+ * CustomEvent fired when the Module is destroyed
+ * @event destroyEvent
+ */
+ this.destroyEvent = new YAHOO.util.CustomEvent("destroy");
+
+ /**
+ * CustomEvent fired before the Module is shown
+ * @event beforeShowEvent
+ */
+ this.beforeShowEvent = new YAHOO.util.CustomEvent("beforeShow");
+
+ /**
+ * CustomEvent fired after the Module is shown
+ * @event showEvent
+ */
+ this.showEvent = new YAHOO.util.CustomEvent("show");
+
+ /**
+ * CustomEvent fired before the Module is hidden
+ * @event beforeHideEvent
+ */
+ this.beforeHideEvent = new YAHOO.util.CustomEvent("beforeHide");
+
+ /**
+ * CustomEvent fired after the Module is hidden
+ * @event hideEvent
+ */
+ this.hideEvent = new YAHOO.util.CustomEvent("hide");
+ },
+
+ /**
+ * String representing the current user-agent platform
+ * @property platform
+ * @type String
+ */
+ platform : function() {
+ var ua = navigator.userAgent.toLowerCase();
+ if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {
+ return "windows";
+ } else if (ua.indexOf("macintosh") != -1) {
+ return "mac";
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * String representing the current user-agent browser
+ * @property browser
+ * @type String
+ */
+ browser : function() {
+ var ua = navigator.userAgent.toLowerCase();
+ if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
+ return 'opera';
+ } else if (ua.indexOf('msie 7')!=-1) { // IE7
+ return 'ie7';
+ } else if (ua.indexOf('msie') !=-1) { // IE
+ return 'ie';
+ } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
+ return 'safari';
+ } else if (ua.indexOf('gecko') != -1) { // Gecko
+ return 'gecko';
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * Boolean representing whether or not the current browsing context is secure (https)
+ * @property isSecure
+ * @type Boolean
+ */
+ isSecure : function() {
+ if (window.location.href.toLowerCase().indexOf("https") === 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
+ */
+ initDefaultConfig : function() {
+ // Add properties //
+
+ /**
+ * Specifies whether the Module is visible on the page.
+ * @config visible
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );
+
+ /**
+ * Object or array of objects representing the ContainerEffect classes that are active for animating the container.
+ * @config effect
+ * @type Object
+ * @default null
+ */
+ this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );
+
+ /**
+ * Specifies whether to create a special proxy iframe to monitor for user font resizing in the document
+ * @config monitorresize
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );
+ },
+
+ /**
+ * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+ * @method init
+ * @param {String} el The element ID representing the Module OR
+ * @param {HTMLElement} el The element representing the Module
+ * @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
+ */
+ init : function(el, userConfig) {
+
+ this.initEvents();
+
+ this.beforeInitEvent.fire(YAHOO.widget.Module);
+
+ /**
+ * The Module's Config object used for monitoring configuration properties.
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ if (this.isSecure) {
+ this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;
+ }
+
+ if (typeof el == "string") {
+ var elId = el;
+
+ el = document.getElementById(el);
+ if (! el) {
+ el = document.createElement("DIV");
+ el.id = elId;
+ }
+ }
+
+ this.element = el;
+
+ if (el.id) {
+ this.id = el.id;
+ }
+
+ var childNodes = this.element.childNodes;
+
+ if (childNodes) {
+ for (var i=0;iOR
+ * @param {HTMLElement} headerContent The HTMLElement to append to the header
+ */
+ setHeader : function(headerContent) {
+ if (! this.header) {
+ this.header = document.createElement("DIV");
+ this.header.className = YAHOO.widget.Module.CSS_HEADER;
+ }
+
+ if (typeof headerContent == "string") {
+ this.header.innerHTML = headerContent;
+ } else {
+ this.header.innerHTML = "";
+ this.header.appendChild(headerContent);
+ }
+
+ this.changeHeaderEvent.fire(headerContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the header. If no header is present, one will be automatically created.
+ * @method appendToHeader
+ * @param {HTMLElement} element The element to append to the header
+ */
+ appendToHeader : function(element) {
+ if (! this.header) {
+ this.header = document.createElement("DIV");
+ this.header.className = YAHOO.widget.Module.CSS_HEADER;
+ }
+
+ this.header.appendChild(element);
+ this.changeHeaderEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.
+ * @method setBody
+ * @param {String} bodyContent The HTML used to set the body OR
+ * @param {HTMLElement} bodyContent The HTMLElement to append to the body
+ */
+ setBody : function(bodyContent) {
+ if (! this.body) {
+ this.body = document.createElement("DIV");
+ this.body.className = YAHOO.widget.Module.CSS_BODY;
+ }
+
+ if (typeof bodyContent == "string")
+ {
+ this.body.innerHTML = bodyContent;
+ } else {
+ this.body.innerHTML = "";
+ this.body.appendChild(bodyContent);
+ }
+
+ this.changeBodyEvent.fire(bodyContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the body. If no body is present, one will be automatically created.
+ * @method appendToBody
+ * @param {HTMLElement} element The element to append to the body
+ */
+ appendToBody : function(element) {
+ if (! this.body) {
+ this.body = document.createElement("DIV");
+ this.body.className = YAHOO.widget.Module.CSS_BODY;
+ }
+
+ this.body.appendChild(element);
+ this.changeBodyEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.
+ * @method setFooter
+ * @param {String} footerContent The HTML used to set the footer OR
+ * @param {HTMLElement} footerContent The HTMLElement to append to the footer
+ */
+ setFooter : function(footerContent) {
+ if (! this.footer) {
+ this.footer = document.createElement("DIV");
+ this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
+ }
+
+ if (typeof footerContent == "string") {
+ this.footer.innerHTML = footerContent;
+ } else {
+ this.footer.innerHTML = "";
+ this.footer.appendChild(footerContent);
+ }
+
+ this.changeFooterEvent.fire(footerContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the footer. If no footer is present, one will be automatically created.
+ * @method appendToFooter
+ * @param {HTMLElement} element The element to append to the footer
+ */
+ appendToFooter : function(element) {
+ if (! this.footer) {
+ this.footer = document.createElement("DIV");
+ this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
+ }
+
+ this.footer.appendChild(element);
+ this.changeFooterEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.
+ * @method render
+ * @param {String} appendToNode The element id to which the Module should be appended to prior to rendering OR
+ * @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
+ * @param {HTMLElement} moduleElement OPTIONAL. The element that represents the actual Standard Module container.
+ * @return {Boolean} Success or failure of the render
+ */
+ render : function(appendToNode, moduleElement) {
+ this.beforeRenderEvent.fire();
+
+ if (! moduleElement) {
+ moduleElement = this.element;
+ }
+
+ var me = this;
+ var appendTo = function(element) {
+ if (typeof element == "string") {
+ element = document.getElementById(element);
+ }
+
+ if (element) {
+ element.appendChild(me.element);
+ me.appendEvent.fire();
+ }
+ };
+
+ if (appendToNode) {
+ appendTo(appendToNode);
+ } else { // No node was passed in. If the element is not pre-marked up, this fails
+ if (! YAHOO.util.Dom.inDocument(this.element)) {
+ YAHOO.log("Render failed. Must specify appendTo node if Module isn't already in the DOM.", "error");
+ return false;
+ }
+ }
+
+ // Need to get everything into the DOM if it isn't already
+
+ if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {
+ // There is a header, but it's not in the DOM yet... need to add it
+ var firstChild = moduleElement.firstChild;
+ if (firstChild) { // Insert before first child if exists
+ moduleElement.insertBefore(this.header, firstChild);
+ } else { // Append to empty body because there are no children
+ moduleElement.appendChild(this.header);
+ }
+ }
+
+ if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {
+ // There is a body, but it's not in the DOM yet... need to add it
+ if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM
+ moduleElement.insertBefore(this.body, this.footer);
+ } else { // Append to element because there is no footer
+ moduleElement.appendChild(this.body);
+ }
+ }
+
+ if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {
+ // There is a footer, but it's not in the DOM yet... need to add it
+ moduleElement.appendChild(this.footer);
+ }
+
+ this.renderEvent.fire();
+ return true;
+ },
+
+ /**
+ * Removes the Module element from the DOM and sets all child elements to null.
+ * @method destroy
+ */
+ destroy : function() {
+ if (this.element) {
+ var parent = this.element.parentNode;
+ }
+ if (parent) {
+ parent.removeChild(this.element);
+ }
+
+ this.element = null;
+ this.header = null;
+ this.body = null;
+ this.footer = null;
+
+ this.destroyEvent.fire();
+ },
+
+ /**
+ * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.
+ * @method show
+ */
+ show : function() {
+ this.cfg.setProperty("visible", true);
+ },
+
+ /**
+ * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.
+ * @method hide
+ */
+ hide : function() {
+ this.cfg.setProperty("visible", false);
+ },
+
+ // BUILT-IN EVENT HANDLERS FOR MODULE //
+
+ /**
+ * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".
+ * This method is responsible for firing showEvent and hideEvent.
+ * @param {String} type The CustomEvent type (usually the property name)
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+ * @method configVisible
+ */
+ configVisible : function(type, args, obj) {
+ var visible = args[0];
+ if (visible) {
+ this.beforeShowEvent.fire();
+ YAHOO.util.Dom.setStyle(this.element, "display", "block");
+ this.showEvent.fire();
+ } else {
+ this.beforeHideEvent.fire();
+ YAHOO.util.Dom.setStyle(this.element, "display", "none");
+ this.hideEvent.fire();
+ }
+ },
+
+ /**
+ * Default event handler for the "monitorresize" configuration property
+ * @param {String} type The CustomEvent type (usually the property name)
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+ * @method configMonitorResize
+ */
+ configMonitorResize : function(type, args, obj) {
+ var monitor = args[0];
+ if (monitor) {
+ this.initResizeMonitor();
+ } else {
+ YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);
+ this.resizeMonitor = null;
+ }
+ }
+};
+
+/**
+* Returns a String representation of the Object.
+* @method toString
+* @return {String} The string representation of the Module
+*/
+YAHOO.widget.Module.prototype.toString = function() {
+ return "Module " + this.id;
+};
+
+/**
+* Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.
+* @class Overlay
+* @namespace YAHOO.widget
+* @extends YAHOO.widget.Module
+* @param {String} el The element ID representing the Overlay OR
+* @param {HTMLElement} el The element representing the Overlay
+* @param {Object} userConfig The configuration object literal containing 10/23/2006the configuration that should be set for this Overlay. See configuration documentation for more details.
+* @constructor
+*/
+YAHOO.widget.Overlay = function(el, userConfig) {
+ YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);
+
+/**
+* The URL that will be placed in the iframe
+* @property YAHOO.widget.Overlay.IFRAME_SRC
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"
+
+/**
+* Constant representing the top left corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.TOP_LEFT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.TOP_LEFT = "tl";
+
+/**
+* Constant representing the top right corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.TOP_RIGHT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.TOP_RIGHT = "tr";
+
+/**
+* Constant representing the top bottom left corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.BOTTOM_LEFT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";
+
+/**
+* Constant representing the bottom right corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.BOTTOM_RIGHT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";
+
+/**
+* Constant representing the default CSS class used for an Overlay
+* @property YAHOO.widget.Overlay.CSS_OVERLAY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";
+
+/**
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+* @method init
+* @param {String} el The element ID representing the Overlay OR
+* @param {HTMLElement} el The element representing the Overlay
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
+*/
+YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {
+ YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
+
+ this.beforeInitEvent.fire(YAHOO.widget.Overlay);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ if (this.platform == "mac" && this.browser == "gecko") {
+ if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {
+ this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);
+ }
+ if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {
+ this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);
+ }
+ }
+
+ this.initEvent.fire(YAHOO.widget.Overlay);
+
+};
+
+/**
+* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.
+* @method initEvents
+*/
+YAHOO.widget.Overlay.prototype.initEvents = function() {
+ YAHOO.widget.Overlay.superclass.initEvents.call(this);
+
+ /**
+ * CustomEvent fired before the Overlay is moved.
+ * @event beforeMoveEvent
+ * @param {Number} x x coordinate
+ * @param {Number} y y coordinate
+ */
+ this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);
+
+ /**
+ * CustomEvent fired after the Overlay is moved.
+ * @event moveEvent
+ * @param {Number} x x coordinate
+ * @param {Number} y y coordinate
+ */
+ this.moveEvent = new YAHOO.util.CustomEvent("move", this);
+};
+
+/**
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
+* @method initDefaultConfig
+*/
+YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {
+ YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);
+
+ // Add overlay config properties //
+
+ /**
+ * The absolute x-coordinate position of the Overlay
+ * @config x
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * The absolute y-coordinate position of the Overlay
+ * @config y
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * An array with the absolute x and y positions of the Overlay
+ * @config xy
+ * @type Number[]
+ * @default null
+ */
+ this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * The array of context arguments for context-sensitive positioning. The format is: [id or element, element corner, context corner]. For example, setting this property to ["img1", "tl", "bl"] would align the Overlay's top left corner to the context element's bottom left corner.
+ * @config context
+ * @type Array
+ * @default null
+ */
+ this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * True if the Overlay should be anchored to the center of the viewport.
+ * @config fixedcenter
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );
+
+ /**
+ * CSS width of the Overlay.
+ * @config width
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * CSS height of the Overlay.
+ * @config height
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * CSS z-index of the Overlay.
+ * @config zIndex
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );
+
+ /**
+ * True if the Overlay should be prevented from being positioned out of the viewport.
+ * @config constraintoviewport
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );
+
+ /**
+ * True if the Overlay should have an IFRAME shim (for correcting the select z-index bug in IE6 and below).
+ * @config iframe
+ * @type Boolean
+ * @default true for IE6 and below, false for all others
+ */
+ this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );
+};
+
+/**
+* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);
+* @method moveTo
+* @param {Number} x The Overlay's new x position
+* @param {Number} y The Overlay's new y position
+*/
+YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {
+ this.cfg.setProperty("xy",[x,y]);
+};
+
+/**
+* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
+* @method hideMacGeckoScrollbars
+*/
+YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {
+ YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");
+ YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");
+};
+
+/**
+* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
+* @method showMacGeckoScrollbars
+*/
+YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {
+ YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");
+ YAHOO.util.Dom.addClass(this.element, "show-scrollbars");
+};
+
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.
+* @method configVisible
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {
+ var visible = args[0];
+ var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");
+
+ if (currentVis == "inherit") {
+ var e = this.element.parentNode;
+ while (e.nodeType != 9 && e.nodeType != 11) {
+ currentVis = YAHOO.util.Dom.getStyle(e, "visibility");
+ if (currentVis != "inherit") { break; }
+ e = e.parentNode;
+ }
+ if (currentVis == "inherit") {
+ currentVis = "visible";
+ }
+ }
+
+ var effect = this.cfg.getProperty("effect");
+
+ var effectInstances = [];
+ if (effect) {
+ if (effect instanceof Array) {
+ for (var i=0;i rightConstraint) {
+ x = rightConstraint;
+ }
+
+ if (y < topConstraint) {
+ y = topConstraint;
+ } else if (y > bottomConstraint) {
+ y = bottomConstraint;
+ }
+
+ this.cfg.setProperty("x", x, true);
+ this.cfg.setProperty("y", y, true);
+ this.cfg.setProperty("xy", [x,y], true);
+};
+
+/**
+* Centers the container in the viewport.
+* @method center
+*/
+YAHOO.widget.Overlay.prototype.center = function() {
+ var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+ var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+
+ var viewPortWidth = YAHOO.util.Dom.getClientWidth();
+ var viewPortHeight = YAHOO.util.Dom.getClientHeight();
+
+ var elementWidth = this.element.offsetWidth;
+ var elementHeight = this.element.offsetHeight;
+
+ var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;
+ var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;
+
+ this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
+
+ this.cfg.refireEvent("iframe");
+};
+
+/**
+* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.
+* @method syncPosition
+*/
+YAHOO.widget.Overlay.prototype.syncPosition = function() {
+ var pos = YAHOO.util.Dom.getXY(this.element);
+ this.cfg.setProperty("x", pos[0], true);
+ this.cfg.setProperty("y", pos[1], true);
+ this.cfg.setProperty("xy", pos, true);
+};
+
+/**
+* Event handler fired when the resize monitor element is resized.
+* @method onDomResize
+* @param {DOMEvent} e The resize DOM event
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {
+ YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);
+ var me = this;
+ setTimeout(function() {
+ me.syncPosition();
+ me.cfg.refireEvent("iframe");
+ me.cfg.refireEvent("context");
+ }, 0);
+};
+
+/**
+* Removes the Overlay element from the DOM and sets all child elements to null.
+* @method destroy
+*/
+YAHOO.widget.Overlay.prototype.destroy = function() {
+ if (this.iframe) {
+ this.iframe.parentNode.removeChild(this.iframe);
+ }
+
+ this.iframe = null;
+
+ YAHOO.widget.Overlay.superclass.destroy.call(this);
+};
+
+/**
+* Returns a String representation of the object.
+* @method toString
+* @return {String} The string representation of the Overlay.
+*/
+YAHOO.widget.Overlay.prototype.toString = function() {
+ return "Overlay " + this.id;
+};
+
+/**
+* A singleton CustomEvent used for reacting to the DOM event for window scroll
+* @event YAHOO.widget.Overlay.windowScrollEvent
+*/
+YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");
+
+/**
+* A singleton CustomEvent used for reacting to the DOM event for window resize
+* @event YAHOO.widget.Overlay.windowResizeEvent
+*/
+YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");
+
+/**
+* The DOM event handler used to fire the CustomEvent for window scroll
+* @method YAHOO.widget.Overlay.windowScrollHandler
+* @static
+* @param {DOMEvent} e The DOM scroll event
+*/
+YAHOO.widget.Overlay.windowScrollHandler = function(e) {
+ if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
+ if (! window.scrollEnd) {
+ window.scrollEnd = -1;
+ }
+ clearTimeout(window.scrollEnd);
+ window.scrollEnd = setTimeout(function() { YAHOO.widget.Overlay.windowScrollEvent.fire(); }, 1);
+ } else {
+ YAHOO.widget.Overlay.windowScrollEvent.fire();
+ }
+};
+
+/**
+* The DOM event handler used to fire the CustomEvent for window resize
+* @method YAHOO.widget.Overlay.windowResizeHandler
+* @static
+* @param {DOMEvent} e The DOM resize event
+*/
+YAHOO.widget.Overlay.windowResizeHandler = function(e) {
+ if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
+ if (! window.resizeEnd) {
+ window.resizeEnd = -1;
+ }
+ clearTimeout(window.resizeEnd);
+ window.resizeEnd = setTimeout(function() { YAHOO.widget.Overlay.windowResizeEvent.fire(); }, 100);
+ } else {
+ YAHOO.widget.Overlay.windowResizeEvent.fire();
+ }
+};
+
+/**
+* A boolean that indicated whether the window resize and scroll events have already been subscribed to.
+* @property YAHOO.widget.Overlay._initialized
+* @private
+* @type Boolean
+*/
+YAHOO.widget.Overlay._initialized = null;
+
+if (YAHOO.widget.Overlay._initialized === null) {
+ YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);
+ YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);
+
+ YAHOO.widget.Overlay._initialized = true;
+}
+
+/**
+* OverlayManager is used for maintaining the focus status of multiple Overlays.* @namespace YAHOO.widget
+* @namespace YAHOO.widget
+* @class OverlayManager
+* @constructor
+* @param {Array} overlays Optional. A collection of Overlays to register with the manager.
+* @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
+*/
+YAHOO.widget.OverlayManager = function(userConfig) {
+ this.init(userConfig);
+};
+
+/**
+* The CSS class representing a focused Overlay
+* @property YAHOO.widget.OverlayManager.CSS_FOCUSED
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";
+
+YAHOO.widget.OverlayManager.prototype = {
+ /**
+ * The class's constructor function
+ * @property contructor
+ * @type Function
+ */
+ constructor : YAHOO.widget.OverlayManager,
+
+ /**
+ * The array of Overlays that are currently registered
+ * @property overlays
+ * @type YAHOO.widget.Overlay[]
+ */
+ overlays : null,
+
+ /**
+ * Initializes the default configuration of the OverlayManager
+ * @method initDefaultConfig
+ */
+ initDefaultConfig : function() {
+ /**
+ * The collection of registered Overlays in use by the OverlayManager
+ * @config overlays
+ * @type YAHOO.widget.Overlay[]
+ * @default null
+ */
+ this.cfg.addProperty("overlays", { suppressEvent:true } );
+
+ /**
+ * The default DOM event that should be used to focus an Overlay
+ * @config focusevent
+ * @type String
+ * @default "mousedown"
+ */
+ this.cfg.addProperty("focusevent", { value:"mousedown" } );
+ },
+
+ /**
+ * Initializes the OverlayManager
+ * @method init
+ * @param {YAHOO.widget.Overlay[]} overlays Optional. A collection of Overlays to register with the manager.
+ * @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
+ */
+ init : function(userConfig) {
+ /**
+ * The OverlayManager's Config object used for monitoring configuration properties.
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ this.initDefaultConfig();
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+ this.cfg.fireQueue();
+
+ /**
+ * The currently activated Overlay
+ * @property activeOverlay
+ * @private
+ * @type YAHOO.widget.Overlay
+ */
+ var activeOverlay = null;
+
+ /**
+ * Returns the currently focused Overlay
+ * @method getActive
+ * @return {YAHOO.widget.Overlay} The currently focused Overlay
+ */
+ this.getActive = function() {
+ return activeOverlay;
+ };
+
+ /**
+ * Focuses the specified Overlay
+ * @method focus
+ * @param {YAHOO.widget.Overlay} overlay The Overlay to focus
+ * @param {String} overlay The id of the Overlay to focus
+ */
+ this.focus = function(overlay) {
+ var o = this.find(overlay);
+ if (o) {
+ this.blurAll();
+ activeOverlay = o;
+ YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);
+ this.overlays.sort(this.compareZIndexDesc);
+ var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");
+ if (! isNaN(topZIndex) && this.overlays[0] != overlay) {
+ activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex, 10) + 2));
+ }
+ this.overlays.sort(this.compareZIndexDesc);
+ }
+ };
+
+ /**
+ * Removes the specified Overlay from the manager
+ * @method remove
+ * @param {YAHOO.widget.Overlay} overlay The Overlay to remove
+ * @param {String} overlay The id of the Overlay to remove
+ */
+ this.remove = function(overlay) {
+ var o = this.find(overlay);
+ if (o) {
+ var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");
+ o.cfg.setProperty("zIndex", -1000, true);
+ this.overlays.sort(this.compareZIndexDesc);
+ this.overlays = this.overlays.slice(0, this.overlays.length-1);
+ o.cfg.setProperty("zIndex", originalZ, true);
+
+ o.cfg.setProperty("manager", null);
+ o.focusEvent = null;
+ o.blurEvent = null;
+ o.focus = null;
+ o.blur = null;
+ }
+ };
+
+ /**
+ * Removes focus from all registered Overlays in the manager
+ * @method blurAll
+ */
+ this.blurAll = function() {
+ activeOverlay = null;
+ for (var o=0;o 0) {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Attempts to locate an Overlay by instance or ID.
+ * @method find
+ * @param {YAHOO.widget.Overlay} overlay An Overlay to locate within the manager
+ * @param {String} overlay An Overlay id to locate within the manager
+ * @return {YAHOO.widget.Overlay} The requested Overlay, if found, or null if it cannot be located.
+ */
+ find : function(overlay) {
+ if (overlay instanceof YAHOO.widget.Overlay) {
+ for (var o=0;o zIndex2) {
+ return -1;
+ } else if (zIndex1 < zIndex2) {
+ return 1;
+ } else {
+ return 0;
+ }
+ },
+
+ /**
+ * Shows all Overlays in the manager.
+ * @method showAll
+ */
+ showAll : function() {
+ for (var o=0;orightConstraint){x=rightConstraint;}
-if(ybottomConstraint){y=bottomConstraint;}
-this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);};YAHOO.widget.Overlay.prototype.center=function(){var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.cfg.setProperty("xy",[parseInt(x,10),parseInt(y,10)]);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);};YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.syncPosition();me.cfg.refireEvent("iframe");me.cfg.refireEvent("context");},0);};YAHOO.widget.Overlay.prototype.destroy=function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}
-this.iframe=null;YAHOO.widget.Overlay.superclass.destroy.call(this);};YAHOO.widget.Overlay.prototype.toString=function(){return"Overlay "+this.id;};YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.scrollEnd){window.scrollEnd=-1;}
-clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){YAHOO.widget.Overlay.windowScrollEvent.fire();},1);}else{YAHOO.widget.Overlay.windowScrollEvent.fire();}};YAHOO.widget.Overlay.windowResizeHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.resizeEnd){window.resizeEnd=-1;}
-clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){YAHOO.widget.Overlay.windowResizeEvent.fire();},100);}else{YAHOO.widget.Overlay.windowResizeEvent.fire();}};YAHOO.widget.Overlay._initialized=null;if(YAHOO.widget.Overlay._initialized===null){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;}
-YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);};YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}
-this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;};this.focus=function(overlay){var o=this.find(overlay);if(o){this.blurAll();activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex,10)+2));}
-this.overlays.sort(this.compareZIndexDesc);}};this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent=null;o.blurEvent=null;o.focus=null;o.blur=null;}};this.blurAll=function(){activeOverlay=null;for(var o=0;o0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;ozIndex2){return-1;}else if(zIndex1rightConstraint){x=rightConstraint;}
+if(ybottomConstraint){y=bottomConstraint;}
+this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);};YAHOO.widget.Overlay.prototype.center=function(){var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.cfg.setProperty("xy",[parseInt(x,10),parseInt(y,10)]);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);};YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.syncPosition();me.cfg.refireEvent("iframe");me.cfg.refireEvent("context");},0);};YAHOO.widget.Overlay.prototype.destroy=function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}
+this.iframe=null;YAHOO.widget.Overlay.superclass.destroy.call(this);};YAHOO.widget.Overlay.prototype.toString=function(){return"Overlay "+this.id;};YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.scrollEnd){window.scrollEnd=-1;}
+clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){YAHOO.widget.Overlay.windowScrollEvent.fire();},1);}else{YAHOO.widget.Overlay.windowScrollEvent.fire();}};YAHOO.widget.Overlay.windowResizeHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.resizeEnd){window.resizeEnd=-1;}
+clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){YAHOO.widget.Overlay.windowResizeEvent.fire();},100);}else{YAHOO.widget.Overlay.windowResizeEvent.fire();}};YAHOO.widget.Overlay._initialized=null;if(YAHOO.widget.Overlay._initialized===null){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;}
+YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);};YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}
+this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;};this.focus=function(overlay){var o=this.find(overlay);if(o){this.blurAll();activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex,10)+2));}
+this.overlays.sort(this.compareZIndexDesc);}};this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent=null;o.blurEvent=null;o.focus=null;o.blur=null;}};this.blurAll=function(){activeOverlay=null;for(var o=0;o0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;ozIndex2){return-1;}else if(zIndex1OR
-* @param {HTMLElement} el The element representing the Module
-* @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
-*/
-YAHOO.widget.Module = function(el, userConfig) {
- if (el) {
- this.init(el, userConfig);
- }
-};
-
-/**
-* Constant representing the prefix path to use for non-secure images
-* @property YAHOO.widget.Module.IMG_ROOT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";
-
-/**
-* Constant representing the prefix path to use for securely served images
-* @property YAHOO.widget.Module.IMG_ROOT_SSL
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";
-
-/**
-* Constant for the default CSS class name that represents a Module
-* @property YAHOO.widget.Module.CSS_MODULE
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_MODULE = "module";
-
-/**
-* Constant representing the module header
-* @property YAHOO.widget.Module.CSS_HEADER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_HEADER = "hd";
-
-/**
-* Constant representing the module body
-* @property YAHOO.widget.Module.CSS_BODY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_BODY = "bd";
-
-/**
-* Constant representing the module footer
-* @property YAHOO.widget.Module.CSS_FOOTER
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.CSS_FOOTER = "ft";
-
-/**
-* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size
-* @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
-
-YAHOO.widget.Module.prototype = {
- /**
- * The class's constructor function
- * @property contructor
- * @type Function
- */
- constructor : YAHOO.widget.Module,
-
- /**
- * The main module element that contains the header, body, and footer
- * @property element
- * @type HTMLElement
- */
- element : null,
-
- /**
- * The header element, denoted with CSS class "hd"
- * @property header
- * @type HTMLElement
- */
- header : null,
-
- /**
- * The body element, denoted with CSS class "bd"
- * @property body
- * @type HTMLElement
- */
- body : null,
-
- /**
- * The footer element, denoted with CSS class "ft"
- * @property footer
- * @type HTMLElement
- */
- footer : null,
-
- /**
- * The id of the element
- * @property id
- * @type String
- */
- id : null,
-
- /**
- * The String representing the image root
- * @property imageRoot
- * @type String
- */
- imageRoot : YAHOO.widget.Module.IMG_ROOT,
-
- /**
- * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
- * @method initEvents
- */
- initEvents : function() {
-
- /**
- * CustomEvent fired prior to class initalization.
- * @event beforeInitEvent
- * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
- */
- this.beforeInitEvent = new YAHOO.util.CustomEvent("beforeInit");
-
- /**
- * CustomEvent fired after class initalization.
- * @event initEvent
- * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
- */
- this.initEvent = new YAHOO.util.CustomEvent("init");
-
- /**
- * CustomEvent fired when the Module is appended to the DOM
- * @event appendEvent
- */
- this.appendEvent = new YAHOO.util.CustomEvent("append");
-
- /**
- * CustomEvent fired before the Module is rendered
- * @event beforeRenderEvent
- */
- this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
-
- /**
- * CustomEvent fired after the Module is rendered
- * @event renderEvent
- */
- this.renderEvent = new YAHOO.util.CustomEvent("render");
-
- /**
- * CustomEvent fired when the header content of the Module is modified
- * @event changeHeaderEvent
- * @param {String/HTMLElement} content String/element representing the new header content
- */
- this.changeHeaderEvent = new YAHOO.util.CustomEvent("changeHeader");
-
- /**
- * CustomEvent fired when the body content of the Module is modified
- * @event changeBodyEvent
- * @param {String/HTMLElement} content String/element representing the new body content
- */
- this.changeBodyEvent = new YAHOO.util.CustomEvent("changeBody");
-
- /**
- * CustomEvent fired when the footer content of the Module is modified
- * @event changeFooterEvent
- * @param {String/HTMLElement} content String/element representing the new footer content
- */
- this.changeFooterEvent = new YAHOO.util.CustomEvent("changeFooter");
-
- /**
- * CustomEvent fired when the content of the Module is modified
- * @event changeContentEvent
- */
- this.changeContentEvent = new YAHOO.util.CustomEvent("changeContent");
-
- /**
- * CustomEvent fired when the Module is destroyed
- * @event destroyEvent
- */
- this.destroyEvent = new YAHOO.util.CustomEvent("destroy");
-
- /**
- * CustomEvent fired before the Module is shown
- * @event beforeShowEvent
- */
- this.beforeShowEvent = new YAHOO.util.CustomEvent("beforeShow");
-
- /**
- * CustomEvent fired after the Module is shown
- * @event showEvent
- */
- this.showEvent = new YAHOO.util.CustomEvent("show");
-
- /**
- * CustomEvent fired before the Module is hidden
- * @event beforeHideEvent
- */
- this.beforeHideEvent = new YAHOO.util.CustomEvent("beforeHide");
-
- /**
- * CustomEvent fired after the Module is hidden
- * @event hideEvent
- */
- this.hideEvent = new YAHOO.util.CustomEvent("hide");
- },
-
- /**
- * String representing the current user-agent platform
- * @property platform
- * @type String
- */
- platform : function() {
- var ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {
- return "windows";
- } else if (ua.indexOf("macintosh") != -1) {
- return "mac";
- } else {
- return false;
- }
- }(),
-
- /**
- * String representing the current user-agent browser
- * @property browser
- * @type String
- */
- browser : function() {
- var ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
- return 'opera';
- } else if (ua.indexOf('msie 7')!=-1) { // IE7
- return 'ie7';
- } else if (ua.indexOf('msie') !=-1) { // IE
- return 'ie';
- } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
- return 'safari';
- } else if (ua.indexOf('gecko') != -1) { // Gecko
- return 'gecko';
- } else {
- return false;
- }
- }(),
-
- /**
- * Boolean representing whether or not the current browsing context is secure (https)
- * @property isSecure
- * @type Boolean
- */
- isSecure : function() {
- if (window.location.href.toLowerCase().indexOf("https") === 0) {
- return true;
- } else {
- return false;
- }
- }(),
-
- /**
- * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
- */
- initDefaultConfig : function() {
- // Add properties //
-
- /**
- * Specifies whether the Module is visible on the page.
- * @config visible
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );
-
- /**
- * Object or array of objects representing the ContainerEffect classes that are active for animating the container.
- * @config effect
- * @type Object
- * @default null
- */
- this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );
-
- /**
- * Specifies whether to create a special proxy iframe to monitor for user font resizing in the document
- * @config monitorresize
- * @type Boolean
- * @default true
- */
- this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );
- },
-
- /**
- * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
- * @method init
- * @param {String} el The element ID representing the Module OR
- * @param {HTMLElement} el The element representing the Module
- * @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
- */
- init : function(el, userConfig) {
-
- this.initEvents();
-
- this.beforeInitEvent.fire(YAHOO.widget.Module);
-
- /**
- * The Module's Config object used for monitoring configuration properties.
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- if (this.isSecure) {
- this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;
- }
-
- if (typeof el == "string") {
- var elId = el;
-
- el = document.getElementById(el);
- if (! el) {
- el = document.createElement("DIV");
- el.id = elId;
- }
- }
-
- this.element = el;
-
- if (el.id) {
- this.id = el.id;
- }
-
- var childNodes = this.element.childNodes;
-
- if (childNodes) {
- for (var i=0;iOR
- * @param {HTMLElement} headerContent The HTMLElement to append to the header
- */
- setHeader : function(headerContent) {
- if (! this.header) {
- this.header = document.createElement("DIV");
- this.header.className = YAHOO.widget.Module.CSS_HEADER;
- }
-
- if (typeof headerContent == "string") {
- this.header.innerHTML = headerContent;
- } else {
- this.header.innerHTML = "";
- this.header.appendChild(headerContent);
- }
-
- this.changeHeaderEvent.fire(headerContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the header. If no header is present, one will be automatically created.
- * @method appendToHeader
- * @param {HTMLElement} element The element to append to the header
- */
- appendToHeader : function(element) {
- if (! this.header) {
- this.header = document.createElement("DIV");
- this.header.className = YAHOO.widget.Module.CSS_HEADER;
- }
-
- this.header.appendChild(element);
- this.changeHeaderEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.
- * @method setBody
- * @param {String} bodyContent The HTML used to set the body OR
- * @param {HTMLElement} bodyContent The HTMLElement to append to the body
- */
- setBody : function(bodyContent) {
- if (! this.body) {
- this.body = document.createElement("DIV");
- this.body.className = YAHOO.widget.Module.CSS_BODY;
- }
-
- if (typeof bodyContent == "string")
- {
- this.body.innerHTML = bodyContent;
- } else {
- this.body.innerHTML = "";
- this.body.appendChild(bodyContent);
- }
-
- this.changeBodyEvent.fire(bodyContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the body. If no body is present, one will be automatically created.
- * @method appendToBody
- * @param {HTMLElement} element The element to append to the body
- */
- appendToBody : function(element) {
- if (! this.body) {
- this.body = document.createElement("DIV");
- this.body.className = YAHOO.widget.Module.CSS_BODY;
- }
-
- this.body.appendChild(element);
- this.changeBodyEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.
- * @method setFooter
- * @param {String} footerContent The HTML used to set the footer OR
- * @param {HTMLElement} footerContent The HTMLElement to append to the footer
- */
- setFooter : function(footerContent) {
- if (! this.footer) {
- this.footer = document.createElement("DIV");
- this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
- }
-
- if (typeof footerContent == "string") {
- this.footer.innerHTML = footerContent;
- } else {
- this.footer.innerHTML = "";
- this.footer.appendChild(footerContent);
- }
-
- this.changeFooterEvent.fire(footerContent);
- this.changeContentEvent.fire();
- },
-
- /**
- * Appends the passed element to the footer. If no footer is present, one will be automatically created.
- * @method appendToFooter
- * @param {HTMLElement} element The element to append to the footer
- */
- appendToFooter : function(element) {
- if (! this.footer) {
- this.footer = document.createElement("DIV");
- this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
- }
-
- this.footer.appendChild(element);
- this.changeFooterEvent.fire(element);
- this.changeContentEvent.fire();
- },
-
- /**
- * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.
- * @method render
- * @param {String} appendToNode The element id to which the Module should be appended to prior to rendering OR
- * @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
- * @param {HTMLElement} moduleElement OPTIONAL. The element that represents the actual Standard Module container.
- * @return {Boolean} Success or failure of the render
- */
- render : function(appendToNode, moduleElement) {
- this.beforeRenderEvent.fire();
-
- if (! moduleElement) {
- moduleElement = this.element;
- }
-
- var me = this;
- var appendTo = function(element) {
- if (typeof element == "string") {
- element = document.getElementById(element);
- }
-
- if (element) {
- element.appendChild(me.element);
- me.appendEvent.fire();
- }
- };
-
- if (appendToNode) {
- appendTo(appendToNode);
- } else { // No node was passed in. If the element is not pre-marked up, this fails
- if (! YAHOO.util.Dom.inDocument(this.element)) {
- return false;
- }
- }
-
- // Need to get everything into the DOM if it isn't already
-
- if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {
- // There is a header, but it's not in the DOM yet... need to add it
- var firstChild = moduleElement.firstChild;
- if (firstChild) { // Insert before first child if exists
- moduleElement.insertBefore(this.header, firstChild);
- } else { // Append to empty body because there are no children
- moduleElement.appendChild(this.header);
- }
- }
-
- if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {
- // There is a body, but it's not in the DOM yet... need to add it
- if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM
- moduleElement.insertBefore(this.body, this.footer);
- } else { // Append to element because there is no footer
- moduleElement.appendChild(this.body);
- }
- }
-
- if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {
- // There is a footer, but it's not in the DOM yet... need to add it
- moduleElement.appendChild(this.footer);
- }
-
- this.renderEvent.fire();
- return true;
- },
-
- /**
- * Removes the Module element from the DOM and sets all child elements to null.
- * @method destroy
- */
- destroy : function() {
- if (this.element) {
- var parent = this.element.parentNode;
- }
- if (parent) {
- parent.removeChild(this.element);
- }
-
- this.element = null;
- this.header = null;
- this.body = null;
- this.footer = null;
-
- this.destroyEvent.fire();
- },
-
- /**
- * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.
- * @method show
- */
- show : function() {
- this.cfg.setProperty("visible", true);
- },
-
- /**
- * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.
- * @method hide
- */
- hide : function() {
- this.cfg.setProperty("visible", false);
- },
-
- // BUILT-IN EVENT HANDLERS FOR MODULE //
-
- /**
- * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".
- * This method is responsible for firing showEvent and hideEvent.
- * @param {String} type The CustomEvent type (usually the property name)
- * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
- * @method configVisible
- */
- configVisible : function(type, args, obj) {
- var visible = args[0];
- if (visible) {
- this.beforeShowEvent.fire();
- YAHOO.util.Dom.setStyle(this.element, "display", "block");
- this.showEvent.fire();
- } else {
- this.beforeHideEvent.fire();
- YAHOO.util.Dom.setStyle(this.element, "display", "none");
- this.hideEvent.fire();
- }
- },
-
- /**
- * Default event handler for the "monitorresize" configuration property
- * @param {String} type The CustomEvent type (usually the property name)
- * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
- * @method configMonitorResize
- */
- configMonitorResize : function(type, args, obj) {
- var monitor = args[0];
- if (monitor) {
- this.initResizeMonitor();
- } else {
- YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);
- this.resizeMonitor = null;
- }
- }
-};
-
-/**
-* Returns a String representation of the Object.
-* @method toString
-* @return {String} The string representation of the Module
-*/
-YAHOO.widget.Module.prototype.toString = function() {
- return "Module " + this.id;
-};
-
-/**
-* Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.
-* @class Overlay
-* @namespace YAHOO.widget
-* @extends YAHOO.widget.Module
-* @param {String} el The element ID representing the Overlay OR
-* @param {HTMLElement} el The element representing the Overlay
-* @param {Object} userConfig The configuration object literal containing 10/23/2006the configuration that should be set for this Overlay. See configuration documentation for more details.
-* @constructor
-*/
-YAHOO.widget.Overlay = function(el, userConfig) {
- YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);
-};
-
-YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);
-
-/**
-* The URL that will be placed in the iframe
-* @property YAHOO.widget.Overlay.IFRAME_SRC
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"
-
-/**
-* Constant representing the top left corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.TOP_LEFT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.TOP_LEFT = "tl";
-
-/**
-* Constant representing the top right corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.TOP_RIGHT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.TOP_RIGHT = "tr";
-
-/**
-* Constant representing the top bottom left corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.BOTTOM_LEFT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";
-
-/**
-* Constant representing the bottom right corner of an element, used for configuring the context element alignment
-* @property YAHOO.widget.Overlay.BOTTOM_RIGHT
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";
-
-/**
-* Constant representing the default CSS class used for an Overlay
-* @property YAHOO.widget.Overlay.CSS_OVERLAY
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";
-
-/**
-* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
-* @method init
-* @param {String} el The element ID representing the Overlay OR
-* @param {HTMLElement} el The element representing the Overlay
-* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
-*/
-YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {
- YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
-
- this.beforeInitEvent.fire(YAHOO.widget.Overlay);
-
- YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
-
- if (this.platform == "mac" && this.browser == "gecko") {
- if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {
- this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);
- }
- if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {
- this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);
- }
- }
-
- this.initEvent.fire(YAHOO.widget.Overlay);
-};
-
-/**
-* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.
-* @method initEvents
-*/
-YAHOO.widget.Overlay.prototype.initEvents = function() {
- YAHOO.widget.Overlay.superclass.initEvents.call(this);
-
- /**
- * CustomEvent fired before the Overlay is moved.
- * @event beforeMoveEvent
- * @param {Number} x x coordinate
- * @param {Number} y y coordinate
- */
- this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);
-
- /**
- * CustomEvent fired after the Overlay is moved.
- * @event moveEvent
- * @param {Number} x x coordinate
- * @param {Number} y y coordinate
- */
- this.moveEvent = new YAHOO.util.CustomEvent("move", this);
-};
-
-/**
-* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
-* @method initDefaultConfig
-*/
-YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {
- YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);
-
- // Add overlay config properties //
-
- /**
- * The absolute x-coordinate position of the Overlay
- * @config x
- * @type Number
- * @default null
- */
- this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * The absolute y-coordinate position of the Overlay
- * @config y
- * @type Number
- * @default null
- */
- this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * An array with the absolute x and y positions of the Overlay
- * @config xy
- * @type Number[]
- * @default null
- */
- this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * The array of context arguments for context-sensitive positioning. The format is: [id or element, element corner, context corner]. For example, setting this property to ["img1", "tl", "bl"] would align the Overlay's top left corner to the context element's bottom left corner.
- * @config context
- * @type Array
- * @default null
- */
- this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * True if the Overlay should be anchored to the center of the viewport.
- * @config fixedcenter
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );
-
- /**
- * CSS width of the Overlay.
- * @config width
- * @type String
- * @default null
- */
- this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * CSS height of the Overlay.
- * @config height
- * @type String
- * @default null
- */
- this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );
-
- /**
- * CSS z-index of the Overlay.
- * @config zIndex
- * @type Number
- * @default null
- */
- this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );
-
- /**
- * True if the Overlay should be prevented from being positioned out of the viewport.
- * @config constraintoviewport
- * @type Boolean
- * @default false
- */
- this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );
-
- /**
- * True if the Overlay should have an IFRAME shim (for correcting the select z-index bug in IE6 and below).
- * @config iframe
- * @type Boolean
- * @default true for IE6 and below, false for all others
- */
- this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );
-};
-
-/**
-* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);
-* @method moveTo
-* @param {Number} x The Overlay's new x position
-* @param {Number} y The Overlay's new y position
-*/
-YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {
- this.cfg.setProperty("xy",[x,y]);
-};
-
-/**
-* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
-* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
-* @method hideMacGeckoScrollbars
-*/
-YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {
- YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");
- YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");
-};
-
-/**
-* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
-* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
-* @method showMacGeckoScrollbars
-*/
-YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {
- YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");
- YAHOO.util.Dom.addClass(this.element, "show-scrollbars");
-};
-
-// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
-
-/**
-* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.
-* @method configVisible
-* @param {String} type The CustomEvent type (usually the property name)
-* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {
- var visible = args[0];
-
- var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");
-
- if (currentVis == "inherit") {
- var e = this.element.parentNode;
- while (e.nodeType != 9 && e.nodeType != 11) {
- currentVis = YAHOO.util.Dom.getStyle(e, "visibility");
- if (currentVis != "inherit") { break; }
- e = e.parentNode;
- }
- if (currentVis == "inherit") {
- currentVis = "visible";
- }
- }
-
- var effect = this.cfg.getProperty("effect");
-
- var effectInstances = [];
- if (effect) {
- if (effect instanceof Array) {
- for (var i=0;i rightConstraint) {
- x = rightConstraint;
- }
-
- if (y < topConstraint) {
- y = topConstraint;
- } else if (y > bottomConstraint) {
- y = bottomConstraint;
- }
-
- this.cfg.setProperty("x", x, true);
- this.cfg.setProperty("y", y, true);
- this.cfg.setProperty("xy", [x,y], true);
-};
-
-/**
-* Centers the container in the viewport.
-* @method center
-*/
-YAHOO.widget.Overlay.prototype.center = function() {
- var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
- var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
-
- var viewPortWidth = YAHOO.util.Dom.getClientWidth();
- var viewPortHeight = YAHOO.util.Dom.getClientHeight();
-
- var elementWidth = this.element.offsetWidth;
- var elementHeight = this.element.offsetHeight;
-
- var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;
- var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;
-
- this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
-
- this.cfg.refireEvent("iframe");
-};
-
-/**
-* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.
-* @method syncPosition
-*/
-YAHOO.widget.Overlay.prototype.syncPosition = function() {
- var pos = YAHOO.util.Dom.getXY(this.element);
- this.cfg.setProperty("x", pos[0], true);
- this.cfg.setProperty("y", pos[1], true);
- this.cfg.setProperty("xy", pos, true);
-};
-
-/**
-* Event handler fired when the resize monitor element is resized.
-* @method onDomResize
-* @param {DOMEvent} e The resize DOM event
-* @param {Object} obj The scope object
-*/
-YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {
- YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);
- var me = this;
- setTimeout(function() {
- me.syncPosition();
- me.cfg.refireEvent("iframe");
- me.cfg.refireEvent("context");
- }, 0);
-};
-
-/**
-* Removes the Overlay element from the DOM and sets all child elements to null.
-* @method destroy
-*/
-YAHOO.widget.Overlay.prototype.destroy = function() {
- if (this.iframe) {
- this.iframe.parentNode.removeChild(this.iframe);
- }
-
- this.iframe = null;
-
- YAHOO.widget.Overlay.superclass.destroy.call(this);
-};
-
-/**
-* Returns a String representation of the object.
-* @method toString
-* @return {String} The string representation of the Overlay.
-*/
-YAHOO.widget.Overlay.prototype.toString = function() {
- return "Overlay " + this.id;
-};
-
-/**
-* A singleton CustomEvent used for reacting to the DOM event for window scroll
-* @event YAHOO.widget.Overlay.windowScrollEvent
-*/
-YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");
-
-/**
-* A singleton CustomEvent used for reacting to the DOM event for window resize
-* @event YAHOO.widget.Overlay.windowResizeEvent
-*/
-YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");
-
-/**
-* The DOM event handler used to fire the CustomEvent for window scroll
-* @method YAHOO.widget.Overlay.windowScrollHandler
-* @static
-* @param {DOMEvent} e The DOM scroll event
-*/
-YAHOO.widget.Overlay.windowScrollHandler = function(e) {
- if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
- if (! window.scrollEnd) {
- window.scrollEnd = -1;
- }
- clearTimeout(window.scrollEnd);
- window.scrollEnd = setTimeout(function() { YAHOO.widget.Overlay.windowScrollEvent.fire(); }, 1);
- } else {
- YAHOO.widget.Overlay.windowScrollEvent.fire();
- }
-};
-
-/**
-* The DOM event handler used to fire the CustomEvent for window resize
-* @method YAHOO.widget.Overlay.windowResizeHandler
-* @static
-* @param {DOMEvent} e The DOM resize event
-*/
-YAHOO.widget.Overlay.windowResizeHandler = function(e) {
- if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
- if (! window.resizeEnd) {
- window.resizeEnd = -1;
- }
- clearTimeout(window.resizeEnd);
- window.resizeEnd = setTimeout(function() { YAHOO.widget.Overlay.windowResizeEvent.fire(); }, 100);
- } else {
- YAHOO.widget.Overlay.windowResizeEvent.fire();
- }
-};
-
-/**
-* A boolean that indicated whether the window resize and scroll events have already been subscribed to.
-* @property YAHOO.widget.Overlay._initialized
-* @private
-* @type Boolean
-*/
-YAHOO.widget.Overlay._initialized = null;
-
-if (YAHOO.widget.Overlay._initialized === null) {
- YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);
- YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);
-
- YAHOO.widget.Overlay._initialized = true;
-}
-
-/**
-* OverlayManager is used for maintaining the focus status of multiple Overlays.* @namespace YAHOO.widget
-* @namespace YAHOO.widget
-* @class OverlayManager
-* @constructor
-* @param {Array} overlays Optional. A collection of Overlays to register with the manager.
-* @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
-*/
-YAHOO.widget.OverlayManager = function(userConfig) {
- this.init(userConfig);
-};
-
-/**
-* The CSS class representing a focused Overlay
-* @property YAHOO.widget.OverlayManager.CSS_FOCUSED
-* @static
-* @final
-* @type String
-*/
-YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";
-
-YAHOO.widget.OverlayManager.prototype = {
- /**
- * The class's constructor function
- * @property contructor
- * @type Function
- */
- constructor : YAHOO.widget.OverlayManager,
-
- /**
- * The array of Overlays that are currently registered
- * @property overlays
- * @type YAHOO.widget.Overlay[]
- */
- overlays : null,
-
- /**
- * Initializes the default configuration of the OverlayManager
- * @method initDefaultConfig
- */
- initDefaultConfig : function() {
- /**
- * The collection of registered Overlays in use by the OverlayManager
- * @config overlays
- * @type YAHOO.widget.Overlay[]
- * @default null
- */
- this.cfg.addProperty("overlays", { suppressEvent:true } );
-
- /**
- * The default DOM event that should be used to focus an Overlay
- * @config focusevent
- * @type String
- * @default "mousedown"
- */
- this.cfg.addProperty("focusevent", { value:"mousedown" } );
- },
-
- /**
- * Initializes the OverlayManager
- * @method init
- * @param {YAHOO.widget.Overlay[]} overlays Optional. A collection of Overlays to register with the manager.
- * @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
- */
- init : function(userConfig) {
- /**
- * The OverlayManager's Config object used for monitoring configuration properties.
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- this.initDefaultConfig();
-
- if (userConfig) {
- this.cfg.applyConfig(userConfig, true);
- }
- this.cfg.fireQueue();
-
- /**
- * The currently activated Overlay
- * @property activeOverlay
- * @private
- * @type YAHOO.widget.Overlay
- */
- var activeOverlay = null;
-
- /**
- * Returns the currently focused Overlay
- * @method getActive
- * @return {YAHOO.widget.Overlay} The currently focused Overlay
- */
- this.getActive = function() {
- return activeOverlay;
- };
-
- /**
- * Focuses the specified Overlay
- * @method focus
- * @param {YAHOO.widget.Overlay} overlay The Overlay to focus
- * @param {String} overlay The id of the Overlay to focus
- */
- this.focus = function(overlay) {
- var o = this.find(overlay);
- if (o) {
- this.blurAll();
- activeOverlay = o;
- YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);
- this.overlays.sort(this.compareZIndexDesc);
- var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");
- if (! isNaN(topZIndex) && this.overlays[0] != overlay) {
- activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex, 10) + 2));
- }
- this.overlays.sort(this.compareZIndexDesc);
- }
- };
-
- /**
- * Removes the specified Overlay from the manager
- * @method remove
- * @param {YAHOO.widget.Overlay} overlay The Overlay to remove
- * @param {String} overlay The id of the Overlay to remove
- */
- this.remove = function(overlay) {
- var o = this.find(overlay);
- if (o) {
- var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");
- o.cfg.setProperty("zIndex", -1000, true);
- this.overlays.sort(this.compareZIndexDesc);
- this.overlays = this.overlays.slice(0, this.overlays.length-1);
- o.cfg.setProperty("zIndex", originalZ, true);
-
- o.cfg.setProperty("manager", null);
- o.focusEvent = null;
- o.blurEvent = null;
- o.focus = null;
- o.blur = null;
- }
- };
-
- /**
- * Removes focus from all registered Overlays in the manager
- * @method blurAll
- */
- this.blurAll = function() {
- activeOverlay = null;
- for (var o=0;o 0) {
- return true;
- }
- } else {
- return false;
- }
- },
-
- /**
- * Attempts to locate an Overlay by instance or ID.
- * @method find
- * @param {YAHOO.widget.Overlay} overlay An Overlay to locate within the manager
- * @param {String} overlay An Overlay id to locate within the manager
- * @return {YAHOO.widget.Overlay} The requested Overlay, if found, or null if it cannot be located.
- */
- find : function(overlay) {
- if (overlay instanceof YAHOO.widget.Overlay) {
- for (var o=0;o zIndex2) {
- return -1;
- } else if (zIndex1 < zIndex2) {
- return 1;
- } else {
- return 0;
- }
- },
-
- /**
- * Shows all Overlays in the manager.
- * @method showAll
- */
- showAll : function() {
- for (var o=0;oOR
+* @param {HTMLElement} el The element representing the Module
+* @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
+*/
+YAHOO.widget.Module = function(el, userConfig) {
+ if (el) {
+ this.init(el, userConfig);
+ }
+};
+
+/**
+* Constant representing the prefix path to use for non-secure images
+* @property YAHOO.widget.Module.IMG_ROOT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";
+
+/**
+* Constant representing the prefix path to use for securely served images
+* @property YAHOO.widget.Module.IMG_ROOT_SSL
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";
+
+/**
+* Constant for the default CSS class name that represents a Module
+* @property YAHOO.widget.Module.CSS_MODULE
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_MODULE = "module";
+
+/**
+* Constant representing the module header
+* @property YAHOO.widget.Module.CSS_HEADER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_HEADER = "hd";
+
+/**
+* Constant representing the module body
+* @property YAHOO.widget.Module.CSS_BODY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_BODY = "bd";
+
+/**
+* Constant representing the module footer
+* @property YAHOO.widget.Module.CSS_FOOTER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.CSS_FOOTER = "ft";
+
+/**
+* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size
+* @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
+
+YAHOO.widget.Module.prototype = {
+ /**
+ * The class's constructor function
+ * @property contructor
+ * @type Function
+ */
+ constructor : YAHOO.widget.Module,
+
+ /**
+ * The main module element that contains the header, body, and footer
+ * @property element
+ * @type HTMLElement
+ */
+ element : null,
+
+ /**
+ * The header element, denoted with CSS class "hd"
+ * @property header
+ * @type HTMLElement
+ */
+ header : null,
+
+ /**
+ * The body element, denoted with CSS class "bd"
+ * @property body
+ * @type HTMLElement
+ */
+ body : null,
+
+ /**
+ * The footer element, denoted with CSS class "ft"
+ * @property footer
+ * @type HTMLElement
+ */
+ footer : null,
+
+ /**
+ * The id of the element
+ * @property id
+ * @type String
+ */
+ id : null,
+
+ /**
+ * The String representing the image root
+ * @property imageRoot
+ * @type String
+ */
+ imageRoot : YAHOO.widget.Module.IMG_ROOT,
+
+ /**
+ * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
+ * @method initEvents
+ */
+ initEvents : function() {
+
+ /**
+ * CustomEvent fired prior to class initalization.
+ * @event beforeInitEvent
+ * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
+ */
+ this.beforeInitEvent = new YAHOO.util.CustomEvent("beforeInit");
+
+ /**
+ * CustomEvent fired after class initalization.
+ * @event initEvent
+ * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
+ */
+ this.initEvent = new YAHOO.util.CustomEvent("init");
+
+ /**
+ * CustomEvent fired when the Module is appended to the DOM
+ * @event appendEvent
+ */
+ this.appendEvent = new YAHOO.util.CustomEvent("append");
+
+ /**
+ * CustomEvent fired before the Module is rendered
+ * @event beforeRenderEvent
+ */
+ this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
+
+ /**
+ * CustomEvent fired after the Module is rendered
+ * @event renderEvent
+ */
+ this.renderEvent = new YAHOO.util.CustomEvent("render");
+
+ /**
+ * CustomEvent fired when the header content of the Module is modified
+ * @event changeHeaderEvent
+ * @param {String/HTMLElement} content String/element representing the new header content
+ */
+ this.changeHeaderEvent = new YAHOO.util.CustomEvent("changeHeader");
+
+ /**
+ * CustomEvent fired when the body content of the Module is modified
+ * @event changeBodyEvent
+ * @param {String/HTMLElement} content String/element representing the new body content
+ */
+ this.changeBodyEvent = new YAHOO.util.CustomEvent("changeBody");
+
+ /**
+ * CustomEvent fired when the footer content of the Module is modified
+ * @event changeFooterEvent
+ * @param {String/HTMLElement} content String/element representing the new footer content
+ */
+ this.changeFooterEvent = new YAHOO.util.CustomEvent("changeFooter");
+
+ /**
+ * CustomEvent fired when the content of the Module is modified
+ * @event changeContentEvent
+ */
+ this.changeContentEvent = new YAHOO.util.CustomEvent("changeContent");
+
+ /**
+ * CustomEvent fired when the Module is destroyed
+ * @event destroyEvent
+ */
+ this.destroyEvent = new YAHOO.util.CustomEvent("destroy");
+
+ /**
+ * CustomEvent fired before the Module is shown
+ * @event beforeShowEvent
+ */
+ this.beforeShowEvent = new YAHOO.util.CustomEvent("beforeShow");
+
+ /**
+ * CustomEvent fired after the Module is shown
+ * @event showEvent
+ */
+ this.showEvent = new YAHOO.util.CustomEvent("show");
+
+ /**
+ * CustomEvent fired before the Module is hidden
+ * @event beforeHideEvent
+ */
+ this.beforeHideEvent = new YAHOO.util.CustomEvent("beforeHide");
+
+ /**
+ * CustomEvent fired after the Module is hidden
+ * @event hideEvent
+ */
+ this.hideEvent = new YAHOO.util.CustomEvent("hide");
+ },
+
+ /**
+ * String representing the current user-agent platform
+ * @property platform
+ * @type String
+ */
+ platform : function() {
+ var ua = navigator.userAgent.toLowerCase();
+ if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {
+ return "windows";
+ } else if (ua.indexOf("macintosh") != -1) {
+ return "mac";
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * String representing the current user-agent browser
+ * @property browser
+ * @type String
+ */
+ browser : function() {
+ var ua = navigator.userAgent.toLowerCase();
+ if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
+ return 'opera';
+ } else if (ua.indexOf('msie 7')!=-1) { // IE7
+ return 'ie7';
+ } else if (ua.indexOf('msie') !=-1) { // IE
+ return 'ie';
+ } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
+ return 'safari';
+ } else if (ua.indexOf('gecko') != -1) { // Gecko
+ return 'gecko';
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * Boolean representing whether or not the current browsing context is secure (https)
+ * @property isSecure
+ * @type Boolean
+ */
+ isSecure : function() {
+ if (window.location.href.toLowerCase().indexOf("https") === 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }(),
+
+ /**
+ * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
+ */
+ initDefaultConfig : function() {
+ // Add properties //
+
+ /**
+ * Specifies whether the Module is visible on the page.
+ * @config visible
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );
+
+ /**
+ * Object or array of objects representing the ContainerEffect classes that are active for animating the container.
+ * @config effect
+ * @type Object
+ * @default null
+ */
+ this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );
+
+ /**
+ * Specifies whether to create a special proxy iframe to monitor for user font resizing in the document
+ * @config monitorresize
+ * @type Boolean
+ * @default true
+ */
+ this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );
+ },
+
+ /**
+ * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+ * @method init
+ * @param {String} el The element ID representing the Module OR
+ * @param {HTMLElement} el The element representing the Module
+ * @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
+ */
+ init : function(el, userConfig) {
+
+ this.initEvents();
+
+ this.beforeInitEvent.fire(YAHOO.widget.Module);
+
+ /**
+ * The Module's Config object used for monitoring configuration properties.
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ if (this.isSecure) {
+ this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;
+ }
+
+ if (typeof el == "string") {
+ var elId = el;
+
+ el = document.getElementById(el);
+ if (! el) {
+ el = document.createElement("DIV");
+ el.id = elId;
+ }
+ }
+
+ this.element = el;
+
+ if (el.id) {
+ this.id = el.id;
+ }
+
+ var childNodes = this.element.childNodes;
+
+ if (childNodes) {
+ for (var i=0;iOR
+ * @param {HTMLElement} headerContent The HTMLElement to append to the header
+ */
+ setHeader : function(headerContent) {
+ if (! this.header) {
+ this.header = document.createElement("DIV");
+ this.header.className = YAHOO.widget.Module.CSS_HEADER;
+ }
+
+ if (typeof headerContent == "string") {
+ this.header.innerHTML = headerContent;
+ } else {
+ this.header.innerHTML = "";
+ this.header.appendChild(headerContent);
+ }
+
+ this.changeHeaderEvent.fire(headerContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the header. If no header is present, one will be automatically created.
+ * @method appendToHeader
+ * @param {HTMLElement} element The element to append to the header
+ */
+ appendToHeader : function(element) {
+ if (! this.header) {
+ this.header = document.createElement("DIV");
+ this.header.className = YAHOO.widget.Module.CSS_HEADER;
+ }
+
+ this.header.appendChild(element);
+ this.changeHeaderEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.
+ * @method setBody
+ * @param {String} bodyContent The HTML used to set the body OR
+ * @param {HTMLElement} bodyContent The HTMLElement to append to the body
+ */
+ setBody : function(bodyContent) {
+ if (! this.body) {
+ this.body = document.createElement("DIV");
+ this.body.className = YAHOO.widget.Module.CSS_BODY;
+ }
+
+ if (typeof bodyContent == "string")
+ {
+ this.body.innerHTML = bodyContent;
+ } else {
+ this.body.innerHTML = "";
+ this.body.appendChild(bodyContent);
+ }
+
+ this.changeBodyEvent.fire(bodyContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the body. If no body is present, one will be automatically created.
+ * @method appendToBody
+ * @param {HTMLElement} element The element to append to the body
+ */
+ appendToBody : function(element) {
+ if (! this.body) {
+ this.body = document.createElement("DIV");
+ this.body.className = YAHOO.widget.Module.CSS_BODY;
+ }
+
+ this.body.appendChild(element);
+ this.changeBodyEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.
+ * @method setFooter
+ * @param {String} footerContent The HTML used to set the footer OR
+ * @param {HTMLElement} footerContent The HTMLElement to append to the footer
+ */
+ setFooter : function(footerContent) {
+ if (! this.footer) {
+ this.footer = document.createElement("DIV");
+ this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
+ }
+
+ if (typeof footerContent == "string") {
+ this.footer.innerHTML = footerContent;
+ } else {
+ this.footer.innerHTML = "";
+ this.footer.appendChild(footerContent);
+ }
+
+ this.changeFooterEvent.fire(footerContent);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Appends the passed element to the footer. If no footer is present, one will be automatically created.
+ * @method appendToFooter
+ * @param {HTMLElement} element The element to append to the footer
+ */
+ appendToFooter : function(element) {
+ if (! this.footer) {
+ this.footer = document.createElement("DIV");
+ this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
+ }
+
+ this.footer.appendChild(element);
+ this.changeFooterEvent.fire(element);
+ this.changeContentEvent.fire();
+ },
+
+ /**
+ * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.
+ * @method render
+ * @param {String} appendToNode The element id to which the Module should be appended to prior to rendering OR
+ * @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
+ * @param {HTMLElement} moduleElement OPTIONAL. The element that represents the actual Standard Module container.
+ * @return {Boolean} Success or failure of the render
+ */
+ render : function(appendToNode, moduleElement) {
+ this.beforeRenderEvent.fire();
+
+ if (! moduleElement) {
+ moduleElement = this.element;
+ }
+
+ var me = this;
+ var appendTo = function(element) {
+ if (typeof element == "string") {
+ element = document.getElementById(element);
+ }
+
+ if (element) {
+ element.appendChild(me.element);
+ me.appendEvent.fire();
+ }
+ };
+
+ if (appendToNode) {
+ appendTo(appendToNode);
+ } else { // No node was passed in. If the element is not pre-marked up, this fails
+ if (! YAHOO.util.Dom.inDocument(this.element)) {
+ return false;
+ }
+ }
+
+ // Need to get everything into the DOM if it isn't already
+
+ if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {
+ // There is a header, but it's not in the DOM yet... need to add it
+ var firstChild = moduleElement.firstChild;
+ if (firstChild) { // Insert before first child if exists
+ moduleElement.insertBefore(this.header, firstChild);
+ } else { // Append to empty body because there are no children
+ moduleElement.appendChild(this.header);
+ }
+ }
+
+ if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {
+ // There is a body, but it's not in the DOM yet... need to add it
+ if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM
+ moduleElement.insertBefore(this.body, this.footer);
+ } else { // Append to element because there is no footer
+ moduleElement.appendChild(this.body);
+ }
+ }
+
+ if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {
+ // There is a footer, but it's not in the DOM yet... need to add it
+ moduleElement.appendChild(this.footer);
+ }
+
+ this.renderEvent.fire();
+ return true;
+ },
+
+ /**
+ * Removes the Module element from the DOM and sets all child elements to null.
+ * @method destroy
+ */
+ destroy : function() {
+ if (this.element) {
+ var parent = this.element.parentNode;
+ }
+ if (parent) {
+ parent.removeChild(this.element);
+ }
+
+ this.element = null;
+ this.header = null;
+ this.body = null;
+ this.footer = null;
+
+ this.destroyEvent.fire();
+ },
+
+ /**
+ * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.
+ * @method show
+ */
+ show : function() {
+ this.cfg.setProperty("visible", true);
+ },
+
+ /**
+ * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.
+ * @method hide
+ */
+ hide : function() {
+ this.cfg.setProperty("visible", false);
+ },
+
+ // BUILT-IN EVENT HANDLERS FOR MODULE //
+
+ /**
+ * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".
+ * This method is responsible for firing showEvent and hideEvent.
+ * @param {String} type The CustomEvent type (usually the property name)
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+ * @method configVisible
+ */
+ configVisible : function(type, args, obj) {
+ var visible = args[0];
+ if (visible) {
+ this.beforeShowEvent.fire();
+ YAHOO.util.Dom.setStyle(this.element, "display", "block");
+ this.showEvent.fire();
+ } else {
+ this.beforeHideEvent.fire();
+ YAHOO.util.Dom.setStyle(this.element, "display", "none");
+ this.hideEvent.fire();
+ }
+ },
+
+ /**
+ * Default event handler for the "monitorresize" configuration property
+ * @param {String} type The CustomEvent type (usually the property name)
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+ * @method configMonitorResize
+ */
+ configMonitorResize : function(type, args, obj) {
+ var monitor = args[0];
+ if (monitor) {
+ this.initResizeMonitor();
+ } else {
+ YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);
+ this.resizeMonitor = null;
+ }
+ }
+};
+
+/**
+* Returns a String representation of the Object.
+* @method toString
+* @return {String} The string representation of the Module
+*/
+YAHOO.widget.Module.prototype.toString = function() {
+ return "Module " + this.id;
+};
+
+/**
+* Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.
+* @class Overlay
+* @namespace YAHOO.widget
+* @extends YAHOO.widget.Module
+* @param {String} el The element ID representing the Overlay OR
+* @param {HTMLElement} el The element representing the Overlay
+* @param {Object} userConfig The configuration object literal containing 10/23/2006the configuration that should be set for this Overlay. See configuration documentation for more details.
+* @constructor
+*/
+YAHOO.widget.Overlay = function(el, userConfig) {
+ YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);
+};
+
+YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);
+
+/**
+* The URL that will be placed in the iframe
+* @property YAHOO.widget.Overlay.IFRAME_SRC
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"
+
+/**
+* Constant representing the top left corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.TOP_LEFT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.TOP_LEFT = "tl";
+
+/**
+* Constant representing the top right corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.TOP_RIGHT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.TOP_RIGHT = "tr";
+
+/**
+* Constant representing the top bottom left corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.BOTTOM_LEFT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";
+
+/**
+* Constant representing the bottom right corner of an element, used for configuring the context element alignment
+* @property YAHOO.widget.Overlay.BOTTOM_RIGHT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";
+
+/**
+* Constant representing the default CSS class used for an Overlay
+* @property YAHOO.widget.Overlay.CSS_OVERLAY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";
+
+/**
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
+* @method init
+* @param {String} el The element ID representing the Overlay OR
+* @param {HTMLElement} el The element representing the Overlay
+* @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
+*/
+YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {
+ YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
+
+ this.beforeInitEvent.fire(YAHOO.widget.Overlay);
+
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+ if (this.platform == "mac" && this.browser == "gecko") {
+ if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {
+ this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);
+ }
+ if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {
+ this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);
+ }
+ }
+
+ this.initEvent.fire(YAHOO.widget.Overlay);
+};
+
+/**
+* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.
+* @method initEvents
+*/
+YAHOO.widget.Overlay.prototype.initEvents = function() {
+ YAHOO.widget.Overlay.superclass.initEvents.call(this);
+
+ /**
+ * CustomEvent fired before the Overlay is moved.
+ * @event beforeMoveEvent
+ * @param {Number} x x coordinate
+ * @param {Number} y y coordinate
+ */
+ this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);
+
+ /**
+ * CustomEvent fired after the Overlay is moved.
+ * @event moveEvent
+ * @param {Number} x x coordinate
+ * @param {Number} y y coordinate
+ */
+ this.moveEvent = new YAHOO.util.CustomEvent("move", this);
+};
+
+/**
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
+* @method initDefaultConfig
+*/
+YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {
+ YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);
+
+ // Add overlay config properties //
+
+ /**
+ * The absolute x-coordinate position of the Overlay
+ * @config x
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * The absolute y-coordinate position of the Overlay
+ * @config y
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * An array with the absolute x and y positions of the Overlay
+ * @config xy
+ * @type Number[]
+ * @default null
+ */
+ this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * The array of context arguments for context-sensitive positioning. The format is: [id or element, element corner, context corner]. For example, setting this property to ["img1", "tl", "bl"] would align the Overlay's top left corner to the context element's bottom left corner.
+ * @config context
+ * @type Array
+ * @default null
+ */
+ this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * True if the Overlay should be anchored to the center of the viewport.
+ * @config fixedcenter
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );
+
+ /**
+ * CSS width of the Overlay.
+ * @config width
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * CSS height of the Overlay.
+ * @config height
+ * @type String
+ * @default null
+ */
+ this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );
+
+ /**
+ * CSS z-index of the Overlay.
+ * @config zIndex
+ * @type Number
+ * @default null
+ */
+ this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );
+
+ /**
+ * True if the Overlay should be prevented from being positioned out of the viewport.
+ * @config constraintoviewport
+ * @type Boolean
+ * @default false
+ */
+ this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );
+
+ /**
+ * True if the Overlay should have an IFRAME shim (for correcting the select z-index bug in IE6 and below).
+ * @config iframe
+ * @type Boolean
+ * @default true for IE6 and below, false for all others
+ */
+ this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );
+};
+
+/**
+* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);
+* @method moveTo
+* @param {Number} x The Overlay's new x position
+* @param {Number} y The Overlay's new y position
+*/
+YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {
+ this.cfg.setProperty("xy",[x,y]);
+};
+
+/**
+* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
+* @method hideMacGeckoScrollbars
+*/
+YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {
+ YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");
+ YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");
+};
+
+/**
+* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
+* @method showMacGeckoScrollbars
+*/
+YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {
+ YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");
+ YAHOO.util.Dom.addClass(this.element, "show-scrollbars");
+};
+
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+
+/**
+* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.
+* @method configVisible
+* @param {String} type The CustomEvent type (usually the property name)
+* @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {
+ var visible = args[0];
+
+ var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");
+
+ if (currentVis == "inherit") {
+ var e = this.element.parentNode;
+ while (e.nodeType != 9 && e.nodeType != 11) {
+ currentVis = YAHOO.util.Dom.getStyle(e, "visibility");
+ if (currentVis != "inherit") { break; }
+ e = e.parentNode;
+ }
+ if (currentVis == "inherit") {
+ currentVis = "visible";
+ }
+ }
+
+ var effect = this.cfg.getProperty("effect");
+
+ var effectInstances = [];
+ if (effect) {
+ if (effect instanceof Array) {
+ for (var i=0;i rightConstraint) {
+ x = rightConstraint;
+ }
+
+ if (y < topConstraint) {
+ y = topConstraint;
+ } else if (y > bottomConstraint) {
+ y = bottomConstraint;
+ }
+
+ this.cfg.setProperty("x", x, true);
+ this.cfg.setProperty("y", y, true);
+ this.cfg.setProperty("xy", [x,y], true);
+};
+
+/**
+* Centers the container in the viewport.
+* @method center
+*/
+YAHOO.widget.Overlay.prototype.center = function() {
+ var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+ var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+
+ var viewPortWidth = YAHOO.util.Dom.getClientWidth();
+ var viewPortHeight = YAHOO.util.Dom.getClientHeight();
+
+ var elementWidth = this.element.offsetWidth;
+ var elementHeight = this.element.offsetHeight;
+
+ var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;
+ var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;
+
+ this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
+
+ this.cfg.refireEvent("iframe");
+};
+
+/**
+* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.
+* @method syncPosition
+*/
+YAHOO.widget.Overlay.prototype.syncPosition = function() {
+ var pos = YAHOO.util.Dom.getXY(this.element);
+ this.cfg.setProperty("x", pos[0], true);
+ this.cfg.setProperty("y", pos[1], true);
+ this.cfg.setProperty("xy", pos, true);
+};
+
+/**
+* Event handler fired when the resize monitor element is resized.
+* @method onDomResize
+* @param {DOMEvent} e The resize DOM event
+* @param {Object} obj The scope object
+*/
+YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {
+ YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);
+ var me = this;
+ setTimeout(function() {
+ me.syncPosition();
+ me.cfg.refireEvent("iframe");
+ me.cfg.refireEvent("context");
+ }, 0);
+};
+
+/**
+* Removes the Overlay element from the DOM and sets all child elements to null.
+* @method destroy
+*/
+YAHOO.widget.Overlay.prototype.destroy = function() {
+ if (this.iframe) {
+ this.iframe.parentNode.removeChild(this.iframe);
+ }
+
+ this.iframe = null;
+
+ YAHOO.widget.Overlay.superclass.destroy.call(this);
+};
+
+/**
+* Returns a String representation of the object.
+* @method toString
+* @return {String} The string representation of the Overlay.
+*/
+YAHOO.widget.Overlay.prototype.toString = function() {
+ return "Overlay " + this.id;
+};
+
+/**
+* A singleton CustomEvent used for reacting to the DOM event for window scroll
+* @event YAHOO.widget.Overlay.windowScrollEvent
+*/
+YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");
+
+/**
+* A singleton CustomEvent used for reacting to the DOM event for window resize
+* @event YAHOO.widget.Overlay.windowResizeEvent
+*/
+YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");
+
+/**
+* The DOM event handler used to fire the CustomEvent for window scroll
+* @method YAHOO.widget.Overlay.windowScrollHandler
+* @static
+* @param {DOMEvent} e The DOM scroll event
+*/
+YAHOO.widget.Overlay.windowScrollHandler = function(e) {
+ if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
+ if (! window.scrollEnd) {
+ window.scrollEnd = -1;
+ }
+ clearTimeout(window.scrollEnd);
+ window.scrollEnd = setTimeout(function() { YAHOO.widget.Overlay.windowScrollEvent.fire(); }, 1);
+ } else {
+ YAHOO.widget.Overlay.windowScrollEvent.fire();
+ }
+};
+
+/**
+* The DOM event handler used to fire the CustomEvent for window resize
+* @method YAHOO.widget.Overlay.windowResizeHandler
+* @static
+* @param {DOMEvent} e The DOM resize event
+*/
+YAHOO.widget.Overlay.windowResizeHandler = function(e) {
+ if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
+ if (! window.resizeEnd) {
+ window.resizeEnd = -1;
+ }
+ clearTimeout(window.resizeEnd);
+ window.resizeEnd = setTimeout(function() { YAHOO.widget.Overlay.windowResizeEvent.fire(); }, 100);
+ } else {
+ YAHOO.widget.Overlay.windowResizeEvent.fire();
+ }
+};
+
+/**
+* A boolean that indicated whether the window resize and scroll events have already been subscribed to.
+* @property YAHOO.widget.Overlay._initialized
+* @private
+* @type Boolean
+*/
+YAHOO.widget.Overlay._initialized = null;
+
+if (YAHOO.widget.Overlay._initialized === null) {
+ YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);
+ YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);
+
+ YAHOO.widget.Overlay._initialized = true;
+}
+
+/**
+* OverlayManager is used for maintaining the focus status of multiple Overlays.* @namespace YAHOO.widget
+* @namespace YAHOO.widget
+* @class OverlayManager
+* @constructor
+* @param {Array} overlays Optional. A collection of Overlays to register with the manager.
+* @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
+*/
+YAHOO.widget.OverlayManager = function(userConfig) {
+ this.init(userConfig);
+};
+
+/**
+* The CSS class representing a focused Overlay
+* @property YAHOO.widget.OverlayManager.CSS_FOCUSED
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";
+
+YAHOO.widget.OverlayManager.prototype = {
+ /**
+ * The class's constructor function
+ * @property contructor
+ * @type Function
+ */
+ constructor : YAHOO.widget.OverlayManager,
+
+ /**
+ * The array of Overlays that are currently registered
+ * @property overlays
+ * @type YAHOO.widget.Overlay[]
+ */
+ overlays : null,
+
+ /**
+ * Initializes the default configuration of the OverlayManager
+ * @method initDefaultConfig
+ */
+ initDefaultConfig : function() {
+ /**
+ * The collection of registered Overlays in use by the OverlayManager
+ * @config overlays
+ * @type YAHOO.widget.Overlay[]
+ * @default null
+ */
+ this.cfg.addProperty("overlays", { suppressEvent:true } );
+
+ /**
+ * The default DOM event that should be used to focus an Overlay
+ * @config focusevent
+ * @type String
+ * @default "mousedown"
+ */
+ this.cfg.addProperty("focusevent", { value:"mousedown" } );
+ },
+
+ /**
+ * Initializes the OverlayManager
+ * @method init
+ * @param {YAHOO.widget.Overlay[]} overlays Optional. A collection of Overlays to register with the manager.
+ * @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
+ */
+ init : function(userConfig) {
+ /**
+ * The OverlayManager's Config object used for monitoring configuration properties.
+ * @property cfg
+ * @type YAHOO.util.Config
+ */
+ this.cfg = new YAHOO.util.Config(this);
+
+ this.initDefaultConfig();
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+ this.cfg.fireQueue();
+
+ /**
+ * The currently activated Overlay
+ * @property activeOverlay
+ * @private
+ * @type YAHOO.widget.Overlay
+ */
+ var activeOverlay = null;
+
+ /**
+ * Returns the currently focused Overlay
+ * @method getActive
+ * @return {YAHOO.widget.Overlay} The currently focused Overlay
+ */
+ this.getActive = function() {
+ return activeOverlay;
+ };
+
+ /**
+ * Focuses the specified Overlay
+ * @method focus
+ * @param {YAHOO.widget.Overlay} overlay The Overlay to focus
+ * @param {String} overlay The id of the Overlay to focus
+ */
+ this.focus = function(overlay) {
+ var o = this.find(overlay);
+ if (o) {
+ this.blurAll();
+ activeOverlay = o;
+ YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);
+ this.overlays.sort(this.compareZIndexDesc);
+ var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");
+ if (! isNaN(topZIndex) && this.overlays[0] != overlay) {
+ activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex, 10) + 2));
+ }
+ this.overlays.sort(this.compareZIndexDesc);
+ }
+ };
+
+ /**
+ * Removes the specified Overlay from the manager
+ * @method remove
+ * @param {YAHOO.widget.Overlay} overlay The Overlay to remove
+ * @param {String} overlay The id of the Overlay to remove
+ */
+ this.remove = function(overlay) {
+ var o = this.find(overlay);
+ if (o) {
+ var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");
+ o.cfg.setProperty("zIndex", -1000, true);
+ this.overlays.sort(this.compareZIndexDesc);
+ this.overlays = this.overlays.slice(0, this.overlays.length-1);
+ o.cfg.setProperty("zIndex", originalZ, true);
+
+ o.cfg.setProperty("manager", null);
+ o.focusEvent = null;
+ o.blurEvent = null;
+ o.focus = null;
+ o.blur = null;
+ }
+ };
+
+ /**
+ * Removes focus from all registered Overlays in the manager
+ * @method blurAll
+ */
+ this.blurAll = function() {
+ activeOverlay = null;
+ for (var o=0;o 0) {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Attempts to locate an Overlay by instance or ID.
+ * @method find
+ * @param {YAHOO.widget.Overlay} overlay An Overlay to locate within the manager
+ * @param {String} overlay An Overlay id to locate within the manager
+ * @return {YAHOO.widget.Overlay} The requested Overlay, if found, or null if it cannot be located.
+ */
+ find : function(overlay) {
+ if (overlay instanceof YAHOO.widget.Overlay) {
+ for (var o=0;o zIndex2) {
+ return -1;
+ } else if (zIndex1 < zIndex2) {
+ return 1;
+ } else {
+ return 0;
+ }
+ },
+
+ /**
+ * Shows all Overlays in the manager.
+ * @method showAll
+ */
+ showAll : function() {
+ for (var o=0;o -1),
- isSafari = (ua.indexOf('safari') > -1),
- isGecko = (!isOpera && !isSafari && ua.indexOf('gecko') > -1),
- isIE = (!isOpera && ua.indexOf('msie') > -1);
-
- // regex cache
- var patterns = {
- HYPHEN: /(-[a-z])/i
- };
-
- var logger = {};
- logger.log = function() { YAHOO.log.apply(window, arguments); };
-
- var toCamel = function(property) {
- if ( !patterns.HYPHEN.test(property) ) {
- return property; // no hyphens
- }
-
- if (propertyCache[property]) { // already converted
- return propertyCache[property];
- }
-
- while( patterns.HYPHEN.exec(property) ) {
- property = property.replace(RegExp.$1,
- RegExp.$1.substr(1).toUpperCase());
- }
-
- propertyCache[property] = property;
- return property;
- //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
- };
-
- // branching at load instead of runtime
- if (document.defaultView && document.defaultView.getComputedStyle) { // W3C DOM method
- getStyle = function(el, property) {
- var value = null;
-
- var computed = document.defaultView.getComputedStyle(el, '');
- if (computed) { // test computed before touching for safari
- value = computed[toCamel(property)];
- }
-
- return el.style[property] || value;
- };
- } else if (document.documentElement.currentStyle && isIE) { // IE method
- getStyle = function(el, property) {
- switch( toCamel(property) ) {
- case 'opacity' :// IE opacity uses filter
- var val = 100;
- try { // will error if no DXImageTransform
- val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
-
- } catch(e) {
- try { // make sure its in the document
- val = el.filters('alpha').opacity;
- } catch(e) {
- logger.log('getStyle: IE filter failed',
- 'error', 'Dom');
- }
- }
- return val / 100;
- break;
- default:
- // test currentStyle before touching
- var value = el.currentStyle ? el.currentStyle[property] : null;
- return ( el.style[property] || value );
- }
- };
- } else { // default to inline only
- getStyle = function(el, property) { return el.style[property]; };
- }
-
- if (isIE) {
- setStyle = function(el, property, val) {
- switch (property) {
- case 'opacity':
- if ( typeof el.style.filter == 'string' ) { // in case not appended
- el.style.filter = 'alpha(opacity=' + val * 100 + ')';
-
- if (!el.currentStyle || !el.currentStyle.hasLayout) {
- el.style.zoom = 1; // when no layout or cant tell
- }
- }
- break;
- default:
- el.style[property] = val;
- }
- };
- } else {
- setStyle = function(el, property, val) {
- el.style[property] = val;
- };
- }
-
- /**
- * Provides helper methods for DOM elements.
- * @namespace YAHOO.util
- * @class Dom
- */
- YAHOO.util.Dom = {
- /**
- * Returns an HTMLElement reference.
- * @method get
- * @param {String | HTMLElement |Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements.
- */
- get: function(el) {
- if (!el) { return null; } // nothing to work with
-
- if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is
- logger.log('get(' + el + ') returning ' + el, 'info', 'Dom');
- return el;
- }
-
- if (typeof el == 'string') { // ID
- logger.log('get("' + el + '") returning ' + document.getElementById(el), 'info', 'Dom');
- return document.getElementById(el);
- }
- else { // array of ID's and/or elements
- var collection = [];
- for (var i = 0, len = el.length; i < len; ++i) {
- collection[collection.length] = Y.Dom.get(el[i]);
- }
-
- logger.log('get("' + el + '") returning ' + collection, 'info', 'Dom');
- return collection;
- }
-
- logger.log('element ' + el + ' not found', 'error', 'Dom');
- return null; // safety, should never happen
- },
-
- /**
- * Normalizes currentStyle and ComputedStyle.
- * @method getStyle
- * @param {String | HTMLElement |Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @param {String} property The style property whose value is returned.
- * @return {String | Array} The current value of the style property for the element(s).
- */
- getStyle: function(el, property) {
- property = toCamel(property);
-
- var f = function(element) {
- return getStyle(element, property);
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Wrapper for setting style properties of HTMLElements. Normalizes "opacity" across modern browsers.
- * @method setStyle
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @param {String} property The style property to be set.
- * @param {String} val The value to apply to the given property.
- */
- setStyle: function(el, property, val) {
- property = toCamel(property);
-
- var f = function(element) {
- setStyle(element, property, val);
- logger.log('setStyle setting ' + property + ' to ' + val, 'info', 'Dom');
-
- };
-
- Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Gets the current position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method getXY
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
- * @return {Array} The XY position of the element(s)
- */
- getXY: function(el) {
- var f = function(el) {
-
- // has to be part of document to have pageXY
- if (el.parentNode === null || el.offsetParent === null ||
- this.getStyle(el, 'display') == 'none') {
- logger.log('getXY failed: element not available', 'error', 'Dom');
- return false;
- }
-
- var parentNode = null;
- var pos = [];
- var box;
-
- if (el.getBoundingClientRect) { // IE
- box = el.getBoundingClientRect();
- var doc = document;
- if ( !this.inDocument(el) && parent.document != document) {// might be in a frame, need to get its scroll
- doc = parent.document;
-
- if ( !this.isAncestor(doc.documentElement, el) ) {
- logger.log('getXY failed: element not available', 'error', 'Dom');
- return false;
- }
-
- }
-
- var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
- var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
-
- return [box.left + scrollLeft, box.top + scrollTop];
- }
- else { // safari, opera, & gecko
- pos = [el.offsetLeft, el.offsetTop];
- parentNode = el.offsetParent;
- if (parentNode != el) {
- while (parentNode) {
- pos[0] += parentNode.offsetLeft;
- pos[1] += parentNode.offsetTop;
- parentNode = parentNode.offsetParent;
- }
- }
- if (isSafari && this.getStyle(el, 'position') == 'absolute' ) { // safari doubles in some cases
- pos[0] -= document.body.offsetLeft;
- pos[1] -= document.body.offsetTop;
- }
- }
-
- if (el.parentNode) { parentNode = el.parentNode; }
- else { parentNode = null; }
-
- while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML')
- { // account for any scrolled ancestors
- if (Y.Dom.getStyle(parentNode, 'display') != 'inline') { // work around opera inline scrollLeft/Top bug
- pos[0] -= parentNode.scrollLeft;
- pos[1] -= parentNode.scrollTop;
- }
-
- if (parentNode.parentNode) {
- parentNode = parentNode.parentNode;
- } else { parentNode = null; }
- }
-
- logger.log('getXY returning ' + pos, 'info', 'Dom');
-
- return pos;
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Gets the current X position of an element based on page coordinates. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method getX
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
- * @return {String | Array} The X position of the element(s)
- */
- getX: function(el) {
- var f = function(el) {
- return Y.Dom.getXY(el)[0];
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Gets the current Y position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method getY
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
- * @return {String | Array} The Y position of the element(s)
- */
- getY: function(el) {
- var f = function(el) {
- return Y.Dom.getXY(el)[1];
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Set the position of an html element in page coordinates, regardless of how the element is positioned.
- * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method setXY
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
- * @param {Array} pos Contains X & Y values for new position (coordinates are page-based)
- * @param {Boolean} noRetry By default we try and set the position a second time if the first fails
- */
- setXY: function(el, pos, noRetry) {
- var f = function(el) {
- var style_pos = this.getStyle(el, 'position');
- if (style_pos == 'static') { // default to relative
- this.setStyle(el, 'position', 'relative');
- style_pos = 'relative';
- }
-
- var pageXY = this.getXY(el);
- if (pageXY === false) { // has to be part of doc to have pageXY
- logger.log('setXY failed: element not available', 'error', 'Dom');
- return false;
- }
-
- var delta = [ // assuming pixels; if not we will have to retry
- parseInt( this.getStyle(el, 'left'), 10 ),
- parseInt( this.getStyle(el, 'top'), 10 )
- ];
-
- if ( isNaN(delta[0]) ) {// in case of 'auto'
- delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
- }
- if ( isNaN(delta[1]) ) { // in case of 'auto'
- delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
- }
-
- if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
- if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
-
- var newXY = this.getXY(el);
-
- // if retry is true, try one more time if we miss
- if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) {
- this.setXY(el, pos, true);
- }
-
- logger.log('setXY setting position to ' + pos, 'info', 'Dom');
- };
-
- Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Set the X position of an html element in page coordinates, regardless of how the element is positioned.
- * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method setX
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @param {Int} x The value to use as the X coordinate for the element(s).
- */
- setX: function(el, x) {
- Y.Dom.setXY(el, [x, null]);
- },
-
- /**
- * Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
- * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method setY
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @param {Int} x To use as the Y coordinate for the element(s).
- */
- setY: function(el, y) {
- Y.Dom.setXY(el, [null, y]);
- },
-
- /**
- * Returns the region position of the given element.
- * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
- * @method getRegion
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @return {Region | Array} A Region or array of Region instances containing "top, left, bottom, right" member data.
- */
- getRegion: function(el) {
- var f = function(el) {
- var region = new Y.Region.getRegion(el);
- logger.log('getRegion returning ' + region, 'info', 'Dom');
- return region;
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Returns the width of the client (viewport).
- * @method getClientWidth
- * @deprecated Now using getViewportWidth. This interface left intact for back compat.
- * @return {Int} The width of the viewable area of the page.
- */
- getClientWidth: function() {
- return Y.Dom.getViewportWidth();
- },
-
- /**
- * Returns the height of the client (viewport).
- * @method getClientHeight
- * @deprecated Now using getViewportHeight. This interface left intact for back compat.
- * @return {Int} The height of the viewable area of the page.
- */
- getClientHeight: function() {
- return Y.Dom.getViewportHeight();
- },
-
- /**
- * Returns a array of HTMLElements with the given class.
- * For optimized performance, include a tag and/or root node when possible.
- * @method getElementsByClassName
- * @param {String} className The class name to match against
- * @param {String} tag (optional) The tag name of the elements being collected
- * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
- * @return {Array} An array of elements that have the given class name
- */
- getElementsByClassName: function(className, tag, root) {
- var method = function(el) { return Y.Dom.hasClass(el, className); };
- return Y.Dom.getElementsBy(method, tag, root);
- },
-
- /**
- * Determines whether an HTMLElement has the given className.
- * @method hasClass
- * @param {String | HTMLElement | Array} el The element or collection to test
- * @param {String} className the class name to search for
- * @return {Boolean | Array} A boolean value or array of boolean values
- */
- hasClass: function(el, className) {
- var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
-
- var f = function(el) {
- logger.log('hasClass returning ' + re.test(el['className']), 'info', 'Dom');
- return re.test(el['className']);
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Adds a class name to a given element or collection of elements.
- * @method addClass
- * @param {String | HTMLElement | Array} el The element or collection to add the class to
- * @param {String} className the class name to add to the class attribute
- */
- addClass: function(el, className) {
- var f = function(el) {
- if (this.hasClass(el, className)) { return; } // already present
-
- logger.log('addClass adding ' + className, 'info', 'Dom');
-
- el['className'] = [el['className'], className].join(' ');
- };
-
- Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Removes a class name from a given element or collection of elements.
- * @method removeClass
- * @param {String | HTMLElement | Array} el The element or collection to remove the class from
- * @param {String} className the class name to remove from the class attribute
- */
- removeClass: function(el, className) {
- var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');
-
- var f = function(el) {
- if (!this.hasClass(el, className)) { return; } // not present
-
- logger.log('removeClass removing ' + className, 'info', 'Dom');
-
- var c = el['className'];
- el['className'] = c.replace(re, ' ');
- if ( this.hasClass(el, className) ) { // in case of multiple adjacent
- this.removeClass(el, className);
- }
-
- };
-
- Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Replace a class with another class for a given element or collection of elements.
- * If no oldClassName is present, the newClassName is simply added.
- * @method replaceClass
- * @param {String | HTMLElement | Array} el The element or collection to remove the class from
- * @param {String} oldClassName the class name to be replaced
- * @param {String} newClassName the class name that will be replacing the old class name
- */
- replaceClass: function(el, oldClassName, newClassName) {
- if (oldClassName === newClassName) { // avoid infinite loop
- return false;
- }
-
- var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');
-
- var f = function(el) {
- logger.log('replaceClass replacing ' + oldClassName + ' with ' + newClassName, 'info', 'Dom');
-
- if ( !this.hasClass(el, oldClassName) ) {
- this.addClass(el, newClassName); // just add it if nothing to replace
- return; // note return
- }
-
- el['className'] = el['className'].replace(re, ' ' + newClassName + ' ');
-
- if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent
- this.replaceClass(el, oldClassName, newClassName);
- }
- };
-
- Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Generates a unique ID
- * @method generateId
- * @param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
- * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
- * @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
- */
- generateId: function(el, prefix) {
- prefix = prefix || 'yui-gen';
- el = el || {};
-
- var f = function(el) {
- if (el) {
- el = Y.Dom.get(el);
- } else {
- el = {}; // just generating ID in this case
- }
-
- if (!el.id) {
- el.id = prefix + id_counter++;
- logger.log('generateId generating ' + el.id, 'info', 'Dom');
- } // dont override existing
-
- logger.log('generateId returning ' + el.id, 'info', 'Dom');
-
- return el.id;
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
- * @method isAncestor
- * @param {String | HTMLElement} haystack The possible ancestor
- * @param {String | HTMLElement} needle The possible descendent
- * @return {Boolean} Whether or not the haystack is an ancestor of needle
- */
- isAncestor: function(haystack, needle) {
- haystack = Y.Dom.get(haystack);
- if (!haystack || !needle) { return false; }
-
- var f = function(needle) {
- if (haystack.contains && !isSafari) { // safari "contains" is broken
- logger.log('isAncestor returning ' + haystack.contains(needle), 'info', 'Dom');
- return haystack.contains(needle);
- }
- else if ( haystack.compareDocumentPosition ) {
- logger.log('isAncestor returning ' + !!(haystack.compareDocumentPosition(needle) & 16), 'info', 'Dom');
- return !!(haystack.compareDocumentPosition(needle) & 16);
- }
- else { // loop up and test each parent
- var parent = needle.parentNode;
-
- while (parent) {
- if (parent == haystack) {
- logger.log('isAncestor returning true', 'info', 'Dom');
- return true;
- }
- else if (!parent.tagName || parent.tagName.toUpperCase() == 'HTML') {
- logger.log('isAncestor returning false', 'info', 'Dom');
- return false;
- }
-
- parent = parent.parentNode;
- }
- logger.log('isAncestor returning false', 'info', 'Dom');
- return false;
- }
- };
-
- return Y.Dom.batch(needle, f, Y.Dom, true);
- },
-
- /**
- * Determines whether an HTMLElement is present in the current document.
- * @method inDocument
- * @param {String | HTMLElement} el The element to search for
- * @return {Boolean} Whether or not the element is present in the current document
- */
- inDocument: function(el) {
- var f = function(el) {
- return this.isAncestor(document.documentElement, el);
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Returns a array of HTMLElements that pass the test applied by supplied boolean method.
- * For optimized performance, include a tag and/or root node when possible.
- * @method getElementsBy
- * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
-
- * @param {String} tag (optional) The tag name of the elements being collected
- * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
- */
- getElementsBy: function(method, tag, root) {
- tag = tag || '*';
- root = Y.Dom.get(root) || document;
-
- var nodes = [];
- var elements = root.getElementsByTagName(tag);
-
- if ( !elements.length && (tag == '*' && root.all) ) {
- elements = root.all; // IE < 6
- }
-
- for (var i = 0, len = elements.length; i < len; ++i) {
- if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; }
- }
-
- logger.log('getElementsBy returning ' + nodes, 'info', 'Dom');
-
- return nodes;
- },
-
- /**
- * Returns an array of elements that have had the supplied method applied.
- * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
- * @method batch
- * @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to
- * @param {Function} method The method to apply to the element(s)
- * @param {Any} o (optional) An optional arg that is passed to the supplied method
- * @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o"
- * @return {HTMLElement | Array} The element(s) with the method applied
- */
- batch: function(el, method, o, override) {
- var id = el;
- el = Y.Dom.get(el);
-
- var scope = (override) ? o : window;
-
- if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection)
- if (!el) {
- logger.log(id + ' not available', 'error', 'Dom');
- return false;
- }
- return method.call(scope, el, o);
- }
-
- var collection = [];
-
- for (var i = 0, len = el.length; i < len; ++i) {
- if (!el[i]) {
- id = el[i];
- logger.log(id + ' not available', 'error', 'Dom');
- }
- collection[collection.length] = method.call(scope, el[i], o);
- }
-
- return collection;
- },
-
- /**
- * Returns the height of the document.
- * @method getDocumentHeight
- * @return {Int} The height of the actual document (which includes the body and its margin).
- */
- getDocumentHeight: function() {
- var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight;
-
- var h = Math.max(scrollHeight, Y.Dom.getViewportHeight());
- logger.log('getDocumentHeight returning ' + h, 'info', 'Dom');
- return h;
- },
-
- /**
- * Returns the width of the document.
- * @method getDocumentWidth
- * @return {Int} The width of the actual document (which includes the body and its margin).
- */
- getDocumentWidth: function() {
- var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth;
- var w = Math.max(scrollWidth, Y.Dom.getViewportWidth());
- logger.log('getDocumentWidth returning ' + w, 'info', 'Dom');
- return w;
- },
-
- /**
- * Returns the current height of the viewport.
- * @method getViewportHeight
- * @return {Int} The height of the viewable area of the page (excludes scrollbars).
- */
- getViewportHeight: function() {
- var height = self.innerHeight; // Safari, Opera
- var mode = document.compatMode;
-
- if ( (mode || isIE) && !isOpera ) { // IE, Gecko
- height = (mode == 'CSS1Compat') ?
- document.documentElement.clientHeight : // Standards
- document.body.clientHeight; // Quirks
- }
-
- logger.log('getViewportHeight returning ' + height, 'info', 'Dom');
- return height;
- },
-
- /**
- * Returns the current width of the viewport.
- * @method getViewportWidth
- * @return {Int} The width of the viewable area of the page (excludes scrollbars).
- */
-
- getViewportWidth: function() {
- var width = self.innerWidth; // Safari
- var mode = document.compatMode;
-
- if (mode || isIE) { // IE, Gecko, Opera
- width = (mode == 'CSS1Compat') ?
- document.documentElement.clientWidth : // Standards
- document.body.clientWidth; // Quirks
- }
- logger.log('getViewportWidth returning ' + width, 'info', 'Dom');
- return width;
- }
- };
-})();
-/**
- * A region is a representation of an object on a grid. It is defined
- * by the top, right, bottom, left extents, so is rectangular by default. If
- * other shapes are required, this class could be extended to support it.
- * @namespace YAHOO.util
- * @class Region
- * @param {Int} t the top extent
- * @param {Int} r the right extent
- * @param {Int} b the bottom extent
- * @param {Int} l the left extent
- * @constructor
- */
-YAHOO.util.Region = function(t, r, b, l) {
-
- /**
- * The region's top extent
- * @property top
- * @type Int
- */
- this.top = t;
-
- /**
- * The region's top extent as index, for symmetry with set/getXY
- * @property 1
- * @type Int
- */
- this[1] = t;
-
- /**
- * The region's right extent
- * @property right
- * @type int
- */
- this.right = r;
-
- /**
- * The region's bottom extent
- * @property bottom
- * @type Int
- */
- this.bottom = b;
-
- /**
- * The region's left extent
- * @property left
- * @type Int
- */
- this.left = l;
-
- /**
- * The region's left extent as index, for symmetry with set/getXY
- * @property 0
- * @type Int
- */
- this[0] = l;
-};
-
-/**
- * Returns true if this region contains the region passed in
- * @method contains
- * @param {Region} region The region to evaluate
- * @return {Boolean} True if the region is contained with this region,
- * else false
- */
-YAHOO.util.Region.prototype.contains = function(region) {
- return ( region.left >= this.left &&
- region.right <= this.right &&
- region.top >= this.top &&
- region.bottom <= this.bottom );
-
- // this.logger.debug("does " + this + " contain " + region + " ... " + ret);
-};
-
-/**
- * Returns the area of the region
- * @method getArea
- * @return {Int} the region's area
- */
-YAHOO.util.Region.prototype.getArea = function() {
- return ( (this.bottom - this.top) * (this.right - this.left) );
-};
-
-/**
- * Returns the region where the passed in region overlaps with this one
- * @method intersect
- * @param {Region} region The region that intersects
- * @return {Region} The overlap region, or null if there is no overlap
- */
-YAHOO.util.Region.prototype.intersect = function(region) {
- var t = Math.max( this.top, region.top );
- var r = Math.min( this.right, region.right );
- var b = Math.min( this.bottom, region.bottom );
- var l = Math.max( this.left, region.left );
-
- if (b >= t && r >= l) {
- return new YAHOO.util.Region(t, r, b, l);
- } else {
- return null;
- }
-};
-
-/**
- * Returns the region representing the smallest region that can contain both
- * the passed in region and this region.
- * @method union
- * @param {Region} region The region that to create the union with
- * @return {Region} The union region
- */
-YAHOO.util.Region.prototype.union = function(region) {
- var t = Math.min( this.top, region.top );
- var r = Math.max( this.right, region.right );
- var b = Math.max( this.bottom, region.bottom );
- var l = Math.min( this.left, region.left );
-
- return new YAHOO.util.Region(t, r, b, l);
-};
-
-/**
- * toString
- * @method toString
- * @return string the region properties
- */
-YAHOO.util.Region.prototype.toString = function() {
- return ( "Region {" +
- "top: " + this.top +
- ", right: " + this.right +
- ", bottom: " + this.bottom +
- ", left: " + this.left +
- "}" );
-};
-
-/**
- * Returns a region that is occupied by the DOM element
- * @method getRegion
- * @param {HTMLElement} el The element
- * @return {Region} The region that the element occupies
- * @static
- */
-YAHOO.util.Region.getRegion = function(el) {
- var p = YAHOO.util.Dom.getXY(el);
-
- var t = p[1];
- var r = p[0] + el.offsetWidth;
- var b = p[1] + el.offsetHeight;
- var l = p[0];
-
- return new YAHOO.util.Region(t, r, b, l);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-
-/**
- * A point is a region that is special in that it represents a single point on
- * the grid.
- * @namespace YAHOO.util
- * @class Point
- * @param {Int} x The X position of the point
- * @param {Int} y The Y position of the point
- * @constructor
- * @extends YAHOO.util.Region
- */
-YAHOO.util.Point = function(x, y) {
- if (x instanceof Array) { // accept output from Dom.getXY
- y = x[1];
- x = x[0];
- }
-
- /**
- * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)
- * @property x
- * @type Int
- */
-
- this.x = this.right = this.left = this[0] = x;
-
- /**
- * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)
- * @property y
- * @type Int
- */
- this.y = this.top = this.bottom = this[1] = y;
-};
-
-YAHOO.util.Point.prototype = new YAHOO.util.Region();
-
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+ * The dom module provides helper methods for manipulating Dom elements.
+ * @module dom
+ *
+ */
+
+(function() {
+ var Y = YAHOO.util, // internal shorthand
+ getStyle, // for load time browser branching
+ setStyle, // ditto
+ id_counter = 0, // for use with generateId
+ propertyCache = {}; // for faster hyphen converts
+
+ // brower detection
+ var ua = navigator.userAgent.toLowerCase(),
+ isOpera = (ua.indexOf('opera') > -1),
+ isSafari = (ua.indexOf('safari') > -1),
+ isGecko = (!isOpera && !isSafari && ua.indexOf('gecko') > -1),
+ isIE = (!isOpera && ua.indexOf('msie') > -1);
+
+ // regex cache
+ var patterns = {
+ HYPHEN: /(-[a-z])/i
+ };
+
+ var logger = {};
+ logger.log = function() { YAHOO.log.apply(window, arguments); };
+
+ var toCamel = function(property) {
+ if ( !patterns.HYPHEN.test(property) ) {
+ return property; // no hyphens
+ }
+
+ if (propertyCache[property]) { // already converted
+ return propertyCache[property];
+ }
+
+ while( patterns.HYPHEN.exec(property) ) {
+ property = property.replace(RegExp.$1,
+ RegExp.$1.substr(1).toUpperCase());
+ }
+
+ propertyCache[property] = property;
+ return property;
+ //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
+ };
+
+ // branching at load instead of runtime
+ if (document.defaultView && document.defaultView.getComputedStyle) { // W3C DOM method
+ getStyle = function(el, property) {
+ var value = null;
+
+ var computed = document.defaultView.getComputedStyle(el, '');
+ if (computed) { // test computed before touching for safari
+ value = computed[toCamel(property)];
+ }
+
+ return el.style[property] || value;
+ };
+ } else if (document.documentElement.currentStyle && isIE) { // IE method
+ getStyle = function(el, property) {
+ switch( toCamel(property) ) {
+ case 'opacity' :// IE opacity uses filter
+ var val = 100;
+ try { // will error if no DXImageTransform
+ val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
+
+ } catch(e) {
+ try { // make sure its in the document
+ val = el.filters('alpha').opacity;
+ } catch(e) {
+ logger.log('getStyle: IE filter failed',
+ 'error', 'Dom');
+ }
+ }
+ return val / 100;
+ break;
+ default:
+ // test currentStyle before touching
+ var value = el.currentStyle ? el.currentStyle[property] : null;
+ return ( el.style[property] || value );
+ }
+ };
+ } else { // default to inline only
+ getStyle = function(el, property) { return el.style[property]; };
+ }
+
+ if (isIE) {
+ setStyle = function(el, property, val) {
+ switch (property) {
+ case 'opacity':
+ if ( typeof el.style.filter == 'string' ) { // in case not appended
+ el.style.filter = 'alpha(opacity=' + val * 100 + ')';
+
+ if (!el.currentStyle || !el.currentStyle.hasLayout) {
+ el.style.zoom = 1; // when no layout or cant tell
+ }
+ }
+ break;
+ default:
+ el.style[property] = val;
+ }
+ };
+ } else {
+ setStyle = function(el, property, val) {
+ el.style[property] = val;
+ };
+ }
+
+ /**
+ * Provides helper methods for DOM elements.
+ * @namespace YAHOO.util
+ * @class Dom
+ */
+ YAHOO.util.Dom = {
+ /**
+ * Returns an HTMLElement reference.
+ * @method get
+ * @param {String | HTMLElement |Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements.
+ */
+ get: function(el) {
+ if (!el) { return null; } // nothing to work with
+
+ if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is
+ logger.log('get(' + el + ') returning ' + el, 'info', 'Dom');
+ return el;
+ }
+
+ if (typeof el == 'string') { // ID
+ logger.log('get("' + el + '") returning ' + document.getElementById(el), 'info', 'Dom');
+ return document.getElementById(el);
+ }
+ else { // array of ID's and/or elements
+ var collection = [];
+ for (var i = 0, len = el.length; i < len; ++i) {
+ collection[collection.length] = Y.Dom.get(el[i]);
+ }
+
+ logger.log('get("' + el + '") returning ' + collection, 'info', 'Dom');
+ return collection;
+ }
+
+ logger.log('element ' + el + ' not found', 'error', 'Dom');
+ return null; // safety, should never happen
+ },
+
+ /**
+ * Normalizes currentStyle and ComputedStyle.
+ * @method getStyle
+ * @param {String | HTMLElement |Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @param {String} property The style property whose value is returned.
+ * @return {String | Array} The current value of the style property for the element(s).
+ */
+ getStyle: function(el, property) {
+ property = toCamel(property);
+
+ var f = function(element) {
+ return getStyle(element, property);
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Wrapper for setting style properties of HTMLElements. Normalizes "opacity" across modern browsers.
+ * @method setStyle
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @param {String} property The style property to be set.
+ * @param {String} val The value to apply to the given property.
+ */
+ setStyle: function(el, property, val) {
+ property = toCamel(property);
+
+ var f = function(element) {
+ setStyle(element, property, val);
+ logger.log('setStyle setting ' + property + ' to ' + val, 'info', 'Dom');
+
+ };
+
+ Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Gets the current position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method getXY
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+ * @return {Array} The XY position of the element(s)
+ */
+ getXY: function(el) {
+ var f = function(el) {
+
+ // has to be part of document to have pageXY
+ if (el.parentNode === null || el.offsetParent === null ||
+ this.getStyle(el, 'display') == 'none') {
+ logger.log('getXY failed: element not available', 'error', 'Dom');
+ return false;
+ }
+
+ var parentNode = null;
+ var pos = [];
+ var box;
+
+ if (el.getBoundingClientRect) { // IE
+ box = el.getBoundingClientRect();
+ var doc = document;
+ if ( !this.inDocument(el) && parent.document != document) {// might be in a frame, need to get its scroll
+ doc = parent.document;
+
+ if ( !this.isAncestor(doc.documentElement, el) ) {
+ logger.log('getXY failed: element not available', 'error', 'Dom');
+ return false;
+ }
+
+ }
+
+ var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
+ var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
+
+ return [box.left + scrollLeft, box.top + scrollTop];
+ }
+ else { // safari, opera, & gecko
+ pos = [el.offsetLeft, el.offsetTop];
+ parentNode = el.offsetParent;
+ if (parentNode != el) {
+ while (parentNode) {
+ pos[0] += parentNode.offsetLeft;
+ pos[1] += parentNode.offsetTop;
+ parentNode = parentNode.offsetParent;
+ }
+ }
+ if (isSafari && this.getStyle(el, 'position') == 'absolute' ) { // safari doubles in some cases
+ pos[0] -= document.body.offsetLeft;
+ pos[1] -= document.body.offsetTop;
+ }
+ }
+
+ if (el.parentNode) { parentNode = el.parentNode; }
+ else { parentNode = null; }
+
+ while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML')
+ { // account for any scrolled ancestors
+ if (Y.Dom.getStyle(parentNode, 'display') != 'inline') { // work around opera inline scrollLeft/Top bug
+ pos[0] -= parentNode.scrollLeft;
+ pos[1] -= parentNode.scrollTop;
+ }
+
+ if (parentNode.parentNode) {
+ parentNode = parentNode.parentNode;
+ } else { parentNode = null; }
+ }
+
+ logger.log('getXY returning ' + pos, 'info', 'Dom');
+
+ return pos;
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Gets the current X position of an element based on page coordinates. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method getX
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+ * @return {String | Array} The X position of the element(s)
+ */
+ getX: function(el) {
+ var f = function(el) {
+ return Y.Dom.getXY(el)[0];
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Gets the current Y position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method getY
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+ * @return {String | Array} The Y position of the element(s)
+ */
+ getY: function(el) {
+ var f = function(el) {
+ return Y.Dom.getXY(el)[1];
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Set the position of an html element in page coordinates, regardless of how the element is positioned.
+ * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method setXY
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+ * @param {Array} pos Contains X & Y values for new position (coordinates are page-based)
+ * @param {Boolean} noRetry By default we try and set the position a second time if the first fails
+ */
+ setXY: function(el, pos, noRetry) {
+ var f = function(el) {
+ var style_pos = this.getStyle(el, 'position');
+ if (style_pos == 'static') { // default to relative
+ this.setStyle(el, 'position', 'relative');
+ style_pos = 'relative';
+ }
+
+ var pageXY = this.getXY(el);
+ if (pageXY === false) { // has to be part of doc to have pageXY
+ logger.log('setXY failed: element not available', 'error', 'Dom');
+ return false;
+ }
+
+ var delta = [ // assuming pixels; if not we will have to retry
+ parseInt( this.getStyle(el, 'left'), 10 ),
+ parseInt( this.getStyle(el, 'top'), 10 )
+ ];
+
+ if ( isNaN(delta[0]) ) {// in case of 'auto'
+ delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
+ }
+ if ( isNaN(delta[1]) ) { // in case of 'auto'
+ delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
+ }
+
+ if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
+ if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
+
+ var newXY = this.getXY(el);
+
+ // if retry is true, try one more time if we miss
+ if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) {
+ this.setXY(el, pos, true);
+ }
+
+ logger.log('setXY setting position to ' + pos, 'info', 'Dom');
+ };
+
+ Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Set the X position of an html element in page coordinates, regardless of how the element is positioned.
+ * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method setX
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @param {Int} x The value to use as the X coordinate for the element(s).
+ */
+ setX: function(el, x) {
+ Y.Dom.setXY(el, [x, null]);
+ },
+
+ /**
+ * Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
+ * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method setY
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @param {Int} x To use as the Y coordinate for the element(s).
+ */
+ setY: function(el, y) {
+ Y.Dom.setXY(el, [null, y]);
+ },
+
+ /**
+ * Returns the region position of the given element.
+ * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
+ * @method getRegion
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @return {Region | Array} A Region or array of Region instances containing "top, left, bottom, right" member data.
+ */
+ getRegion: function(el) {
+ var f = function(el) {
+ var region = new Y.Region.getRegion(el);
+ logger.log('getRegion returning ' + region, 'info', 'Dom');
+ return region;
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Returns the width of the client (viewport).
+ * @method getClientWidth
+ * @deprecated Now using getViewportWidth. This interface left intact for back compat.
+ * @return {Int} The width of the viewable area of the page.
+ */
+ getClientWidth: function() {
+ return Y.Dom.getViewportWidth();
+ },
+
+ /**
+ * Returns the height of the client (viewport).
+ * @method getClientHeight
+ * @deprecated Now using getViewportHeight. This interface left intact for back compat.
+ * @return {Int} The height of the viewable area of the page.
+ */
+ getClientHeight: function() {
+ return Y.Dom.getViewportHeight();
+ },
+
+ /**
+ * Returns a array of HTMLElements with the given class.
+ * For optimized performance, include a tag and/or root node when possible.
+ * @method getElementsByClassName
+ * @param {String} className The class name to match against
+ * @param {String} tag (optional) The tag name of the elements being collected
+ * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
+ * @return {Array} An array of elements that have the given class name
+ */
+ getElementsByClassName: function(className, tag, root) {
+ var method = function(el) { return Y.Dom.hasClass(el, className); };
+ return Y.Dom.getElementsBy(method, tag, root);
+ },
+
+ /**
+ * Determines whether an HTMLElement has the given className.
+ * @method hasClass
+ * @param {String | HTMLElement | Array} el The element or collection to test
+ * @param {String} className the class name to search for
+ * @return {Boolean | Array} A boolean value or array of boolean values
+ */
+ hasClass: function(el, className) {
+ var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
+
+ var f = function(el) {
+ logger.log('hasClass returning ' + re.test(el['className']), 'info', 'Dom');
+ return re.test(el['className']);
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Adds a class name to a given element or collection of elements.
+ * @method addClass
+ * @param {String | HTMLElement | Array} el The element or collection to add the class to
+ * @param {String} className the class name to add to the class attribute
+ */
+ addClass: function(el, className) {
+ var f = function(el) {
+ if (this.hasClass(el, className)) { return; } // already present
+
+ logger.log('addClass adding ' + className, 'info', 'Dom');
+
+ el['className'] = [el['className'], className].join(' ');
+ };
+
+ Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Removes a class name from a given element or collection of elements.
+ * @method removeClass
+ * @param {String | HTMLElement | Array} el The element or collection to remove the class from
+ * @param {String} className the class name to remove from the class attribute
+ */
+ removeClass: function(el, className) {
+ var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');
+
+ var f = function(el) {
+ if (!this.hasClass(el, className)) { return; } // not present
+
+ logger.log('removeClass removing ' + className, 'info', 'Dom');
+
+ var c = el['className'];
+ el['className'] = c.replace(re, ' ');
+ if ( this.hasClass(el, className) ) { // in case of multiple adjacent
+ this.removeClass(el, className);
+ }
+
+ };
+
+ Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Replace a class with another class for a given element or collection of elements.
+ * If no oldClassName is present, the newClassName is simply added.
+ * @method replaceClass
+ * @param {String | HTMLElement | Array} el The element or collection to remove the class from
+ * @param {String} oldClassName the class name to be replaced
+ * @param {String} newClassName the class name that will be replacing the old class name
+ */
+ replaceClass: function(el, oldClassName, newClassName) {
+ if (oldClassName === newClassName) { // avoid infinite loop
+ return false;
+ }
+
+ var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');
+
+ var f = function(el) {
+ logger.log('replaceClass replacing ' + oldClassName + ' with ' + newClassName, 'info', 'Dom');
+
+ if ( !this.hasClass(el, oldClassName) ) {
+ this.addClass(el, newClassName); // just add it if nothing to replace
+ return; // note return
+ }
+
+ el['className'] = el['className'].replace(re, ' ' + newClassName + ' ');
+
+ if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent
+ this.replaceClass(el, oldClassName, newClassName);
+ }
+ };
+
+ Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Generates a unique ID
+ * @method generateId
+ * @param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
+ * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
+ * @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
+ */
+ generateId: function(el, prefix) {
+ prefix = prefix || 'yui-gen';
+ el = el || {};
+
+ var f = function(el) {
+ if (el) {
+ el = Y.Dom.get(el);
+ } else {
+ el = {}; // just generating ID in this case
+ }
+
+ if (!el.id) {
+ el.id = prefix + id_counter++;
+ logger.log('generateId generating ' + el.id, 'info', 'Dom');
+ } // dont override existing
+
+ logger.log('generateId returning ' + el.id, 'info', 'Dom');
+
+ return el.id;
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
+ * @method isAncestor
+ * @param {String | HTMLElement} haystack The possible ancestor
+ * @param {String | HTMLElement} needle The possible descendent
+ * @return {Boolean} Whether or not the haystack is an ancestor of needle
+ */
+ isAncestor: function(haystack, needle) {
+ haystack = Y.Dom.get(haystack);
+ if (!haystack || !needle) { return false; }
+
+ var f = function(needle) {
+ if (haystack.contains && !isSafari) { // safari "contains" is broken
+ logger.log('isAncestor returning ' + haystack.contains(needle), 'info', 'Dom');
+ return haystack.contains(needle);
+ }
+ else if ( haystack.compareDocumentPosition ) {
+ logger.log('isAncestor returning ' + !!(haystack.compareDocumentPosition(needle) & 16), 'info', 'Dom');
+ return !!(haystack.compareDocumentPosition(needle) & 16);
+ }
+ else { // loop up and test each parent
+ var parent = needle.parentNode;
+
+ while (parent) {
+ if (parent == haystack) {
+ logger.log('isAncestor returning true', 'info', 'Dom');
+ return true;
+ }
+ else if (!parent.tagName || parent.tagName.toUpperCase() == 'HTML') {
+ logger.log('isAncestor returning false', 'info', 'Dom');
+ return false;
+ }
+
+ parent = parent.parentNode;
+ }
+ logger.log('isAncestor returning false', 'info', 'Dom');
+ return false;
+ }
+ };
+
+ return Y.Dom.batch(needle, f, Y.Dom, true);
+ },
+
+ /**
+ * Determines whether an HTMLElement is present in the current document.
+ * @method inDocument
+ * @param {String | HTMLElement} el The element to search for
+ * @return {Boolean} Whether or not the element is present in the current document
+ */
+ inDocument: function(el) {
+ var f = function(el) {
+ return this.isAncestor(document.documentElement, el);
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Returns a array of HTMLElements that pass the test applied by supplied boolean method.
+ * For optimized performance, include a tag and/or root node when possible.
+ * @method getElementsBy
+ * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
+
+ * @param {String} tag (optional) The tag name of the elements being collected
+ * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
+ */
+ getElementsBy: function(method, tag, root) {
+ tag = tag || '*';
+ root = Y.Dom.get(root) || document;
+
+ var nodes = [];
+ var elements = root.getElementsByTagName(tag);
+
+ if ( !elements.length && (tag == '*' && root.all) ) {
+ elements = root.all; // IE < 6
+ }
+
+ for (var i = 0, len = elements.length; i < len; ++i) {
+ if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; }
+ }
+
+ logger.log('getElementsBy returning ' + nodes, 'info', 'Dom');
+
+ return nodes;
+ },
+
+ /**
+ * Returns an array of elements that have had the supplied method applied.
+ * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
+ * @method batch
+ * @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to
+ * @param {Function} method The method to apply to the element(s)
+ * @param {Any} o (optional) An optional arg that is passed to the supplied method
+ * @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o"
+ * @return {HTMLElement | Array} The element(s) with the method applied
+ */
+ batch: function(el, method, o, override) {
+ var id = el;
+ el = Y.Dom.get(el);
+
+ var scope = (override) ? o : window;
+
+ if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection)
+ if (!el) {
+ logger.log(id + ' not available', 'error', 'Dom');
+ return false;
+ }
+ return method.call(scope, el, o);
+ }
+
+ var collection = [];
+
+ for (var i = 0, len = el.length; i < len; ++i) {
+ if (!el[i]) {
+ id = el[i];
+ logger.log(id + ' not available', 'error', 'Dom');
+ }
+ collection[collection.length] = method.call(scope, el[i], o);
+ }
+
+ return collection;
+ },
+
+ /**
+ * Returns the height of the document.
+ * @method getDocumentHeight
+ * @return {Int} The height of the actual document (which includes the body and its margin).
+ */
+ getDocumentHeight: function() {
+ var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight;
+
+ var h = Math.max(scrollHeight, Y.Dom.getViewportHeight());
+ logger.log('getDocumentHeight returning ' + h, 'info', 'Dom');
+ return h;
+ },
+
+ /**
+ * Returns the width of the document.
+ * @method getDocumentWidth
+ * @return {Int} The width of the actual document (which includes the body and its margin).
+ */
+ getDocumentWidth: function() {
+ var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth;
+ var w = Math.max(scrollWidth, Y.Dom.getViewportWidth());
+ logger.log('getDocumentWidth returning ' + w, 'info', 'Dom');
+ return w;
+ },
+
+ /**
+ * Returns the current height of the viewport.
+ * @method getViewportHeight
+ * @return {Int} The height of the viewable area of the page (excludes scrollbars).
+ */
+ getViewportHeight: function() {
+ var height = self.innerHeight; // Safari, Opera
+ var mode = document.compatMode;
+
+ if ( (mode || isIE) && !isOpera ) { // IE, Gecko
+ height = (mode == 'CSS1Compat') ?
+ document.documentElement.clientHeight : // Standards
+ document.body.clientHeight; // Quirks
+ }
+
+ logger.log('getViewportHeight returning ' + height, 'info', 'Dom');
+ return height;
+ },
+
+ /**
+ * Returns the current width of the viewport.
+ * @method getViewportWidth
+ * @return {Int} The width of the viewable area of the page (excludes scrollbars).
+ */
+
+ getViewportWidth: function() {
+ var width = self.innerWidth; // Safari
+ var mode = document.compatMode;
+
+ if (mode || isIE) { // IE, Gecko, Opera
+ width = (mode == 'CSS1Compat') ?
+ document.documentElement.clientWidth : // Standards
+ document.body.clientWidth; // Quirks
+ }
+ logger.log('getViewportWidth returning ' + width, 'info', 'Dom');
+ return width;
+ }
+ };
+})();
+/**
+ * A region is a representation of an object on a grid. It is defined
+ * by the top, right, bottom, left extents, so is rectangular by default. If
+ * other shapes are required, this class could be extended to support it.
+ * @namespace YAHOO.util
+ * @class Region
+ * @param {Int} t the top extent
+ * @param {Int} r the right extent
+ * @param {Int} b the bottom extent
+ * @param {Int} l the left extent
+ * @constructor
+ */
+YAHOO.util.Region = function(t, r, b, l) {
+
+ /**
+ * The region's top extent
+ * @property top
+ * @type Int
+ */
+ this.top = t;
+
+ /**
+ * The region's top extent as index, for symmetry with set/getXY
+ * @property 1
+ * @type Int
+ */
+ this[1] = t;
+
+ /**
+ * The region's right extent
+ * @property right
+ * @type int
+ */
+ this.right = r;
+
+ /**
+ * The region's bottom extent
+ * @property bottom
+ * @type Int
+ */
+ this.bottom = b;
+
+ /**
+ * The region's left extent
+ * @property left
+ * @type Int
+ */
+ this.left = l;
+
+ /**
+ * The region's left extent as index, for symmetry with set/getXY
+ * @property 0
+ * @type Int
+ */
+ this[0] = l;
+};
+
+/**
+ * Returns true if this region contains the region passed in
+ * @method contains
+ * @param {Region} region The region to evaluate
+ * @return {Boolean} True if the region is contained with this region,
+ * else false
+ */
+YAHOO.util.Region.prototype.contains = function(region) {
+ return ( region.left >= this.left &&
+ region.right <= this.right &&
+ region.top >= this.top &&
+ region.bottom <= this.bottom );
+
+ // this.logger.debug("does " + this + " contain " + region + " ... " + ret);
+};
+
+/**
+ * Returns the area of the region
+ * @method getArea
+ * @return {Int} the region's area
+ */
+YAHOO.util.Region.prototype.getArea = function() {
+ return ( (this.bottom - this.top) * (this.right - this.left) );
+};
+
+/**
+ * Returns the region where the passed in region overlaps with this one
+ * @method intersect
+ * @param {Region} region The region that intersects
+ * @return {Region} The overlap region, or null if there is no overlap
+ */
+YAHOO.util.Region.prototype.intersect = function(region) {
+ var t = Math.max( this.top, region.top );
+ var r = Math.min( this.right, region.right );
+ var b = Math.min( this.bottom, region.bottom );
+ var l = Math.max( this.left, region.left );
+
+ if (b >= t && r >= l) {
+ return new YAHOO.util.Region(t, r, b, l);
+ } else {
+ return null;
+ }
+};
+
+/**
+ * Returns the region representing the smallest region that can contain both
+ * the passed in region and this region.
+ * @method union
+ * @param {Region} region The region that to create the union with
+ * @return {Region} The union region
+ */
+YAHOO.util.Region.prototype.union = function(region) {
+ var t = Math.min( this.top, region.top );
+ var r = Math.max( this.right, region.right );
+ var b = Math.max( this.bottom, region.bottom );
+ var l = Math.min( this.left, region.left );
+
+ return new YAHOO.util.Region(t, r, b, l);
+};
+
+/**
+ * toString
+ * @method toString
+ * @return string the region properties
+ */
+YAHOO.util.Region.prototype.toString = function() {
+ return ( "Region {" +
+ "top: " + this.top +
+ ", right: " + this.right +
+ ", bottom: " + this.bottom +
+ ", left: " + this.left +
+ "}" );
+};
+
+/**
+ * Returns a region that is occupied by the DOM element
+ * @method getRegion
+ * @param {HTMLElement} el The element
+ * @return {Region} The region that the element occupies
+ * @static
+ */
+YAHOO.util.Region.getRegion = function(el) {
+ var p = YAHOO.util.Dom.getXY(el);
+
+ var t = p[1];
+ var r = p[0] + el.offsetWidth;
+ var b = p[1] + el.offsetHeight;
+ var l = p[0];
+
+ return new YAHOO.util.Region(t, r, b, l);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+/**
+ * A point is a region that is special in that it represents a single point on
+ * the grid.
+ * @namespace YAHOO.util
+ * @class Point
+ * @param {Int} x The X position of the point
+ * @param {Int} y The Y position of the point
+ * @constructor
+ * @extends YAHOO.util.Region
+ */
+YAHOO.util.Point = function(x, y) {
+ if (x instanceof Array) { // accept output from Dom.getXY
+ y = x[1];
+ x = x[0];
+ }
+
+ /**
+ * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)
+ * @property x
+ * @type Int
+ */
+
+ this.x = this.right = this.left = this[0] = x;
+
+ /**
+ * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)
+ * @property y
+ * @type Int
+ */
+ this.y = this.top = this.bottom = this[1] = y;
+};
+
+YAHOO.util.Point.prototype = new YAHOO.util.Region();
+
diff --git a/thirdpartyjs/yui/dom/dom.js b/thirdpartyjs/yui/dom/dom.js
index 6f04c43..9084411 100644
--- a/thirdpartyjs/yui/dom/dom.js
+++ b/thirdpartyjs/yui/dom/dom.js
@@ -1,881 +1,881 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-/**
- * The dom module provides helper methods for manipulating Dom elements.
- * @module dom
- *
- */
-
-(function() {
- var Y = YAHOO.util, // internal shorthand
- getStyle, // for load time browser branching
- setStyle, // ditto
- id_counter = 0, // for use with generateId
- propertyCache = {}; // for faster hyphen converts
-
- // brower detection
- var ua = navigator.userAgent.toLowerCase(),
- isOpera = (ua.indexOf('opera') > -1),
- isSafari = (ua.indexOf('safari') > -1),
- isGecko = (!isOpera && !isSafari && ua.indexOf('gecko') > -1),
- isIE = (!isOpera && ua.indexOf('msie') > -1);
-
- // regex cache
- var patterns = {
- HYPHEN: /(-[a-z])/i
- };
-
-
- var toCamel = function(property) {
- if ( !patterns.HYPHEN.test(property) ) {
- return property; // no hyphens
- }
-
- if (propertyCache[property]) { // already converted
- return propertyCache[property];
- }
-
- while( patterns.HYPHEN.exec(property) ) {
- property = property.replace(RegExp.$1,
- RegExp.$1.substr(1).toUpperCase());
- }
-
- propertyCache[property] = property;
- return property;
- //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
- };
-
- // branching at load instead of runtime
- if (document.defaultView && document.defaultView.getComputedStyle) { // W3C DOM method
- getStyle = function(el, property) {
- var value = null;
-
- var computed = document.defaultView.getComputedStyle(el, '');
- if (computed) { // test computed before touching for safari
- value = computed[toCamel(property)];
- }
-
- return el.style[property] || value;
- };
- } else if (document.documentElement.currentStyle && isIE) { // IE method
- getStyle = function(el, property) {
- switch( toCamel(property) ) {
- case 'opacity' :// IE opacity uses filter
- var val = 100;
- try { // will error if no DXImageTransform
- val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
-
- } catch(e) {
- try { // make sure its in the document
- val = el.filters('alpha').opacity;
- } catch(e) {
- }
- }
- return val / 100;
- break;
- default:
- // test currentStyle before touching
- var value = el.currentStyle ? el.currentStyle[property] : null;
- return ( el.style[property] || value );
- }
- };
- } else { // default to inline only
- getStyle = function(el, property) { return el.style[property]; };
- }
-
- if (isIE) {
- setStyle = function(el, property, val) {
- switch (property) {
- case 'opacity':
- if ( typeof el.style.filter == 'string' ) { // in case not appended
- el.style.filter = 'alpha(opacity=' + val * 100 + ')';
-
- if (!el.currentStyle || !el.currentStyle.hasLayout) {
- el.style.zoom = 1; // when no layout or cant tell
- }
- }
- break;
- default:
- el.style[property] = val;
- }
- };
- } else {
- setStyle = function(el, property, val) {
- el.style[property] = val;
- };
- }
-
- /**
- * Provides helper methods for DOM elements.
- * @namespace YAHOO.util
- * @class Dom
- */
- YAHOO.util.Dom = {
- /**
- * Returns an HTMLElement reference.
- * @method get
- * @param {String | HTMLElement |Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements.
- */
- get: function(el) {
- if (!el) { return null; } // nothing to work with
-
- if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is
- return el;
- }
-
- if (typeof el == 'string') { // ID
- return document.getElementById(el);
- }
- else { // array of ID's and/or elements
- var collection = [];
- for (var i = 0, len = el.length; i < len; ++i) {
- collection[collection.length] = Y.Dom.get(el[i]);
- }
-
- return collection;
- }
-
- return null; // safety, should never happen
- },
-
- /**
- * Normalizes currentStyle and ComputedStyle.
- * @method getStyle
- * @param {String | HTMLElement |Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @param {String} property The style property whose value is returned.
- * @return {String | Array} The current value of the style property for the element(s).
- */
- getStyle: function(el, property) {
- property = toCamel(property);
-
- var f = function(element) {
- return getStyle(element, property);
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Wrapper for setting style properties of HTMLElements. Normalizes "opacity" across modern browsers.
- * @method setStyle
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @param {String} property The style property to be set.
- * @param {String} val The value to apply to the given property.
- */
- setStyle: function(el, property, val) {
- property = toCamel(property);
-
- var f = function(element) {
- setStyle(element, property, val);
-
- };
-
- Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Gets the current position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method getXY
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
- * @return {Array} The XY position of the element(s)
- */
- getXY: function(el) {
- var f = function(el) {
-
- // has to be part of document to have pageXY
- if (el.parentNode === null || el.offsetParent === null ||
- this.getStyle(el, 'display') == 'none') {
- return false;
- }
-
- var parentNode = null;
- var pos = [];
- var box;
-
- if (el.getBoundingClientRect) { // IE
- box = el.getBoundingClientRect();
- var doc = document;
- if ( !this.inDocument(el) && parent.document != document) {// might be in a frame, need to get its scroll
- doc = parent.document;
-
- if ( !this.isAncestor(doc.documentElement, el) ) {
- return false;
- }
-
- }
-
- var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
- var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
-
- return [box.left + scrollLeft, box.top + scrollTop];
- }
- else { // safari, opera, & gecko
- pos = [el.offsetLeft, el.offsetTop];
- parentNode = el.offsetParent;
- if (parentNode != el) {
- while (parentNode) {
- pos[0] += parentNode.offsetLeft;
- pos[1] += parentNode.offsetTop;
- parentNode = parentNode.offsetParent;
- }
- }
- if (isSafari && this.getStyle(el, 'position') == 'absolute' ) { // safari doubles in some cases
- pos[0] -= document.body.offsetLeft;
- pos[1] -= document.body.offsetTop;
- }
- }
-
- if (el.parentNode) { parentNode = el.parentNode; }
- else { parentNode = null; }
-
- while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML')
- { // account for any scrolled ancestors
- if (Y.Dom.getStyle(parentNode, 'display') != 'inline') { // work around opera inline scrollLeft/Top bug
- pos[0] -= parentNode.scrollLeft;
- pos[1] -= parentNode.scrollTop;
- }
-
- if (parentNode.parentNode) {
- parentNode = parentNode.parentNode;
- } else { parentNode = null; }
- }
-
-
- return pos;
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Gets the current X position of an element based on page coordinates. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method getX
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
- * @return {String | Array} The X position of the element(s)
- */
- getX: function(el) {
- var f = function(el) {
- return Y.Dom.getXY(el)[0];
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Gets the current Y position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method getY
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
- * @return {String | Array} The Y position of the element(s)
- */
- getY: function(el) {
- var f = function(el) {
- return Y.Dom.getXY(el)[1];
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Set the position of an html element in page coordinates, regardless of how the element is positioned.
- * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method setXY
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
- * @param {Array} pos Contains X & Y values for new position (coordinates are page-based)
- * @param {Boolean} noRetry By default we try and set the position a second time if the first fails
- */
- setXY: function(el, pos, noRetry) {
- var f = function(el) {
- var style_pos = this.getStyle(el, 'position');
- if (style_pos == 'static') { // default to relative
- this.setStyle(el, 'position', 'relative');
- style_pos = 'relative';
- }
-
- var pageXY = this.getXY(el);
- if (pageXY === false) { // has to be part of doc to have pageXY
- return false;
- }
-
- var delta = [ // assuming pixels; if not we will have to retry
- parseInt( this.getStyle(el, 'left'), 10 ),
- parseInt( this.getStyle(el, 'top'), 10 )
- ];
-
- if ( isNaN(delta[0]) ) {// in case of 'auto'
- delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
- }
- if ( isNaN(delta[1]) ) { // in case of 'auto'
- delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
- }
-
- if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
- if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
-
- var newXY = this.getXY(el);
-
- // if retry is true, try one more time if we miss
- if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) {
- this.setXY(el, pos, true);
- }
-
- };
-
- Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Set the X position of an html element in page coordinates, regardless of how the element is positioned.
- * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method setX
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @param {Int} x The value to use as the X coordinate for the element(s).
- */
- setX: function(el, x) {
- Y.Dom.setXY(el, [x, null]);
- },
-
- /**
- * Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
- * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
- * @method setY
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @param {Int} x To use as the Y coordinate for the element(s).
- */
- setY: function(el, y) {
- Y.Dom.setXY(el, [null, y]);
- },
-
- /**
- * Returns the region position of the given element.
- * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
- * @method getRegion
- * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
- * @return {Region | Array} A Region or array of Region instances containing "top, left, bottom, right" member data.
- */
- getRegion: function(el) {
- var f = function(el) {
- var region = new Y.Region.getRegion(el);
- return region;
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Returns the width of the client (viewport).
- * @method getClientWidth
- * @deprecated Now using getViewportWidth. This interface left intact for back compat.
- * @return {Int} The width of the viewable area of the page.
- */
- getClientWidth: function() {
- return Y.Dom.getViewportWidth();
- },
-
- /**
- * Returns the height of the client (viewport).
- * @method getClientHeight
- * @deprecated Now using getViewportHeight. This interface left intact for back compat.
- * @return {Int} The height of the viewable area of the page.
- */
- getClientHeight: function() {
- return Y.Dom.getViewportHeight();
- },
-
- /**
- * Returns a array of HTMLElements with the given class.
- * For optimized performance, include a tag and/or root node when possible.
- * @method getElementsByClassName
- * @param {String} className The class name to match against
- * @param {String} tag (optional) The tag name of the elements being collected
- * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
- * @return {Array} An array of elements that have the given class name
- */
- getElementsByClassName: function(className, tag, root) {
- var method = function(el) { return Y.Dom.hasClass(el, className); };
- return Y.Dom.getElementsBy(method, tag, root);
- },
-
- /**
- * Determines whether an HTMLElement has the given className.
- * @method hasClass
- * @param {String | HTMLElement | Array} el The element or collection to test
- * @param {String} className the class name to search for
- * @return {Boolean | Array} A boolean value or array of boolean values
- */
- hasClass: function(el, className) {
- var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
-
- var f = function(el) {
- return re.test(el['className']);
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Adds a class name to a given element or collection of elements.
- * @method addClass
- * @param {String | HTMLElement | Array} el The element or collection to add the class to
- * @param {String} className the class name to add to the class attribute
- */
- addClass: function(el, className) {
- var f = function(el) {
- if (this.hasClass(el, className)) { return; } // already present
-
-
- el['className'] = [el['className'], className].join(' ');
- };
-
- Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Removes a class name from a given element or collection of elements.
- * @method removeClass
- * @param {String | HTMLElement | Array} el The element or collection to remove the class from
- * @param {String} className the class name to remove from the class attribute
- */
- removeClass: function(el, className) {
- var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');
-
- var f = function(el) {
- if (!this.hasClass(el, className)) { return; } // not present
-
-
- var c = el['className'];
- el['className'] = c.replace(re, ' ');
- if ( this.hasClass(el, className) ) { // in case of multiple adjacent
- this.removeClass(el, className);
- }
-
- };
-
- Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Replace a class with another class for a given element or collection of elements.
- * If no oldClassName is present, the newClassName is simply added.
- * @method replaceClass
- * @param {String | HTMLElement | Array} el The element or collection to remove the class from
- * @param {String} oldClassName the class name to be replaced
- * @param {String} newClassName the class name that will be replacing the old class name
- */
- replaceClass: function(el, oldClassName, newClassName) {
- if (oldClassName === newClassName) { // avoid infinite loop
- return false;
- }
-
- var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');
-
- var f = function(el) {
-
- if ( !this.hasClass(el, oldClassName) ) {
- this.addClass(el, newClassName); // just add it if nothing to replace
- return; // note return
- }
-
- el['className'] = el['className'].replace(re, ' ' + newClassName + ' ');
-
- if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent
- this.replaceClass(el, oldClassName, newClassName);
- }
- };
-
- Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Generates a unique ID
- * @method generateId
- * @param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
- * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
- * @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
- */
- generateId: function(el, prefix) {
- prefix = prefix || 'yui-gen';
- el = el || {};
-
- var f = function(el) {
- if (el) {
- el = Y.Dom.get(el);
- } else {
- el = {}; // just generating ID in this case
- }
-
- if (!el.id) {
- el.id = prefix + id_counter++;
- } // dont override existing
-
-
- return el.id;
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
- * @method isAncestor
- * @param {String | HTMLElement} haystack The possible ancestor
- * @param {String | HTMLElement} needle The possible descendent
- * @return {Boolean} Whether or not the haystack is an ancestor of needle
- */
- isAncestor: function(haystack, needle) {
- haystack = Y.Dom.get(haystack);
- if (!haystack || !needle) { return false; }
-
- var f = function(needle) {
- if (haystack.contains && !isSafari) { // safari "contains" is broken
- return haystack.contains(needle);
- }
- else if ( haystack.compareDocumentPosition ) {
- return !!(haystack.compareDocumentPosition(needle) & 16);
- }
- else { // loop up and test each parent
- var parent = needle.parentNode;
-
- while (parent) {
- if (parent == haystack) {
- return true;
- }
- else if (!parent.tagName || parent.tagName.toUpperCase() == 'HTML') {
- return false;
- }
-
- parent = parent.parentNode;
- }
- return false;
- }
- };
-
- return Y.Dom.batch(needle, f, Y.Dom, true);
- },
-
- /**
- * Determines whether an HTMLElement is present in the current document.
- * @method inDocument
- * @param {String | HTMLElement} el The element to search for
- * @return {Boolean} Whether or not the element is present in the current document
- */
- inDocument: function(el) {
- var f = function(el) {
- return this.isAncestor(document.documentElement, el);
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
- },
-
- /**
- * Returns a array of HTMLElements that pass the test applied by supplied boolean method.
- * For optimized performance, include a tag and/or root node when possible.
- * @method getElementsBy
- * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
-
- * @param {String} tag (optional) The tag name of the elements being collected
- * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
- */
- getElementsBy: function(method, tag, root) {
- tag = tag || '*';
- root = Y.Dom.get(root) || document;
-
- var nodes = [];
- var elements = root.getElementsByTagName(tag);
-
- if ( !elements.length && (tag == '*' && root.all) ) {
- elements = root.all; // IE < 6
- }
-
- for (var i = 0, len = elements.length; i < len; ++i) {
- if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; }
- }
-
-
- return nodes;
- },
-
- /**
- * Returns an array of elements that have had the supplied method applied.
- * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
- * @method batch
- * @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to
- * @param {Function} method The method to apply to the element(s)
- * @param {Any} o (optional) An optional arg that is passed to the supplied method
- * @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o"
- * @return {HTMLElement | Array} The element(s) with the method applied
- */
- batch: function(el, method, o, override) {
- var id = el;
- el = Y.Dom.get(el);
-
- var scope = (override) ? o : window;
-
- if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection)
- if (!el) {
- return false;
- }
- return method.call(scope, el, o);
- }
-
- var collection = [];
-
- for (var i = 0, len = el.length; i < len; ++i) {
- if (!el[i]) {
- id = el[i];
- }
- collection[collection.length] = method.call(scope, el[i], o);
- }
-
- return collection;
- },
-
- /**
- * Returns the height of the document.
- * @method getDocumentHeight
- * @return {Int} The height of the actual document (which includes the body and its margin).
- */
- getDocumentHeight: function() {
- var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight;
-
- var h = Math.max(scrollHeight, Y.Dom.getViewportHeight());
- return h;
- },
-
- /**
- * Returns the width of the document.
- * @method getDocumentWidth
- * @return {Int} The width of the actual document (which includes the body and its margin).
- */
- getDocumentWidth: function() {
- var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth;
- var w = Math.max(scrollWidth, Y.Dom.getViewportWidth());
- return w;
- },
-
- /**
- * Returns the current height of the viewport.
- * @method getViewportHeight
- * @return {Int} The height of the viewable area of the page (excludes scrollbars).
- */
- getViewportHeight: function() {
- var height = self.innerHeight; // Safari, Opera
- var mode = document.compatMode;
-
- if ( (mode || isIE) && !isOpera ) { // IE, Gecko
- height = (mode == 'CSS1Compat') ?
- document.documentElement.clientHeight : // Standards
- document.body.clientHeight; // Quirks
- }
-
- return height;
- },
-
- /**
- * Returns the current width of the viewport.
- * @method getViewportWidth
- * @return {Int} The width of the viewable area of the page (excludes scrollbars).
- */
-
- getViewportWidth: function() {
- var width = self.innerWidth; // Safari
- var mode = document.compatMode;
-
- if (mode || isIE) { // IE, Gecko, Opera
- width = (mode == 'CSS1Compat') ?
- document.documentElement.clientWidth : // Standards
- document.body.clientWidth; // Quirks
- }
- return width;
- }
- };
-})();
-/**
- * A region is a representation of an object on a grid. It is defined
- * by the top, right, bottom, left extents, so is rectangular by default. If
- * other shapes are required, this class could be extended to support it.
- * @namespace YAHOO.util
- * @class Region
- * @param {Int} t the top extent
- * @param {Int} r the right extent
- * @param {Int} b the bottom extent
- * @param {Int} l the left extent
- * @constructor
- */
-YAHOO.util.Region = function(t, r, b, l) {
-
- /**
- * The region's top extent
- * @property top
- * @type Int
- */
- this.top = t;
-
- /**
- * The region's top extent as index, for symmetry with set/getXY
- * @property 1
- * @type Int
- */
- this[1] = t;
-
- /**
- * The region's right extent
- * @property right
- * @type int
- */
- this.right = r;
-
- /**
- * The region's bottom extent
- * @property bottom
- * @type Int
- */
- this.bottom = b;
-
- /**
- * The region's left extent
- * @property left
- * @type Int
- */
- this.left = l;
-
- /**
- * The region's left extent as index, for symmetry with set/getXY
- * @property 0
- * @type Int
- */
- this[0] = l;
-};
-
-/**
- * Returns true if this region contains the region passed in
- * @method contains
- * @param {Region} region The region to evaluate
- * @return {Boolean} True if the region is contained with this region,
- * else false
- */
-YAHOO.util.Region.prototype.contains = function(region) {
- return ( region.left >= this.left &&
- region.right <= this.right &&
- region.top >= this.top &&
- region.bottom <= this.bottom );
-
-};
-
-/**
- * Returns the area of the region
- * @method getArea
- * @return {Int} the region's area
- */
-YAHOO.util.Region.prototype.getArea = function() {
- return ( (this.bottom - this.top) * (this.right - this.left) );
-};
-
-/**
- * Returns the region where the passed in region overlaps with this one
- * @method intersect
- * @param {Region} region The region that intersects
- * @return {Region} The overlap region, or null if there is no overlap
- */
-YAHOO.util.Region.prototype.intersect = function(region) {
- var t = Math.max( this.top, region.top );
- var r = Math.min( this.right, region.right );
- var b = Math.min( this.bottom, region.bottom );
- var l = Math.max( this.left, region.left );
-
- if (b >= t && r >= l) {
- return new YAHOO.util.Region(t, r, b, l);
- } else {
- return null;
- }
-};
-
-/**
- * Returns the region representing the smallest region that can contain both
- * the passed in region and this region.
- * @method union
- * @param {Region} region The region that to create the union with
- * @return {Region} The union region
- */
-YAHOO.util.Region.prototype.union = function(region) {
- var t = Math.min( this.top, region.top );
- var r = Math.max( this.right, region.right );
- var b = Math.max( this.bottom, region.bottom );
- var l = Math.min( this.left, region.left );
-
- return new YAHOO.util.Region(t, r, b, l);
-};
-
-/**
- * toString
- * @method toString
- * @return string the region properties
- */
-YAHOO.util.Region.prototype.toString = function() {
- return ( "Region {" +
- "top: " + this.top +
- ", right: " + this.right +
- ", bottom: " + this.bottom +
- ", left: " + this.left +
- "}" );
-};
-
-/**
- * Returns a region that is occupied by the DOM element
- * @method getRegion
- * @param {HTMLElement} el The element
- * @return {Region} The region that the element occupies
- * @static
- */
-YAHOO.util.Region.getRegion = function(el) {
- var p = YAHOO.util.Dom.getXY(el);
-
- var t = p[1];
- var r = p[0] + el.offsetWidth;
- var b = p[1] + el.offsetHeight;
- var l = p[0];
-
- return new YAHOO.util.Region(t, r, b, l);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-/**
- * A point is a region that is special in that it represents a single point on
- * the grid.
- * @namespace YAHOO.util
- * @class Point
- * @param {Int} x The X position of the point
- * @param {Int} y The Y position of the point
- * @constructor
- * @extends YAHOO.util.Region
- */
-YAHOO.util.Point = function(x, y) {
- if (x instanceof Array) { // accept output from Dom.getXY
- y = x[1];
- x = x[0];
- }
-
- /**
- * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)
- * @property x
- * @type Int
- */
-
- this.x = this.right = this.left = this[0] = x;
-
- /**
- * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)
- * @property y
- * @type Int
- */
- this.y = this.top = this.bottom = this[1] = y;
-};
-
-YAHOO.util.Point.prototype = new YAHOO.util.Region();
-
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+ * The dom module provides helper methods for manipulating Dom elements.
+ * @module dom
+ *
+ */
+
+(function() {
+ var Y = YAHOO.util, // internal shorthand
+ getStyle, // for load time browser branching
+ setStyle, // ditto
+ id_counter = 0, // for use with generateId
+ propertyCache = {}; // for faster hyphen converts
+
+ // brower detection
+ var ua = navigator.userAgent.toLowerCase(),
+ isOpera = (ua.indexOf('opera') > -1),
+ isSafari = (ua.indexOf('safari') > -1),
+ isGecko = (!isOpera && !isSafari && ua.indexOf('gecko') > -1),
+ isIE = (!isOpera && ua.indexOf('msie') > -1);
+
+ // regex cache
+ var patterns = {
+ HYPHEN: /(-[a-z])/i
+ };
+
+
+ var toCamel = function(property) {
+ if ( !patterns.HYPHEN.test(property) ) {
+ return property; // no hyphens
+ }
+
+ if (propertyCache[property]) { // already converted
+ return propertyCache[property];
+ }
+
+ while( patterns.HYPHEN.exec(property) ) {
+ property = property.replace(RegExp.$1,
+ RegExp.$1.substr(1).toUpperCase());
+ }
+
+ propertyCache[property] = property;
+ return property;
+ //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
+ };
+
+ // branching at load instead of runtime
+ if (document.defaultView && document.defaultView.getComputedStyle) { // W3C DOM method
+ getStyle = function(el, property) {
+ var value = null;
+
+ var computed = document.defaultView.getComputedStyle(el, '');
+ if (computed) { // test computed before touching for safari
+ value = computed[toCamel(property)];
+ }
+
+ return el.style[property] || value;
+ };
+ } else if (document.documentElement.currentStyle && isIE) { // IE method
+ getStyle = function(el, property) {
+ switch( toCamel(property) ) {
+ case 'opacity' :// IE opacity uses filter
+ var val = 100;
+ try { // will error if no DXImageTransform
+ val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
+
+ } catch(e) {
+ try { // make sure its in the document
+ val = el.filters('alpha').opacity;
+ } catch(e) {
+ }
+ }
+ return val / 100;
+ break;
+ default:
+ // test currentStyle before touching
+ var value = el.currentStyle ? el.currentStyle[property] : null;
+ return ( el.style[property] || value );
+ }
+ };
+ } else { // default to inline only
+ getStyle = function(el, property) { return el.style[property]; };
+ }
+
+ if (isIE) {
+ setStyle = function(el, property, val) {
+ switch (property) {
+ case 'opacity':
+ if ( typeof el.style.filter == 'string' ) { // in case not appended
+ el.style.filter = 'alpha(opacity=' + val * 100 + ')';
+
+ if (!el.currentStyle || !el.currentStyle.hasLayout) {
+ el.style.zoom = 1; // when no layout or cant tell
+ }
+ }
+ break;
+ default:
+ el.style[property] = val;
+ }
+ };
+ } else {
+ setStyle = function(el, property, val) {
+ el.style[property] = val;
+ };
+ }
+
+ /**
+ * Provides helper methods for DOM elements.
+ * @namespace YAHOO.util
+ * @class Dom
+ */
+ YAHOO.util.Dom = {
+ /**
+ * Returns an HTMLElement reference.
+ * @method get
+ * @param {String | HTMLElement |Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements.
+ */
+ get: function(el) {
+ if (!el) { return null; } // nothing to work with
+
+ if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is
+ return el;
+ }
+
+ if (typeof el == 'string') { // ID
+ return document.getElementById(el);
+ }
+ else { // array of ID's and/or elements
+ var collection = [];
+ for (var i = 0, len = el.length; i < len; ++i) {
+ collection[collection.length] = Y.Dom.get(el[i]);
+ }
+
+ return collection;
+ }
+
+ return null; // safety, should never happen
+ },
+
+ /**
+ * Normalizes currentStyle and ComputedStyle.
+ * @method getStyle
+ * @param {String | HTMLElement |Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @param {String} property The style property whose value is returned.
+ * @return {String | Array} The current value of the style property for the element(s).
+ */
+ getStyle: function(el, property) {
+ property = toCamel(property);
+
+ var f = function(element) {
+ return getStyle(element, property);
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Wrapper for setting style properties of HTMLElements. Normalizes "opacity" across modern browsers.
+ * @method setStyle
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @param {String} property The style property to be set.
+ * @param {String} val The value to apply to the given property.
+ */
+ setStyle: function(el, property, val) {
+ property = toCamel(property);
+
+ var f = function(element) {
+ setStyle(element, property, val);
+
+ };
+
+ Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Gets the current position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method getXY
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+ * @return {Array} The XY position of the element(s)
+ */
+ getXY: function(el) {
+ var f = function(el) {
+
+ // has to be part of document to have pageXY
+ if (el.parentNode === null || el.offsetParent === null ||
+ this.getStyle(el, 'display') == 'none') {
+ return false;
+ }
+
+ var parentNode = null;
+ var pos = [];
+ var box;
+
+ if (el.getBoundingClientRect) { // IE
+ box = el.getBoundingClientRect();
+ var doc = document;
+ if ( !this.inDocument(el) && parent.document != document) {// might be in a frame, need to get its scroll
+ doc = parent.document;
+
+ if ( !this.isAncestor(doc.documentElement, el) ) {
+ return false;
+ }
+
+ }
+
+ var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
+ var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
+
+ return [box.left + scrollLeft, box.top + scrollTop];
+ }
+ else { // safari, opera, & gecko
+ pos = [el.offsetLeft, el.offsetTop];
+ parentNode = el.offsetParent;
+ if (parentNode != el) {
+ while (parentNode) {
+ pos[0] += parentNode.offsetLeft;
+ pos[1] += parentNode.offsetTop;
+ parentNode = parentNode.offsetParent;
+ }
+ }
+ if (isSafari && this.getStyle(el, 'position') == 'absolute' ) { // safari doubles in some cases
+ pos[0] -= document.body.offsetLeft;
+ pos[1] -= document.body.offsetTop;
+ }
+ }
+
+ if (el.parentNode) { parentNode = el.parentNode; }
+ else { parentNode = null; }
+
+ while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML')
+ { // account for any scrolled ancestors
+ if (Y.Dom.getStyle(parentNode, 'display') != 'inline') { // work around opera inline scrollLeft/Top bug
+ pos[0] -= parentNode.scrollLeft;
+ pos[1] -= parentNode.scrollTop;
+ }
+
+ if (parentNode.parentNode) {
+ parentNode = parentNode.parentNode;
+ } else { parentNode = null; }
+ }
+
+
+ return pos;
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Gets the current X position of an element based on page coordinates. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method getX
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+ * @return {String | Array} The X position of the element(s)
+ */
+ getX: function(el) {
+ var f = function(el) {
+ return Y.Dom.getXY(el)[0];
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Gets the current Y position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method getY
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+ * @return {String | Array} The Y position of the element(s)
+ */
+ getY: function(el) {
+ var f = function(el) {
+ return Y.Dom.getXY(el)[1];
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Set the position of an html element in page coordinates, regardless of how the element is positioned.
+ * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method setXY
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+ * @param {Array} pos Contains X & Y values for new position (coordinates are page-based)
+ * @param {Boolean} noRetry By default we try and set the position a second time if the first fails
+ */
+ setXY: function(el, pos, noRetry) {
+ var f = function(el) {
+ var style_pos = this.getStyle(el, 'position');
+ if (style_pos == 'static') { // default to relative
+ this.setStyle(el, 'position', 'relative');
+ style_pos = 'relative';
+ }
+
+ var pageXY = this.getXY(el);
+ if (pageXY === false) { // has to be part of doc to have pageXY
+ return false;
+ }
+
+ var delta = [ // assuming pixels; if not we will have to retry
+ parseInt( this.getStyle(el, 'left'), 10 ),
+ parseInt( this.getStyle(el, 'top'), 10 )
+ ];
+
+ if ( isNaN(delta[0]) ) {// in case of 'auto'
+ delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
+ }
+ if ( isNaN(delta[1]) ) { // in case of 'auto'
+ delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
+ }
+
+ if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
+ if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
+
+ var newXY = this.getXY(el);
+
+ // if retry is true, try one more time if we miss
+ if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) {
+ this.setXY(el, pos, true);
+ }
+
+ };
+
+ Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Set the X position of an html element in page coordinates, regardless of how the element is positioned.
+ * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method setX
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @param {Int} x The value to use as the X coordinate for the element(s).
+ */
+ setX: function(el, x) {
+ Y.Dom.setXY(el, [x, null]);
+ },
+
+ /**
+ * Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
+ * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+ * @method setY
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @param {Int} x To use as the Y coordinate for the element(s).
+ */
+ setY: function(el, y) {
+ Y.Dom.setXY(el, [null, y]);
+ },
+
+ /**
+ * Returns the region position of the given element.
+ * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
+ * @method getRegion
+ * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+ * @return {Region | Array} A Region or array of Region instances containing "top, left, bottom, right" member data.
+ */
+ getRegion: function(el) {
+ var f = function(el) {
+ var region = new Y.Region.getRegion(el);
+ return region;
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Returns the width of the client (viewport).
+ * @method getClientWidth
+ * @deprecated Now using getViewportWidth. This interface left intact for back compat.
+ * @return {Int} The width of the viewable area of the page.
+ */
+ getClientWidth: function() {
+ return Y.Dom.getViewportWidth();
+ },
+
+ /**
+ * Returns the height of the client (viewport).
+ * @method getClientHeight
+ * @deprecated Now using getViewportHeight. This interface left intact for back compat.
+ * @return {Int} The height of the viewable area of the page.
+ */
+ getClientHeight: function() {
+ return Y.Dom.getViewportHeight();
+ },
+
+ /**
+ * Returns a array of HTMLElements with the given class.
+ * For optimized performance, include a tag and/or root node when possible.
+ * @method getElementsByClassName
+ * @param {String} className The class name to match against
+ * @param {String} tag (optional) The tag name of the elements being collected
+ * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
+ * @return {Array} An array of elements that have the given class name
+ */
+ getElementsByClassName: function(className, tag, root) {
+ var method = function(el) { return Y.Dom.hasClass(el, className); };
+ return Y.Dom.getElementsBy(method, tag, root);
+ },
+
+ /**
+ * Determines whether an HTMLElement has the given className.
+ * @method hasClass
+ * @param {String | HTMLElement | Array} el The element or collection to test
+ * @param {String} className the class name to search for
+ * @return {Boolean | Array} A boolean value or array of boolean values
+ */
+ hasClass: function(el, className) {
+ var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
+
+ var f = function(el) {
+ return re.test(el['className']);
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Adds a class name to a given element or collection of elements.
+ * @method addClass
+ * @param {String | HTMLElement | Array} el The element or collection to add the class to
+ * @param {String} className the class name to add to the class attribute
+ */
+ addClass: function(el, className) {
+ var f = function(el) {
+ if (this.hasClass(el, className)) { return; } // already present
+
+
+ el['className'] = [el['className'], className].join(' ');
+ };
+
+ Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Removes a class name from a given element or collection of elements.
+ * @method removeClass
+ * @param {String | HTMLElement | Array} el The element or collection to remove the class from
+ * @param {String} className the class name to remove from the class attribute
+ */
+ removeClass: function(el, className) {
+ var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');
+
+ var f = function(el) {
+ if (!this.hasClass(el, className)) { return; } // not present
+
+
+ var c = el['className'];
+ el['className'] = c.replace(re, ' ');
+ if ( this.hasClass(el, className) ) { // in case of multiple adjacent
+ this.removeClass(el, className);
+ }
+
+ };
+
+ Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Replace a class with another class for a given element or collection of elements.
+ * If no oldClassName is present, the newClassName is simply added.
+ * @method replaceClass
+ * @param {String | HTMLElement | Array} el The element or collection to remove the class from
+ * @param {String} oldClassName the class name to be replaced
+ * @param {String} newClassName the class name that will be replacing the old class name
+ */
+ replaceClass: function(el, oldClassName, newClassName) {
+ if (oldClassName === newClassName) { // avoid infinite loop
+ return false;
+ }
+
+ var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');
+
+ var f = function(el) {
+
+ if ( !this.hasClass(el, oldClassName) ) {
+ this.addClass(el, newClassName); // just add it if nothing to replace
+ return; // note return
+ }
+
+ el['className'] = el['className'].replace(re, ' ' + newClassName + ' ');
+
+ if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent
+ this.replaceClass(el, oldClassName, newClassName);
+ }
+ };
+
+ Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Generates a unique ID
+ * @method generateId
+ * @param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
+ * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
+ * @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
+ */
+ generateId: function(el, prefix) {
+ prefix = prefix || 'yui-gen';
+ el = el || {};
+
+ var f = function(el) {
+ if (el) {
+ el = Y.Dom.get(el);
+ } else {
+ el = {}; // just generating ID in this case
+ }
+
+ if (!el.id) {
+ el.id = prefix + id_counter++;
+ } // dont override existing
+
+
+ return el.id;
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
+ * @method isAncestor
+ * @param {String | HTMLElement} haystack The possible ancestor
+ * @param {String | HTMLElement} needle The possible descendent
+ * @return {Boolean} Whether or not the haystack is an ancestor of needle
+ */
+ isAncestor: function(haystack, needle) {
+ haystack = Y.Dom.get(haystack);
+ if (!haystack || !needle) { return false; }
+
+ var f = function(needle) {
+ if (haystack.contains && !isSafari) { // safari "contains" is broken
+ return haystack.contains(needle);
+ }
+ else if ( haystack.compareDocumentPosition ) {
+ return !!(haystack.compareDocumentPosition(needle) & 16);
+ }
+ else { // loop up and test each parent
+ var parent = needle.parentNode;
+
+ while (parent) {
+ if (parent == haystack) {
+ return true;
+ }
+ else if (!parent.tagName || parent.tagName.toUpperCase() == 'HTML') {
+ return false;
+ }
+
+ parent = parent.parentNode;
+ }
+ return false;
+ }
+ };
+
+ return Y.Dom.batch(needle, f, Y.Dom, true);
+ },
+
+ /**
+ * Determines whether an HTMLElement is present in the current document.
+ * @method inDocument
+ * @param {String | HTMLElement} el The element to search for
+ * @return {Boolean} Whether or not the element is present in the current document
+ */
+ inDocument: function(el) {
+ var f = function(el) {
+ return this.isAncestor(document.documentElement, el);
+ };
+
+ return Y.Dom.batch(el, f, Y.Dom, true);
+ },
+
+ /**
+ * Returns a array of HTMLElements that pass the test applied by supplied boolean method.
+ * For optimized performance, include a tag and/or root node when possible.
+ * @method getElementsBy
+ * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
+
+ * @param {String} tag (optional) The tag name of the elements being collected
+ * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
+ */
+ getElementsBy: function(method, tag, root) {
+ tag = tag || '*';
+ root = Y.Dom.get(root) || document;
+
+ var nodes = [];
+ var elements = root.getElementsByTagName(tag);
+
+ if ( !elements.length && (tag == '*' && root.all) ) {
+ elements = root.all; // IE < 6
+ }
+
+ for (var i = 0, len = elements.length; i < len; ++i) {
+ if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; }
+ }
+
+
+ return nodes;
+ },
+
+ /**
+ * Returns an array of elements that have had the supplied method applied.
+ * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
+ * @method batch
+ * @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to
+ * @param {Function} method The method to apply to the element(s)
+ * @param {Any} o (optional) An optional arg that is passed to the supplied method
+ * @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o"
+ * @return {HTMLElement | Array} The element(s) with the method applied
+ */
+ batch: function(el, method, o, override) {
+ var id = el;
+ el = Y.Dom.get(el);
+
+ var scope = (override) ? o : window;
+
+ if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection)
+ if (!el) {
+ return false;
+ }
+ return method.call(scope, el, o);
+ }
+
+ var collection = [];
+
+ for (var i = 0, len = el.length; i < len; ++i) {
+ if (!el[i]) {
+ id = el[i];
+ }
+ collection[collection.length] = method.call(scope, el[i], o);
+ }
+
+ return collection;
+ },
+
+ /**
+ * Returns the height of the document.
+ * @method getDocumentHeight
+ * @return {Int} The height of the actual document (which includes the body and its margin).
+ */
+ getDocumentHeight: function() {
+ var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight;
+
+ var h = Math.max(scrollHeight, Y.Dom.getViewportHeight());
+ return h;
+ },
+
+ /**
+ * Returns the width of the document.
+ * @method getDocumentWidth
+ * @return {Int} The width of the actual document (which includes the body and its margin).
+ */
+ getDocumentWidth: function() {
+ var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth;
+ var w = Math.max(scrollWidth, Y.Dom.getViewportWidth());
+ return w;
+ },
+
+ /**
+ * Returns the current height of the viewport.
+ * @method getViewportHeight
+ * @return {Int} The height of the viewable area of the page (excludes scrollbars).
+ */
+ getViewportHeight: function() {
+ var height = self.innerHeight; // Safari, Opera
+ var mode = document.compatMode;
+
+ if ( (mode || isIE) && !isOpera ) { // IE, Gecko
+ height = (mode == 'CSS1Compat') ?
+ document.documentElement.clientHeight : // Standards
+ document.body.clientHeight; // Quirks
+ }
+
+ return height;
+ },
+
+ /**
+ * Returns the current width of the viewport.
+ * @method getViewportWidth
+ * @return {Int} The width of the viewable area of the page (excludes scrollbars).
+ */
+
+ getViewportWidth: function() {
+ var width = self.innerWidth; // Safari
+ var mode = document.compatMode;
+
+ if (mode || isIE) { // IE, Gecko, Opera
+ width = (mode == 'CSS1Compat') ?
+ document.documentElement.clientWidth : // Standards
+ document.body.clientWidth; // Quirks
+ }
+ return width;
+ }
+ };
+})();
+/**
+ * A region is a representation of an object on a grid. It is defined
+ * by the top, right, bottom, left extents, so is rectangular by default. If
+ * other shapes are required, this class could be extended to support it.
+ * @namespace YAHOO.util
+ * @class Region
+ * @param {Int} t the top extent
+ * @param {Int} r the right extent
+ * @param {Int} b the bottom extent
+ * @param {Int} l the left extent
+ * @constructor
+ */
+YAHOO.util.Region = function(t, r, b, l) {
+
+ /**
+ * The region's top extent
+ * @property top
+ * @type Int
+ */
+ this.top = t;
+
+ /**
+ * The region's top extent as index, for symmetry with set/getXY
+ * @property 1
+ * @type Int
+ */
+ this[1] = t;
+
+ /**
+ * The region's right extent
+ * @property right
+ * @type int
+ */
+ this.right = r;
+
+ /**
+ * The region's bottom extent
+ * @property bottom
+ * @type Int
+ */
+ this.bottom = b;
+
+ /**
+ * The region's left extent
+ * @property left
+ * @type Int
+ */
+ this.left = l;
+
+ /**
+ * The region's left extent as index, for symmetry with set/getXY
+ * @property 0
+ * @type Int
+ */
+ this[0] = l;
+};
+
+/**
+ * Returns true if this region contains the region passed in
+ * @method contains
+ * @param {Region} region The region to evaluate
+ * @return {Boolean} True if the region is contained with this region,
+ * else false
+ */
+YAHOO.util.Region.prototype.contains = function(region) {
+ return ( region.left >= this.left &&
+ region.right <= this.right &&
+ region.top >= this.top &&
+ region.bottom <= this.bottom );
+
+};
+
+/**
+ * Returns the area of the region
+ * @method getArea
+ * @return {Int} the region's area
+ */
+YAHOO.util.Region.prototype.getArea = function() {
+ return ( (this.bottom - this.top) * (this.right - this.left) );
+};
+
+/**
+ * Returns the region where the passed in region overlaps with this one
+ * @method intersect
+ * @param {Region} region The region that intersects
+ * @return {Region} The overlap region, or null if there is no overlap
+ */
+YAHOO.util.Region.prototype.intersect = function(region) {
+ var t = Math.max( this.top, region.top );
+ var r = Math.min( this.right, region.right );
+ var b = Math.min( this.bottom, region.bottom );
+ var l = Math.max( this.left, region.left );
+
+ if (b >= t && r >= l) {
+ return new YAHOO.util.Region(t, r, b, l);
+ } else {
+ return null;
+ }
+};
+
+/**
+ * Returns the region representing the smallest region that can contain both
+ * the passed in region and this region.
+ * @method union
+ * @param {Region} region The region that to create the union with
+ * @return {Region} The union region
+ */
+YAHOO.util.Region.prototype.union = function(region) {
+ var t = Math.min( this.top, region.top );
+ var r = Math.max( this.right, region.right );
+ var b = Math.max( this.bottom, region.bottom );
+ var l = Math.min( this.left, region.left );
+
+ return new YAHOO.util.Region(t, r, b, l);
+};
+
+/**
+ * toString
+ * @method toString
+ * @return string the region properties
+ */
+YAHOO.util.Region.prototype.toString = function() {
+ return ( "Region {" +
+ "top: " + this.top +
+ ", right: " + this.right +
+ ", bottom: " + this.bottom +
+ ", left: " + this.left +
+ "}" );
+};
+
+/**
+ * Returns a region that is occupied by the DOM element
+ * @method getRegion
+ * @param {HTMLElement} el The element
+ * @return {Region} The region that the element occupies
+ * @static
+ */
+YAHOO.util.Region.getRegion = function(el) {
+ var p = YAHOO.util.Dom.getXY(el);
+
+ var t = p[1];
+ var r = p[0] + el.offsetWidth;
+ var b = p[1] + el.offsetHeight;
+ var l = p[0];
+
+ return new YAHOO.util.Region(t, r, b, l);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * A point is a region that is special in that it represents a single point on
+ * the grid.
+ * @namespace YAHOO.util
+ * @class Point
+ * @param {Int} x The X position of the point
+ * @param {Int} y The Y position of the point
+ * @constructor
+ * @extends YAHOO.util.Region
+ */
+YAHOO.util.Point = function(x, y) {
+ if (x instanceof Array) { // accept output from Dom.getXY
+ y = x[1];
+ x = x[0];
+ }
+
+ /**
+ * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)
+ * @property x
+ * @type Int
+ */
+
+ this.x = this.right = this.left = this[0] = x;
+
+ /**
+ * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)
+ * @property y
+ * @type Int
+ */
+ this.y = this.top = this.bottom = this[1] = y;
+};
+
+YAHOO.util.Point.prototype = new YAHOO.util.Region();
+
diff --git a/thirdpartyjs/yui/dragdrop/README b/thirdpartyjs/yui/dragdrop/README
index c76e65c..661feda 100644
--- a/thirdpartyjs/yui/dragdrop/README
+++ b/thirdpartyjs/yui/dragdrop/README
@@ -1,96 +1,96 @@
-Drag and Drop Release Notes
-
-0.12.0
-
- * The logic to determine if a drag should be initiated has been isolated
- to the clickValidator method. This method can be overridden to provide
- custom valdiation logic. For example, it is possible to specify hotspots
- of any dimension or shape. The provided example shows how to make only
- a circular region in the middle of the element initiate a drag.
-
- * Added a new drag and drop event: onInvalidDrop. This is executed when
- the dragged element in dropped in a location without a target. Previously
- this condition could only detected by implementing handlers for three
- other events.
-
- * Now accepts an element reference in lieu of an id. Ids will
- be generated if the element does not have one.
-
- * Fixed horizontal autoscroll when scrollTop is zero.
-
- * Added hasOuterHandles property to bypass the isOverTarget check in the
- mousedown validation routine. Fixes setOuterHandleElId.
-
-0.11.4
-
- * YAHOO.util.DragDropMgr.swapNode now handles adjacent nodes properly
-
- * Fixed missing variable declarations
-
-0.11.3
-
- * Fixed a JavaScript error that would be generated when trying to implement
- DDProxy using the default settings and a tiny element.
-
- * Fixed an error that resulted when constraints were applied to DragDrop
- instances.
-
-0.11.2
-
- * Drag and drop will no longer interfere with selecting text on elements
- that are not involved in drag and drop.
-
- * The shared drag and drop proxy element now resizes correctly when autoResize
- is enabled.
-
-0.11.1
-
- * Fixes an issue where the setXY cache could get out of sync if the element's
- offsetParent is changed during onDragDrop.
-
-0.11.0
-
- * The Dom.util.setXY calculation for the initial placement of the dragged
- element is cached during the drag, enhancing the drag performance.
-
- * DDProxy no longer enforces having a single proxy element for all instances.
- dragElId can be set in the config object in the constructor. If the
- element already exists it will use that element, otherwise a new one will
- be created with that id.
-
- * DDProxy->borderWidth has been removed. The value is calculated on the fly
- instead.
-
- * Added DragDrop->clearTicks and DragDrop->clearConstraints
-
- * All drag and drop constructors now have an additional, optional parameter
- call "config". It is an object that can contain properties for a
- number of configuration settings.
-
- * Drag and drop will not be disabled for elements that cannot have their
- location determined.
-
- * isLegalTarget won't return dd objects that are not targetable.
-
- * Added DragDrop->removeFromGroup.
-
- * Constraints are now applied properly when determining which drag and drop
- events should fire.
-
-
-0.10.0
-
- * Improved the performance when in intersect mode
-
- * It was possible for the drag and drop initialization to be skipped
- for very slow loading pages. This was fixed.
-
- * New methods to exclude regions within your drag and drop element:
- addInvalidHandleId(), addInvalidHandleClass()
-
- * Added an onAvailable handler that is executed after the initial state is set.
-
- * Drag and drop is more forgiving when the implementer attempts to create the
- instance prior to the element being in the document, but after the window
- load event has fired.
-
+Drag and Drop Release Notes
+
+0.12.0
+
+ * The logic to determine if a drag should be initiated has been isolated
+ to the clickValidator method. This method can be overridden to provide
+ custom valdiation logic. For example, it is possible to specify hotspots
+ of any dimension or shape. The provided example shows how to make only
+ a circular region in the middle of the element initiate a drag.
+
+ * Added a new drag and drop event: onInvalidDrop. This is executed when
+ the dragged element in dropped in a location without a target. Previously
+ this condition could only detected by implementing handlers for three
+ other events.
+
+ * Now accepts an element reference in lieu of an id. Ids will
+ be generated if the element does not have one.
+
+ * Fixed horizontal autoscroll when scrollTop is zero.
+
+ * Added hasOuterHandles property to bypass the isOverTarget check in the
+ mousedown validation routine. Fixes setOuterHandleElId.
+
+0.11.4
+
+ * YAHOO.util.DragDropMgr.swapNode now handles adjacent nodes properly
+
+ * Fixed missing variable declarations
+
+0.11.3
+
+ * Fixed a JavaScript error that would be generated when trying to implement
+ DDProxy using the default settings and a tiny element.
+
+ * Fixed an error that resulted when constraints were applied to DragDrop
+ instances.
+
+0.11.2
+
+ * Drag and drop will no longer interfere with selecting text on elements
+ that are not involved in drag and drop.
+
+ * The shared drag and drop proxy element now resizes correctly when autoResize
+ is enabled.
+
+0.11.1
+
+ * Fixes an issue where the setXY cache could get out of sync if the element's
+ offsetParent is changed during onDragDrop.
+
+0.11.0
+
+ * The Dom.util.setXY calculation for the initial placement of the dragged
+ element is cached during the drag, enhancing the drag performance.
+
+ * DDProxy no longer enforces having a single proxy element for all instances.
+ dragElId can be set in the config object in the constructor. If the
+ element already exists it will use that element, otherwise a new one will
+ be created with that id.
+
+ * DDProxy->borderWidth has been removed. The value is calculated on the fly
+ instead.
+
+ * Added DragDrop->clearTicks and DragDrop->clearConstraints
+
+ * All drag and drop constructors now have an additional, optional parameter
+ call "config". It is an object that can contain properties for a
+ number of configuration settings.
+
+ * Drag and drop will not be disabled for elements that cannot have their
+ location determined.
+
+ * isLegalTarget won't return dd objects that are not targetable.
+
+ * Added DragDrop->removeFromGroup.
+
+ * Constraints are now applied properly when determining which drag and drop
+ events should fire.
+
+
+0.10.0
+
+ * Improved the performance when in intersect mode
+
+ * It was possible for the drag and drop initialization to be skipped
+ for very slow loading pages. This was fixed.
+
+ * New methods to exclude regions within your drag and drop element:
+ addInvalidHandleId(), addInvalidHandleClass()
+
+ * Added an onAvailable handler that is executed after the initial state is set.
+
+ * Drag and drop is more forgiving when the implementer attempts to create the
+ instance prior to the element being in the document, but after the window
+ load event has fired.
+
diff --git a/thirdpartyjs/yui/dragdrop/dragdrop-debug.js b/thirdpartyjs/yui/dragdrop/dragdrop-debug.js
index e08f31d..9c290fb 100644
--- a/thirdpartyjs/yui/dragdrop/dragdrop-debug.js
+++ b/thirdpartyjs/yui/dragdrop/dragdrop-debug.js
@@ -1,3047 +1,3047 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-(function() {
-
-var Event=YAHOO.util.Event;
-var Dom=YAHOO.util.Dom;
-
-/**
- * Defines the interface and base operation of items that that can be
- * dragged or can be drop targets. It was designed to be extended, overriding
- * the event handlers for startDrag, onDrag, onDragOver, onDragOut.
- * Up to three html elements can be associated with a DragDrop instance:
- *
- * linked element: the element that is passed into the constructor.
- * This is the element which defines the boundaries for interaction with
- * other DragDrop objects.
- * handle element(s): The drag operation only occurs if the element that
- * was clicked matches a handle element. By default this is the linked
- * element, but there are times that you will want only a portion of the
- * linked element to initiate the drag operation, and the setHandleElId()
- * method provides a way to define this.
- * drag element: this represents an the element that would be moved along
- * with the cursor during a drag operation. By default, this is the linked
- * element itself as in {@link YAHOO.util.DD}. setDragElId() lets you define
- * a separate element that would be moved, as in {@link YAHOO.util.DDProxy}
- *
- *
- * This class should not be instantiated until the onload event to ensure that
- * the associated elements are available.
- * The following would define a DragDrop obj that would interact with any
- * other DragDrop obj in the "group1" group:
- *
- * dd = new YAHOO.util.DragDrop("div1", "group1");
- *
- * Since none of the event handlers have been implemented, nothing would
- * actually happen if you were to run the code above. Normally you would
- * override this class or one of the default implementations, but you can
- * also override the methods you want on an instance of the class...
- *
- * dd.onDragDrop = function(e, id) {
- * alert("dd was dropped on " + id);
- * }
- *
- * @namespace YAHOO.util
- * @class DragDrop
- * @constructor
- * @param {String} id of the element that is linked to this instance
- * @param {String} sGroup the group of related DragDrop objects
- * @param {object} config an object containing configurable attributes
- * Valid properties for DragDrop:
- * padding, isTarget, maintainOffset, primaryButtonOnly
- */
-YAHOO.util.DragDrop = function(id, sGroup, config) {
- if (id) {
- this.init(id, sGroup, config);
- }
-};
-
-YAHOO.util.DragDrop.prototype = {
-
- /**
- * The id of the element associated with this object. This is what we
- * refer to as the "linked element" because the size and position of
- * this element is used to determine when the drag and drop objects have
- * interacted.
- * @property id
- * @type String
- */
- id: null,
-
- /**
- * Configuration attributes passed into the constructor
- * @property config
- * @type object
- */
- config: null,
-
- /**
- * The id of the element that will be dragged. By default this is same
- * as the linked element , but could be changed to another element. Ex:
- * YAHOO.util.DDProxy
- * @property dragElId
- * @type String
- * @private
- */
- dragElId: null,
-
- /**
- * the id of the element that initiates the drag operation. By default
- * this is the linked element, but could be changed to be a child of this
- * element. This lets us do things like only starting the drag when the
- * header element within the linked html element is clicked.
- * @property handleElId
- * @type String
- * @private
- */
- handleElId: null,
-
- /**
- * An associative array of HTML tags that will be ignored if clicked.
- * @property invalidHandleTypes
- * @type {string: string}
- */
- invalidHandleTypes: null,
-
- /**
- * An associative array of ids for elements that will be ignored if clicked
- * @property invalidHandleIds
- * @type {string: string}
- */
- invalidHandleIds: null,
-
- /**
- * An indexted array of css class names for elements that will be ignored
- * if clicked.
- * @property invalidHandleClasses
- * @type string[]
- */
- invalidHandleClasses: null,
-
- /**
- * The linked element's absolute X position at the time the drag was
- * started
- * @property startPageX
- * @type int
- * @private
- */
- startPageX: 0,
-
- /**
- * The linked element's absolute X position at the time the drag was
- * started
- * @property startPageY
- * @type int
- * @private
- */
- startPageY: 0,
-
- /**
- * The group defines a logical collection of DragDrop objects that are
- * related. Instances only get events when interacting with other
- * DragDrop object in the same group. This lets us define multiple
- * groups using a single DragDrop subclass if we want.
- * @property groups
- * @type {string: string}
- */
- groups: null,
-
- /**
- * Individual drag/drop instances can be locked. This will prevent
- * onmousedown start drag.
- * @property locked
- * @type boolean
- * @private
- */
- locked: false,
-
- /**
- * Lock this instance
- * @method lock
- */
- lock: function() { this.locked = true; },
-
- /**
- * Unlock this instace
- * @method unlock
- */
- unlock: function() { this.locked = false; },
-
- /**
- * By default, all insances can be a drop target. This can be disabled by
- * setting isTarget to false.
- * @method isTarget
- * @type boolean
- */
- isTarget: true,
-
- /**
- * The padding configured for this drag and drop object for calculating
- * the drop zone intersection with this object.
- * @method padding
- * @type int[]
- */
- padding: null,
-
- /**
- * Cached reference to the linked element
- * @property _domRef
- * @private
- */
- _domRef: null,
-
- /**
- * Internal typeof flag
- * @property __ygDragDrop
- * @private
- */
- __ygDragDrop: true,
-
- /**
- * Set to true when horizontal contraints are applied
- * @property constrainX
- * @type boolean
- * @private
- */
- constrainX: false,
-
- /**
- * Set to true when vertical contraints are applied
- * @property constrainY
- * @type boolean
- * @private
- */
- constrainY: false,
-
- /**
- * The left constraint
- * @property minX
- * @type int
- * @private
- */
- minX: 0,
-
- /**
- * The right constraint
- * @property maxX
- * @type int
- * @private
- */
- maxX: 0,
-
- /**
- * The up constraint
- * @property minY
- * @type int
- * @type int
- * @private
- */
- minY: 0,
-
- /**
- * The down constraint
- * @property maxY
- * @type int
- * @private
- */
- maxY: 0,
-
- /**
- * Maintain offsets when we resetconstraints. Set to true when you want
- * the position of the element relative to its parent to stay the same
- * when the page changes
- *
- * @property maintainOffset
- * @type boolean
- */
- maintainOffset: false,
-
- /**
- * Array of pixel locations the element will snap to if we specified a
- * horizontal graduation/interval. This array is generated automatically
- * when you define a tick interval.
- * @property xTicks
- * @type int[]
- */
- xTicks: null,
-
- /**
- * Array of pixel locations the element will snap to if we specified a
- * vertical graduation/interval. This array is generated automatically
- * when you define a tick interval.
- * @property yTicks
- * @type int[]
- */
- yTicks: null,
-
- /**
- * By default the drag and drop instance will only respond to the primary
- * button click (left button for a right-handed mouse). Set to true to
- * allow drag and drop to start with any mouse click that is propogated
- * by the browser
- * @property primaryButtonOnly
- * @type boolean
- */
- primaryButtonOnly: true,
-
- /**
- * The availabe property is false until the linked dom element is accessible.
- * @property available
- * @type boolean
- */
- available: false,
-
- /**
- * By default, drags can only be initiated if the mousedown occurs in the
- * region the linked element is. This is done in part to work around a
- * bug in some browsers that mis-report the mousedown if the previous
- * mouseup happened outside of the window. This property is set to true
- * if outer handles are defined.
- *
- * @property hasOuterHandles
- * @type boolean
- * @default false
- */
- hasOuterHandles: false,
-
- /**
- * Code that executes immediately before the startDrag event
- * @method b4StartDrag
- * @private
- */
- b4StartDrag: function(x, y) { },
-
- /**
- * Abstract method called after a drag/drop object is clicked
- * and the drag or mousedown time thresholds have beeen met.
- * @method startDrag
- * @param {int} X click location
- * @param {int} Y click location
- */
- startDrag: function(x, y) { /* override this */ },
-
- /**
- * Code that executes immediately before the onDrag event
- * @method b4Drag
- * @private
- */
- b4Drag: function(e) { },
-
- /**
- * Abstract method called during the onMouseMove event while dragging an
- * object.
- * @method onDrag
- * @param {Event} e the mousemove event
- */
- onDrag: function(e) { /* override this */ },
-
- /**
- * Abstract method called when this element fist begins hovering over
- * another DragDrop obj
- * @method onDragEnter
- * @param {Event} e the mousemove event
- * @param {String|DragDrop[]} id In POINT mode, the element
- * id this is hovering over. In INTERSECT mode, an array of one or more
- * dragdrop items being hovered over.
- */
- onDragEnter: function(e, id) { /* override this */ },
-
- /**
- * Code that executes immediately before the onDragOver event
- * @method b4DragOver
- * @private
- */
- b4DragOver: function(e) { },
-
- /**
- * Abstract method called when this element is hovering over another
- * DragDrop obj
- * @method onDragOver
- * @param {Event} e the mousemove event
- * @param {String|DragDrop[]} id In POINT mode, the element
- * id this is hovering over. In INTERSECT mode, an array of dd items
- * being hovered over.
- */
- onDragOver: function(e, id) { /* override this */ },
-
- /**
- * Code that executes immediately before the onDragOut event
- * @method b4DragOut
- * @private
- */
- b4DragOut: function(e) { },
-
- /**
- * Abstract method called when we are no longer hovering over an element
- * @method onDragOut
- * @param {Event} e the mousemove event
- * @param {String|DragDrop[]} id In POINT mode, the element
- * id this was hovering over. In INTERSECT mode, an array of dd items
- * that the mouse is no longer over.
- */
- onDragOut: function(e, id) { /* override this */ },
-
- /**
- * Code that executes immediately before the onDragDrop event
- * @method b4DragDrop
- * @private
- */
- b4DragDrop: function(e) { },
-
- /**
- * Abstract method called when this item is dropped on another DragDrop
- * obj
- * @method onDragDrop
- * @param {Event} e the mouseup event
- * @param {String|DragDrop[]} id In POINT mode, the element
- * id this was dropped on. In INTERSECT mode, an array of dd items this
- * was dropped on.
- */
- onDragDrop: function(e, id) { /* override this */ },
-
- /**
- * Abstract method called when this item is dropped on an area with no
- * drop target
- * @method onInvalidDrop
- * @param {Event} e the mouseup event
- */
- onInvalidDrop: function(e) { /* override this */ },
-
- /**
- * Code that executes immediately before the endDrag event
- * @method b4EndDrag
- * @private
- */
- b4EndDrag: function(e) { },
-
- /**
- * Fired when we are done dragging the object
- * @method endDrag
- * @param {Event} e the mouseup event
- */
- endDrag: function(e) { /* override this */ },
-
- /**
- * Code executed immediately before the onMouseDown event
- * @method b4MouseDown
- * @param {Event} e the mousedown event
- * @private
- */
- b4MouseDown: function(e) { },
-
- /**
- * Event handler that fires when a drag/drop obj gets a mousedown
- * @method onMouseDown
- * @param {Event} e the mousedown event
- */
- onMouseDown: function(e) { /* override this */ },
-
- /**
- * Event handler that fires when a drag/drop obj gets a mouseup
- * @method onMouseUp
- * @param {Event} e the mouseup event
- */
- onMouseUp: function(e) { /* override this */ },
-
- /**
- * Override the onAvailable method to do what is needed after the initial
- * position was determined.
- * @method onAvailable
- */
- onAvailable: function () {
- this.logger.log("onAvailable (base)");
- },
-
- /**
- * Returns a reference to the linked element
- * @method getEl
- * @return {HTMLElement} the html element
- */
- getEl: function() {
- if (!this._domRef) {
- this._domRef = Dom.get(this.id);
- }
-
- return this._domRef;
- },
-
- /**
- * Returns a reference to the actual element to drag. By default this is
- * the same as the html element, but it can be assigned to another
- * element. An example of this can be found in YAHOO.util.DDProxy
- * @method getDragEl
- * @return {HTMLElement} the html element
- */
- getDragEl: function() {
- return Dom.get(this.dragElId);
- },
-
- /**
- * Sets up the DragDrop object. Must be called in the constructor of any
- * YAHOO.util.DragDrop subclass
- * @method init
- * @param id the id of the linked element
- * @param {String} sGroup the group of related items
- * @param {object} config configuration attributes
- */
- init: function(id, sGroup, config) {
- this.initTarget(id, sGroup, config);
- Event.on(this.id, "mousedown", this.handleMouseDown, this, true);
- // Event.on(this.id, "selectstart", Event.preventDefault);
- },
-
- /**
- * Initializes Targeting functionality only... the object does not
- * get a mousedown handler.
- * @method initTarget
- * @param id the id of the linked element
- * @param {String} sGroup the group of related items
- * @param {object} config configuration attributes
- */
- initTarget: function(id, sGroup, config) {
-
- // configuration attributes
- this.config = config || {};
-
- // create a local reference to the drag and drop manager
- this.DDM = YAHOO.util.DDM;
- // initialize the groups array
- this.groups = {};
-
- // assume that we have an element reference instead of an id if the
- // parameter is not a string
- if (typeof id !== "string") {
- YAHOO.log("id is not a string, assuming it is an HTMLElement");
- id = Dom.generateId(id);
- }
-
- // set the id
- this.id = id;
-
- // add to an interaction group
- this.addToGroup((sGroup) ? sGroup : "default");
-
- // We don't want to register this as the handle with the manager
- // so we just set the id rather than calling the setter.
- this.handleElId = id;
-
- Event.onAvailable(id, this.handleOnAvailable, this, true);
-
- // create a logger instance
- this.logger = (YAHOO.widget.LogWriter) ?
- new YAHOO.widget.LogWriter(this.toString()) : YAHOO;
-
- // the linked element is the element that gets dragged by default
- this.setDragElId(id);
-
- // by default, clicked anchors will not start drag operations.
- // @TODO what else should be here? Probably form fields.
- this.invalidHandleTypes = { A: "A" };
- this.invalidHandleIds = {};
- this.invalidHandleClasses = [];
-
- this.applyConfig();
- },
-
- /**
- * Applies the configuration parameters that were passed into the constructor.
- * This is supposed to happen at each level through the inheritance chain. So
- * a DDProxy implentation will execute apply config on DDProxy, DD, and
- * DragDrop in order to get all of the parameters that are available in
- * each object.
- * @method applyConfig
- */
- applyConfig: function() {
-
- // configurable properties:
- // padding, isTarget, maintainOffset, primaryButtonOnly
- this.padding = this.config.padding || [0, 0, 0, 0];
- this.isTarget = (this.config.isTarget !== false);
- this.maintainOffset = (this.config.maintainOffset);
- this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);
-
- },
-
- /**
- * Executed when the linked element is available
- * @method handleOnAvailable
- * @private
- */
- handleOnAvailable: function() {
- this.logger.log("handleOnAvailable");
- this.available = true;
- this.resetConstraints();
- this.onAvailable();
- },
-
- /**
- * Configures the padding for the target zone in px. Effectively expands
- * (or reduces) the virtual object size for targeting calculations.
- * Supports css-style shorthand; if only one parameter is passed, all sides
- * will have that padding, and if only two are passed, the top and bottom
- * will have the first param, the left and right the second.
- * @method setPadding
- * @param {int} iTop Top pad
- * @param {int} iRight Right pad
- * @param {int} iBot Bot pad
- * @param {int} iLeft Left pad
- */
- setPadding: function(iTop, iRight, iBot, iLeft) {
- // this.padding = [iLeft, iRight, iTop, iBot];
- if (!iRight && 0 !== iRight) {
- this.padding = [iTop, iTop, iTop, iTop];
- } else if (!iBot && 0 !== iBot) {
- this.padding = [iTop, iRight, iTop, iRight];
- } else {
- this.padding = [iTop, iRight, iBot, iLeft];
- }
- },
-
- /**
- * Stores the initial placement of the linked element.
- * @method setInitialPosition
- * @param {int} diffX the X offset, default 0
- * @param {int} diffY the Y offset, default 0
- */
- setInitPosition: function(diffX, diffY) {
- var el = this.getEl();
-
- if (!this.DDM.verifyEl(el)) {
- this.logger.log(this.id + " element is broken");
- return;
- }
-
- var dx = diffX || 0;
- var dy = diffY || 0;
-
- var p = Dom.getXY( el );
-
- this.initPageX = p[0] - dx;
- this.initPageY = p[1] - dy;
-
- this.lastPageX = p[0];
- this.lastPageY = p[1];
-
- this.logger.log(this.id + " inital position: " + this.initPageX +
- ", " + this.initPageY);
-
-
- this.setStartPosition(p);
- },
-
- /**
- * Sets the start position of the element. This is set when the obj
- * is initialized, the reset when a drag is started.
- * @method setStartPosition
- * @param pos current position (from previous lookup)
- * @private
- */
- setStartPosition: function(pos) {
- var p = pos || Dom.getXY( this.getEl() );
- this.deltaSetXY = null;
-
- this.startPageX = p[0];
- this.startPageY = p[1];
- },
-
- /**
- * Add this instance to a group of related drag/drop objects. All
- * instances belong to at least one group, and can belong to as many
- * groups as needed.
- * @method addToGroup
- * @param sGroup {string} the name of the group
- */
- addToGroup: function(sGroup) {
- this.groups[sGroup] = true;
- this.DDM.regDragDrop(this, sGroup);
- },
-
- /**
- * Remove's this instance from the supplied interaction group
- * @method removeFromGroup
- * @param {string} sGroup The group to drop
- */
- removeFromGroup: function(sGroup) {
- this.logger.log("Removing from group: " + sGroup);
- if (this.groups[sGroup]) {
- delete this.groups[sGroup];
- }
-
- this.DDM.removeDDFromGroup(this, sGroup);
- },
-
- /**
- * Allows you to specify that an element other than the linked element
- * will be moved with the cursor during a drag
- * @method setDragElId
- * @param id {string} the id of the element that will be used to initiate the drag
- */
- setDragElId: function(id) {
- this.dragElId = id;
- },
-
- /**
- * Allows you to specify a child of the linked element that should be
- * used to initiate the drag operation. An example of this would be if
- * you have a content div with text and links. Clicking anywhere in the
- * content area would normally start the drag operation. Use this method
- * to specify that an element inside of the content div is the element
- * that starts the drag operation.
- * @method setHandleElId
- * @param id {string} the id of the element that will be used to
- * initiate the drag.
- */
- setHandleElId: function(id) {
- if (typeof id !== "string") {
- YAHOO.log("id is not a string, assuming it is an HTMLElement");
- id = Dom.generateId(id);
- }
- this.handleElId = id;
- this.DDM.regHandle(this.id, id);
- },
-
- /**
- * Allows you to set an element outside of the linked element as a drag
- * handle
- * @method setOuterHandleElId
- * @param id the id of the element that will be used to initiate the drag
- */
- setOuterHandleElId: function(id) {
- if (typeof id !== "string") {
- YAHOO.log("id is not a string, assuming it is an HTMLElement");
- id = Dom.generateId(id);
- }
- this.logger.log("Adding outer handle event: " + id);
- Event.on(id, "mousedown",
- this.handleMouseDown, this, true);
- this.setHandleElId(id);
-
- this.hasOuterHandles = true;
- },
-
- /**
- * Remove all drag and drop hooks for this element
- * @method unreg
- */
- unreg: function() {
- this.logger.log("DragDrop obj cleanup " + this.id);
- Event.removeListener(this.id, "mousedown",
- this.handleMouseDown);
- this._domRef = null;
- this.DDM._remove(this);
- },
-
- /**
- * Returns true if this instance is locked, or the drag drop mgr is locked
- * (meaning that all drag/drop is disabled on the page.)
- * @method isLocked
- * @return {boolean} true if this obj or all drag/drop is locked, else
- * false
- */
- isLocked: function() {
- return (this.DDM.isLocked() || this.locked);
- },
-
- /**
- * Fired when this object is clicked
- * @method handleMouseDown
- * @param {Event} e
- * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)
- * @private
- */
- handleMouseDown: function(e, oDD) {
-
- var button = e.which || e.button;
- this.logger.log("button: " + button);
-
- if (this.primaryButtonOnly && button > 1) {
- this.logger.log("Mousedown was not produced by the primary button");
- return;
- }
-
- if (this.isLocked()) {
- this.logger.log("Drag and drop is disabled, aborting");
- return;
- }
-
- this.logger.log("mousedown " + this.id);
- this.DDM.refreshCache(this.groups);
- // var self = this;
- // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);
-
- // Only process the event if we really clicked within the linked
- // element. The reason we make this check is that in the case that
- // another element was moved between the clicked element and the
- // cursor in the time between the mousedown and mouseup events. When
- // this happens, the element gets the next mousedown event
- // regardless of where on the screen it happened.
- var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e));
- if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) {
- this.logger.log("Click was not over the element: " + this.id);
- } else {
- if (this.clickValidator(e)) {
-
- this.logger.log("click was a valid handle");
-
- // set the initial element position
- this.setStartPosition();
-
- this.logger.log("firing onMouseDown events");
-
- this.b4MouseDown(e);
- this.onMouseDown(e);
- this.DDM.handleMouseDown(e, this);
-
- this.DDM.stopEvent(e);
- } else {
-
-this.logger.log("clickValidator returned false, drag not initiated");
-
- }
- }
- },
-
- clickValidator: function(e) {
- var target = Event.getTarget(e);
- return ( this.isValidHandleChild(target) &&
- (this.id == this.handleElId ||
- this.DDM.handleWasClicked(target, this.id)) );
- },
-
- /**
- * Allows you to specify a tag name that should not start a drag operation
- * when clicked. This is designed to facilitate embedding links within a
- * drag handle that do something other than start the drag.
- * @method addInvalidHandleType
- * @param {string} tagName the type of element to exclude
- */
- addInvalidHandleType: function(tagName) {
- var type = tagName.toUpperCase();
- this.invalidHandleTypes[type] = type;
- },
-
- /**
- * Lets you to specify an element id for a child of a drag handle
- * that should not initiate a drag
- * @method addInvalidHandleId
- * @param {string} id the element id of the element you wish to ignore
- */
- addInvalidHandleId: function(id) {
- if (typeof id !== "string") {
- YAHOO.log("id is not a string, assuming it is an HTMLElement");
- id = Dom.generateId(id);
- }
- this.invalidHandleIds[id] = id;
- },
-
-
- /**
- * Lets you specify a css class of elements that will not initiate a drag
- * @method addInvalidHandleClass
- * @param {string} cssClass the class of the elements you wish to ignore
- */
- addInvalidHandleClass: function(cssClass) {
- this.invalidHandleClasses.push(cssClass);
- },
-
- /**
- * Unsets an excluded tag name set by addInvalidHandleType
- * @method removeInvalidHandleType
- * @param {string} tagName the type of element to unexclude
- */
- removeInvalidHandleType: function(tagName) {
- var type = tagName.toUpperCase();
- // this.invalidHandleTypes[type] = null;
- delete this.invalidHandleTypes[type];
- },
-
- /**
- * Unsets an invalid handle id
- * @method removeInvalidHandleId
- * @param {string} id the id of the element to re-enable
- */
- removeInvalidHandleId: function(id) {
- if (typeof id !== "string") {
- YAHOO.log("id is not a string, assuming it is an HTMLElement");
- id = Dom.generateId(id);
- }
- delete this.invalidHandleIds[id];
- },
-
- /**
- * Unsets an invalid css class
- * @method removeInvalidHandleClass
- * @param {string} cssClass the class of the element(s) you wish to
- * re-enable
- */
- removeInvalidHandleClass: function(cssClass) {
- for (var i=0, len=this.invalidHandleClasses.length; i= this.minX; i = i - iTickSize) {
- if (!tickMap[i]) {
- this.xTicks[this.xTicks.length] = i;
- tickMap[i] = true;
- }
- }
-
- for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
- if (!tickMap[i]) {
- this.xTicks[this.xTicks.length] = i;
- tickMap[i] = true;
- }
- }
-
- this.xTicks.sort(this.DDM.numericSort) ;
- this.logger.log("xTicks: " + this.xTicks.join());
- },
-
- /**
- * Create the array of vertical tick marks if an interval was specified in
- * setYConstraint().
- * @method setYTicks
- * @private
- */
- setYTicks: function(iStartY, iTickSize) {
- // this.logger.log("setYTicks: " + iStartY + ", " + iTickSize
- // + ", " + this.initPageY + ", " + this.minY + ", " + this.maxY );
- this.yTicks = [];
- this.yTickSize = iTickSize;
-
- var tickMap = {};
-
- for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
- if (!tickMap[i]) {
- this.yTicks[this.yTicks.length] = i;
- tickMap[i] = true;
- }
- }
-
- for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
- if (!tickMap[i]) {
- this.yTicks[this.yTicks.length] = i;
- tickMap[i] = true;
- }
- }
-
- this.yTicks.sort(this.DDM.numericSort) ;
- this.logger.log("yTicks: " + this.yTicks.join());
- },
-
- /**
- * By default, the element can be dragged any place on the screen. Use
- * this method to limit the horizontal travel of the element. Pass in
- * 0,0 for the parameters if you want to lock the drag to the y axis.
- * @method setXConstraint
- * @param {int} iLeft the number of pixels the element can move to the left
- * @param {int} iRight the number of pixels the element can move to the
- * right
- * @param {int} iTickSize optional parameter for specifying that the
- * element
- * should move iTickSize pixels at a time.
- */
- setXConstraint: function(iLeft, iRight, iTickSize) {
- this.leftConstraint = iLeft;
- this.rightConstraint = iRight;
-
- this.minX = this.initPageX - iLeft;
- this.maxX = this.initPageX + iRight;
- if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
-
- this.constrainX = true;
- this.logger.log("initPageX:" + this.initPageX + " minX:" + this.minX +
- " maxX:" + this.maxX);
- },
-
- /**
- * Clears any constraints applied to this instance. Also clears ticks
- * since they can't exist independent of a constraint at this time.
- * @method clearConstraints
- */
- clearConstraints: function() {
- this.logger.log("Clearing constraints");
- this.constrainX = false;
- this.constrainY = false;
- this.clearTicks();
- },
-
- /**
- * Clears any tick interval defined for this instance
- * @method clearTicks
- */
- clearTicks: function() {
- this.logger.log("Clearing ticks");
- this.xTicks = null;
- this.yTicks = null;
- this.xTickSize = 0;
- this.yTickSize = 0;
- },
-
- /**
- * By default, the element can be dragged any place on the screen. Set
- * this to limit the vertical travel of the element. Pass in 0,0 for the
- * parameters if you want to lock the drag to the x axis.
- * @method setYConstraint
- * @param {int} iUp the number of pixels the element can move up
- * @param {int} iDown the number of pixels the element can move down
- * @param {int} iTickSize optional parameter for specifying that the
- * element should move iTickSize pixels at a time.
- */
- setYConstraint: function(iUp, iDown, iTickSize) {
- this.logger.log("setYConstraint: " + iUp + "," + iDown + "," + iTickSize);
- this.topConstraint = iUp;
- this.bottomConstraint = iDown;
-
- this.minY = this.initPageY - iUp;
- this.maxY = this.initPageY + iDown;
- if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
-
- this.constrainY = true;
-
- this.logger.log("initPageY:" + this.initPageY + " minY:" + this.minY +
- " maxY:" + this.maxY);
- },
-
- /**
- * resetConstraints must be called if you manually reposition a dd element.
- * @method resetConstraints
- * @param {boolean} maintainOffset
- */
- resetConstraints: function() {
-
- this.logger.log("resetConstraints");
-
- // Maintain offsets if necessary
- if (this.initPageX || this.initPageX === 0) {
- this.logger.log("init pagexy: " + this.initPageX + ", " +
- this.initPageY);
- this.logger.log("last pagexy: " + this.lastPageX + ", " +
- this.lastPageY);
- // figure out how much this thing has moved
- var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
- var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
-
- this.setInitPosition(dx, dy);
-
- // This is the first time we have detected the element's position
- } else {
- this.setInitPosition();
- }
-
- if (this.constrainX) {
- this.setXConstraint( this.leftConstraint,
- this.rightConstraint,
- this.xTickSize );
- }
-
- if (this.constrainY) {
- this.setYConstraint( this.topConstraint,
- this.bottomConstraint,
- this.yTickSize );
- }
- },
-
- /**
- * Normally the drag element is moved pixel by pixel, but we can specify
- * that it move a number of pixels at a time. This method resolves the
- * location when we have it set up like this.
- * @method getTick
- * @param {int} val where we want to place the object
- * @param {int[]} tickArray sorted array of valid points
- * @return {int} the closest tick
- * @private
- */
- getTick: function(val, tickArray) {
-
- if (!tickArray) {
- // If tick interval is not defined, it is effectively 1 pixel,
- // so we return the value passed to us.
- return val;
- } else if (tickArray[0] >= val) {
- // The value is lower than the first tick, so we return the first
- // tick.
- return tickArray[0];
- } else {
- for (var i=0, len=tickArray.length; i= val) {
- var diff1 = val - tickArray[i];
- var diff2 = tickArray[next] - val;
- return (diff2 > diff1) ? tickArray[i] : tickArray[next];
- }
- }
-
- // The value is larger than the last tick, so we return the last
- // tick.
- return tickArray[tickArray.length - 1];
- }
- },
-
- /**
- * toString method
- * @method toString
- * @return {string} string representation of the dd obj
- */
- toString: function() {
- return ("DragDrop " + this.id);
- }
-
-};
-
-})();
-/**
- * The drag and drop utility provides a framework for building drag and drop
- * applications. In addition to enabling drag and drop for specific elements,
- * the drag and drop elements are tracked by the manager class, and the
- * interactions between the various elements are tracked during the drag and
- * the implementing code is notified about these important moments.
- * @module dragdrop
- * @title Drag and Drop
- * @requires yahoo,dom,event
- * @namespace YAHOO.util
- */
-
-// Only load the library once. Rewriting the manager class would orphan
-// existing drag and drop instances.
-if (!YAHOO.util.DragDropMgr) {
-
-/**
- * DragDropMgr is a singleton that tracks the element interaction for
- * all DragDrop items in the window. Generally, you will not call
- * this class directly, but it does have helper methods that could
- * be useful in your DragDrop implementations.
- * @class DragDropMgr
- * @static
- */
-YAHOO.util.DragDropMgr = function() {
-
- var Event = YAHOO.util.Event;
-
- return {
-
- /**
- * Two dimensional Array of registered DragDrop objects. The first
- * dimension is the DragDrop item group, the second the DragDrop
- * object.
- * @property ids
- * @type {string: string}
- * @private
- * @static
- */
- ids: {},
-
- /**
- * Array of element ids defined as drag handles. Used to determine
- * if the element that generated the mousedown event is actually the
- * handle and not the html element itself.
- * @property handleIds
- * @type {string: string}
- * @private
- * @static
- */
- handleIds: {},
-
- /**
- * the DragDrop object that is currently being dragged
- * @property dragCurrent
- * @type DragDrop
- * @private
- * @static
- **/
- dragCurrent: null,
-
- /**
- * the DragDrop object(s) that are being hovered over
- * @property dragOvers
- * @type Array
- * @private
- * @static
- */
- dragOvers: {},
-
- /**
- * the X distance between the cursor and the object being dragged
- * @property deltaX
- * @type int
- * @private
- * @static
- */
- deltaX: 0,
-
- /**
- * the Y distance between the cursor and the object being dragged
- * @property deltaY
- * @type int
- * @private
- * @static
- */
- deltaY: 0,
-
- /**
- * Flag to determine if we should prevent the default behavior of the
- * events we define. By default this is true, but this can be set to
- * false if you need the default behavior (not recommended)
- * @property preventDefault
- * @type boolean
- * @static
- */
- preventDefault: true,
-
- /**
- * Flag to determine if we should stop the propagation of the events
- * we generate. This is true by default but you may want to set it to
- * false if the html element contains other features that require the
- * mouse click.
- * @property stopPropagation
- * @type boolean
- * @static
- */
- stopPropagation: true,
-
- /**
- * Internal flag that is set to true when drag and drop has been
- * intialized
- * @property initialized
- * @private
- * @static
- */
- initalized: false,
-
- /**
- * All drag and drop can be disabled.
- * @property locked
- * @private
- * @static
- */
- locked: false,
-
- /**
- * Called the first time an element is registered.
- * @method init
- * @private
- * @static
- */
- init: function() {
- this.logger = new YAHOO.widget.LogWriter("DragDropMgr");
- this.initialized = true;
- },
-
- /**
- * In point mode, drag and drop interaction is defined by the
- * location of the cursor during the drag/drop
- * @property POINT
- * @type int
- * @static
- */
- POINT: 0,
-
- /**
- * In intersect mode, drag and drop interactio nis defined by the
- * overlap of two or more drag and drop objects.
- * @property INTERSECT
- * @type int
- * @static
- */
- INTERSECT: 1,
-
- /**
- * The current drag and drop mode. Default: POINT
- * @property mode
- * @type int
- * @static
- */
- mode: 0,
-
- /**
- * Runs method on all drag and drop objects
- * @method _execOnAll
- * @private
- * @static
- */
- _execOnAll: function(sMethod, args) {
- for (var i in this.ids) {
- for (var j in this.ids[i]) {
- var oDD = this.ids[i][j];
- if (! this.isTypeOfDD(oDD)) {
- continue;
- }
- oDD[sMethod].apply(oDD, args);
- }
- }
- },
-
- /**
- * Drag and drop initialization. Sets up the global event handlers
- * @method _onLoad
- * @private
- * @static
- */
- _onLoad: function() {
-
- this.init();
-
- this.logger.log("DDM onload");
-
- Event.on(document, "mouseup", this.handleMouseUp, this, true);
- Event.on(document, "mousemove", this.handleMouseMove, this, true);
- Event.on(window, "unload", this._onUnload, this, true);
- Event.on(window, "resize", this._onResize, this, true);
- // Event.on(window, "mouseout", this._test);
-
- },
-
- /**
- * Reset constraints on all drag and drop objs
- * @method _onResize
- * @private
- * @static
- */
- _onResize: function(e) {
- this.logger.log("window resize");
- this._execOnAll("resetConstraints", []);
- },
-
- /**
- * Lock all drag and drop functionality
- * @method lock
- * @static
- */
- lock: function() { this.locked = true; },
-
- /**
- * Unlock all drag and drop functionality
- * @method unlock
- * @static
- */
- unlock: function() { this.locked = false; },
-
- /**
- * Is drag and drop locked?
- * @method isLocked
- * @return {boolean} True if drag and drop is locked, false otherwise.
- * @static
- */
- isLocked: function() { return this.locked; },
-
- /**
- * Location cache that is set for all drag drop objects when a drag is
- * initiated, cleared when the drag is finished.
- * @property locationCache
- * @private
- * @static
- */
- locationCache: {},
-
- /**
- * Set useCache to false if you want to force object the lookup of each
- * drag and drop linked element constantly during a drag.
- * @property useCache
- * @type boolean
- * @static
- */
- useCache: true,
-
- /**
- * The number of pixels that the mouse needs to move after the
- * mousedown before the drag is initiated. Default=3;
- * @property clickPixelThresh
- * @type int
- * @static
- */
- clickPixelThresh: 3,
-
- /**
- * The number of milliseconds after the mousedown event to initiate the
- * drag if we don't get a mouseup event. Default=1000
- * @property clickTimeThresh
- * @type int
- * @static
- */
- clickTimeThresh: 1000,
-
- /**
- * Flag that indicates that either the drag pixel threshold or the
- * mousdown time threshold has been met
- * @property dragThreshMet
- * @type boolean
- * @private
- * @static
- */
- dragThreshMet: false,
-
- /**
- * Timeout used for the click time threshold
- * @property clickTimeout
- * @type Object
- * @private
- * @static
- */
- clickTimeout: null,
-
- /**
- * The X position of the mousedown event stored for later use when a
- * drag threshold is met.
- * @property startX
- * @type int
- * @private
- * @static
- */
- startX: 0,
-
- /**
- * The Y position of the mousedown event stored for later use when a
- * drag threshold is met.
- * @property startY
- * @type int
- * @private
- * @static
- */
- startY: 0,
-
- /**
- * Each DragDrop instance must be registered with the DragDropMgr.
- * This is executed in DragDrop.init()
- * @method regDragDrop
- * @param {DragDrop} oDD the DragDrop object to register
- * @param {String} sGroup the name of the group this element belongs to
- * @static
- */
- regDragDrop: function(oDD, sGroup) {
- if (!this.initialized) { this.init(); }
-
- if (!this.ids[sGroup]) {
- this.ids[sGroup] = {};
- }
- this.ids[sGroup][oDD.id] = oDD;
- },
-
- /**
- * Removes the supplied dd instance from the supplied group. Executed
- * by DragDrop.removeFromGroup, so don't call this function directly.
- * @method removeDDFromGroup
- * @private
- * @static
- */
- removeDDFromGroup: function(oDD, sGroup) {
- if (!this.ids[sGroup]) {
- this.ids[sGroup] = {};
- }
-
- var obj = this.ids[sGroup];
- if (obj && obj[oDD.id]) {
- delete obj[oDD.id];
- }
- },
-
- /**
- * Unregisters a drag and drop item. This is executed in
- * DragDrop.unreg, use that method instead of calling this directly.
- * @method _remove
- * @private
- * @static
- */
- _remove: function(oDD) {
- for (var g in oDD.groups) {
- if (g && this.ids[g][oDD.id]) {
- delete this.ids[g][oDD.id];
- //this.logger.log("NEW LEN " + this.ids.length, "warn");
- }
- }
- delete this.handleIds[oDD.id];
- },
-
- /**
- * Each DragDrop handle element must be registered. This is done
- * automatically when executing DragDrop.setHandleElId()
- * @method regHandle
- * @param {String} sDDId the DragDrop id this element is a handle for
- * @param {String} sHandleId the id of the element that is the drag
- * handle
- * @static
- */
- regHandle: function(sDDId, sHandleId) {
- if (!this.handleIds[sDDId]) {
- this.handleIds[sDDId] = {};
- }
- this.handleIds[sDDId][sHandleId] = sHandleId;
- },
-
- /**
- * Utility function to determine if a given element has been
- * registered as a drag drop item.
- * @method isDragDrop
- * @param {String} id the element id to check
- * @return {boolean} true if this element is a DragDrop item,
- * false otherwise
- * @static
- */
- isDragDrop: function(id) {
- return ( this.getDDById(id) ) ? true : false;
- },
-
- /**
- * Returns the drag and drop instances that are in all groups the
- * passed in instance belongs to.
- * @method getRelated
- * @param {DragDrop} p_oDD the obj to get related data for
- * @param {boolean} bTargetsOnly if true, only return targetable objs
- * @return {DragDrop[]} the related instances
- * @static
- */
- getRelated: function(p_oDD, bTargetsOnly) {
- var oDDs = [];
- for (var i in p_oDD.groups) {
- for (j in this.ids[i]) {
- var dd = this.ids[i][j];
- if (! this.isTypeOfDD(dd)) {
- continue;
- }
- if (!bTargetsOnly || dd.isTarget) {
- oDDs[oDDs.length] = dd;
- }
- }
- }
-
- return oDDs;
- },
-
- /**
- * Returns true if the specified dd target is a legal target for
- * the specifice drag obj
- * @method isLegalTarget
- * @param {DragDrop} the drag obj
- * @param {DragDrop} the target
- * @return {boolean} true if the target is a legal target for the
- * dd obj
- * @static
- */
- isLegalTarget: function (oDD, oTargetDD) {
- var targets = this.getRelated(oDD, true);
- for (var i=0, len=targets.length;i this.clickPixelThresh ||
- diffY > this.clickPixelThresh) {
- this.logger.log("pixel threshold met");
- this.startDrag(this.startX, this.startY);
- }
- }
-
- if (this.dragThreshMet) {
- this.dragCurrent.b4Drag(e);
- this.dragCurrent.onDrag(e);
- this.fireEvents(e, false);
- }
-
- this.stopEvent(e);
-
- return true;
- },
-
- /**
- * Iterates over all of the DragDrop elements to find ones we are
- * hovering over or dropping on
- * @method fireEvents
- * @param {Event} e the event
- * @param {boolean} isDrop is this a drop op or a mouseover op?
- * @private
- * @static
- */
- fireEvents: function(e, isDrop) {
- var dc = this.dragCurrent;
-
- // If the user did the mouse up outside of the window, we could
- // get here even though we have ended the drag.
- if (!dc || dc.isLocked()) {
- return;
- }
-
- var x = YAHOO.util.Event.getPageX(e);
- var y = YAHOO.util.Event.getPageY(e);
- var pt = new YAHOO.util.Point(x,y);
-
- // cache the previous dragOver array
- var oldOvers = [];
-
- var outEvts = [];
- var overEvts = [];
- var dropEvts = [];
- var enterEvts = [];
-
- // Check to see if the object(s) we were hovering over is no longer
- // being hovered over so we can fire the onDragOut event
- for (var i in this.dragOvers) {
-
- var ddo = this.dragOvers[i];
-
- if (! this.isTypeOfDD(ddo)) {
- continue;
- }
-
- if (! this.isOverTarget(pt, ddo, this.mode)) {
- outEvts.push( ddo );
- }
-
- oldOvers[i] = true;
- delete this.dragOvers[i];
- }
-
- for (var sGroup in dc.groups) {
- // this.logger.log("Processing group " + sGroup);
-
- if ("string" != typeof sGroup) {
- continue;
- }
-
- for (i in this.ids[sGroup]) {
- var oDD = this.ids[sGroup][i];
- if (! this.isTypeOfDD(oDD)) {
- continue;
- }
-
- if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {
- if (this.isOverTarget(pt, oDD, this.mode)) {
- // look for drop interactions
- if (isDrop) {
- dropEvts.push( oDD );
- // look for drag enter and drag over interactions
- } else {
-
- // initial drag over: dragEnter fires
- if (!oldOvers[oDD.id]) {
- enterEvts.push( oDD );
- // subsequent drag overs: dragOver fires
- } else {
- overEvts.push( oDD );
- }
-
- this.dragOvers[oDD.id] = oDD;
- }
- }
- }
- }
- }
-
- if (this.mode) {
- if (outEvts.length) {
- this.logger.log(dc.id+" onDragOut: " + outEvts);
- dc.b4DragOut(e, outEvts);
- dc.onDragOut(e, outEvts);
- }
-
- if (enterEvts.length) {
- this.logger.log(dc.id+" onDragEnter: " + enterEvts);
- dc.onDragEnter(e, enterEvts);
- }
-
- if (overEvts.length) {
- this.logger.log(dc.id+" onDragOver: " + overEvts);
- dc.b4DragOver(e, overEvts);
- dc.onDragOver(e, overEvts);
- }
-
- if (dropEvts.length) {
- this.logger.log(dc.id+" onDragDrop: " + dropEvts);
- dc.b4DragDrop(e, dropEvts);
- dc.onDragDrop(e, dropEvts);
- }
-
- } else {
- // fire dragout events
- var len = 0;
- for (i=0, len=outEvts.length; i
- * YAHOO.util.DragDropMgr.refreshCache(ddinstance.groups);
- *
- * Alternatively:
- *
- * YAHOO.util.DragDropMgr.refreshCache({group1:true, group2:true});
- *
- * @TODO this really should be an indexed array. Alternatively this
- * method could accept both.
- * @method refreshCache
- * @param {Object} groups an associative array of groups to refresh
- * @static
- */
- refreshCache: function(groups) {
- this.logger.log("refreshing element location cache");
- for (var sGroup in groups) {
- if ("string" != typeof sGroup) {
- continue;
- }
- for (var i in this.ids[sGroup]) {
- var oDD = this.ids[sGroup][i];
-
- if (this.isTypeOfDD(oDD)) {
- // if (this.isTypeOfDD(oDD) && oDD.isTarget) {
- var loc = this.getLocation(oDD);
- if (loc) {
- this.locationCache[oDD.id] = loc;
- } else {
- delete this.locationCache[oDD.id];
- this.logger.log("Could not get the loc for " + oDD.id,
- "warn");
- // this will unregister the drag and drop object if
- // the element is not in a usable state
- // oDD.unreg();
- }
- }
- }
- }
- },
-
- /**
- * This checks to make sure an element exists and is in the DOM. The
- * main purpose is to handle cases where innerHTML is used to remove
- * drag and drop objects from the DOM. IE provides an 'unspecified
- * error' when trying to access the offsetParent of such an element
- * @method verifyEl
- * @param {HTMLElement} el the element to check
- * @return {boolean} true if the element looks usable
- * @static
- */
- verifyEl: function(el) {
- try {
- if (el) {
- var parent = el.offsetParent;
- if (parent) {
- return true;
- }
- }
- } catch(e) {
- this.logger.log("detected problem with an element");
- }
-
- return false;
- },
-
- /**
- * Returns a Region object containing the drag and drop element's position
- * and size, including the padding configured for it
- * @method getLocation
- * @param {DragDrop} oDD the drag and drop object to get the
- * location for
- * @return {YAHOO.util.Region} a Region object representing the total area
- * the element occupies, including any padding
- * the instance is configured for.
- * @static
- */
- getLocation: function(oDD) {
- if (! this.isTypeOfDD(oDD)) {
- this.logger.log(oDD + " is not a DD obj");
- return null;
- }
-
- var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
-
- try {
- pos= YAHOO.util.Dom.getXY(el);
- } catch (e) { }
-
- if (!pos) {
- this.logger.log("getXY failed");
- return null;
- }
-
- x1 = pos[0];
- x2 = x1 + el.offsetWidth;
- y1 = pos[1];
- y2 = y1 + el.offsetHeight;
-
- t = y1 - oDD.padding[0];
- r = x2 + oDD.padding[1];
- b = y2 + oDD.padding[2];
- l = x1 - oDD.padding[3];
-
- return new YAHOO.util.Region( t, r, b, l );
- },
-
- /**
- * Checks the cursor location to see if it over the target
- * @method isOverTarget
- * @param {YAHOO.util.Point} pt The point to evaluate
- * @param {DragDrop} oTarget the DragDrop object we are inspecting
- * @return {boolean} true if the mouse is over the target
- * @private
- * @static
- */
- isOverTarget: function(pt, oTarget, intersect) {
- // use cache if available
- var loc = this.locationCache[oTarget.id];
- if (!loc || !this.useCache) {
- this.logger.log("cache not populated");
- loc = this.getLocation(oTarget);
- this.locationCache[oTarget.id] = loc;
-
- this.logger.log("cache: " + loc);
- }
-
- if (!loc) {
- this.logger.log("could not get the location of the element");
- return false;
- }
-
- //this.logger.log("loc: " + loc + ", pt: " + pt);
- oTarget.cursorIsOver = loc.contains( pt );
-
- // DragDrop is using this as a sanity check for the initial mousedown
- // in this case we are done. In POINT mode, if the drag obj has no
- // contraints, we are also done. Otherwise we need to evaluate the
- // location of the target as related to the actual location of the
- // dragged element.
- var dc = this.dragCurrent;
- if (!dc || !dc.getTargetCoord ||
- (!intersect && !dc.constrainX && !dc.constrainY)) {
- return oTarget.cursorIsOver;
- }
-
- oTarget.overlap = null;
-
- // Get the current location of the drag element, this is the
- // location of the mouse event less the delta that represents
- // where the original mousedown happened on the element. We
- // need to consider constraints and ticks as well.
- var pos = dc.getTargetCoord(pt.x, pt.y);
-
- var el = dc.getDragEl();
- var curRegion = new YAHOO.util.Region( pos.y,
- pos.x + el.offsetWidth,
- pos.y + el.offsetHeight,
- pos.x );
-
- var overlap = curRegion.intersect(loc);
-
- if (overlap) {
- oTarget.overlap = overlap;
- return (intersect) ? true : oTarget.cursorIsOver;
- } else {
- return false;
- }
- },
-
- /**
- * unload event handler
- * @method _onUnload
- * @private
- * @static
- */
- _onUnload: function(e, me) {
- this.unregAll();
- },
-
- /**
- * Cleans up the drag and drop events and objects.
- * @method unregAll
- * @private
- * @static
- */
- unregAll: function() {
- this.logger.log("unregister all");
-
- if (this.dragCurrent) {
- this.stopDrag();
- this.dragCurrent = null;
- }
-
- this._execOnAll("unreg", []);
-
- for (i in this.elementCache) {
- delete this.elementCache[i];
- }
-
- this.elementCache = {};
- this.ids = {};
- },
-
- /**
- * A cache of DOM elements
- * @property elementCache
- * @private
- * @static
- */
- elementCache: {},
-
- /**
- * Get the wrapper for the DOM element specified
- * @method getElWrapper
- * @param {String} id the id of the element to get
- * @return {YAHOO.util.DDM.ElementWrapper} the wrapped element
- * @private
- * @deprecated This wrapper isn't that useful
- * @static
- */
- getElWrapper: function(id) {
- var oWrapper = this.elementCache[id];
- if (!oWrapper || !oWrapper.el) {
- oWrapper = this.elementCache[id] =
- new this.ElementWrapper(YAHOO.util.Dom.get(id));
- }
- return oWrapper;
- },
-
- /**
- * Returns the actual DOM element
- * @method getElement
- * @param {String} id the id of the elment to get
- * @return {Object} The element
- * @deprecated use YAHOO.util.Dom.get instead
- * @static
- */
- getElement: function(id) {
- return YAHOO.util.Dom.get(id);
- },
-
- /**
- * Returns the style property for the DOM element (i.e.,
- * document.getElById(id).style)
- * @method getCss
- * @param {String} id the id of the elment to get
- * @return {Object} The style property of the element
- * @deprecated use YAHOO.util.Dom instead
- * @static
- */
- getCss: function(id) {
- var el = YAHOO.util.Dom.get(id);
- return (el) ? el.style : null;
- },
-
- /**
- * Inner class for cached elements
- * @class DragDropMgr.ElementWrapper
- * @for DragDropMgr
- * @private
- * @deprecated
- */
- ElementWrapper: function(el) {
- /**
- * The element
- * @property el
- */
- this.el = el || null;
- /**
- * The element id
- * @property id
- */
- this.id = this.el && el.id;
- /**
- * A reference to the style property
- * @property css
- */
- this.css = this.el && el.style;
- },
-
- /**
- * Returns the X position of an html element
- * @method getPosX
- * @param el the element for which to get the position
- * @return {int} the X coordinate
- * @for DragDropMgr
- * @deprecated use YAHOO.util.Dom.getX instead
- * @static
- */
- getPosX: function(el) {
- return YAHOO.util.Dom.getX(el);
- },
-
- /**
- * Returns the Y position of an html element
- * @method getPosY
- * @param el the element for which to get the position
- * @return {int} the Y coordinate
- * @deprecated use YAHOO.util.Dom.getY instead
- * @static
- */
- getPosY: function(el) {
- return YAHOO.util.Dom.getY(el);
- },
-
- /**
- * Swap two nodes. In IE, we use the native method, for others we
- * emulate the IE behavior
- * @method swapNode
- * @param n1 the first node to swap
- * @param n2 the other node to swap
- * @static
- */
- swapNode: function(n1, n2) {
- if (n1.swapNode) {
- n1.swapNode(n2);
- } else {
- var p = n2.parentNode;
- var s = n2.nextSibling;
-
- if (s == n1) {
- p.insertBefore(n1, n2);
- } else if (n2 == n1.nextSibling) {
- p.insertBefore(n2, n1);
- } else {
- n1.parentNode.replaceChild(n2, n1);
- p.insertBefore(n1, s);
- }
- }
- },
-
- /**
- * Returns the current scroll position
- * @method getScroll
- * @private
- * @static
- */
- getScroll: function () {
- var t, l, dde=document.documentElement, db=document.body;
- if (dde && (dde.scrollTop || dde.scrollLeft)) {
- t = dde.scrollTop;
- l = dde.scrollLeft;
- } else if (db) {
- t = db.scrollTop;
- l = db.scrollLeft;
- } else {
- YAHOO.log("could not get scroll property");
- }
- return { top: t, left: l };
- },
-
- /**
- * Returns the specified element style property
- * @method getStyle
- * @param {HTMLElement} el the element
- * @param {string} styleProp the style property
- * @return {string} The value of the style property
- * @deprecated use YAHOO.util.Dom.getStyle
- * @static
- */
- getStyle: function(el, styleProp) {
- return YAHOO.util.Dom.getStyle(el, styleProp);
- },
-
- /**
- * Gets the scrollTop
- * @method getScrollTop
- * @return {int} the document's scrollTop
- * @static
- */
- getScrollTop: function () { return this.getScroll().top; },
-
- /**
- * Gets the scrollLeft
- * @method getScrollLeft
- * @return {int} the document's scrollTop
- * @static
- */
- getScrollLeft: function () { return this.getScroll().left; },
-
- /**
- * Sets the x/y position of an element to the location of the
- * target element.
- * @method moveToEl
- * @param {HTMLElement} moveEl The element to move
- * @param {HTMLElement} targetEl The position reference element
- * @static
- */
- moveToEl: function (moveEl, targetEl) {
- var aCoord = YAHOO.util.Dom.getXY(targetEl);
- this.logger.log("moveToEl: " + aCoord);
- YAHOO.util.Dom.setXY(moveEl, aCoord);
- },
-
- /**
- * Gets the client height
- * @method getClientHeight
- * @return {int} client height in px
- * @deprecated use YAHOO.util.Dom.getViewportHeight instead
- * @static
- */
- getClientHeight: function() {
- return YAHOO.util.Dom.getViewportHeight();
- },
-
- /**
- * Gets the client width
- * @method getClientWidth
- * @return {int} client width in px
- * @deprecated use YAHOO.util.Dom.getViewportWidth instead
- * @static
- */
- getClientWidth: function() {
- return YAHOO.util.Dom.getViewportWidth();
- },
-
- /**
- * Numeric array sort function
- * @method numericSort
- * @static
- */
- numericSort: function(a, b) { return (a - b); },
-
- /**
- * Internal counter
- * @property _timeoutCount
- * @private
- * @static
- */
- _timeoutCount: 0,
-
- /**
- * Trying to make the load order less important. Without this we get
- * an error if this file is loaded before the Event Utility.
- * @method _addListeners
- * @private
- * @static
- */
- _addListeners: function() {
- var DDM = YAHOO.util.DDM;
- if ( YAHOO.util.Event && document ) {
- DDM._onLoad();
- } else {
- if (DDM._timeoutCount > 2000) {
- DDM.logger.log("DragDrop requires the Event Utility");
- } else {
- setTimeout(DDM._addListeners, 10);
- if (document && document.body) {
- DDM._timeoutCount += 1;
- }
- }
- }
- },
-
- /**
- * Recursively searches the immediate parent and all child nodes for
- * the handle element in order to determine wheter or not it was
- * clicked.
- * @method handleWasClicked
- * @param node the html element to inspect
- * @static
- */
- handleWasClicked: function(node, id) {
- if (this.isHandle(id, node.id)) {
- this.logger.log("clicked node is a handle");
- return true;
- } else {
- // check to see if this is a text node child of the one we want
- var p = node.parentNode;
- // this.logger.log("p: " + p);
-
- while (p) {
- if (this.isHandle(id, p.id)) {
- return true;
- } else {
- this.logger.log(p.id + " is not a handle");
- p = p.parentNode;
- }
- }
- }
-
- return false;
- }
-
- };
-
-}();
-
-// shorter alias, save a few bytes
-YAHOO.util.DDM = YAHOO.util.DragDropMgr;
-YAHOO.util.DDM._addListeners();
-
-}
-
-/**
- * A DragDrop implementation where the linked element follows the
- * mouse cursor during a drag.
- * @class DD
- * @extends YAHOO.util.DragDrop
- * @constructor
- * @param {String} id the id of the linked element
- * @param {String} sGroup the group of related DragDrop items
- * @param {object} config an object containing configurable attributes
- * Valid properties for DD:
- * scroll
- */
-YAHOO.util.DD = function(id, sGroup, config) {
- if (id) {
- this.init(id, sGroup, config);
- }
-};
-
-YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
-
- /**
- * When set to true, the utility automatically tries to scroll the browser
- * window wehn a drag and drop element is dragged near the viewport boundary.
- * Defaults to true.
- * @property scroll
- * @type boolean
- */
- scroll: true,
-
- /**
- * Sets the pointer offset to the distance between the linked element's top
- * left corner and the location the element was clicked
- * @method autoOffset
- * @param {int} iPageX the X coordinate of the click
- * @param {int} iPageY the Y coordinate of the click
- */
- autoOffset: function(iPageX, iPageY) {
- var x = iPageX - this.startPageX;
- var y = iPageY - this.startPageY;
- this.setDelta(x, y);
- // this.logger.log("autoOffset el pos: " + aCoord + ", delta: " + x + "," + y);
- },
-
- /**
- * Sets the pointer offset. You can call this directly to force the
- * offset to be in a particular location (e.g., pass in 0,0 to set it
- * to the center of the object, as done in YAHOO.widget.Slider)
- * @method setDelta
- * @param {int} iDeltaX the distance from the left
- * @param {int} iDeltaY the distance from the top
- */
- setDelta: function(iDeltaX, iDeltaY) {
- this.deltaX = iDeltaX;
- this.deltaY = iDeltaY;
- this.logger.log("deltaX:" + this.deltaX + ", deltaY:" + this.deltaY);
- },
-
- /**
- * Sets the drag element to the location of the mousedown or click event,
- * maintaining the cursor location relative to the location on the element
- * that was clicked. Override this if you want to place the element in a
- * location other than where the cursor is.
- * @method setDragElPos
- * @param {int} iPageX the X coordinate of the mousedown or drag event
- * @param {int} iPageY the Y coordinate of the mousedown or drag event
- */
- setDragElPos: function(iPageX, iPageY) {
- // the first time we do this, we are going to check to make sure
- // the element has css positioning
-
- var el = this.getDragEl();
- this.alignElWithMouse(el, iPageX, iPageY);
- },
-
- /**
- * Sets the element to the location of the mousedown or click event,
- * maintaining the cursor location relative to the location on the element
- * that was clicked. Override this if you want to place the element in a
- * location other than where the cursor is.
- * @method alignElWithMouse
- * @param {HTMLElement} el the element to move
- * @param {int} iPageX the X coordinate of the mousedown or drag event
- * @param {int} iPageY the Y coordinate of the mousedown or drag event
- */
- alignElWithMouse: function(el, iPageX, iPageY) {
- var oCoord = this.getTargetCoord(iPageX, iPageY);
- // this.logger.log("****alignElWithMouse : " + el.id + ", " + aCoord + ", " + el.style.display);
-
- if (!this.deltaSetXY) {
- var aCoord = [oCoord.x, oCoord.y];
- YAHOO.util.Dom.setXY(el, aCoord);
- var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );
- var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );
-
- this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
- } else {
- YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");
- YAHOO.util.Dom.setStyle(el, "top", (oCoord.y + this.deltaSetXY[1]) + "px");
- }
-
- this.cachePosition(oCoord.x, oCoord.y);
- this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
- },
-
- /**
- * Saves the most recent position so that we can reset the constraints and
- * tick marks on-demand. We need to know this so that we can calculate the
- * number of pixels the element is offset from its original position.
- * @method cachePosition
- * @param iPageX the current x position (optional, this just makes it so we
- * don't have to look it up again)
- * @param iPageY the current y position (optional, this just makes it so we
- * don't have to look it up again)
- */
- cachePosition: function(iPageX, iPageY) {
- if (iPageX) {
- this.lastPageX = iPageX;
- this.lastPageY = iPageY;
- } else {
- var aCoord = YAHOO.util.Dom.getXY(this.getEl());
- this.lastPageX = aCoord[0];
- this.lastPageY = aCoord[1];
- }
- },
-
- /**
- * Auto-scroll the window if the dragged object has been moved beyond the
- * visible window boundary.
- * @method autoScroll
- * @param {int} x the drag element's x position
- * @param {int} y the drag element's y position
- * @param {int} h the height of the drag element
- * @param {int} w the width of the drag element
- * @private
- */
- autoScroll: function(x, y, h, w) {
-
- if (this.scroll) {
- // The client height
- var clientH = this.DDM.getClientHeight();
-
- // The client width
- var clientW = this.DDM.getClientWidth();
-
- // The amt scrolled down
- var st = this.DDM.getScrollTop();
-
- // The amt scrolled right
- var sl = this.DDM.getScrollLeft();
-
- // Location of the bottom of the element
- var bot = h + y;
-
- // Location of the right of the element
- var right = w + x;
-
- // The distance from the cursor to the bottom of the visible area,
- // adjusted so that we don't scroll if the cursor is beyond the
- // element drag constraints
- var toBot = (clientH + st - y - this.deltaY);
-
- // The distance from the cursor to the right of the visible area
- var toRight = (clientW + sl - x - this.deltaX);
-
- // this.logger.log( " x: " + x + " y: " + y + " h: " + h +
- // " clientH: " + clientH + " clientW: " + clientW +
- // " st: " + st + " sl: " + sl + " bot: " + bot +
- // " right: " + right + " toBot: " + toBot + " toRight: " + toRight);
-
- // How close to the edge the cursor must be before we scroll
- // var thresh = (document.all) ? 100 : 40;
- var thresh = 40;
-
- // How many pixels to scroll per autoscroll op. This helps to reduce
- // clunky scrolling. IE is more sensitive about this ... it needs this
- // value to be higher.
- var scrAmt = (document.all) ? 80 : 30;
-
- // Scroll down if we are near the bottom of the visible page and the
- // obj extends below the crease
- if ( bot > clientH && toBot < thresh ) {
- window.scrollTo(sl, st + scrAmt);
- }
-
- // Scroll up if the window is scrolled down and the top of the object
- // goes above the top border
- if ( y < st && st > 0 && y - st < thresh ) {
- window.scrollTo(sl, st - scrAmt);
- }
-
- // Scroll right if the obj is beyond the right border and the cursor is
- // near the border.
- if ( right > clientW && toRight < thresh ) {
- window.scrollTo(sl + scrAmt, st);
- }
-
- // Scroll left if the window has been scrolled to the right and the obj
- // extends past the left border
- if ( x < sl && sl > 0 && x - sl < thresh ) {
- window.scrollTo(sl - scrAmt, st);
- }
- }
- },
-
- /**
- * Finds the location the element should be placed if we want to move
- * it to where the mouse location less the click offset would place us.
- * @method getTargetCoord
- * @param {int} iPageX the X coordinate of the click
- * @param {int} iPageY the Y coordinate of the click
- * @return an object that contains the coordinates (Object.x and Object.y)
- * @private
- */
- getTargetCoord: function(iPageX, iPageY) {
-
- // this.logger.log("getTargetCoord: " + iPageX + ", " + iPageY);
-
- var x = iPageX - this.deltaX;
- var y = iPageY - this.deltaY;
-
- if (this.constrainX) {
- if (x < this.minX) { x = this.minX; }
- if (x > this.maxX) { x = this.maxX; }
- }
-
- if (this.constrainY) {
- if (y < this.minY) { y = this.minY; }
- if (y > this.maxY) { y = this.maxY; }
- }
-
- x = this.getTick(x, this.xTicks);
- y = this.getTick(y, this.yTicks);
-
- // this.logger.log("getTargetCoord " +
- // " iPageX: " + iPageX +
- // " iPageY: " + iPageY +
- // " x: " + x + ", y: " + y);
-
- return {x:x, y:y};
- },
-
- /*
- * Sets up config options specific to this class. Overrides
- * YAHOO.util.DragDrop, but all versions of this method through the
- * inheritance chain are called
- */
- applyConfig: function() {
- YAHOO.util.DD.superclass.applyConfig.call(this);
- this.scroll = (this.config.scroll !== false);
- },
-
- /*
- * Event that fires prior to the onMouseDown event. Overrides
- * YAHOO.util.DragDrop.
- */
- b4MouseDown: function(e) {
- // this.resetConstraints();
- this.autoOffset(YAHOO.util.Event.getPageX(e),
- YAHOO.util.Event.getPageY(e));
- },
-
- /*
- * Event that fires prior to the onDrag event. Overrides
- * YAHOO.util.DragDrop.
- */
- b4Drag: function(e) {
- this.setDragElPos(YAHOO.util.Event.getPageX(e),
- YAHOO.util.Event.getPageY(e));
- },
-
- toString: function() {
- return ("DD " + this.id);
- }
-
- //////////////////////////////////////////////////////////////////////////
- // Debugging ygDragDrop events that can be overridden
- //////////////////////////////////////////////////////////////////////////
- /*
- startDrag: function(x, y) {
- this.logger.log(this.id.toString() + " startDrag");
- },
-
- onDrag: function(e) {
- this.logger.log(this.id.toString() + " onDrag");
- },
-
- onDragEnter: function(e, id) {
- this.logger.log(this.id.toString() + " onDragEnter: " + id);
- },
-
- onDragOver: function(e, id) {
- this.logger.log(this.id.toString() + " onDragOver: " + id);
- },
-
- onDragOut: function(e, id) {
- this.logger.log(this.id.toString() + " onDragOut: " + id);
- },
-
- onDragDrop: function(e, id) {
- this.logger.log(this.id.toString() + " onDragDrop: " + id);
- },
-
- endDrag: function(e) {
- this.logger.log(this.id.toString() + " endDrag");
- }
-
- */
-
-});
-/**
- * A DragDrop implementation that inserts an empty, bordered div into
- * the document that follows the cursor during drag operations. At the time of
- * the click, the frame div is resized to the dimensions of the linked html
- * element, and moved to the exact location of the linked element.
- *
- * References to the "frame" element refer to the single proxy element that
- * was created to be dragged in place of all DDProxy elements on the
- * page.
- *
- * @class DDProxy
- * @extends YAHOO.util.DD
- * @constructor
- * @param {String} id the id of the linked html element
- * @param {String} sGroup the group of related DragDrop objects
- * @param {object} config an object containing configurable attributes
- * Valid properties for DDProxy in addition to those in DragDrop:
- * resizeFrame, centerFrame, dragElId
- */
-YAHOO.util.DDProxy = function(id, sGroup, config) {
- if (id) {
- this.init(id, sGroup, config);
- this.initFrame();
- }
-};
-
-/**
- * The default drag frame div id
- * @property YAHOO.util.DDProxy.dragElId
- * @type String
- * @static
- */
-YAHOO.util.DDProxy.dragElId = "ygddfdiv";
-
-YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
-
- /**
- * By default we resize the drag frame to be the same size as the element
- * we want to drag (this is to get the frame effect). We can turn it off
- * if we want a different behavior.
- * @property resizeFrame
- * @type boolean
- */
- resizeFrame: true,
-
- /**
- * By default the frame is positioned exactly where the drag element is, so
- * we use the cursor offset provided by YAHOO.util.DD. Another option that works only if
- * you do not have constraints on the obj is to have the drag frame centered
- * around the cursor. Set centerFrame to true for this effect.
- * @property centerFrame
- * @type boolean
- */
- centerFrame: false,
-
- /**
- * Creates the proxy element if it does not yet exist
- * @method createFrame
- */
- createFrame: function() {
- var self = this;
- var body = document.body;
-
- if (!body || !body.firstChild) {
- setTimeout( function() { self.createFrame(); }, 50 );
- return;
- }
-
- var div = this.getDragEl();
-
- if (!div) {
- div = document.createElement("div");
- div.id = this.dragElId;
- var s = div.style;
-
- s.position = "absolute";
- s.visibility = "hidden";
- s.cursor = "move";
- s.border = "2px solid #aaa";
- s.zIndex = 999;
-
- // appendChild can blow up IE if invoked prior to the window load event
- // while rendering a table. It is possible there are other scenarios
- // that would cause this to happen as well.
- body.insertBefore(div, body.firstChild);
- }
- },
-
- /**
- * Initialization for the drag frame element. Must be called in the
- * constructor of all subclasses
- * @method initFrame
- */
- initFrame: function() {
- this.createFrame();
- },
-
- applyConfig: function() {
- this.logger.log("DDProxy applyConfig");
- YAHOO.util.DDProxy.superclass.applyConfig.call(this);
-
- this.resizeFrame = (this.config.resizeFrame !== false);
- this.centerFrame = (this.config.centerFrame);
- this.setDragElId(this.config.dragElId || YAHOO.util.DDProxy.dragElId);
- },
-
- /**
- * Resizes the drag frame to the dimensions of the clicked object, positions
- * it over the object, and finally displays it
- * @method showFrame
- * @param {int} iPageX X click position
- * @param {int} iPageY Y click position
- * @private
- */
- showFrame: function(iPageX, iPageY) {
- var el = this.getEl();
- var dragEl = this.getDragEl();
- var s = dragEl.style;
-
- this._resizeProxy();
-
- if (this.centerFrame) {
- this.setDelta( Math.round(parseInt(s.width, 10)/2),
- Math.round(parseInt(s.height, 10)/2) );
- }
-
- this.setDragElPos(iPageX, iPageY);
-
- YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible");
- },
-
- /**
- * The proxy is automatically resized to the dimensions of the linked
- * element when a drag is initiated, unless resizeFrame is set to false
- * @method _resizeProxy
- * @private
- */
- _resizeProxy: function() {
- if (this.resizeFrame) {
- var DOM = YAHOO.util.Dom;
- var el = this.getEl();
- var dragEl = this.getDragEl();
-
- var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth" ), 10);
- var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth" ), 10);
- var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10);
- var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth" ), 10);
-
- if (isNaN(bt)) { bt = 0; }
- if (isNaN(br)) { br = 0; }
- if (isNaN(bb)) { bb = 0; }
- if (isNaN(bl)) { bl = 0; }
-
- this.logger.log("proxy size: " + bt + " " + br + " " + bb + " " + bl);
-
- var newWidth = Math.max(0, el.offsetWidth - br - bl);
- var newHeight = Math.max(0, el.offsetHeight - bt - bb);
-
- this.logger.log("Resizing proxy element");
-
- DOM.setStyle( dragEl, "width", newWidth + "px" );
- DOM.setStyle( dragEl, "height", newHeight + "px" );
- }
- },
-
- // overrides YAHOO.util.DragDrop
- b4MouseDown: function(e) {
- var x = YAHOO.util.Event.getPageX(e);
- var y = YAHOO.util.Event.getPageY(e);
- this.autoOffset(x, y);
- this.setDragElPos(x, y);
- },
-
- // overrides YAHOO.util.DragDrop
- b4StartDrag: function(x, y) {
- // show the drag frame
- this.logger.log("start drag show frame, x: " + x + ", y: " + y);
- this.showFrame(x, y);
- },
-
- // overrides YAHOO.util.DragDrop
- b4EndDrag: function(e) {
- this.logger.log(this.id + " b4EndDrag");
- YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden");
- },
-
- // overrides YAHOO.util.DragDrop
- // By default we try to move the element to the last location of the frame.
- // This is so that the default behavior mirrors that of YAHOO.util.DD.
- endDrag: function(e) {
- var DOM = YAHOO.util.Dom;
- this.logger.log(this.id + " endDrag");
- var lel = this.getEl();
- var del = this.getDragEl();
-
- // Show the drag frame briefly so we can get its position
- // del.style.visibility = "";
- DOM.setStyle(del, "visibility", "");
-
- // Hide the linked element before the move to get around a Safari
- // rendering bug.
- //lel.style.visibility = "hidden";
- DOM.setStyle(lel, "visibility", "hidden");
- YAHOO.util.DDM.moveToEl(lel, del);
- //del.style.visibility = "hidden";
- DOM.setStyle(del, "visibility", "hidden");
- //lel.style.visibility = "";
- DOM.setStyle(lel, "visibility", "");
- },
-
- toString: function() {
- return ("DDProxy " + this.id);
- }
-
-});
-/**
- * A DragDrop implementation that does not move, but can be a drop
- * target. You would get the same result by simply omitting implementation
- * for the event callbacks, but this way we reduce the processing cost of the
- * event listener and the callbacks.
- * @class DDTarget
- * @extends YAHOO.util.DragDrop
- * @constructor
- * @param {String} id the id of the element that is a drop target
- * @param {String} sGroup the group of related DragDrop objects
- * @param {object} config an object containing configurable attributes
- * Valid properties for DDTarget in addition to those in
- * DragDrop:
- * none
- */
-YAHOO.util.DDTarget = function(id, sGroup, config) {
- if (id) {
- this.initTarget(id, sGroup, config);
- }
-};
-
-// YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop();
-YAHOO.extend(YAHOO.util.DDTarget, YAHOO.util.DragDrop, {
- toString: function() {
- return ("DDTarget " + this.id);
- }
-});
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+(function() {
+
+var Event=YAHOO.util.Event;
+var Dom=YAHOO.util.Dom;
+
+/**
+ * Defines the interface and base operation of items that that can be
+ * dragged or can be drop targets. It was designed to be extended, overriding
+ * the event handlers for startDrag, onDrag, onDragOver, onDragOut.
+ * Up to three html elements can be associated with a DragDrop instance:
+ *
+ * linked element: the element that is passed into the constructor.
+ * This is the element which defines the boundaries for interaction with
+ * other DragDrop objects.
+ * handle element(s): The drag operation only occurs if the element that
+ * was clicked matches a handle element. By default this is the linked
+ * element, but there are times that you will want only a portion of the
+ * linked element to initiate the drag operation, and the setHandleElId()
+ * method provides a way to define this.
+ * drag element: this represents an the element that would be moved along
+ * with the cursor during a drag operation. By default, this is the linked
+ * element itself as in {@link YAHOO.util.DD}. setDragElId() lets you define
+ * a separate element that would be moved, as in {@link YAHOO.util.DDProxy}
+ *
+ *
+ * This class should not be instantiated until the onload event to ensure that
+ * the associated elements are available.
+ * The following would define a DragDrop obj that would interact with any
+ * other DragDrop obj in the "group1" group:
+ *
+ * dd = new YAHOO.util.DragDrop("div1", "group1");
+ *
+ * Since none of the event handlers have been implemented, nothing would
+ * actually happen if you were to run the code above. Normally you would
+ * override this class or one of the default implementations, but you can
+ * also override the methods you want on an instance of the class...
+ *
+ * dd.onDragDrop = function(e, id) {
+ * alert("dd was dropped on " + id);
+ * }
+ *
+ * @namespace YAHOO.util
+ * @class DragDrop
+ * @constructor
+ * @param {String} id of the element that is linked to this instance
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ * Valid properties for DragDrop:
+ * padding, isTarget, maintainOffset, primaryButtonOnly
+ */
+YAHOO.util.DragDrop = function(id, sGroup, config) {
+ if (id) {
+ this.init(id, sGroup, config);
+ }
+};
+
+YAHOO.util.DragDrop.prototype = {
+
+ /**
+ * The id of the element associated with this object. This is what we
+ * refer to as the "linked element" because the size and position of
+ * this element is used to determine when the drag and drop objects have
+ * interacted.
+ * @property id
+ * @type String
+ */
+ id: null,
+
+ /**
+ * Configuration attributes passed into the constructor
+ * @property config
+ * @type object
+ */
+ config: null,
+
+ /**
+ * The id of the element that will be dragged. By default this is same
+ * as the linked element , but could be changed to another element. Ex:
+ * YAHOO.util.DDProxy
+ * @property dragElId
+ * @type String
+ * @private
+ */
+ dragElId: null,
+
+ /**
+ * the id of the element that initiates the drag operation. By default
+ * this is the linked element, but could be changed to be a child of this
+ * element. This lets us do things like only starting the drag when the
+ * header element within the linked html element is clicked.
+ * @property handleElId
+ * @type String
+ * @private
+ */
+ handleElId: null,
+
+ /**
+ * An associative array of HTML tags that will be ignored if clicked.
+ * @property invalidHandleTypes
+ * @type {string: string}
+ */
+ invalidHandleTypes: null,
+
+ /**
+ * An associative array of ids for elements that will be ignored if clicked
+ * @property invalidHandleIds
+ * @type {string: string}
+ */
+ invalidHandleIds: null,
+
+ /**
+ * An indexted array of css class names for elements that will be ignored
+ * if clicked.
+ * @property invalidHandleClasses
+ * @type string[]
+ */
+ invalidHandleClasses: null,
+
+ /**
+ * The linked element's absolute X position at the time the drag was
+ * started
+ * @property startPageX
+ * @type int
+ * @private
+ */
+ startPageX: 0,
+
+ /**
+ * The linked element's absolute X position at the time the drag was
+ * started
+ * @property startPageY
+ * @type int
+ * @private
+ */
+ startPageY: 0,
+
+ /**
+ * The group defines a logical collection of DragDrop objects that are
+ * related. Instances only get events when interacting with other
+ * DragDrop object in the same group. This lets us define multiple
+ * groups using a single DragDrop subclass if we want.
+ * @property groups
+ * @type {string: string}
+ */
+ groups: null,
+
+ /**
+ * Individual drag/drop instances can be locked. This will prevent
+ * onmousedown start drag.
+ * @property locked
+ * @type boolean
+ * @private
+ */
+ locked: false,
+
+ /**
+ * Lock this instance
+ * @method lock
+ */
+ lock: function() { this.locked = true; },
+
+ /**
+ * Unlock this instace
+ * @method unlock
+ */
+ unlock: function() { this.locked = false; },
+
+ /**
+ * By default, all insances can be a drop target. This can be disabled by
+ * setting isTarget to false.
+ * @method isTarget
+ * @type boolean
+ */
+ isTarget: true,
+
+ /**
+ * The padding configured for this drag and drop object for calculating
+ * the drop zone intersection with this object.
+ * @method padding
+ * @type int[]
+ */
+ padding: null,
+
+ /**
+ * Cached reference to the linked element
+ * @property _domRef
+ * @private
+ */
+ _domRef: null,
+
+ /**
+ * Internal typeof flag
+ * @property __ygDragDrop
+ * @private
+ */
+ __ygDragDrop: true,
+
+ /**
+ * Set to true when horizontal contraints are applied
+ * @property constrainX
+ * @type boolean
+ * @private
+ */
+ constrainX: false,
+
+ /**
+ * Set to true when vertical contraints are applied
+ * @property constrainY
+ * @type boolean
+ * @private
+ */
+ constrainY: false,
+
+ /**
+ * The left constraint
+ * @property minX
+ * @type int
+ * @private
+ */
+ minX: 0,
+
+ /**
+ * The right constraint
+ * @property maxX
+ * @type int
+ * @private
+ */
+ maxX: 0,
+
+ /**
+ * The up constraint
+ * @property minY
+ * @type int
+ * @type int
+ * @private
+ */
+ minY: 0,
+
+ /**
+ * The down constraint
+ * @property maxY
+ * @type int
+ * @private
+ */
+ maxY: 0,
+
+ /**
+ * Maintain offsets when we resetconstraints. Set to true when you want
+ * the position of the element relative to its parent to stay the same
+ * when the page changes
+ *
+ * @property maintainOffset
+ * @type boolean
+ */
+ maintainOffset: false,
+
+ /**
+ * Array of pixel locations the element will snap to if we specified a
+ * horizontal graduation/interval. This array is generated automatically
+ * when you define a tick interval.
+ * @property xTicks
+ * @type int[]
+ */
+ xTicks: null,
+
+ /**
+ * Array of pixel locations the element will snap to if we specified a
+ * vertical graduation/interval. This array is generated automatically
+ * when you define a tick interval.
+ * @property yTicks
+ * @type int[]
+ */
+ yTicks: null,
+
+ /**
+ * By default the drag and drop instance will only respond to the primary
+ * button click (left button for a right-handed mouse). Set to true to
+ * allow drag and drop to start with any mouse click that is propogated
+ * by the browser
+ * @property primaryButtonOnly
+ * @type boolean
+ */
+ primaryButtonOnly: true,
+
+ /**
+ * The availabe property is false until the linked dom element is accessible.
+ * @property available
+ * @type boolean
+ */
+ available: false,
+
+ /**
+ * By default, drags can only be initiated if the mousedown occurs in the
+ * region the linked element is. This is done in part to work around a
+ * bug in some browsers that mis-report the mousedown if the previous
+ * mouseup happened outside of the window. This property is set to true
+ * if outer handles are defined.
+ *
+ * @property hasOuterHandles
+ * @type boolean
+ * @default false
+ */
+ hasOuterHandles: false,
+
+ /**
+ * Code that executes immediately before the startDrag event
+ * @method b4StartDrag
+ * @private
+ */
+ b4StartDrag: function(x, y) { },
+
+ /**
+ * Abstract method called after a drag/drop object is clicked
+ * and the drag or mousedown time thresholds have beeen met.
+ * @method startDrag
+ * @param {int} X click location
+ * @param {int} Y click location
+ */
+ startDrag: function(x, y) { /* override this */ },
+
+ /**
+ * Code that executes immediately before the onDrag event
+ * @method b4Drag
+ * @private
+ */
+ b4Drag: function(e) { },
+
+ /**
+ * Abstract method called during the onMouseMove event while dragging an
+ * object.
+ * @method onDrag
+ * @param {Event} e the mousemove event
+ */
+ onDrag: function(e) { /* override this */ },
+
+ /**
+ * Abstract method called when this element fist begins hovering over
+ * another DragDrop obj
+ * @method onDragEnter
+ * @param {Event} e the mousemove event
+ * @param {String|DragDrop[]} id In POINT mode, the element
+ * id this is hovering over. In INTERSECT mode, an array of one or more
+ * dragdrop items being hovered over.
+ */
+ onDragEnter: function(e, id) { /* override this */ },
+
+ /**
+ * Code that executes immediately before the onDragOver event
+ * @method b4DragOver
+ * @private
+ */
+ b4DragOver: function(e) { },
+
+ /**
+ * Abstract method called when this element is hovering over another
+ * DragDrop obj
+ * @method onDragOver
+ * @param {Event} e the mousemove event
+ * @param {String|DragDrop[]} id In POINT mode, the element
+ * id this is hovering over. In INTERSECT mode, an array of dd items
+ * being hovered over.
+ */
+ onDragOver: function(e, id) { /* override this */ },
+
+ /**
+ * Code that executes immediately before the onDragOut event
+ * @method b4DragOut
+ * @private
+ */
+ b4DragOut: function(e) { },
+
+ /**
+ * Abstract method called when we are no longer hovering over an element
+ * @method onDragOut
+ * @param {Event} e the mousemove event
+ * @param {String|DragDrop[]} id In POINT mode, the element
+ * id this was hovering over. In INTERSECT mode, an array of dd items
+ * that the mouse is no longer over.
+ */
+ onDragOut: function(e, id) { /* override this */ },
+
+ /**
+ * Code that executes immediately before the onDragDrop event
+ * @method b4DragDrop
+ * @private
+ */
+ b4DragDrop: function(e) { },
+
+ /**
+ * Abstract method called when this item is dropped on another DragDrop
+ * obj
+ * @method onDragDrop
+ * @param {Event} e the mouseup event
+ * @param {String|DragDrop[]} id In POINT mode, the element
+ * id this was dropped on. In INTERSECT mode, an array of dd items this
+ * was dropped on.
+ */
+ onDragDrop: function(e, id) { /* override this */ },
+
+ /**
+ * Abstract method called when this item is dropped on an area with no
+ * drop target
+ * @method onInvalidDrop
+ * @param {Event} e the mouseup event
+ */
+ onInvalidDrop: function(e) { /* override this */ },
+
+ /**
+ * Code that executes immediately before the endDrag event
+ * @method b4EndDrag
+ * @private
+ */
+ b4EndDrag: function(e) { },
+
+ /**
+ * Fired when we are done dragging the object
+ * @method endDrag
+ * @param {Event} e the mouseup event
+ */
+ endDrag: function(e) { /* override this */ },
+
+ /**
+ * Code executed immediately before the onMouseDown event
+ * @method b4MouseDown
+ * @param {Event} e the mousedown event
+ * @private
+ */
+ b4MouseDown: function(e) { },
+
+ /**
+ * Event handler that fires when a drag/drop obj gets a mousedown
+ * @method onMouseDown
+ * @param {Event} e the mousedown event
+ */
+ onMouseDown: function(e) { /* override this */ },
+
+ /**
+ * Event handler that fires when a drag/drop obj gets a mouseup
+ * @method onMouseUp
+ * @param {Event} e the mouseup event
+ */
+ onMouseUp: function(e) { /* override this */ },
+
+ /**
+ * Override the onAvailable method to do what is needed after the initial
+ * position was determined.
+ * @method onAvailable
+ */
+ onAvailable: function () {
+ this.logger.log("onAvailable (base)");
+ },
+
+ /**
+ * Returns a reference to the linked element
+ * @method getEl
+ * @return {HTMLElement} the html element
+ */
+ getEl: function() {
+ if (!this._domRef) {
+ this._domRef = Dom.get(this.id);
+ }
+
+ return this._domRef;
+ },
+
+ /**
+ * Returns a reference to the actual element to drag. By default this is
+ * the same as the html element, but it can be assigned to another
+ * element. An example of this can be found in YAHOO.util.DDProxy
+ * @method getDragEl
+ * @return {HTMLElement} the html element
+ */
+ getDragEl: function() {
+ return Dom.get(this.dragElId);
+ },
+
+ /**
+ * Sets up the DragDrop object. Must be called in the constructor of any
+ * YAHOO.util.DragDrop subclass
+ * @method init
+ * @param id the id of the linked element
+ * @param {String} sGroup the group of related items
+ * @param {object} config configuration attributes
+ */
+ init: function(id, sGroup, config) {
+ this.initTarget(id, sGroup, config);
+ Event.on(this.id, "mousedown", this.handleMouseDown, this, true);
+ // Event.on(this.id, "selectstart", Event.preventDefault);
+ },
+
+ /**
+ * Initializes Targeting functionality only... the object does not
+ * get a mousedown handler.
+ * @method initTarget
+ * @param id the id of the linked element
+ * @param {String} sGroup the group of related items
+ * @param {object} config configuration attributes
+ */
+ initTarget: function(id, sGroup, config) {
+
+ // configuration attributes
+ this.config = config || {};
+
+ // create a local reference to the drag and drop manager
+ this.DDM = YAHOO.util.DDM;
+ // initialize the groups array
+ this.groups = {};
+
+ // assume that we have an element reference instead of an id if the
+ // parameter is not a string
+ if (typeof id !== "string") {
+ YAHOO.log("id is not a string, assuming it is an HTMLElement");
+ id = Dom.generateId(id);
+ }
+
+ // set the id
+ this.id = id;
+
+ // add to an interaction group
+ this.addToGroup((sGroup) ? sGroup : "default");
+
+ // We don't want to register this as the handle with the manager
+ // so we just set the id rather than calling the setter.
+ this.handleElId = id;
+
+ Event.onAvailable(id, this.handleOnAvailable, this, true);
+
+ // create a logger instance
+ this.logger = (YAHOO.widget.LogWriter) ?
+ new YAHOO.widget.LogWriter(this.toString()) : YAHOO;
+
+ // the linked element is the element that gets dragged by default
+ this.setDragElId(id);
+
+ // by default, clicked anchors will not start drag operations.
+ // @TODO what else should be here? Probably form fields.
+ this.invalidHandleTypes = { A: "A" };
+ this.invalidHandleIds = {};
+ this.invalidHandleClasses = [];
+
+ this.applyConfig();
+ },
+
+ /**
+ * Applies the configuration parameters that were passed into the constructor.
+ * This is supposed to happen at each level through the inheritance chain. So
+ * a DDProxy implentation will execute apply config on DDProxy, DD, and
+ * DragDrop in order to get all of the parameters that are available in
+ * each object.
+ * @method applyConfig
+ */
+ applyConfig: function() {
+
+ // configurable properties:
+ // padding, isTarget, maintainOffset, primaryButtonOnly
+ this.padding = this.config.padding || [0, 0, 0, 0];
+ this.isTarget = (this.config.isTarget !== false);
+ this.maintainOffset = (this.config.maintainOffset);
+ this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);
+
+ },
+
+ /**
+ * Executed when the linked element is available
+ * @method handleOnAvailable
+ * @private
+ */
+ handleOnAvailable: function() {
+ this.logger.log("handleOnAvailable");
+ this.available = true;
+ this.resetConstraints();
+ this.onAvailable();
+ },
+
+ /**
+ * Configures the padding for the target zone in px. Effectively expands
+ * (or reduces) the virtual object size for targeting calculations.
+ * Supports css-style shorthand; if only one parameter is passed, all sides
+ * will have that padding, and if only two are passed, the top and bottom
+ * will have the first param, the left and right the second.
+ * @method setPadding
+ * @param {int} iTop Top pad
+ * @param {int} iRight Right pad
+ * @param {int} iBot Bot pad
+ * @param {int} iLeft Left pad
+ */
+ setPadding: function(iTop, iRight, iBot, iLeft) {
+ // this.padding = [iLeft, iRight, iTop, iBot];
+ if (!iRight && 0 !== iRight) {
+ this.padding = [iTop, iTop, iTop, iTop];
+ } else if (!iBot && 0 !== iBot) {
+ this.padding = [iTop, iRight, iTop, iRight];
+ } else {
+ this.padding = [iTop, iRight, iBot, iLeft];
+ }
+ },
+
+ /**
+ * Stores the initial placement of the linked element.
+ * @method setInitialPosition
+ * @param {int} diffX the X offset, default 0
+ * @param {int} diffY the Y offset, default 0
+ */
+ setInitPosition: function(diffX, diffY) {
+ var el = this.getEl();
+
+ if (!this.DDM.verifyEl(el)) {
+ this.logger.log(this.id + " element is broken");
+ return;
+ }
+
+ var dx = diffX || 0;
+ var dy = diffY || 0;
+
+ var p = Dom.getXY( el );
+
+ this.initPageX = p[0] - dx;
+ this.initPageY = p[1] - dy;
+
+ this.lastPageX = p[0];
+ this.lastPageY = p[1];
+
+ this.logger.log(this.id + " inital position: " + this.initPageX +
+ ", " + this.initPageY);
+
+
+ this.setStartPosition(p);
+ },
+
+ /**
+ * Sets the start position of the element. This is set when the obj
+ * is initialized, the reset when a drag is started.
+ * @method setStartPosition
+ * @param pos current position (from previous lookup)
+ * @private
+ */
+ setStartPosition: function(pos) {
+ var p = pos || Dom.getXY( this.getEl() );
+ this.deltaSetXY = null;
+
+ this.startPageX = p[0];
+ this.startPageY = p[1];
+ },
+
+ /**
+ * Add this instance to a group of related drag/drop objects. All
+ * instances belong to at least one group, and can belong to as many
+ * groups as needed.
+ * @method addToGroup
+ * @param sGroup {string} the name of the group
+ */
+ addToGroup: function(sGroup) {
+ this.groups[sGroup] = true;
+ this.DDM.regDragDrop(this, sGroup);
+ },
+
+ /**
+ * Remove's this instance from the supplied interaction group
+ * @method removeFromGroup
+ * @param {string} sGroup The group to drop
+ */
+ removeFromGroup: function(sGroup) {
+ this.logger.log("Removing from group: " + sGroup);
+ if (this.groups[sGroup]) {
+ delete this.groups[sGroup];
+ }
+
+ this.DDM.removeDDFromGroup(this, sGroup);
+ },
+
+ /**
+ * Allows you to specify that an element other than the linked element
+ * will be moved with the cursor during a drag
+ * @method setDragElId
+ * @param id {string} the id of the element that will be used to initiate the drag
+ */
+ setDragElId: function(id) {
+ this.dragElId = id;
+ },
+
+ /**
+ * Allows you to specify a child of the linked element that should be
+ * used to initiate the drag operation. An example of this would be if
+ * you have a content div with text and links. Clicking anywhere in the
+ * content area would normally start the drag operation. Use this method
+ * to specify that an element inside of the content div is the element
+ * that starts the drag operation.
+ * @method setHandleElId
+ * @param id {string} the id of the element that will be used to
+ * initiate the drag.
+ */
+ setHandleElId: function(id) {
+ if (typeof id !== "string") {
+ YAHOO.log("id is not a string, assuming it is an HTMLElement");
+ id = Dom.generateId(id);
+ }
+ this.handleElId = id;
+ this.DDM.regHandle(this.id, id);
+ },
+
+ /**
+ * Allows you to set an element outside of the linked element as a drag
+ * handle
+ * @method setOuterHandleElId
+ * @param id the id of the element that will be used to initiate the drag
+ */
+ setOuterHandleElId: function(id) {
+ if (typeof id !== "string") {
+ YAHOO.log("id is not a string, assuming it is an HTMLElement");
+ id = Dom.generateId(id);
+ }
+ this.logger.log("Adding outer handle event: " + id);
+ Event.on(id, "mousedown",
+ this.handleMouseDown, this, true);
+ this.setHandleElId(id);
+
+ this.hasOuterHandles = true;
+ },
+
+ /**
+ * Remove all drag and drop hooks for this element
+ * @method unreg
+ */
+ unreg: function() {
+ this.logger.log("DragDrop obj cleanup " + this.id);
+ Event.removeListener(this.id, "mousedown",
+ this.handleMouseDown);
+ this._domRef = null;
+ this.DDM._remove(this);
+ },
+
+ /**
+ * Returns true if this instance is locked, or the drag drop mgr is locked
+ * (meaning that all drag/drop is disabled on the page.)
+ * @method isLocked
+ * @return {boolean} true if this obj or all drag/drop is locked, else
+ * false
+ */
+ isLocked: function() {
+ return (this.DDM.isLocked() || this.locked);
+ },
+
+ /**
+ * Fired when this object is clicked
+ * @method handleMouseDown
+ * @param {Event} e
+ * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)
+ * @private
+ */
+ handleMouseDown: function(e, oDD) {
+
+ var button = e.which || e.button;
+ this.logger.log("button: " + button);
+
+ if (this.primaryButtonOnly && button > 1) {
+ this.logger.log("Mousedown was not produced by the primary button");
+ return;
+ }
+
+ if (this.isLocked()) {
+ this.logger.log("Drag and drop is disabled, aborting");
+ return;
+ }
+
+ this.logger.log("mousedown " + this.id);
+ this.DDM.refreshCache(this.groups);
+ // var self = this;
+ // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);
+
+ // Only process the event if we really clicked within the linked
+ // element. The reason we make this check is that in the case that
+ // another element was moved between the clicked element and the
+ // cursor in the time between the mousedown and mouseup events. When
+ // this happens, the element gets the next mousedown event
+ // regardless of where on the screen it happened.
+ var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e));
+ if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) {
+ this.logger.log("Click was not over the element: " + this.id);
+ } else {
+ if (this.clickValidator(e)) {
+
+ this.logger.log("click was a valid handle");
+
+ // set the initial element position
+ this.setStartPosition();
+
+ this.logger.log("firing onMouseDown events");
+
+ this.b4MouseDown(e);
+ this.onMouseDown(e);
+ this.DDM.handleMouseDown(e, this);
+
+ this.DDM.stopEvent(e);
+ } else {
+
+this.logger.log("clickValidator returned false, drag not initiated");
+
+ }
+ }
+ },
+
+ clickValidator: function(e) {
+ var target = Event.getTarget(e);
+ return ( this.isValidHandleChild(target) &&
+ (this.id == this.handleElId ||
+ this.DDM.handleWasClicked(target, this.id)) );
+ },
+
+ /**
+ * Allows you to specify a tag name that should not start a drag operation
+ * when clicked. This is designed to facilitate embedding links within a
+ * drag handle that do something other than start the drag.
+ * @method addInvalidHandleType
+ * @param {string} tagName the type of element to exclude
+ */
+ addInvalidHandleType: function(tagName) {
+ var type = tagName.toUpperCase();
+ this.invalidHandleTypes[type] = type;
+ },
+
+ /**
+ * Lets you to specify an element id for a child of a drag handle
+ * that should not initiate a drag
+ * @method addInvalidHandleId
+ * @param {string} id the element id of the element you wish to ignore
+ */
+ addInvalidHandleId: function(id) {
+ if (typeof id !== "string") {
+ YAHOO.log("id is not a string, assuming it is an HTMLElement");
+ id = Dom.generateId(id);
+ }
+ this.invalidHandleIds[id] = id;
+ },
+
+
+ /**
+ * Lets you specify a css class of elements that will not initiate a drag
+ * @method addInvalidHandleClass
+ * @param {string} cssClass the class of the elements you wish to ignore
+ */
+ addInvalidHandleClass: function(cssClass) {
+ this.invalidHandleClasses.push(cssClass);
+ },
+
+ /**
+ * Unsets an excluded tag name set by addInvalidHandleType
+ * @method removeInvalidHandleType
+ * @param {string} tagName the type of element to unexclude
+ */
+ removeInvalidHandleType: function(tagName) {
+ var type = tagName.toUpperCase();
+ // this.invalidHandleTypes[type] = null;
+ delete this.invalidHandleTypes[type];
+ },
+
+ /**
+ * Unsets an invalid handle id
+ * @method removeInvalidHandleId
+ * @param {string} id the id of the element to re-enable
+ */
+ removeInvalidHandleId: function(id) {
+ if (typeof id !== "string") {
+ YAHOO.log("id is not a string, assuming it is an HTMLElement");
+ id = Dom.generateId(id);
+ }
+ delete this.invalidHandleIds[id];
+ },
+
+ /**
+ * Unsets an invalid css class
+ * @method removeInvalidHandleClass
+ * @param {string} cssClass the class of the element(s) you wish to
+ * re-enable
+ */
+ removeInvalidHandleClass: function(cssClass) {
+ for (var i=0, len=this.invalidHandleClasses.length; i= this.minX; i = i - iTickSize) {
+ if (!tickMap[i]) {
+ this.xTicks[this.xTicks.length] = i;
+ tickMap[i] = true;
+ }
+ }
+
+ for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
+ if (!tickMap[i]) {
+ this.xTicks[this.xTicks.length] = i;
+ tickMap[i] = true;
+ }
+ }
+
+ this.xTicks.sort(this.DDM.numericSort) ;
+ this.logger.log("xTicks: " + this.xTicks.join());
+ },
+
+ /**
+ * Create the array of vertical tick marks if an interval was specified in
+ * setYConstraint().
+ * @method setYTicks
+ * @private
+ */
+ setYTicks: function(iStartY, iTickSize) {
+ // this.logger.log("setYTicks: " + iStartY + ", " + iTickSize
+ // + ", " + this.initPageY + ", " + this.minY + ", " + this.maxY );
+ this.yTicks = [];
+ this.yTickSize = iTickSize;
+
+ var tickMap = {};
+
+ for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
+ if (!tickMap[i]) {
+ this.yTicks[this.yTicks.length] = i;
+ tickMap[i] = true;
+ }
+ }
+
+ for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
+ if (!tickMap[i]) {
+ this.yTicks[this.yTicks.length] = i;
+ tickMap[i] = true;
+ }
+ }
+
+ this.yTicks.sort(this.DDM.numericSort) ;
+ this.logger.log("yTicks: " + this.yTicks.join());
+ },
+
+ /**
+ * By default, the element can be dragged any place on the screen. Use
+ * this method to limit the horizontal travel of the element. Pass in
+ * 0,0 for the parameters if you want to lock the drag to the y axis.
+ * @method setXConstraint
+ * @param {int} iLeft the number of pixels the element can move to the left
+ * @param {int} iRight the number of pixels the element can move to the
+ * right
+ * @param {int} iTickSize optional parameter for specifying that the
+ * element
+ * should move iTickSize pixels at a time.
+ */
+ setXConstraint: function(iLeft, iRight, iTickSize) {
+ this.leftConstraint = iLeft;
+ this.rightConstraint = iRight;
+
+ this.minX = this.initPageX - iLeft;
+ this.maxX = this.initPageX + iRight;
+ if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
+
+ this.constrainX = true;
+ this.logger.log("initPageX:" + this.initPageX + " minX:" + this.minX +
+ " maxX:" + this.maxX);
+ },
+
+ /**
+ * Clears any constraints applied to this instance. Also clears ticks
+ * since they can't exist independent of a constraint at this time.
+ * @method clearConstraints
+ */
+ clearConstraints: function() {
+ this.logger.log("Clearing constraints");
+ this.constrainX = false;
+ this.constrainY = false;
+ this.clearTicks();
+ },
+
+ /**
+ * Clears any tick interval defined for this instance
+ * @method clearTicks
+ */
+ clearTicks: function() {
+ this.logger.log("Clearing ticks");
+ this.xTicks = null;
+ this.yTicks = null;
+ this.xTickSize = 0;
+ this.yTickSize = 0;
+ },
+
+ /**
+ * By default, the element can be dragged any place on the screen. Set
+ * this to limit the vertical travel of the element. Pass in 0,0 for the
+ * parameters if you want to lock the drag to the x axis.
+ * @method setYConstraint
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize optional parameter for specifying that the
+ * element should move iTickSize pixels at a time.
+ */
+ setYConstraint: function(iUp, iDown, iTickSize) {
+ this.logger.log("setYConstraint: " + iUp + "," + iDown + "," + iTickSize);
+ this.topConstraint = iUp;
+ this.bottomConstraint = iDown;
+
+ this.minY = this.initPageY - iUp;
+ this.maxY = this.initPageY + iDown;
+ if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
+
+ this.constrainY = true;
+
+ this.logger.log("initPageY:" + this.initPageY + " minY:" + this.minY +
+ " maxY:" + this.maxY);
+ },
+
+ /**
+ * resetConstraints must be called if you manually reposition a dd element.
+ * @method resetConstraints
+ * @param {boolean} maintainOffset
+ */
+ resetConstraints: function() {
+
+ this.logger.log("resetConstraints");
+
+ // Maintain offsets if necessary
+ if (this.initPageX || this.initPageX === 0) {
+ this.logger.log("init pagexy: " + this.initPageX + ", " +
+ this.initPageY);
+ this.logger.log("last pagexy: " + this.lastPageX + ", " +
+ this.lastPageY);
+ // figure out how much this thing has moved
+ var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
+ var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
+
+ this.setInitPosition(dx, dy);
+
+ // This is the first time we have detected the element's position
+ } else {
+ this.setInitPosition();
+ }
+
+ if (this.constrainX) {
+ this.setXConstraint( this.leftConstraint,
+ this.rightConstraint,
+ this.xTickSize );
+ }
+
+ if (this.constrainY) {
+ this.setYConstraint( this.topConstraint,
+ this.bottomConstraint,
+ this.yTickSize );
+ }
+ },
+
+ /**
+ * Normally the drag element is moved pixel by pixel, but we can specify
+ * that it move a number of pixels at a time. This method resolves the
+ * location when we have it set up like this.
+ * @method getTick
+ * @param {int} val where we want to place the object
+ * @param {int[]} tickArray sorted array of valid points
+ * @return {int} the closest tick
+ * @private
+ */
+ getTick: function(val, tickArray) {
+
+ if (!tickArray) {
+ // If tick interval is not defined, it is effectively 1 pixel,
+ // so we return the value passed to us.
+ return val;
+ } else if (tickArray[0] >= val) {
+ // The value is lower than the first tick, so we return the first
+ // tick.
+ return tickArray[0];
+ } else {
+ for (var i=0, len=tickArray.length; i= val) {
+ var diff1 = val - tickArray[i];
+ var diff2 = tickArray[next] - val;
+ return (diff2 > diff1) ? tickArray[i] : tickArray[next];
+ }
+ }
+
+ // The value is larger than the last tick, so we return the last
+ // tick.
+ return tickArray[tickArray.length - 1];
+ }
+ },
+
+ /**
+ * toString method
+ * @method toString
+ * @return {string} string representation of the dd obj
+ */
+ toString: function() {
+ return ("DragDrop " + this.id);
+ }
+
+};
+
+})();
+/**
+ * The drag and drop utility provides a framework for building drag and drop
+ * applications. In addition to enabling drag and drop for specific elements,
+ * the drag and drop elements are tracked by the manager class, and the
+ * interactions between the various elements are tracked during the drag and
+ * the implementing code is notified about these important moments.
+ * @module dragdrop
+ * @title Drag and Drop
+ * @requires yahoo,dom,event
+ * @namespace YAHOO.util
+ */
+
+// Only load the library once. Rewriting the manager class would orphan
+// existing drag and drop instances.
+if (!YAHOO.util.DragDropMgr) {
+
+/**
+ * DragDropMgr is a singleton that tracks the element interaction for
+ * all DragDrop items in the window. Generally, you will not call
+ * this class directly, but it does have helper methods that could
+ * be useful in your DragDrop implementations.
+ * @class DragDropMgr
+ * @static
+ */
+YAHOO.util.DragDropMgr = function() {
+
+ var Event = YAHOO.util.Event;
+
+ return {
+
+ /**
+ * Two dimensional Array of registered DragDrop objects. The first
+ * dimension is the DragDrop item group, the second the DragDrop
+ * object.
+ * @property ids
+ * @type {string: string}
+ * @private
+ * @static
+ */
+ ids: {},
+
+ /**
+ * Array of element ids defined as drag handles. Used to determine
+ * if the element that generated the mousedown event is actually the
+ * handle and not the html element itself.
+ * @property handleIds
+ * @type {string: string}
+ * @private
+ * @static
+ */
+ handleIds: {},
+
+ /**
+ * the DragDrop object that is currently being dragged
+ * @property dragCurrent
+ * @type DragDrop
+ * @private
+ * @static
+ **/
+ dragCurrent: null,
+
+ /**
+ * the DragDrop object(s) that are being hovered over
+ * @property dragOvers
+ * @type Array
+ * @private
+ * @static
+ */
+ dragOvers: {},
+
+ /**
+ * the X distance between the cursor and the object being dragged
+ * @property deltaX
+ * @type int
+ * @private
+ * @static
+ */
+ deltaX: 0,
+
+ /**
+ * the Y distance between the cursor and the object being dragged
+ * @property deltaY
+ * @type int
+ * @private
+ * @static
+ */
+ deltaY: 0,
+
+ /**
+ * Flag to determine if we should prevent the default behavior of the
+ * events we define. By default this is true, but this can be set to
+ * false if you need the default behavior (not recommended)
+ * @property preventDefault
+ * @type boolean
+ * @static
+ */
+ preventDefault: true,
+
+ /**
+ * Flag to determine if we should stop the propagation of the events
+ * we generate. This is true by default but you may want to set it to
+ * false if the html element contains other features that require the
+ * mouse click.
+ * @property stopPropagation
+ * @type boolean
+ * @static
+ */
+ stopPropagation: true,
+
+ /**
+ * Internal flag that is set to true when drag and drop has been
+ * intialized
+ * @property initialized
+ * @private
+ * @static
+ */
+ initalized: false,
+
+ /**
+ * All drag and drop can be disabled.
+ * @property locked
+ * @private
+ * @static
+ */
+ locked: false,
+
+ /**
+ * Called the first time an element is registered.
+ * @method init
+ * @private
+ * @static
+ */
+ init: function() {
+ this.logger = new YAHOO.widget.LogWriter("DragDropMgr");
+ this.initialized = true;
+ },
+
+ /**
+ * In point mode, drag and drop interaction is defined by the
+ * location of the cursor during the drag/drop
+ * @property POINT
+ * @type int
+ * @static
+ */
+ POINT: 0,
+
+ /**
+ * In intersect mode, drag and drop interactio nis defined by the
+ * overlap of two or more drag and drop objects.
+ * @property INTERSECT
+ * @type int
+ * @static
+ */
+ INTERSECT: 1,
+
+ /**
+ * The current drag and drop mode. Default: POINT
+ * @property mode
+ * @type int
+ * @static
+ */
+ mode: 0,
+
+ /**
+ * Runs method on all drag and drop objects
+ * @method _execOnAll
+ * @private
+ * @static
+ */
+ _execOnAll: function(sMethod, args) {
+ for (var i in this.ids) {
+ for (var j in this.ids[i]) {
+ var oDD = this.ids[i][j];
+ if (! this.isTypeOfDD(oDD)) {
+ continue;
+ }
+ oDD[sMethod].apply(oDD, args);
+ }
+ }
+ },
+
+ /**
+ * Drag and drop initialization. Sets up the global event handlers
+ * @method _onLoad
+ * @private
+ * @static
+ */
+ _onLoad: function() {
+
+ this.init();
+
+ this.logger.log("DDM onload");
+
+ Event.on(document, "mouseup", this.handleMouseUp, this, true);
+ Event.on(document, "mousemove", this.handleMouseMove, this, true);
+ Event.on(window, "unload", this._onUnload, this, true);
+ Event.on(window, "resize", this._onResize, this, true);
+ // Event.on(window, "mouseout", this._test);
+
+ },
+
+ /**
+ * Reset constraints on all drag and drop objs
+ * @method _onResize
+ * @private
+ * @static
+ */
+ _onResize: function(e) {
+ this.logger.log("window resize");
+ this._execOnAll("resetConstraints", []);
+ },
+
+ /**
+ * Lock all drag and drop functionality
+ * @method lock
+ * @static
+ */
+ lock: function() { this.locked = true; },
+
+ /**
+ * Unlock all drag and drop functionality
+ * @method unlock
+ * @static
+ */
+ unlock: function() { this.locked = false; },
+
+ /**
+ * Is drag and drop locked?
+ * @method isLocked
+ * @return {boolean} True if drag and drop is locked, false otherwise.
+ * @static
+ */
+ isLocked: function() { return this.locked; },
+
+ /**
+ * Location cache that is set for all drag drop objects when a drag is
+ * initiated, cleared when the drag is finished.
+ * @property locationCache
+ * @private
+ * @static
+ */
+ locationCache: {},
+
+ /**
+ * Set useCache to false if you want to force object the lookup of each
+ * drag and drop linked element constantly during a drag.
+ * @property useCache
+ * @type boolean
+ * @static
+ */
+ useCache: true,
+
+ /**
+ * The number of pixels that the mouse needs to move after the
+ * mousedown before the drag is initiated. Default=3;
+ * @property clickPixelThresh
+ * @type int
+ * @static
+ */
+ clickPixelThresh: 3,
+
+ /**
+ * The number of milliseconds after the mousedown event to initiate the
+ * drag if we don't get a mouseup event. Default=1000
+ * @property clickTimeThresh
+ * @type int
+ * @static
+ */
+ clickTimeThresh: 1000,
+
+ /**
+ * Flag that indicates that either the drag pixel threshold or the
+ * mousdown time threshold has been met
+ * @property dragThreshMet
+ * @type boolean
+ * @private
+ * @static
+ */
+ dragThreshMet: false,
+
+ /**
+ * Timeout used for the click time threshold
+ * @property clickTimeout
+ * @type Object
+ * @private
+ * @static
+ */
+ clickTimeout: null,
+
+ /**
+ * The X position of the mousedown event stored for later use when a
+ * drag threshold is met.
+ * @property startX
+ * @type int
+ * @private
+ * @static
+ */
+ startX: 0,
+
+ /**
+ * The Y position of the mousedown event stored for later use when a
+ * drag threshold is met.
+ * @property startY
+ * @type int
+ * @private
+ * @static
+ */
+ startY: 0,
+
+ /**
+ * Each DragDrop instance must be registered with the DragDropMgr.
+ * This is executed in DragDrop.init()
+ * @method regDragDrop
+ * @param {DragDrop} oDD the DragDrop object to register
+ * @param {String} sGroup the name of the group this element belongs to
+ * @static
+ */
+ regDragDrop: function(oDD, sGroup) {
+ if (!this.initialized) { this.init(); }
+
+ if (!this.ids[sGroup]) {
+ this.ids[sGroup] = {};
+ }
+ this.ids[sGroup][oDD.id] = oDD;
+ },
+
+ /**
+ * Removes the supplied dd instance from the supplied group. Executed
+ * by DragDrop.removeFromGroup, so don't call this function directly.
+ * @method removeDDFromGroup
+ * @private
+ * @static
+ */
+ removeDDFromGroup: function(oDD, sGroup) {
+ if (!this.ids[sGroup]) {
+ this.ids[sGroup] = {};
+ }
+
+ var obj = this.ids[sGroup];
+ if (obj && obj[oDD.id]) {
+ delete obj[oDD.id];
+ }
+ },
+
+ /**
+ * Unregisters a drag and drop item. This is executed in
+ * DragDrop.unreg, use that method instead of calling this directly.
+ * @method _remove
+ * @private
+ * @static
+ */
+ _remove: function(oDD) {
+ for (var g in oDD.groups) {
+ if (g && this.ids[g][oDD.id]) {
+ delete this.ids[g][oDD.id];
+ //this.logger.log("NEW LEN " + this.ids.length, "warn");
+ }
+ }
+ delete this.handleIds[oDD.id];
+ },
+
+ /**
+ * Each DragDrop handle element must be registered. This is done
+ * automatically when executing DragDrop.setHandleElId()
+ * @method regHandle
+ * @param {String} sDDId the DragDrop id this element is a handle for
+ * @param {String} sHandleId the id of the element that is the drag
+ * handle
+ * @static
+ */
+ regHandle: function(sDDId, sHandleId) {
+ if (!this.handleIds[sDDId]) {
+ this.handleIds[sDDId] = {};
+ }
+ this.handleIds[sDDId][sHandleId] = sHandleId;
+ },
+
+ /**
+ * Utility function to determine if a given element has been
+ * registered as a drag drop item.
+ * @method isDragDrop
+ * @param {String} id the element id to check
+ * @return {boolean} true if this element is a DragDrop item,
+ * false otherwise
+ * @static
+ */
+ isDragDrop: function(id) {
+ return ( this.getDDById(id) ) ? true : false;
+ },
+
+ /**
+ * Returns the drag and drop instances that are in all groups the
+ * passed in instance belongs to.
+ * @method getRelated
+ * @param {DragDrop} p_oDD the obj to get related data for
+ * @param {boolean} bTargetsOnly if true, only return targetable objs
+ * @return {DragDrop[]} the related instances
+ * @static
+ */
+ getRelated: function(p_oDD, bTargetsOnly) {
+ var oDDs = [];
+ for (var i in p_oDD.groups) {
+ for (j in this.ids[i]) {
+ var dd = this.ids[i][j];
+ if (! this.isTypeOfDD(dd)) {
+ continue;
+ }
+ if (!bTargetsOnly || dd.isTarget) {
+ oDDs[oDDs.length] = dd;
+ }
+ }
+ }
+
+ return oDDs;
+ },
+
+ /**
+ * Returns true if the specified dd target is a legal target for
+ * the specifice drag obj
+ * @method isLegalTarget
+ * @param {DragDrop} the drag obj
+ * @param {DragDrop} the target
+ * @return {boolean} true if the target is a legal target for the
+ * dd obj
+ * @static
+ */
+ isLegalTarget: function (oDD, oTargetDD) {
+ var targets = this.getRelated(oDD, true);
+ for (var i=0, len=targets.length;i this.clickPixelThresh ||
+ diffY > this.clickPixelThresh) {
+ this.logger.log("pixel threshold met");
+ this.startDrag(this.startX, this.startY);
+ }
+ }
+
+ if (this.dragThreshMet) {
+ this.dragCurrent.b4Drag(e);
+ this.dragCurrent.onDrag(e);
+ this.fireEvents(e, false);
+ }
+
+ this.stopEvent(e);
+
+ return true;
+ },
+
+ /**
+ * Iterates over all of the DragDrop elements to find ones we are
+ * hovering over or dropping on
+ * @method fireEvents
+ * @param {Event} e the event
+ * @param {boolean} isDrop is this a drop op or a mouseover op?
+ * @private
+ * @static
+ */
+ fireEvents: function(e, isDrop) {
+ var dc = this.dragCurrent;
+
+ // If the user did the mouse up outside of the window, we could
+ // get here even though we have ended the drag.
+ if (!dc || dc.isLocked()) {
+ return;
+ }
+
+ var x = YAHOO.util.Event.getPageX(e);
+ var y = YAHOO.util.Event.getPageY(e);
+ var pt = new YAHOO.util.Point(x,y);
+
+ // cache the previous dragOver array
+ var oldOvers = [];
+
+ var outEvts = [];
+ var overEvts = [];
+ var dropEvts = [];
+ var enterEvts = [];
+
+ // Check to see if the object(s) we were hovering over is no longer
+ // being hovered over so we can fire the onDragOut event
+ for (var i in this.dragOvers) {
+
+ var ddo = this.dragOvers[i];
+
+ if (! this.isTypeOfDD(ddo)) {
+ continue;
+ }
+
+ if (! this.isOverTarget(pt, ddo, this.mode)) {
+ outEvts.push( ddo );
+ }
+
+ oldOvers[i] = true;
+ delete this.dragOvers[i];
+ }
+
+ for (var sGroup in dc.groups) {
+ // this.logger.log("Processing group " + sGroup);
+
+ if ("string" != typeof sGroup) {
+ continue;
+ }
+
+ for (i in this.ids[sGroup]) {
+ var oDD = this.ids[sGroup][i];
+ if (! this.isTypeOfDD(oDD)) {
+ continue;
+ }
+
+ if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {
+ if (this.isOverTarget(pt, oDD, this.mode)) {
+ // look for drop interactions
+ if (isDrop) {
+ dropEvts.push( oDD );
+ // look for drag enter and drag over interactions
+ } else {
+
+ // initial drag over: dragEnter fires
+ if (!oldOvers[oDD.id]) {
+ enterEvts.push( oDD );
+ // subsequent drag overs: dragOver fires
+ } else {
+ overEvts.push( oDD );
+ }
+
+ this.dragOvers[oDD.id] = oDD;
+ }
+ }
+ }
+ }
+ }
+
+ if (this.mode) {
+ if (outEvts.length) {
+ this.logger.log(dc.id+" onDragOut: " + outEvts);
+ dc.b4DragOut(e, outEvts);
+ dc.onDragOut(e, outEvts);
+ }
+
+ if (enterEvts.length) {
+ this.logger.log(dc.id+" onDragEnter: " + enterEvts);
+ dc.onDragEnter(e, enterEvts);
+ }
+
+ if (overEvts.length) {
+ this.logger.log(dc.id+" onDragOver: " + overEvts);
+ dc.b4DragOver(e, overEvts);
+ dc.onDragOver(e, overEvts);
+ }
+
+ if (dropEvts.length) {
+ this.logger.log(dc.id+" onDragDrop: " + dropEvts);
+ dc.b4DragDrop(e, dropEvts);
+ dc.onDragDrop(e, dropEvts);
+ }
+
+ } else {
+ // fire dragout events
+ var len = 0;
+ for (i=0, len=outEvts.length; i
+ * YAHOO.util.DragDropMgr.refreshCache(ddinstance.groups);
+ *
+ * Alternatively:
+ *
+ * YAHOO.util.DragDropMgr.refreshCache({group1:true, group2:true});
+ *
+ * @TODO this really should be an indexed array. Alternatively this
+ * method could accept both.
+ * @method refreshCache
+ * @param {Object} groups an associative array of groups to refresh
+ * @static
+ */
+ refreshCache: function(groups) {
+ this.logger.log("refreshing element location cache");
+ for (var sGroup in groups) {
+ if ("string" != typeof sGroup) {
+ continue;
+ }
+ for (var i in this.ids[sGroup]) {
+ var oDD = this.ids[sGroup][i];
+
+ if (this.isTypeOfDD(oDD)) {
+ // if (this.isTypeOfDD(oDD) && oDD.isTarget) {
+ var loc = this.getLocation(oDD);
+ if (loc) {
+ this.locationCache[oDD.id] = loc;
+ } else {
+ delete this.locationCache[oDD.id];
+ this.logger.log("Could not get the loc for " + oDD.id,
+ "warn");
+ // this will unregister the drag and drop object if
+ // the element is not in a usable state
+ // oDD.unreg();
+ }
+ }
+ }
+ }
+ },
+
+ /**
+ * This checks to make sure an element exists and is in the DOM. The
+ * main purpose is to handle cases where innerHTML is used to remove
+ * drag and drop objects from the DOM. IE provides an 'unspecified
+ * error' when trying to access the offsetParent of such an element
+ * @method verifyEl
+ * @param {HTMLElement} el the element to check
+ * @return {boolean} true if the element looks usable
+ * @static
+ */
+ verifyEl: function(el) {
+ try {
+ if (el) {
+ var parent = el.offsetParent;
+ if (parent) {
+ return true;
+ }
+ }
+ } catch(e) {
+ this.logger.log("detected problem with an element");
+ }
+
+ return false;
+ },
+
+ /**
+ * Returns a Region object containing the drag and drop element's position
+ * and size, including the padding configured for it
+ * @method getLocation
+ * @param {DragDrop} oDD the drag and drop object to get the
+ * location for
+ * @return {YAHOO.util.Region} a Region object representing the total area
+ * the element occupies, including any padding
+ * the instance is configured for.
+ * @static
+ */
+ getLocation: function(oDD) {
+ if (! this.isTypeOfDD(oDD)) {
+ this.logger.log(oDD + " is not a DD obj");
+ return null;
+ }
+
+ var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
+
+ try {
+ pos= YAHOO.util.Dom.getXY(el);
+ } catch (e) { }
+
+ if (!pos) {
+ this.logger.log("getXY failed");
+ return null;
+ }
+
+ x1 = pos[0];
+ x2 = x1 + el.offsetWidth;
+ y1 = pos[1];
+ y2 = y1 + el.offsetHeight;
+
+ t = y1 - oDD.padding[0];
+ r = x2 + oDD.padding[1];
+ b = y2 + oDD.padding[2];
+ l = x1 - oDD.padding[3];
+
+ return new YAHOO.util.Region( t, r, b, l );
+ },
+
+ /**
+ * Checks the cursor location to see if it over the target
+ * @method isOverTarget
+ * @param {YAHOO.util.Point} pt The point to evaluate
+ * @param {DragDrop} oTarget the DragDrop object we are inspecting
+ * @return {boolean} true if the mouse is over the target
+ * @private
+ * @static
+ */
+ isOverTarget: function(pt, oTarget, intersect) {
+ // use cache if available
+ var loc = this.locationCache[oTarget.id];
+ if (!loc || !this.useCache) {
+ this.logger.log("cache not populated");
+ loc = this.getLocation(oTarget);
+ this.locationCache[oTarget.id] = loc;
+
+ this.logger.log("cache: " + loc);
+ }
+
+ if (!loc) {
+ this.logger.log("could not get the location of the element");
+ return false;
+ }
+
+ //this.logger.log("loc: " + loc + ", pt: " + pt);
+ oTarget.cursorIsOver = loc.contains( pt );
+
+ // DragDrop is using this as a sanity check for the initial mousedown
+ // in this case we are done. In POINT mode, if the drag obj has no
+ // contraints, we are also done. Otherwise we need to evaluate the
+ // location of the target as related to the actual location of the
+ // dragged element.
+ var dc = this.dragCurrent;
+ if (!dc || !dc.getTargetCoord ||
+ (!intersect && !dc.constrainX && !dc.constrainY)) {
+ return oTarget.cursorIsOver;
+ }
+
+ oTarget.overlap = null;
+
+ // Get the current location of the drag element, this is the
+ // location of the mouse event less the delta that represents
+ // where the original mousedown happened on the element. We
+ // need to consider constraints and ticks as well.
+ var pos = dc.getTargetCoord(pt.x, pt.y);
+
+ var el = dc.getDragEl();
+ var curRegion = new YAHOO.util.Region( pos.y,
+ pos.x + el.offsetWidth,
+ pos.y + el.offsetHeight,
+ pos.x );
+
+ var overlap = curRegion.intersect(loc);
+
+ if (overlap) {
+ oTarget.overlap = overlap;
+ return (intersect) ? true : oTarget.cursorIsOver;
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * unload event handler
+ * @method _onUnload
+ * @private
+ * @static
+ */
+ _onUnload: function(e, me) {
+ this.unregAll();
+ },
+
+ /**
+ * Cleans up the drag and drop events and objects.
+ * @method unregAll
+ * @private
+ * @static
+ */
+ unregAll: function() {
+ this.logger.log("unregister all");
+
+ if (this.dragCurrent) {
+ this.stopDrag();
+ this.dragCurrent = null;
+ }
+
+ this._execOnAll("unreg", []);
+
+ for (i in this.elementCache) {
+ delete this.elementCache[i];
+ }
+
+ this.elementCache = {};
+ this.ids = {};
+ },
+
+ /**
+ * A cache of DOM elements
+ * @property elementCache
+ * @private
+ * @static
+ */
+ elementCache: {},
+
+ /**
+ * Get the wrapper for the DOM element specified
+ * @method getElWrapper
+ * @param {String} id the id of the element to get
+ * @return {YAHOO.util.DDM.ElementWrapper} the wrapped element
+ * @private
+ * @deprecated This wrapper isn't that useful
+ * @static
+ */
+ getElWrapper: function(id) {
+ var oWrapper = this.elementCache[id];
+ if (!oWrapper || !oWrapper.el) {
+ oWrapper = this.elementCache[id] =
+ new this.ElementWrapper(YAHOO.util.Dom.get(id));
+ }
+ return oWrapper;
+ },
+
+ /**
+ * Returns the actual DOM element
+ * @method getElement
+ * @param {String} id the id of the elment to get
+ * @return {Object} The element
+ * @deprecated use YAHOO.util.Dom.get instead
+ * @static
+ */
+ getElement: function(id) {
+ return YAHOO.util.Dom.get(id);
+ },
+
+ /**
+ * Returns the style property for the DOM element (i.e.,
+ * document.getElById(id).style)
+ * @method getCss
+ * @param {String} id the id of the elment to get
+ * @return {Object} The style property of the element
+ * @deprecated use YAHOO.util.Dom instead
+ * @static
+ */
+ getCss: function(id) {
+ var el = YAHOO.util.Dom.get(id);
+ return (el) ? el.style : null;
+ },
+
+ /**
+ * Inner class for cached elements
+ * @class DragDropMgr.ElementWrapper
+ * @for DragDropMgr
+ * @private
+ * @deprecated
+ */
+ ElementWrapper: function(el) {
+ /**
+ * The element
+ * @property el
+ */
+ this.el = el || null;
+ /**
+ * The element id
+ * @property id
+ */
+ this.id = this.el && el.id;
+ /**
+ * A reference to the style property
+ * @property css
+ */
+ this.css = this.el && el.style;
+ },
+
+ /**
+ * Returns the X position of an html element
+ * @method getPosX
+ * @param el the element for which to get the position
+ * @return {int} the X coordinate
+ * @for DragDropMgr
+ * @deprecated use YAHOO.util.Dom.getX instead
+ * @static
+ */
+ getPosX: function(el) {
+ return YAHOO.util.Dom.getX(el);
+ },
+
+ /**
+ * Returns the Y position of an html element
+ * @method getPosY
+ * @param el the element for which to get the position
+ * @return {int} the Y coordinate
+ * @deprecated use YAHOO.util.Dom.getY instead
+ * @static
+ */
+ getPosY: function(el) {
+ return YAHOO.util.Dom.getY(el);
+ },
+
+ /**
+ * Swap two nodes. In IE, we use the native method, for others we
+ * emulate the IE behavior
+ * @method swapNode
+ * @param n1 the first node to swap
+ * @param n2 the other node to swap
+ * @static
+ */
+ swapNode: function(n1, n2) {
+ if (n1.swapNode) {
+ n1.swapNode(n2);
+ } else {
+ var p = n2.parentNode;
+ var s = n2.nextSibling;
+
+ if (s == n1) {
+ p.insertBefore(n1, n2);
+ } else if (n2 == n1.nextSibling) {
+ p.insertBefore(n2, n1);
+ } else {
+ n1.parentNode.replaceChild(n2, n1);
+ p.insertBefore(n1, s);
+ }
+ }
+ },
+
+ /**
+ * Returns the current scroll position
+ * @method getScroll
+ * @private
+ * @static
+ */
+ getScroll: function () {
+ var t, l, dde=document.documentElement, db=document.body;
+ if (dde && (dde.scrollTop || dde.scrollLeft)) {
+ t = dde.scrollTop;
+ l = dde.scrollLeft;
+ } else if (db) {
+ t = db.scrollTop;
+ l = db.scrollLeft;
+ } else {
+ YAHOO.log("could not get scroll property");
+ }
+ return { top: t, left: l };
+ },
+
+ /**
+ * Returns the specified element style property
+ * @method getStyle
+ * @param {HTMLElement} el the element
+ * @param {string} styleProp the style property
+ * @return {string} The value of the style property
+ * @deprecated use YAHOO.util.Dom.getStyle
+ * @static
+ */
+ getStyle: function(el, styleProp) {
+ return YAHOO.util.Dom.getStyle(el, styleProp);
+ },
+
+ /**
+ * Gets the scrollTop
+ * @method getScrollTop
+ * @return {int} the document's scrollTop
+ * @static
+ */
+ getScrollTop: function () { return this.getScroll().top; },
+
+ /**
+ * Gets the scrollLeft
+ * @method getScrollLeft
+ * @return {int} the document's scrollTop
+ * @static
+ */
+ getScrollLeft: function () { return this.getScroll().left; },
+
+ /**
+ * Sets the x/y position of an element to the location of the
+ * target element.
+ * @method moveToEl
+ * @param {HTMLElement} moveEl The element to move
+ * @param {HTMLElement} targetEl The position reference element
+ * @static
+ */
+ moveToEl: function (moveEl, targetEl) {
+ var aCoord = YAHOO.util.Dom.getXY(targetEl);
+ this.logger.log("moveToEl: " + aCoord);
+ YAHOO.util.Dom.setXY(moveEl, aCoord);
+ },
+
+ /**
+ * Gets the client height
+ * @method getClientHeight
+ * @return {int} client height in px
+ * @deprecated use YAHOO.util.Dom.getViewportHeight instead
+ * @static
+ */
+ getClientHeight: function() {
+ return YAHOO.util.Dom.getViewportHeight();
+ },
+
+ /**
+ * Gets the client width
+ * @method getClientWidth
+ * @return {int} client width in px
+ * @deprecated use YAHOO.util.Dom.getViewportWidth instead
+ * @static
+ */
+ getClientWidth: function() {
+ return YAHOO.util.Dom.getViewportWidth();
+ },
+
+ /**
+ * Numeric array sort function
+ * @method numericSort
+ * @static
+ */
+ numericSort: function(a, b) { return (a - b); },
+
+ /**
+ * Internal counter
+ * @property _timeoutCount
+ * @private
+ * @static
+ */
+ _timeoutCount: 0,
+
+ /**
+ * Trying to make the load order less important. Without this we get
+ * an error if this file is loaded before the Event Utility.
+ * @method _addListeners
+ * @private
+ * @static
+ */
+ _addListeners: function() {
+ var DDM = YAHOO.util.DDM;
+ if ( YAHOO.util.Event && document ) {
+ DDM._onLoad();
+ } else {
+ if (DDM._timeoutCount > 2000) {
+ DDM.logger.log("DragDrop requires the Event Utility");
+ } else {
+ setTimeout(DDM._addListeners, 10);
+ if (document && document.body) {
+ DDM._timeoutCount += 1;
+ }
+ }
+ }
+ },
+
+ /**
+ * Recursively searches the immediate parent and all child nodes for
+ * the handle element in order to determine wheter or not it was
+ * clicked.
+ * @method handleWasClicked
+ * @param node the html element to inspect
+ * @static
+ */
+ handleWasClicked: function(node, id) {
+ if (this.isHandle(id, node.id)) {
+ this.logger.log("clicked node is a handle");
+ return true;
+ } else {
+ // check to see if this is a text node child of the one we want
+ var p = node.parentNode;
+ // this.logger.log("p: " + p);
+
+ while (p) {
+ if (this.isHandle(id, p.id)) {
+ return true;
+ } else {
+ this.logger.log(p.id + " is not a handle");
+ p = p.parentNode;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ };
+
+}();
+
+// shorter alias, save a few bytes
+YAHOO.util.DDM = YAHOO.util.DragDropMgr;
+YAHOO.util.DDM._addListeners();
+
+}
+
+/**
+ * A DragDrop implementation where the linked element follows the
+ * mouse cursor during a drag.
+ * @class DD
+ * @extends YAHOO.util.DragDrop
+ * @constructor
+ * @param {String} id the id of the linked element
+ * @param {String} sGroup the group of related DragDrop items
+ * @param {object} config an object containing configurable attributes
+ * Valid properties for DD:
+ * scroll
+ */
+YAHOO.util.DD = function(id, sGroup, config) {
+ if (id) {
+ this.init(id, sGroup, config);
+ }
+};
+
+YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
+
+ /**
+ * When set to true, the utility automatically tries to scroll the browser
+ * window wehn a drag and drop element is dragged near the viewport boundary.
+ * Defaults to true.
+ * @property scroll
+ * @type boolean
+ */
+ scroll: true,
+
+ /**
+ * Sets the pointer offset to the distance between the linked element's top
+ * left corner and the location the element was clicked
+ * @method autoOffset
+ * @param {int} iPageX the X coordinate of the click
+ * @param {int} iPageY the Y coordinate of the click
+ */
+ autoOffset: function(iPageX, iPageY) {
+ var x = iPageX - this.startPageX;
+ var y = iPageY - this.startPageY;
+ this.setDelta(x, y);
+ // this.logger.log("autoOffset el pos: " + aCoord + ", delta: " + x + "," + y);
+ },
+
+ /**
+ * Sets the pointer offset. You can call this directly to force the
+ * offset to be in a particular location (e.g., pass in 0,0 to set it
+ * to the center of the object, as done in YAHOO.widget.Slider)
+ * @method setDelta
+ * @param {int} iDeltaX the distance from the left
+ * @param {int} iDeltaY the distance from the top
+ */
+ setDelta: function(iDeltaX, iDeltaY) {
+ this.deltaX = iDeltaX;
+ this.deltaY = iDeltaY;
+ this.logger.log("deltaX:" + this.deltaX + ", deltaY:" + this.deltaY);
+ },
+
+ /**
+ * Sets the drag element to the location of the mousedown or click event,
+ * maintaining the cursor location relative to the location on the element
+ * that was clicked. Override this if you want to place the element in a
+ * location other than where the cursor is.
+ * @method setDragElPos
+ * @param {int} iPageX the X coordinate of the mousedown or drag event
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event
+ */
+ setDragElPos: function(iPageX, iPageY) {
+ // the first time we do this, we are going to check to make sure
+ // the element has css positioning
+
+ var el = this.getDragEl();
+ this.alignElWithMouse(el, iPageX, iPageY);
+ },
+
+ /**
+ * Sets the element to the location of the mousedown or click event,
+ * maintaining the cursor location relative to the location on the element
+ * that was clicked. Override this if you want to place the element in a
+ * location other than where the cursor is.
+ * @method alignElWithMouse
+ * @param {HTMLElement} el the element to move
+ * @param {int} iPageX the X coordinate of the mousedown or drag event
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event
+ */
+ alignElWithMouse: function(el, iPageX, iPageY) {
+ var oCoord = this.getTargetCoord(iPageX, iPageY);
+ // this.logger.log("****alignElWithMouse : " + el.id + ", " + aCoord + ", " + el.style.display);
+
+ if (!this.deltaSetXY) {
+ var aCoord = [oCoord.x, oCoord.y];
+ YAHOO.util.Dom.setXY(el, aCoord);
+ var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );
+ var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );
+
+ this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
+ } else {
+ YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");
+ YAHOO.util.Dom.setStyle(el, "top", (oCoord.y + this.deltaSetXY[1]) + "px");
+ }
+
+ this.cachePosition(oCoord.x, oCoord.y);
+ this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
+ },
+
+ /**
+ * Saves the most recent position so that we can reset the constraints and
+ * tick marks on-demand. We need to know this so that we can calculate the
+ * number of pixels the element is offset from its original position.
+ * @method cachePosition
+ * @param iPageX the current x position (optional, this just makes it so we
+ * don't have to look it up again)
+ * @param iPageY the current y position (optional, this just makes it so we
+ * don't have to look it up again)
+ */
+ cachePosition: function(iPageX, iPageY) {
+ if (iPageX) {
+ this.lastPageX = iPageX;
+ this.lastPageY = iPageY;
+ } else {
+ var aCoord = YAHOO.util.Dom.getXY(this.getEl());
+ this.lastPageX = aCoord[0];
+ this.lastPageY = aCoord[1];
+ }
+ },
+
+ /**
+ * Auto-scroll the window if the dragged object has been moved beyond the
+ * visible window boundary.
+ * @method autoScroll
+ * @param {int} x the drag element's x position
+ * @param {int} y the drag element's y position
+ * @param {int} h the height of the drag element
+ * @param {int} w the width of the drag element
+ * @private
+ */
+ autoScroll: function(x, y, h, w) {
+
+ if (this.scroll) {
+ // The client height
+ var clientH = this.DDM.getClientHeight();
+
+ // The client width
+ var clientW = this.DDM.getClientWidth();
+
+ // The amt scrolled down
+ var st = this.DDM.getScrollTop();
+
+ // The amt scrolled right
+ var sl = this.DDM.getScrollLeft();
+
+ // Location of the bottom of the element
+ var bot = h + y;
+
+ // Location of the right of the element
+ var right = w + x;
+
+ // The distance from the cursor to the bottom of the visible area,
+ // adjusted so that we don't scroll if the cursor is beyond the
+ // element drag constraints
+ var toBot = (clientH + st - y - this.deltaY);
+
+ // The distance from the cursor to the right of the visible area
+ var toRight = (clientW + sl - x - this.deltaX);
+
+ // this.logger.log( " x: " + x + " y: " + y + " h: " + h +
+ // " clientH: " + clientH + " clientW: " + clientW +
+ // " st: " + st + " sl: " + sl + " bot: " + bot +
+ // " right: " + right + " toBot: " + toBot + " toRight: " + toRight);
+
+ // How close to the edge the cursor must be before we scroll
+ // var thresh = (document.all) ? 100 : 40;
+ var thresh = 40;
+
+ // How many pixels to scroll per autoscroll op. This helps to reduce
+ // clunky scrolling. IE is more sensitive about this ... it needs this
+ // value to be higher.
+ var scrAmt = (document.all) ? 80 : 30;
+
+ // Scroll down if we are near the bottom of the visible page and the
+ // obj extends below the crease
+ if ( bot > clientH && toBot < thresh ) {
+ window.scrollTo(sl, st + scrAmt);
+ }
+
+ // Scroll up if the window is scrolled down and the top of the object
+ // goes above the top border
+ if ( y < st && st > 0 && y - st < thresh ) {
+ window.scrollTo(sl, st - scrAmt);
+ }
+
+ // Scroll right if the obj is beyond the right border and the cursor is
+ // near the border.
+ if ( right > clientW && toRight < thresh ) {
+ window.scrollTo(sl + scrAmt, st);
+ }
+
+ // Scroll left if the window has been scrolled to the right and the obj
+ // extends past the left border
+ if ( x < sl && sl > 0 && x - sl < thresh ) {
+ window.scrollTo(sl - scrAmt, st);
+ }
+ }
+ },
+
+ /**
+ * Finds the location the element should be placed if we want to move
+ * it to where the mouse location less the click offset would place us.
+ * @method getTargetCoord
+ * @param {int} iPageX the X coordinate of the click
+ * @param {int} iPageY the Y coordinate of the click
+ * @return an object that contains the coordinates (Object.x and Object.y)
+ * @private
+ */
+ getTargetCoord: function(iPageX, iPageY) {
+
+ // this.logger.log("getTargetCoord: " + iPageX + ", " + iPageY);
+
+ var x = iPageX - this.deltaX;
+ var y = iPageY - this.deltaY;
+
+ if (this.constrainX) {
+ if (x < this.minX) { x = this.minX; }
+ if (x > this.maxX) { x = this.maxX; }
+ }
+
+ if (this.constrainY) {
+ if (y < this.minY) { y = this.minY; }
+ if (y > this.maxY) { y = this.maxY; }
+ }
+
+ x = this.getTick(x, this.xTicks);
+ y = this.getTick(y, this.yTicks);
+
+ // this.logger.log("getTargetCoord " +
+ // " iPageX: " + iPageX +
+ // " iPageY: " + iPageY +
+ // " x: " + x + ", y: " + y);
+
+ return {x:x, y:y};
+ },
+
+ /*
+ * Sets up config options specific to this class. Overrides
+ * YAHOO.util.DragDrop, but all versions of this method through the
+ * inheritance chain are called
+ */
+ applyConfig: function() {
+ YAHOO.util.DD.superclass.applyConfig.call(this);
+ this.scroll = (this.config.scroll !== false);
+ },
+
+ /*
+ * Event that fires prior to the onMouseDown event. Overrides
+ * YAHOO.util.DragDrop.
+ */
+ b4MouseDown: function(e) {
+ // this.resetConstraints();
+ this.autoOffset(YAHOO.util.Event.getPageX(e),
+ YAHOO.util.Event.getPageY(e));
+ },
+
+ /*
+ * Event that fires prior to the onDrag event. Overrides
+ * YAHOO.util.DragDrop.
+ */
+ b4Drag: function(e) {
+ this.setDragElPos(YAHOO.util.Event.getPageX(e),
+ YAHOO.util.Event.getPageY(e));
+ },
+
+ toString: function() {
+ return ("DD " + this.id);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Debugging ygDragDrop events that can be overridden
+ //////////////////////////////////////////////////////////////////////////
+ /*
+ startDrag: function(x, y) {
+ this.logger.log(this.id.toString() + " startDrag");
+ },
+
+ onDrag: function(e) {
+ this.logger.log(this.id.toString() + " onDrag");
+ },
+
+ onDragEnter: function(e, id) {
+ this.logger.log(this.id.toString() + " onDragEnter: " + id);
+ },
+
+ onDragOver: function(e, id) {
+ this.logger.log(this.id.toString() + " onDragOver: " + id);
+ },
+
+ onDragOut: function(e, id) {
+ this.logger.log(this.id.toString() + " onDragOut: " + id);
+ },
+
+ onDragDrop: function(e, id) {
+ this.logger.log(this.id.toString() + " onDragDrop: " + id);
+ },
+
+ endDrag: function(e) {
+ this.logger.log(this.id.toString() + " endDrag");
+ }
+
+ */
+
+});
+/**
+ * A DragDrop implementation that inserts an empty, bordered div into
+ * the document that follows the cursor during drag operations. At the time of
+ * the click, the frame div is resized to the dimensions of the linked html
+ * element, and moved to the exact location of the linked element.
+ *
+ * References to the "frame" element refer to the single proxy element that
+ * was created to be dragged in place of all DDProxy elements on the
+ * page.
+ *
+ * @class DDProxy
+ * @extends YAHOO.util.DD
+ * @constructor
+ * @param {String} id the id of the linked html element
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ * Valid properties for DDProxy in addition to those in DragDrop:
+ * resizeFrame, centerFrame, dragElId
+ */
+YAHOO.util.DDProxy = function(id, sGroup, config) {
+ if (id) {
+ this.init(id, sGroup, config);
+ this.initFrame();
+ }
+};
+
+/**
+ * The default drag frame div id
+ * @property YAHOO.util.DDProxy.dragElId
+ * @type String
+ * @static
+ */
+YAHOO.util.DDProxy.dragElId = "ygddfdiv";
+
+YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
+
+ /**
+ * By default we resize the drag frame to be the same size as the element
+ * we want to drag (this is to get the frame effect). We can turn it off
+ * if we want a different behavior.
+ * @property resizeFrame
+ * @type boolean
+ */
+ resizeFrame: true,
+
+ /**
+ * By default the frame is positioned exactly where the drag element is, so
+ * we use the cursor offset provided by YAHOO.util.DD. Another option that works only if
+ * you do not have constraints on the obj is to have the drag frame centered
+ * around the cursor. Set centerFrame to true for this effect.
+ * @property centerFrame
+ * @type boolean
+ */
+ centerFrame: false,
+
+ /**
+ * Creates the proxy element if it does not yet exist
+ * @method createFrame
+ */
+ createFrame: function() {
+ var self = this;
+ var body = document.body;
+
+ if (!body || !body.firstChild) {
+ setTimeout( function() { self.createFrame(); }, 50 );
+ return;
+ }
+
+ var div = this.getDragEl();
+
+ if (!div) {
+ div = document.createElement("div");
+ div.id = this.dragElId;
+ var s = div.style;
+
+ s.position = "absolute";
+ s.visibility = "hidden";
+ s.cursor = "move";
+ s.border = "2px solid #aaa";
+ s.zIndex = 999;
+
+ // appendChild can blow up IE if invoked prior to the window load event
+ // while rendering a table. It is possible there are other scenarios
+ // that would cause this to happen as well.
+ body.insertBefore(div, body.firstChild);
+ }
+ },
+
+ /**
+ * Initialization for the drag frame element. Must be called in the
+ * constructor of all subclasses
+ * @method initFrame
+ */
+ initFrame: function() {
+ this.createFrame();
+ },
+
+ applyConfig: function() {
+ this.logger.log("DDProxy applyConfig");
+ YAHOO.util.DDProxy.superclass.applyConfig.call(this);
+
+ this.resizeFrame = (this.config.resizeFrame !== false);
+ this.centerFrame = (this.config.centerFrame);
+ this.setDragElId(this.config.dragElId || YAHOO.util.DDProxy.dragElId);
+ },
+
+ /**
+ * Resizes the drag frame to the dimensions of the clicked object, positions
+ * it over the object, and finally displays it
+ * @method showFrame
+ * @param {int} iPageX X click position
+ * @param {int} iPageY Y click position
+ * @private
+ */
+ showFrame: function(iPageX, iPageY) {
+ var el = this.getEl();
+ var dragEl = this.getDragEl();
+ var s = dragEl.style;
+
+ this._resizeProxy();
+
+ if (this.centerFrame) {
+ this.setDelta( Math.round(parseInt(s.width, 10)/2),
+ Math.round(parseInt(s.height, 10)/2) );
+ }
+
+ this.setDragElPos(iPageX, iPageY);
+
+ YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible");
+ },
+
+ /**
+ * The proxy is automatically resized to the dimensions of the linked
+ * element when a drag is initiated, unless resizeFrame is set to false
+ * @method _resizeProxy
+ * @private
+ */
+ _resizeProxy: function() {
+ if (this.resizeFrame) {
+ var DOM = YAHOO.util.Dom;
+ var el = this.getEl();
+ var dragEl = this.getDragEl();
+
+ var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth" ), 10);
+ var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth" ), 10);
+ var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10);
+ var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth" ), 10);
+
+ if (isNaN(bt)) { bt = 0; }
+ if (isNaN(br)) { br = 0; }
+ if (isNaN(bb)) { bb = 0; }
+ if (isNaN(bl)) { bl = 0; }
+
+ this.logger.log("proxy size: " + bt + " " + br + " " + bb + " " + bl);
+
+ var newWidth = Math.max(0, el.offsetWidth - br - bl);
+ var newHeight = Math.max(0, el.offsetHeight - bt - bb);
+
+ this.logger.log("Resizing proxy element");
+
+ DOM.setStyle( dragEl, "width", newWidth + "px" );
+ DOM.setStyle( dragEl, "height", newHeight + "px" );
+ }
+ },
+
+ // overrides YAHOO.util.DragDrop
+ b4MouseDown: function(e) {
+ var x = YAHOO.util.Event.getPageX(e);
+ var y = YAHOO.util.Event.getPageY(e);
+ this.autoOffset(x, y);
+ this.setDragElPos(x, y);
+ },
+
+ // overrides YAHOO.util.DragDrop
+ b4StartDrag: function(x, y) {
+ // show the drag frame
+ this.logger.log("start drag show frame, x: " + x + ", y: " + y);
+ this.showFrame(x, y);
+ },
+
+ // overrides YAHOO.util.DragDrop
+ b4EndDrag: function(e) {
+ this.logger.log(this.id + " b4EndDrag");
+ YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden");
+ },
+
+ // overrides YAHOO.util.DragDrop
+ // By default we try to move the element to the last location of the frame.
+ // This is so that the default behavior mirrors that of YAHOO.util.DD.
+ endDrag: function(e) {
+ var DOM = YAHOO.util.Dom;
+ this.logger.log(this.id + " endDrag");
+ var lel = this.getEl();
+ var del = this.getDragEl();
+
+ // Show the drag frame briefly so we can get its position
+ // del.style.visibility = "";
+ DOM.setStyle(del, "visibility", "");
+
+ // Hide the linked element before the move to get around a Safari
+ // rendering bug.
+ //lel.style.visibility = "hidden";
+ DOM.setStyle(lel, "visibility", "hidden");
+ YAHOO.util.DDM.moveToEl(lel, del);
+ //del.style.visibility = "hidden";
+ DOM.setStyle(del, "visibility", "hidden");
+ //lel.style.visibility = "";
+ DOM.setStyle(lel, "visibility", "");
+ },
+
+ toString: function() {
+ return ("DDProxy " + this.id);
+ }
+
+});
+/**
+ * A DragDrop implementation that does not move, but can be a drop
+ * target. You would get the same result by simply omitting implementation
+ * for the event callbacks, but this way we reduce the processing cost of the
+ * event listener and the callbacks.
+ * @class DDTarget
+ * @extends YAHOO.util.DragDrop
+ * @constructor
+ * @param {String} id the id of the element that is a drop target
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ * Valid properties for DDTarget in addition to those in
+ * DragDrop:
+ * none
+ */
+YAHOO.util.DDTarget = function(id, sGroup, config) {
+ if (id) {
+ this.initTarget(id, sGroup, config);
+ }
+};
+
+// YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop();
+YAHOO.extend(YAHOO.util.DDTarget, YAHOO.util.DragDrop, {
+ toString: function() {
+ return ("DDTarget " + this.id);
+ }
+});
diff --git a/thirdpartyjs/yui/dragdrop/dragdrop.js b/thirdpartyjs/yui/dragdrop/dragdrop.js
index 48aff4b..3ff1049 100644
--- a/thirdpartyjs/yui/dragdrop/dragdrop.js
+++ b/thirdpartyjs/yui/dragdrop/dragdrop.js
@@ -1,2942 +1,2942 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-(function() {
-
-var Event=YAHOO.util.Event;
-var Dom=YAHOO.util.Dom;
-
-/**
- * Defines the interface and base operation of items that that can be
- * dragged or can be drop targets. It was designed to be extended, overriding
- * the event handlers for startDrag, onDrag, onDragOver, onDragOut.
- * Up to three html elements can be associated with a DragDrop instance:
- *
- * linked element: the element that is passed into the constructor.
- * This is the element which defines the boundaries for interaction with
- * other DragDrop objects.
- * handle element(s): The drag operation only occurs if the element that
- * was clicked matches a handle element. By default this is the linked
- * element, but there are times that you will want only a portion of the
- * linked element to initiate the drag operation, and the setHandleElId()
- * method provides a way to define this.
- * drag element: this represents an the element that would be moved along
- * with the cursor during a drag operation. By default, this is the linked
- * element itself as in {@link YAHOO.util.DD}. setDragElId() lets you define
- * a separate element that would be moved, as in {@link YAHOO.util.DDProxy}
- *
- *
- * This class should not be instantiated until the onload event to ensure that
- * the associated elements are available.
- * The following would define a DragDrop obj that would interact with any
- * other DragDrop obj in the "group1" group:
- *
- * dd = new YAHOO.util.DragDrop("div1", "group1");
- *
- * Since none of the event handlers have been implemented, nothing would
- * actually happen if you were to run the code above. Normally you would
- * override this class or one of the default implementations, but you can
- * also override the methods you want on an instance of the class...
- *
- * dd.onDragDrop = function(e, id) {
- * alert("dd was dropped on " + id);
- * }
- *
- * @namespace YAHOO.util
- * @class DragDrop
- * @constructor
- * @param {String} id of the element that is linked to this instance
- * @param {String} sGroup the group of related DragDrop objects
- * @param {object} config an object containing configurable attributes
- * Valid properties for DragDrop:
- * padding, isTarget, maintainOffset, primaryButtonOnly
- */
-YAHOO.util.DragDrop = function(id, sGroup, config) {
- if (id) {
- this.init(id, sGroup, config);
- }
-};
-
-YAHOO.util.DragDrop.prototype = {
-
- /**
- * The id of the element associated with this object. This is what we
- * refer to as the "linked element" because the size and position of
- * this element is used to determine when the drag and drop objects have
- * interacted.
- * @property id
- * @type String
- */
- id: null,
-
- /**
- * Configuration attributes passed into the constructor
- * @property config
- * @type object
- */
- config: null,
-
- /**
- * The id of the element that will be dragged. By default this is same
- * as the linked element , but could be changed to another element. Ex:
- * YAHOO.util.DDProxy
- * @property dragElId
- * @type String
- * @private
- */
- dragElId: null,
-
- /**
- * the id of the element that initiates the drag operation. By default
- * this is the linked element, but could be changed to be a child of this
- * element. This lets us do things like only starting the drag when the
- * header element within the linked html element is clicked.
- * @property handleElId
- * @type String
- * @private
- */
- handleElId: null,
-
- /**
- * An associative array of HTML tags that will be ignored if clicked.
- * @property invalidHandleTypes
- * @type {string: string}
- */
- invalidHandleTypes: null,
-
- /**
- * An associative array of ids for elements that will be ignored if clicked
- * @property invalidHandleIds
- * @type {string: string}
- */
- invalidHandleIds: null,
-
- /**
- * An indexted array of css class names for elements that will be ignored
- * if clicked.
- * @property invalidHandleClasses
- * @type string[]
- */
- invalidHandleClasses: null,
-
- /**
- * The linked element's absolute X position at the time the drag was
- * started
- * @property startPageX
- * @type int
- * @private
- */
- startPageX: 0,
-
- /**
- * The linked element's absolute X position at the time the drag was
- * started
- * @property startPageY
- * @type int
- * @private
- */
- startPageY: 0,
-
- /**
- * The group defines a logical collection of DragDrop objects that are
- * related. Instances only get events when interacting with other
- * DragDrop object in the same group. This lets us define multiple
- * groups using a single DragDrop subclass if we want.
- * @property groups
- * @type {string: string}
- */
- groups: null,
-
- /**
- * Individual drag/drop instances can be locked. This will prevent
- * onmousedown start drag.
- * @property locked
- * @type boolean
- * @private
- */
- locked: false,
-
- /**
- * Lock this instance
- * @method lock
- */
- lock: function() { this.locked = true; },
-
- /**
- * Unlock this instace
- * @method unlock
- */
- unlock: function() { this.locked = false; },
-
- /**
- * By default, all insances can be a drop target. This can be disabled by
- * setting isTarget to false.
- * @method isTarget
- * @type boolean
- */
- isTarget: true,
-
- /**
- * The padding configured for this drag and drop object for calculating
- * the drop zone intersection with this object.
- * @method padding
- * @type int[]
- */
- padding: null,
-
- /**
- * Cached reference to the linked element
- * @property _domRef
- * @private
- */
- _domRef: null,
-
- /**
- * Internal typeof flag
- * @property __ygDragDrop
- * @private
- */
- __ygDragDrop: true,
-
- /**
- * Set to true when horizontal contraints are applied
- * @property constrainX
- * @type boolean
- * @private
- */
- constrainX: false,
-
- /**
- * Set to true when vertical contraints are applied
- * @property constrainY
- * @type boolean
- * @private
- */
- constrainY: false,
-
- /**
- * The left constraint
- * @property minX
- * @type int
- * @private
- */
- minX: 0,
-
- /**
- * The right constraint
- * @property maxX
- * @type int
- * @private
- */
- maxX: 0,
-
- /**
- * The up constraint
- * @property minY
- * @type int
- * @type int
- * @private
- */
- minY: 0,
-
- /**
- * The down constraint
- * @property maxY
- * @type int
- * @private
- */
- maxY: 0,
-
- /**
- * Maintain offsets when we resetconstraints. Set to true when you want
- * the position of the element relative to its parent to stay the same
- * when the page changes
- *
- * @property maintainOffset
- * @type boolean
- */
- maintainOffset: false,
-
- /**
- * Array of pixel locations the element will snap to if we specified a
- * horizontal graduation/interval. This array is generated automatically
- * when you define a tick interval.
- * @property xTicks
- * @type int[]
- */
- xTicks: null,
-
- /**
- * Array of pixel locations the element will snap to if we specified a
- * vertical graduation/interval. This array is generated automatically
- * when you define a tick interval.
- * @property yTicks
- * @type int[]
- */
- yTicks: null,
-
- /**
- * By default the drag and drop instance will only respond to the primary
- * button click (left button for a right-handed mouse). Set to true to
- * allow drag and drop to start with any mouse click that is propogated
- * by the browser
- * @property primaryButtonOnly
- * @type boolean
- */
- primaryButtonOnly: true,
-
- /**
- * The availabe property is false until the linked dom element is accessible.
- * @property available
- * @type boolean
- */
- available: false,
-
- /**
- * By default, drags can only be initiated if the mousedown occurs in the
- * region the linked element is. This is done in part to work around a
- * bug in some browsers that mis-report the mousedown if the previous
- * mouseup happened outside of the window. This property is set to true
- * if outer handles are defined.
- *
- * @property hasOuterHandles
- * @type boolean
- * @default false
- */
- hasOuterHandles: false,
-
- /**
- * Code that executes immediately before the startDrag event
- * @method b4StartDrag
- * @private
- */
- b4StartDrag: function(x, y) { },
-
- /**
- * Abstract method called after a drag/drop object is clicked
- * and the drag or mousedown time thresholds have beeen met.
- * @method startDrag
- * @param {int} X click location
- * @param {int} Y click location
- */
- startDrag: function(x, y) { /* override this */ },
-
- /**
- * Code that executes immediately before the onDrag event
- * @method b4Drag
- * @private
- */
- b4Drag: function(e) { },
-
- /**
- * Abstract method called during the onMouseMove event while dragging an
- * object.
- * @method onDrag
- * @param {Event} e the mousemove event
- */
- onDrag: function(e) { /* override this */ },
-
- /**
- * Abstract method called when this element fist begins hovering over
- * another DragDrop obj
- * @method onDragEnter
- * @param {Event} e the mousemove event
- * @param {String|DragDrop[]} id In POINT mode, the element
- * id this is hovering over. In INTERSECT mode, an array of one or more
- * dragdrop items being hovered over.
- */
- onDragEnter: function(e, id) { /* override this */ },
-
- /**
- * Code that executes immediately before the onDragOver event
- * @method b4DragOver
- * @private
- */
- b4DragOver: function(e) { },
-
- /**
- * Abstract method called when this element is hovering over another
- * DragDrop obj
- * @method onDragOver
- * @param {Event} e the mousemove event
- * @param {String|DragDrop[]} id In POINT mode, the element
- * id this is hovering over. In INTERSECT mode, an array of dd items
- * being hovered over.
- */
- onDragOver: function(e, id) { /* override this */ },
-
- /**
- * Code that executes immediately before the onDragOut event
- * @method b4DragOut
- * @private
- */
- b4DragOut: function(e) { },
-
- /**
- * Abstract method called when we are no longer hovering over an element
- * @method onDragOut
- * @param {Event} e the mousemove event
- * @param {String|DragDrop[]} id In POINT mode, the element
- * id this was hovering over. In INTERSECT mode, an array of dd items
- * that the mouse is no longer over.
- */
- onDragOut: function(e, id) { /* override this */ },
-
- /**
- * Code that executes immediately before the onDragDrop event
- * @method b4DragDrop
- * @private
- */
- b4DragDrop: function(e) { },
-
- /**
- * Abstract method called when this item is dropped on another DragDrop
- * obj
- * @method onDragDrop
- * @param {Event} e the mouseup event
- * @param {String|DragDrop[]} id In POINT mode, the element
- * id this was dropped on. In INTERSECT mode, an array of dd items this
- * was dropped on.
- */
- onDragDrop: function(e, id) { /* override this */ },
-
- /**
- * Abstract method called when this item is dropped on an area with no
- * drop target
- * @method onInvalidDrop
- * @param {Event} e the mouseup event
- */
- onInvalidDrop: function(e) { /* override this */ },
-
- /**
- * Code that executes immediately before the endDrag event
- * @method b4EndDrag
- * @private
- */
- b4EndDrag: function(e) { },
-
- /**
- * Fired when we are done dragging the object
- * @method endDrag
- * @param {Event} e the mouseup event
- */
- endDrag: function(e) { /* override this */ },
-
- /**
- * Code executed immediately before the onMouseDown event
- * @method b4MouseDown
- * @param {Event} e the mousedown event
- * @private
- */
- b4MouseDown: function(e) { },
-
- /**
- * Event handler that fires when a drag/drop obj gets a mousedown
- * @method onMouseDown
- * @param {Event} e the mousedown event
- */
- onMouseDown: function(e) { /* override this */ },
-
- /**
- * Event handler that fires when a drag/drop obj gets a mouseup
- * @method onMouseUp
- * @param {Event} e the mouseup event
- */
- onMouseUp: function(e) { /* override this */ },
-
- /**
- * Override the onAvailable method to do what is needed after the initial
- * position was determined.
- * @method onAvailable
- */
- onAvailable: function () {
- },
-
- /**
- * Returns a reference to the linked element
- * @method getEl
- * @return {HTMLElement} the html element
- */
- getEl: function() {
- if (!this._domRef) {
- this._domRef = Dom.get(this.id);
- }
-
- return this._domRef;
- },
-
- /**
- * Returns a reference to the actual element to drag. By default this is
- * the same as the html element, but it can be assigned to another
- * element. An example of this can be found in YAHOO.util.DDProxy
- * @method getDragEl
- * @return {HTMLElement} the html element
- */
- getDragEl: function() {
- return Dom.get(this.dragElId);
- },
-
- /**
- * Sets up the DragDrop object. Must be called in the constructor of any
- * YAHOO.util.DragDrop subclass
- * @method init
- * @param id the id of the linked element
- * @param {String} sGroup the group of related items
- * @param {object} config configuration attributes
- */
- init: function(id, sGroup, config) {
- this.initTarget(id, sGroup, config);
- Event.on(this.id, "mousedown", this.handleMouseDown, this, true);
- // Event.on(this.id, "selectstart", Event.preventDefault);
- },
-
- /**
- * Initializes Targeting functionality only... the object does not
- * get a mousedown handler.
- * @method initTarget
- * @param id the id of the linked element
- * @param {String} sGroup the group of related items
- * @param {object} config configuration attributes
- */
- initTarget: function(id, sGroup, config) {
-
- // configuration attributes
- this.config = config || {};
-
- // create a local reference to the drag and drop manager
- this.DDM = YAHOO.util.DDM;
- // initialize the groups array
- this.groups = {};
-
- // assume that we have an element reference instead of an id if the
- // parameter is not a string
- if (typeof id !== "string") {
- YAHOO.log("id is not a string, assuming it is an HTMLElement");
- id = Dom.generateId(id);
- }
-
- // set the id
- this.id = id;
-
- // add to an interaction group
- this.addToGroup((sGroup) ? sGroup : "default");
-
- // We don't want to register this as the handle with the manager
- // so we just set the id rather than calling the setter.
- this.handleElId = id;
-
- Event.onAvailable(id, this.handleOnAvailable, this, true);
-
-
- // the linked element is the element that gets dragged by default
- this.setDragElId(id);
-
- // by default, clicked anchors will not start drag operations.
- // @TODO what else should be here? Probably form fields.
- this.invalidHandleTypes = { A: "A" };
- this.invalidHandleIds = {};
- this.invalidHandleClasses = [];
-
- this.applyConfig();
- },
-
- /**
- * Applies the configuration parameters that were passed into the constructor.
- * This is supposed to happen at each level through the inheritance chain. So
- * a DDProxy implentation will execute apply config on DDProxy, DD, and
- * DragDrop in order to get all of the parameters that are available in
- * each object.
- * @method applyConfig
- */
- applyConfig: function() {
-
- // configurable properties:
- // padding, isTarget, maintainOffset, primaryButtonOnly
- this.padding = this.config.padding || [0, 0, 0, 0];
- this.isTarget = (this.config.isTarget !== false);
- this.maintainOffset = (this.config.maintainOffset);
- this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);
-
- },
-
- /**
- * Executed when the linked element is available
- * @method handleOnAvailable
- * @private
- */
- handleOnAvailable: function() {
- this.available = true;
- this.resetConstraints();
- this.onAvailable();
- },
-
- /**
- * Configures the padding for the target zone in px. Effectively expands
- * (or reduces) the virtual object size for targeting calculations.
- * Supports css-style shorthand; if only one parameter is passed, all sides
- * will have that padding, and if only two are passed, the top and bottom
- * will have the first param, the left and right the second.
- * @method setPadding
- * @param {int} iTop Top pad
- * @param {int} iRight Right pad
- * @param {int} iBot Bot pad
- * @param {int} iLeft Left pad
- */
- setPadding: function(iTop, iRight, iBot, iLeft) {
- // this.padding = [iLeft, iRight, iTop, iBot];
- if (!iRight && 0 !== iRight) {
- this.padding = [iTop, iTop, iTop, iTop];
- } else if (!iBot && 0 !== iBot) {
- this.padding = [iTop, iRight, iTop, iRight];
- } else {
- this.padding = [iTop, iRight, iBot, iLeft];
- }
- },
-
- /**
- * Stores the initial placement of the linked element.
- * @method setInitialPosition
- * @param {int} diffX the X offset, default 0
- * @param {int} diffY the Y offset, default 0
- */
- setInitPosition: function(diffX, diffY) {
- var el = this.getEl();
-
- if (!this.DDM.verifyEl(el)) {
- return;
- }
-
- var dx = diffX || 0;
- var dy = diffY || 0;
-
- var p = Dom.getXY( el );
-
- this.initPageX = p[0] - dx;
- this.initPageY = p[1] - dy;
-
- this.lastPageX = p[0];
- this.lastPageY = p[1];
-
-
- this.setStartPosition(p);
- },
-
- /**
- * Sets the start position of the element. This is set when the obj
- * is initialized, the reset when a drag is started.
- * @method setStartPosition
- * @param pos current position (from previous lookup)
- * @private
- */
- setStartPosition: function(pos) {
- var p = pos || Dom.getXY( this.getEl() );
- this.deltaSetXY = null;
-
- this.startPageX = p[0];
- this.startPageY = p[1];
- },
-
- /**
- * Add this instance to a group of related drag/drop objects. All
- * instances belong to at least one group, and can belong to as many
- * groups as needed.
- * @method addToGroup
- * @param sGroup {string} the name of the group
- */
- addToGroup: function(sGroup) {
- this.groups[sGroup] = true;
- this.DDM.regDragDrop(this, sGroup);
- },
-
- /**
- * Remove's this instance from the supplied interaction group
- * @method removeFromGroup
- * @param {string} sGroup The group to drop
- */
- removeFromGroup: function(sGroup) {
- if (this.groups[sGroup]) {
- delete this.groups[sGroup];
- }
-
- this.DDM.removeDDFromGroup(this, sGroup);
- },
-
- /**
- * Allows you to specify that an element other than the linked element
- * will be moved with the cursor during a drag
- * @method setDragElId
- * @param id {string} the id of the element that will be used to initiate the drag
- */
- setDragElId: function(id) {
- this.dragElId = id;
- },
-
- /**
- * Allows you to specify a child of the linked element that should be
- * used to initiate the drag operation. An example of this would be if
- * you have a content div with text and links. Clicking anywhere in the
- * content area would normally start the drag operation. Use this method
- * to specify that an element inside of the content div is the element
- * that starts the drag operation.
- * @method setHandleElId
- * @param id {string} the id of the element that will be used to
- * initiate the drag.
- */
- setHandleElId: function(id) {
- if (typeof id !== "string") {
- YAHOO.log("id is not a string, assuming it is an HTMLElement");
- id = Dom.generateId(id);
- }
- this.handleElId = id;
- this.DDM.regHandle(this.id, id);
- },
-
- /**
- * Allows you to set an element outside of the linked element as a drag
- * handle
- * @method setOuterHandleElId
- * @param id the id of the element that will be used to initiate the drag
- */
- setOuterHandleElId: function(id) {
- if (typeof id !== "string") {
- YAHOO.log("id is not a string, assuming it is an HTMLElement");
- id = Dom.generateId(id);
- }
- Event.on(id, "mousedown",
- this.handleMouseDown, this, true);
- this.setHandleElId(id);
-
- this.hasOuterHandles = true;
- },
-
- /**
- * Remove all drag and drop hooks for this element
- * @method unreg
- */
- unreg: function() {
- Event.removeListener(this.id, "mousedown",
- this.handleMouseDown);
- this._domRef = null;
- this.DDM._remove(this);
- },
-
- /**
- * Returns true if this instance is locked, or the drag drop mgr is locked
- * (meaning that all drag/drop is disabled on the page.)
- * @method isLocked
- * @return {boolean} true if this obj or all drag/drop is locked, else
- * false
- */
- isLocked: function() {
- return (this.DDM.isLocked() || this.locked);
- },
-
- /**
- * Fired when this object is clicked
- * @method handleMouseDown
- * @param {Event} e
- * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)
- * @private
- */
- handleMouseDown: function(e, oDD) {
-
- var button = e.which || e.button;
-
- if (this.primaryButtonOnly && button > 1) {
- return;
- }
-
- if (this.isLocked()) {
- return;
- }
-
- this.DDM.refreshCache(this.groups);
- // var self = this;
- // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);
-
- // Only process the event if we really clicked within the linked
- // element. The reason we make this check is that in the case that
- // another element was moved between the clicked element and the
- // cursor in the time between the mousedown and mouseup events. When
- // this happens, the element gets the next mousedown event
- // regardless of where on the screen it happened.
- var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e));
- if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) {
- } else {
- if (this.clickValidator(e)) {
- // set the initial element position
- this.setStartPosition();
-
-
- this.b4MouseDown(e);
- this.onMouseDown(e);
- this.DDM.handleMouseDown(e, this);
-
- this.DDM.stopEvent(e);
- } else {
-
-
- }
- }
- },
-
- clickValidator: function(e) {
- var target = Event.getTarget(e);
- return ( this.isValidHandleChild(target) &&
- (this.id == this.handleElId ||
- this.DDM.handleWasClicked(target, this.id)) );
- },
-
- /**
- * Allows you to specify a tag name that should not start a drag operation
- * when clicked. This is designed to facilitate embedding links within a
- * drag handle that do something other than start the drag.
- * @method addInvalidHandleType
- * @param {string} tagName the type of element to exclude
- */
- addInvalidHandleType: function(tagName) {
- var type = tagName.toUpperCase();
- this.invalidHandleTypes[type] = type;
- },
-
- /**
- * Lets you to specify an element id for a child of a drag handle
- * that should not initiate a drag
- * @method addInvalidHandleId
- * @param {string} id the element id of the element you wish to ignore
- */
- addInvalidHandleId: function(id) {
- if (typeof id !== "string") {
- YAHOO.log("id is not a string, assuming it is an HTMLElement");
- id = Dom.generateId(id);
- }
- this.invalidHandleIds[id] = id;
- },
-
- /**
- * Lets you specify a css class of elements that will not initiate a drag
- * @method addInvalidHandleClass
- * @param {string} cssClass the class of the elements you wish to ignore
- */
- addInvalidHandleClass: function(cssClass) {
- this.invalidHandleClasses.push(cssClass);
- },
-
- /**
- * Unsets an excluded tag name set by addInvalidHandleType
- * @method removeInvalidHandleType
- * @param {string} tagName the type of element to unexclude
- */
- removeInvalidHandleType: function(tagName) {
- var type = tagName.toUpperCase();
- // this.invalidHandleTypes[type] = null;
- delete this.invalidHandleTypes[type];
- },
-
- /**
- * Unsets an invalid handle id
- * @method removeInvalidHandleId
- * @param {string} id the id of the element to re-enable
- */
- removeInvalidHandleId: function(id) {
- if (typeof id !== "string") {
- YAHOO.log("id is not a string, assuming it is an HTMLElement");
- id = Dom.generateId(id);
- }
- delete this.invalidHandleIds[id];
- },
-
- /**
- * Unsets an invalid css class
- * @method removeInvalidHandleClass
- * @param {string} cssClass the class of the element(s) you wish to
- * re-enable
- */
- removeInvalidHandleClass: function(cssClass) {
- for (var i=0, len=this.invalidHandleClasses.length; i= this.minX; i = i - iTickSize) {
- if (!tickMap[i]) {
- this.xTicks[this.xTicks.length] = i;
- tickMap[i] = true;
- }
- }
-
- for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
- if (!tickMap[i]) {
- this.xTicks[this.xTicks.length] = i;
- tickMap[i] = true;
- }
- }
-
- this.xTicks.sort(this.DDM.numericSort) ;
- },
-
- /**
- * Create the array of vertical tick marks if an interval was specified in
- * setYConstraint().
- * @method setYTicks
- * @private
- */
- setYTicks: function(iStartY, iTickSize) {
- this.yTicks = [];
- this.yTickSize = iTickSize;
-
- var tickMap = {};
-
- for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
- if (!tickMap[i]) {
- this.yTicks[this.yTicks.length] = i;
- tickMap[i] = true;
- }
- }
-
- for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
- if (!tickMap[i]) {
- this.yTicks[this.yTicks.length] = i;
- tickMap[i] = true;
- }
- }
-
- this.yTicks.sort(this.DDM.numericSort) ;
- },
-
- /**
- * By default, the element can be dragged any place on the screen. Use
- * this method to limit the horizontal travel of the element. Pass in
- * 0,0 for the parameters if you want to lock the drag to the y axis.
- * @method setXConstraint
- * @param {int} iLeft the number of pixels the element can move to the left
- * @param {int} iRight the number of pixels the element can move to the
- * right
- * @param {int} iTickSize optional parameter for specifying that the
- * element
- * should move iTickSize pixels at a time.
- */
- setXConstraint: function(iLeft, iRight, iTickSize) {
- this.leftConstraint = iLeft;
- this.rightConstraint = iRight;
-
- this.minX = this.initPageX - iLeft;
- this.maxX = this.initPageX + iRight;
- if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
-
- this.constrainX = true;
- },
-
- /**
- * Clears any constraints applied to this instance. Also clears ticks
- * since they can't exist independent of a constraint at this time.
- * @method clearConstraints
- */
- clearConstraints: function() {
- this.constrainX = false;
- this.constrainY = false;
- this.clearTicks();
- },
-
- /**
- * Clears any tick interval defined for this instance
- * @method clearTicks
- */
- clearTicks: function() {
- this.xTicks = null;
- this.yTicks = null;
- this.xTickSize = 0;
- this.yTickSize = 0;
- },
-
- /**
- * By default, the element can be dragged any place on the screen. Set
- * this to limit the vertical travel of the element. Pass in 0,0 for the
- * parameters if you want to lock the drag to the x axis.
- * @method setYConstraint
- * @param {int} iUp the number of pixels the element can move up
- * @param {int} iDown the number of pixels the element can move down
- * @param {int} iTickSize optional parameter for specifying that the
- * element should move iTickSize pixels at a time.
- */
- setYConstraint: function(iUp, iDown, iTickSize) {
- this.topConstraint = iUp;
- this.bottomConstraint = iDown;
-
- this.minY = this.initPageY - iUp;
- this.maxY = this.initPageY + iDown;
- if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
-
- this.constrainY = true;
-
- },
-
- /**
- * resetConstraints must be called if you manually reposition a dd element.
- * @method resetConstraints
- * @param {boolean} maintainOffset
- */
- resetConstraints: function() {
-
-
- // Maintain offsets if necessary
- if (this.initPageX || this.initPageX === 0) {
- // figure out how much this thing has moved
- var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
- var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
-
- this.setInitPosition(dx, dy);
-
- // This is the first time we have detected the element's position
- } else {
- this.setInitPosition();
- }
-
- if (this.constrainX) {
- this.setXConstraint( this.leftConstraint,
- this.rightConstraint,
- this.xTickSize );
- }
-
- if (this.constrainY) {
- this.setYConstraint( this.topConstraint,
- this.bottomConstraint,
- this.yTickSize );
- }
- },
-
- /**
- * Normally the drag element is moved pixel by pixel, but we can specify
- * that it move a number of pixels at a time. This method resolves the
- * location when we have it set up like this.
- * @method getTick
- * @param {int} val where we want to place the object
- * @param {int[]} tickArray sorted array of valid points
- * @return {int} the closest tick
- * @private
- */
- getTick: function(val, tickArray) {
-
- if (!tickArray) {
- // If tick interval is not defined, it is effectively 1 pixel,
- // so we return the value passed to us.
- return val;
- } else if (tickArray[0] >= val) {
- // The value is lower than the first tick, so we return the first
- // tick.
- return tickArray[0];
- } else {
- for (var i=0, len=tickArray.length; i= val) {
- var diff1 = val - tickArray[i];
- var diff2 = tickArray[next] - val;
- return (diff2 > diff1) ? tickArray[i] : tickArray[next];
- }
- }
-
- // The value is larger than the last tick, so we return the last
- // tick.
- return tickArray[tickArray.length - 1];
- }
- },
-
- /**
- * toString method
- * @method toString
- * @return {string} string representation of the dd obj
- */
- toString: function() {
- return ("DragDrop " + this.id);
- }
-
-};
-
-})();
-/**
- * The drag and drop utility provides a framework for building drag and drop
- * applications. In addition to enabling drag and drop for specific elements,
- * the drag and drop elements are tracked by the manager class, and the
- * interactions between the various elements are tracked during the drag and
- * the implementing code is notified about these important moments.
- * @module dragdrop
- * @title Drag and Drop
- * @requires yahoo,dom,event
- * @namespace YAHOO.util
- */
-
-// Only load the library once. Rewriting the manager class would orphan
-// existing drag and drop instances.
-if (!YAHOO.util.DragDropMgr) {
-
-/**
- * DragDropMgr is a singleton that tracks the element interaction for
- * all DragDrop items in the window. Generally, you will not call
- * this class directly, but it does have helper methods that could
- * be useful in your DragDrop implementations.
- * @class DragDropMgr
- * @static
- */
-YAHOO.util.DragDropMgr = function() {
-
- var Event = YAHOO.util.Event;
-
- return {
-
- /**
- * Two dimensional Array of registered DragDrop objects. The first
- * dimension is the DragDrop item group, the second the DragDrop
- * object.
- * @property ids
- * @type {string: string}
- * @private
- * @static
- */
- ids: {},
-
- /**
- * Array of element ids defined as drag handles. Used to determine
- * if the element that generated the mousedown event is actually the
- * handle and not the html element itself.
- * @property handleIds
- * @type {string: string}
- * @private
- * @static
- */
- handleIds: {},
-
- /**
- * the DragDrop object that is currently being dragged
- * @property dragCurrent
- * @type DragDrop
- * @private
- * @static
- **/
- dragCurrent: null,
-
- /**
- * the DragDrop object(s) that are being hovered over
- * @property dragOvers
- * @type Array
- * @private
- * @static
- */
- dragOvers: {},
-
- /**
- * the X distance between the cursor and the object being dragged
- * @property deltaX
- * @type int
- * @private
- * @static
- */
- deltaX: 0,
-
- /**
- * the Y distance between the cursor and the object being dragged
- * @property deltaY
- * @type int
- * @private
- * @static
- */
- deltaY: 0,
-
- /**
- * Flag to determine if we should prevent the default behavior of the
- * events we define. By default this is true, but this can be set to
- * false if you need the default behavior (not recommended)
- * @property preventDefault
- * @type boolean
- * @static
- */
- preventDefault: true,
-
- /**
- * Flag to determine if we should stop the propagation of the events
- * we generate. This is true by default but you may want to set it to
- * false if the html element contains other features that require the
- * mouse click.
- * @property stopPropagation
- * @type boolean
- * @static
- */
- stopPropagation: true,
-
- /**
- * Internal flag that is set to true when drag and drop has been
- * intialized
- * @property initialized
- * @private
- * @static
- */
- initalized: false,
-
- /**
- * All drag and drop can be disabled.
- * @property locked
- * @private
- * @static
- */
- locked: false,
-
- /**
- * Called the first time an element is registered.
- * @method init
- * @private
- * @static
- */
- init: function() {
- this.initialized = true;
- },
-
- /**
- * In point mode, drag and drop interaction is defined by the
- * location of the cursor during the drag/drop
- * @property POINT
- * @type int
- * @static
- */
- POINT: 0,
-
- /**
- * In intersect mode, drag and drop interactio nis defined by the
- * overlap of two or more drag and drop objects.
- * @property INTERSECT
- * @type int
- * @static
- */
- INTERSECT: 1,
-
- /**
- * The current drag and drop mode. Default: POINT
- * @property mode
- * @type int
- * @static
- */
- mode: 0,
-
- /**
- * Runs method on all drag and drop objects
- * @method _execOnAll
- * @private
- * @static
- */
- _execOnAll: function(sMethod, args) {
- for (var i in this.ids) {
- for (var j in this.ids[i]) {
- var oDD = this.ids[i][j];
- if (! this.isTypeOfDD(oDD)) {
- continue;
- }
- oDD[sMethod].apply(oDD, args);
- }
- }
- },
-
- /**
- * Drag and drop initialization. Sets up the global event handlers
- * @method _onLoad
- * @private
- * @static
- */
- _onLoad: function() {
-
- this.init();
-
-
- Event.on(document, "mouseup", this.handleMouseUp, this, true);
- Event.on(document, "mousemove", this.handleMouseMove, this, true);
- Event.on(window, "unload", this._onUnload, this, true);
- Event.on(window, "resize", this._onResize, this, true);
- // Event.on(window, "mouseout", this._test);
-
- },
-
- /**
- * Reset constraints on all drag and drop objs
- * @method _onResize
- * @private
- * @static
- */
- _onResize: function(e) {
- this._execOnAll("resetConstraints", []);
- },
-
- /**
- * Lock all drag and drop functionality
- * @method lock
- * @static
- */
- lock: function() { this.locked = true; },
-
- /**
- * Unlock all drag and drop functionality
- * @method unlock
- * @static
- */
- unlock: function() { this.locked = false; },
-
- /**
- * Is drag and drop locked?
- * @method isLocked
- * @return {boolean} True if drag and drop is locked, false otherwise.
- * @static
- */
- isLocked: function() { return this.locked; },
-
- /**
- * Location cache that is set for all drag drop objects when a drag is
- * initiated, cleared when the drag is finished.
- * @property locationCache
- * @private
- * @static
- */
- locationCache: {},
-
- /**
- * Set useCache to false if you want to force object the lookup of each
- * drag and drop linked element constantly during a drag.
- * @property useCache
- * @type boolean
- * @static
- */
- useCache: true,
-
- /**
- * The number of pixels that the mouse needs to move after the
- * mousedown before the drag is initiated. Default=3;
- * @property clickPixelThresh
- * @type int
- * @static
- */
- clickPixelThresh: 3,
-
- /**
- * The number of milliseconds after the mousedown event to initiate the
- * drag if we don't get a mouseup event. Default=1000
- * @property clickTimeThresh
- * @type int
- * @static
- */
- clickTimeThresh: 1000,
-
- /**
- * Flag that indicates that either the drag pixel threshold or the
- * mousdown time threshold has been met
- * @property dragThreshMet
- * @type boolean
- * @private
- * @static
- */
- dragThreshMet: false,
-
- /**
- * Timeout used for the click time threshold
- * @property clickTimeout
- * @type Object
- * @private
- * @static
- */
- clickTimeout: null,
-
- /**
- * The X position of the mousedown event stored for later use when a
- * drag threshold is met.
- * @property startX
- * @type int
- * @private
- * @static
- */
- startX: 0,
-
- /**
- * The Y position of the mousedown event stored for later use when a
- * drag threshold is met.
- * @property startY
- * @type int
- * @private
- * @static
- */
- startY: 0,
-
- /**
- * Each DragDrop instance must be registered with the DragDropMgr.
- * This is executed in DragDrop.init()
- * @method regDragDrop
- * @param {DragDrop} oDD the DragDrop object to register
- * @param {String} sGroup the name of the group this element belongs to
- * @static
- */
- regDragDrop: function(oDD, sGroup) {
- if (!this.initialized) { this.init(); }
-
- if (!this.ids[sGroup]) {
- this.ids[sGroup] = {};
- }
- this.ids[sGroup][oDD.id] = oDD;
- },
-
- /**
- * Removes the supplied dd instance from the supplied group. Executed
- * by DragDrop.removeFromGroup, so don't call this function directly.
- * @method removeDDFromGroup
- * @private
- * @static
- */
- removeDDFromGroup: function(oDD, sGroup) {
- if (!this.ids[sGroup]) {
- this.ids[sGroup] = {};
- }
-
- var obj = this.ids[sGroup];
- if (obj && obj[oDD.id]) {
- delete obj[oDD.id];
- }
- },
-
- /**
- * Unregisters a drag and drop item. This is executed in
- * DragDrop.unreg, use that method instead of calling this directly.
- * @method _remove
- * @private
- * @static
- */
- _remove: function(oDD) {
- for (var g in oDD.groups) {
- if (g && this.ids[g][oDD.id]) {
- delete this.ids[g][oDD.id];
- }
- }
- delete this.handleIds[oDD.id];
- },
-
- /**
- * Each DragDrop handle element must be registered. This is done
- * automatically when executing DragDrop.setHandleElId()
- * @method regHandle
- * @param {String} sDDId the DragDrop id this element is a handle for
- * @param {String} sHandleId the id of the element that is the drag
- * handle
- * @static
- */
- regHandle: function(sDDId, sHandleId) {
- if (!this.handleIds[sDDId]) {
- this.handleIds[sDDId] = {};
- }
- this.handleIds[sDDId][sHandleId] = sHandleId;
- },
-
- /**
- * Utility function to determine if a given element has been
- * registered as a drag drop item.
- * @method isDragDrop
- * @param {String} id the element id to check
- * @return {boolean} true if this element is a DragDrop item,
- * false otherwise
- * @static
- */
- isDragDrop: function(id) {
- return ( this.getDDById(id) ) ? true : false;
- },
-
- /**
- * Returns the drag and drop instances that are in all groups the
- * passed in instance belongs to.
- * @method getRelated
- * @param {DragDrop} p_oDD the obj to get related data for
- * @param {boolean} bTargetsOnly if true, only return targetable objs
- * @return {DragDrop[]} the related instances
- * @static
- */
- getRelated: function(p_oDD, bTargetsOnly) {
- var oDDs = [];
- for (var i in p_oDD.groups) {
- for (j in this.ids[i]) {
- var dd = this.ids[i][j];
- if (! this.isTypeOfDD(dd)) {
- continue;
- }
- if (!bTargetsOnly || dd.isTarget) {
- oDDs[oDDs.length] = dd;
- }
- }
- }
-
- return oDDs;
- },
-
- /**
- * Returns true if the specified dd target is a legal target for
- * the specifice drag obj
- * @method isLegalTarget
- * @param {DragDrop} the drag obj
- * @param {DragDrop} the target
- * @return {boolean} true if the target is a legal target for the
- * dd obj
- * @static
- */
- isLegalTarget: function (oDD, oTargetDD) {
- var targets = this.getRelated(oDD, true);
- for (var i=0, len=targets.length;i this.clickPixelThresh ||
- diffY > this.clickPixelThresh) {
- this.startDrag(this.startX, this.startY);
- }
- }
-
- if (this.dragThreshMet) {
- this.dragCurrent.b4Drag(e);
- this.dragCurrent.onDrag(e);
- this.fireEvents(e, false);
- }
-
- this.stopEvent(e);
-
- return true;
- },
-
- /**
- * Iterates over all of the DragDrop elements to find ones we are
- * hovering over or dropping on
- * @method fireEvents
- * @param {Event} e the event
- * @param {boolean} isDrop is this a drop op or a mouseover op?
- * @private
- * @static
- */
- fireEvents: function(e, isDrop) {
- var dc = this.dragCurrent;
-
- // If the user did the mouse up outside of the window, we could
- // get here even though we have ended the drag.
- if (!dc || dc.isLocked()) {
- return;
- }
-
- var x = YAHOO.util.Event.getPageX(e);
- var y = YAHOO.util.Event.getPageY(e);
- var pt = new YAHOO.util.Point(x,y);
-
- // cache the previous dragOver array
- var oldOvers = [];
-
- var outEvts = [];
- var overEvts = [];
- var dropEvts = [];
- var enterEvts = [];
-
- // Check to see if the object(s) we were hovering over is no longer
- // being hovered over so we can fire the onDragOut event
- for (var i in this.dragOvers) {
-
- var ddo = this.dragOvers[i];
-
- if (! this.isTypeOfDD(ddo)) {
- continue;
- }
-
- if (! this.isOverTarget(pt, ddo, this.mode)) {
- outEvts.push( ddo );
- }
-
- oldOvers[i] = true;
- delete this.dragOvers[i];
- }
-
- for (var sGroup in dc.groups) {
-
- if ("string" != typeof sGroup) {
- continue;
- }
-
- for (i in this.ids[sGroup]) {
- var oDD = this.ids[sGroup][i];
- if (! this.isTypeOfDD(oDD)) {
- continue;
- }
-
- if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {
- if (this.isOverTarget(pt, oDD, this.mode)) {
- // look for drop interactions
- if (isDrop) {
- dropEvts.push( oDD );
- // look for drag enter and drag over interactions
- } else {
-
- // initial drag over: dragEnter fires
- if (!oldOvers[oDD.id]) {
- enterEvts.push( oDD );
- // subsequent drag overs: dragOver fires
- } else {
- overEvts.push( oDD );
- }
-
- this.dragOvers[oDD.id] = oDD;
- }
- }
- }
- }
- }
-
- if (this.mode) {
- if (outEvts.length) {
- dc.b4DragOut(e, outEvts);
- dc.onDragOut(e, outEvts);
- }
-
- if (enterEvts.length) {
- dc.onDragEnter(e, enterEvts);
- }
-
- if (overEvts.length) {
- dc.b4DragOver(e, overEvts);
- dc.onDragOver(e, overEvts);
- }
-
- if (dropEvts.length) {
- dc.b4DragDrop(e, dropEvts);
- dc.onDragDrop(e, dropEvts);
- }
-
- } else {
- // fire dragout events
- var len = 0;
- for (i=0, len=outEvts.length; i
- * YAHOO.util.DragDropMgr.refreshCache(ddinstance.groups);
- *
- * Alternatively:
- *
- * YAHOO.util.DragDropMgr.refreshCache({group1:true, group2:true});
- *
- * @TODO this really should be an indexed array. Alternatively this
- * method could accept both.
- * @method refreshCache
- * @param {Object} groups an associative array of groups to refresh
- * @static
- */
- refreshCache: function(groups) {
- for (var sGroup in groups) {
- if ("string" != typeof sGroup) {
- continue;
- }
- for (var i in this.ids[sGroup]) {
- var oDD = this.ids[sGroup][i];
-
- if (this.isTypeOfDD(oDD)) {
- // if (this.isTypeOfDD(oDD) && oDD.isTarget) {
- var loc = this.getLocation(oDD);
- if (loc) {
- this.locationCache[oDD.id] = loc;
- } else {
- delete this.locationCache[oDD.id];
- // this will unregister the drag and drop object if
- // the element is not in a usable state
- // oDD.unreg();
- }
- }
- }
- }
- },
-
- /**
- * This checks to make sure an element exists and is in the DOM. The
- * main purpose is to handle cases where innerHTML is used to remove
- * drag and drop objects from the DOM. IE provides an 'unspecified
- * error' when trying to access the offsetParent of such an element
- * @method verifyEl
- * @param {HTMLElement} el the element to check
- * @return {boolean} true if the element looks usable
- * @static
- */
- verifyEl: function(el) {
- try {
- if (el) {
- var parent = el.offsetParent;
- if (parent) {
- return true;
- }
- }
- } catch(e) {
- }
-
- return false;
- },
-
- /**
- * Returns a Region object containing the drag and drop element's position
- * and size, including the padding configured for it
- * @method getLocation
- * @param {DragDrop} oDD the drag and drop object to get the
- * location for
- * @return {YAHOO.util.Region} a Region object representing the total area
- * the element occupies, including any padding
- * the instance is configured for.
- * @static
- */
- getLocation: function(oDD) {
- if (! this.isTypeOfDD(oDD)) {
- return null;
- }
-
- var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
-
- try {
- pos= YAHOO.util.Dom.getXY(el);
- } catch (e) { }
-
- if (!pos) {
- return null;
- }
-
- x1 = pos[0];
- x2 = x1 + el.offsetWidth;
- y1 = pos[1];
- y2 = y1 + el.offsetHeight;
-
- t = y1 - oDD.padding[0];
- r = x2 + oDD.padding[1];
- b = y2 + oDD.padding[2];
- l = x1 - oDD.padding[3];
-
- return new YAHOO.util.Region( t, r, b, l );
- },
-
- /**
- * Checks the cursor location to see if it over the target
- * @method isOverTarget
- * @param {YAHOO.util.Point} pt The point to evaluate
- * @param {DragDrop} oTarget the DragDrop object we are inspecting
- * @return {boolean} true if the mouse is over the target
- * @private
- * @static
- */
- isOverTarget: function(pt, oTarget, intersect) {
- // use cache if available
- var loc = this.locationCache[oTarget.id];
- if (!loc || !this.useCache) {
- loc = this.getLocation(oTarget);
- this.locationCache[oTarget.id] = loc;
-
- }
-
- if (!loc) {
- return false;
- }
-
- oTarget.cursorIsOver = loc.contains( pt );
-
- // DragDrop is using this as a sanity check for the initial mousedown
- // in this case we are done. In POINT mode, if the drag obj has no
- // contraints, we are also done. Otherwise we need to evaluate the
- // location of the target as related to the actual location of the
- // dragged element.
- var dc = this.dragCurrent;
- if (!dc || !dc.getTargetCoord ||
- (!intersect && !dc.constrainX && !dc.constrainY)) {
- return oTarget.cursorIsOver;
- }
-
- oTarget.overlap = null;
-
- // Get the current location of the drag element, this is the
- // location of the mouse event less the delta that represents
- // where the original mousedown happened on the element. We
- // need to consider constraints and ticks as well.
- var pos = dc.getTargetCoord(pt.x, pt.y);
-
- var el = dc.getDragEl();
- var curRegion = new YAHOO.util.Region( pos.y,
- pos.x + el.offsetWidth,
- pos.y + el.offsetHeight,
- pos.x );
-
- var overlap = curRegion.intersect(loc);
-
- if (overlap) {
- oTarget.overlap = overlap;
- return (intersect) ? true : oTarget.cursorIsOver;
- } else {
- return false;
- }
- },
-
- /**
- * unload event handler
- * @method _onUnload
- * @private
- * @static
- */
- _onUnload: function(e, me) {
- this.unregAll();
- },
-
- /**
- * Cleans up the drag and drop events and objects.
- * @method unregAll
- * @private
- * @static
- */
- unregAll: function() {
-
- if (this.dragCurrent) {
- this.stopDrag();
- this.dragCurrent = null;
- }
-
- this._execOnAll("unreg", []);
-
- for (i in this.elementCache) {
- delete this.elementCache[i];
- }
-
- this.elementCache = {};
- this.ids = {};
- },
-
- /**
- * A cache of DOM elements
- * @property elementCache
- * @private
- * @static
- */
- elementCache: {},
-
- /**
- * Get the wrapper for the DOM element specified
- * @method getElWrapper
- * @param {String} id the id of the element to get
- * @return {YAHOO.util.DDM.ElementWrapper} the wrapped element
- * @private
- * @deprecated This wrapper isn't that useful
- * @static
- */
- getElWrapper: function(id) {
- var oWrapper = this.elementCache[id];
- if (!oWrapper || !oWrapper.el) {
- oWrapper = this.elementCache[id] =
- new this.ElementWrapper(YAHOO.util.Dom.get(id));
- }
- return oWrapper;
- },
-
- /**
- * Returns the actual DOM element
- * @method getElement
- * @param {String} id the id of the elment to get
- * @return {Object} The element
- * @deprecated use YAHOO.util.Dom.get instead
- * @static
- */
- getElement: function(id) {
- return YAHOO.util.Dom.get(id);
- },
-
- /**
- * Returns the style property for the DOM element (i.e.,
- * document.getElById(id).style)
- * @method getCss
- * @param {String} id the id of the elment to get
- * @return {Object} The style property of the element
- * @deprecated use YAHOO.util.Dom instead
- * @static
- */
- getCss: function(id) {
- var el = YAHOO.util.Dom.get(id);
- return (el) ? el.style : null;
- },
-
- /**
- * Inner class for cached elements
- * @class DragDropMgr.ElementWrapper
- * @for DragDropMgr
- * @private
- * @deprecated
- */
- ElementWrapper: function(el) {
- /**
- * The element
- * @property el
- */
- this.el = el || null;
- /**
- * The element id
- * @property id
- */
- this.id = this.el && el.id;
- /**
- * A reference to the style property
- * @property css
- */
- this.css = this.el && el.style;
- },
-
- /**
- * Returns the X position of an html element
- * @method getPosX
- * @param el the element for which to get the position
- * @return {int} the X coordinate
- * @for DragDropMgr
- * @deprecated use YAHOO.util.Dom.getX instead
- * @static
- */
- getPosX: function(el) {
- return YAHOO.util.Dom.getX(el);
- },
-
- /**
- * Returns the Y position of an html element
- * @method getPosY
- * @param el the element for which to get the position
- * @return {int} the Y coordinate
- * @deprecated use YAHOO.util.Dom.getY instead
- * @static
- */
- getPosY: function(el) {
- return YAHOO.util.Dom.getY(el);
- },
-
- /**
- * Swap two nodes. In IE, we use the native method, for others we
- * emulate the IE behavior
- * @method swapNode
- * @param n1 the first node to swap
- * @param n2 the other node to swap
- * @static
- */
- swapNode: function(n1, n2) {
- if (n1.swapNode) {
- n1.swapNode(n2);
- } else {
- var p = n2.parentNode;
- var s = n2.nextSibling;
-
- if (s == n1) {
- p.insertBefore(n1, n2);
- } else if (n2 == n1.nextSibling) {
- p.insertBefore(n2, n1);
- } else {
- n1.parentNode.replaceChild(n2, n1);
- p.insertBefore(n1, s);
- }
- }
- },
-
- /**
- * Returns the current scroll position
- * @method getScroll
- * @private
- * @static
- */
- getScroll: function () {
- var t, l, dde=document.documentElement, db=document.body;
- if (dde && (dde.scrollTop || dde.scrollLeft)) {
- t = dde.scrollTop;
- l = dde.scrollLeft;
- } else if (db) {
- t = db.scrollTop;
- l = db.scrollLeft;
- } else {
- YAHOO.log("could not get scroll property");
- }
- return { top: t, left: l };
- },
-
- /**
- * Returns the specified element style property
- * @method getStyle
- * @param {HTMLElement} el the element
- * @param {string} styleProp the style property
- * @return {string} The value of the style property
- * @deprecated use YAHOO.util.Dom.getStyle
- * @static
- */
- getStyle: function(el, styleProp) {
- return YAHOO.util.Dom.getStyle(el, styleProp);
- },
-
- /**
- * Gets the scrollTop
- * @method getScrollTop
- * @return {int} the document's scrollTop
- * @static
- */
- getScrollTop: function () { return this.getScroll().top; },
-
- /**
- * Gets the scrollLeft
- * @method getScrollLeft
- * @return {int} the document's scrollTop
- * @static
- */
- getScrollLeft: function () { return this.getScroll().left; },
-
- /**
- * Sets the x/y position of an element to the location of the
- * target element.
- * @method moveToEl
- * @param {HTMLElement} moveEl The element to move
- * @param {HTMLElement} targetEl The position reference element
- * @static
- */
- moveToEl: function (moveEl, targetEl) {
- var aCoord = YAHOO.util.Dom.getXY(targetEl);
- YAHOO.util.Dom.setXY(moveEl, aCoord);
- },
-
- /**
- * Gets the client height
- * @method getClientHeight
- * @return {int} client height in px
- * @deprecated use YAHOO.util.Dom.getViewportHeight instead
- * @static
- */
- getClientHeight: function() {
- return YAHOO.util.Dom.getViewportHeight();
- },
-
- /**
- * Gets the client width
- * @method getClientWidth
- * @return {int} client width in px
- * @deprecated use YAHOO.util.Dom.getViewportWidth instead
- * @static
- */
- getClientWidth: function() {
- return YAHOO.util.Dom.getViewportWidth();
- },
-
- /**
- * Numeric array sort function
- * @method numericSort
- * @static
- */
- numericSort: function(a, b) { return (a - b); },
-
- /**
- * Internal counter
- * @property _timeoutCount
- * @private
- * @static
- */
- _timeoutCount: 0,
-
- /**
- * Trying to make the load order less important. Without this we get
- * an error if this file is loaded before the Event Utility.
- * @method _addListeners
- * @private
- * @static
- */
- _addListeners: function() {
- var DDM = YAHOO.util.DDM;
- if ( YAHOO.util.Event && document ) {
- DDM._onLoad();
- } else {
- if (DDM._timeoutCount > 2000) {
- } else {
- setTimeout(DDM._addListeners, 10);
- if (document && document.body) {
- DDM._timeoutCount += 1;
- }
- }
- }
- },
-
- /**
- * Recursively searches the immediate parent and all child nodes for
- * the handle element in order to determine wheter or not it was
- * clicked.
- * @method handleWasClicked
- * @param node the html element to inspect
- * @static
- */
- handleWasClicked: function(node, id) {
- if (this.isHandle(id, node.id)) {
- return true;
- } else {
- // check to see if this is a text node child of the one we want
- var p = node.parentNode;
-
- while (p) {
- if (this.isHandle(id, p.id)) {
- return true;
- } else {
- p = p.parentNode;
- }
- }
- }
-
- return false;
- }
-
- };
-
-}();
-
-// shorter alias, save a few bytes
-YAHOO.util.DDM = YAHOO.util.DragDropMgr;
-YAHOO.util.DDM._addListeners();
-
-}
-
-/**
- * A DragDrop implementation where the linked element follows the
- * mouse cursor during a drag.
- * @class DD
- * @extends YAHOO.util.DragDrop
- * @constructor
- * @param {String} id the id of the linked element
- * @param {String} sGroup the group of related DragDrop items
- * @param {object} config an object containing configurable attributes
- * Valid properties for DD:
- * scroll
- */
-YAHOO.util.DD = function(id, sGroup, config) {
- if (id) {
- this.init(id, sGroup, config);
- }
-};
-
-YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
-
- /**
- * When set to true, the utility automatically tries to scroll the browser
- * window wehn a drag and drop element is dragged near the viewport boundary.
- * Defaults to true.
- * @property scroll
- * @type boolean
- */
- scroll: true,
-
- /**
- * Sets the pointer offset to the distance between the linked element's top
- * left corner and the location the element was clicked
- * @method autoOffset
- * @param {int} iPageX the X coordinate of the click
- * @param {int} iPageY the Y coordinate of the click
- */
- autoOffset: function(iPageX, iPageY) {
- var x = iPageX - this.startPageX;
- var y = iPageY - this.startPageY;
- this.setDelta(x, y);
- },
-
- /**
- * Sets the pointer offset. You can call this directly to force the
- * offset to be in a particular location (e.g., pass in 0,0 to set it
- * to the center of the object, as done in YAHOO.widget.Slider)
- * @method setDelta
- * @param {int} iDeltaX the distance from the left
- * @param {int} iDeltaY the distance from the top
- */
- setDelta: function(iDeltaX, iDeltaY) {
- this.deltaX = iDeltaX;
- this.deltaY = iDeltaY;
- },
-
- /**
- * Sets the drag element to the location of the mousedown or click event,
- * maintaining the cursor location relative to the location on the element
- * that was clicked. Override this if you want to place the element in a
- * location other than where the cursor is.
- * @method setDragElPos
- * @param {int} iPageX the X coordinate of the mousedown or drag event
- * @param {int} iPageY the Y coordinate of the mousedown or drag event
- */
- setDragElPos: function(iPageX, iPageY) {
- // the first time we do this, we are going to check to make sure
- // the element has css positioning
-
- var el = this.getDragEl();
- this.alignElWithMouse(el, iPageX, iPageY);
- },
-
- /**
- * Sets the element to the location of the mousedown or click event,
- * maintaining the cursor location relative to the location on the element
- * that was clicked. Override this if you want to place the element in a
- * location other than where the cursor is.
- * @method alignElWithMouse
- * @param {HTMLElement} el the element to move
- * @param {int} iPageX the X coordinate of the mousedown or drag event
- * @param {int} iPageY the Y coordinate of the mousedown or drag event
- */
- alignElWithMouse: function(el, iPageX, iPageY) {
- var oCoord = this.getTargetCoord(iPageX, iPageY);
-
- if (!this.deltaSetXY) {
- var aCoord = [oCoord.x, oCoord.y];
- YAHOO.util.Dom.setXY(el, aCoord);
- var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );
- var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );
-
- this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
- } else {
- YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");
- YAHOO.util.Dom.setStyle(el, "top", (oCoord.y + this.deltaSetXY[1]) + "px");
- }
-
- this.cachePosition(oCoord.x, oCoord.y);
- this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
- },
-
- /**
- * Saves the most recent position so that we can reset the constraints and
- * tick marks on-demand. We need to know this so that we can calculate the
- * number of pixels the element is offset from its original position.
- * @method cachePosition
- * @param iPageX the current x position (optional, this just makes it so we
- * don't have to look it up again)
- * @param iPageY the current y position (optional, this just makes it so we
- * don't have to look it up again)
- */
- cachePosition: function(iPageX, iPageY) {
- if (iPageX) {
- this.lastPageX = iPageX;
- this.lastPageY = iPageY;
- } else {
- var aCoord = YAHOO.util.Dom.getXY(this.getEl());
- this.lastPageX = aCoord[0];
- this.lastPageY = aCoord[1];
- }
- },
-
- /**
- * Auto-scroll the window if the dragged object has been moved beyond the
- * visible window boundary.
- * @method autoScroll
- * @param {int} x the drag element's x position
- * @param {int} y the drag element's y position
- * @param {int} h the height of the drag element
- * @param {int} w the width of the drag element
- * @private
- */
- autoScroll: function(x, y, h, w) {
-
- if (this.scroll) {
- // The client height
- var clientH = this.DDM.getClientHeight();
-
- // The client width
- var clientW = this.DDM.getClientWidth();
-
- // The amt scrolled down
- var st = this.DDM.getScrollTop();
-
- // The amt scrolled right
- var sl = this.DDM.getScrollLeft();
-
- // Location of the bottom of the element
- var bot = h + y;
-
- // Location of the right of the element
- var right = w + x;
-
- // The distance from the cursor to the bottom of the visible area,
- // adjusted so that we don't scroll if the cursor is beyond the
- // element drag constraints
- var toBot = (clientH + st - y - this.deltaY);
-
- // The distance from the cursor to the right of the visible area
- var toRight = (clientW + sl - x - this.deltaX);
-
-
- // How close to the edge the cursor must be before we scroll
- // var thresh = (document.all) ? 100 : 40;
- var thresh = 40;
-
- // How many pixels to scroll per autoscroll op. This helps to reduce
- // clunky scrolling. IE is more sensitive about this ... it needs this
- // value to be higher.
- var scrAmt = (document.all) ? 80 : 30;
-
- // Scroll down if we are near the bottom of the visible page and the
- // obj extends below the crease
- if ( bot > clientH && toBot < thresh ) {
- window.scrollTo(sl, st + scrAmt);
- }
-
- // Scroll up if the window is scrolled down and the top of the object
- // goes above the top border
- if ( y < st && st > 0 && y - st < thresh ) {
- window.scrollTo(sl, st - scrAmt);
- }
-
- // Scroll right if the obj is beyond the right border and the cursor is
- // near the border.
- if ( right > clientW && toRight < thresh ) {
- window.scrollTo(sl + scrAmt, st);
- }
-
- // Scroll left if the window has been scrolled to the right and the obj
- // extends past the left border
- if ( x < sl && sl > 0 && x - sl < thresh ) {
- window.scrollTo(sl - scrAmt, st);
- }
- }
- },
-
- /**
- * Finds the location the element should be placed if we want to move
- * it to where the mouse location less the click offset would place us.
- * @method getTargetCoord
- * @param {int} iPageX the X coordinate of the click
- * @param {int} iPageY the Y coordinate of the click
- * @return an object that contains the coordinates (Object.x and Object.y)
- * @private
- */
- getTargetCoord: function(iPageX, iPageY) {
-
-
- var x = iPageX - this.deltaX;
- var y = iPageY - this.deltaY;
-
- if (this.constrainX) {
- if (x < this.minX) { x = this.minX; }
- if (x > this.maxX) { x = this.maxX; }
- }
-
- if (this.constrainY) {
- if (y < this.minY) { y = this.minY; }
- if (y > this.maxY) { y = this.maxY; }
- }
-
- x = this.getTick(x, this.xTicks);
- y = this.getTick(y, this.yTicks);
-
-
- return {x:x, y:y};
- },
-
- /*
- * Sets up config options specific to this class. Overrides
- * YAHOO.util.DragDrop, but all versions of this method through the
- * inheritance chain are called
- */
- applyConfig: function() {
- YAHOO.util.DD.superclass.applyConfig.call(this);
- this.scroll = (this.config.scroll !== false);
- },
-
- /*
- * Event that fires prior to the onMouseDown event. Overrides
- * YAHOO.util.DragDrop.
- */
- b4MouseDown: function(e) {
- // this.resetConstraints();
- this.autoOffset(YAHOO.util.Event.getPageX(e),
- YAHOO.util.Event.getPageY(e));
- },
-
- /*
- * Event that fires prior to the onDrag event. Overrides
- * YAHOO.util.DragDrop.
- */
- b4Drag: function(e) {
- this.setDragElPos(YAHOO.util.Event.getPageX(e),
- YAHOO.util.Event.getPageY(e));
- },
-
- toString: function() {
- return ("DD " + this.id);
- }
-
- //////////////////////////////////////////////////////////////////////////
- // Debugging ygDragDrop events that can be overridden
- //////////////////////////////////////////////////////////////////////////
- /*
- startDrag: function(x, y) {
- },
-
- onDrag: function(e) {
- },
-
- onDragEnter: function(e, id) {
- },
-
- onDragOver: function(e, id) {
- },
-
- onDragOut: function(e, id) {
- },
-
- onDragDrop: function(e, id) {
- },
-
- endDrag: function(e) {
- }
-
- */
-
-});
-/**
- * A DragDrop implementation that inserts an empty, bordered div into
- * the document that follows the cursor during drag operations. At the time of
- * the click, the frame div is resized to the dimensions of the linked html
- * element, and moved to the exact location of the linked element.
- *
- * References to the "frame" element refer to the single proxy element that
- * was created to be dragged in place of all DDProxy elements on the
- * page.
- *
- * @class DDProxy
- * @extends YAHOO.util.DD
- * @constructor
- * @param {String} id the id of the linked html element
- * @param {String} sGroup the group of related DragDrop objects
- * @param {object} config an object containing configurable attributes
- * Valid properties for DDProxy in addition to those in DragDrop:
- * resizeFrame, centerFrame, dragElId
- */
-YAHOO.util.DDProxy = function(id, sGroup, config) {
- if (id) {
- this.init(id, sGroup, config);
- this.initFrame();
- }
-};
-
-/**
- * The default drag frame div id
- * @property YAHOO.util.DDProxy.dragElId
- * @type String
- * @static
- */
-YAHOO.util.DDProxy.dragElId = "ygddfdiv";
-
-YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
-
- /**
- * By default we resize the drag frame to be the same size as the element
- * we want to drag (this is to get the frame effect). We can turn it off
- * if we want a different behavior.
- * @property resizeFrame
- * @type boolean
- */
- resizeFrame: true,
-
- /**
- * By default the frame is positioned exactly where the drag element is, so
- * we use the cursor offset provided by YAHOO.util.DD. Another option that works only if
- * you do not have constraints on the obj is to have the drag frame centered
- * around the cursor. Set centerFrame to true for this effect.
- * @property centerFrame
- * @type boolean
- */
- centerFrame: false,
-
- /**
- * Creates the proxy element if it does not yet exist
- * @method createFrame
- */
- createFrame: function() {
- var self = this;
- var body = document.body;
-
- if (!body || !body.firstChild) {
- setTimeout( function() { self.createFrame(); }, 50 );
- return;
- }
-
- var div = this.getDragEl();
-
- if (!div) {
- div = document.createElement("div");
- div.id = this.dragElId;
- var s = div.style;
-
- s.position = "absolute";
- s.visibility = "hidden";
- s.cursor = "move";
- s.border = "2px solid #aaa";
- s.zIndex = 999;
-
- // appendChild can blow up IE if invoked prior to the window load event
- // while rendering a table. It is possible there are other scenarios
- // that would cause this to happen as well.
- body.insertBefore(div, body.firstChild);
- }
- },
-
- /**
- * Initialization for the drag frame element. Must be called in the
- * constructor of all subclasses
- * @method initFrame
- */
- initFrame: function() {
- this.createFrame();
- },
-
- applyConfig: function() {
- YAHOO.util.DDProxy.superclass.applyConfig.call(this);
-
- this.resizeFrame = (this.config.resizeFrame !== false);
- this.centerFrame = (this.config.centerFrame);
- this.setDragElId(this.config.dragElId || YAHOO.util.DDProxy.dragElId);
- },
-
- /**
- * Resizes the drag frame to the dimensions of the clicked object, positions
- * it over the object, and finally displays it
- * @method showFrame
- * @param {int} iPageX X click position
- * @param {int} iPageY Y click position
- * @private
- */
- showFrame: function(iPageX, iPageY) {
- var el = this.getEl();
- var dragEl = this.getDragEl();
- var s = dragEl.style;
-
- this._resizeProxy();
-
- if (this.centerFrame) {
- this.setDelta( Math.round(parseInt(s.width, 10)/2),
- Math.round(parseInt(s.height, 10)/2) );
- }
-
- this.setDragElPos(iPageX, iPageY);
-
- YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible");
- },
-
- /**
- * The proxy is automatically resized to the dimensions of the linked
- * element when a drag is initiated, unless resizeFrame is set to false
- * @method _resizeProxy
- * @private
- */
- _resizeProxy: function() {
- if (this.resizeFrame) {
- var DOM = YAHOO.util.Dom;
- var el = this.getEl();
- var dragEl = this.getDragEl();
-
- var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth" ), 10);
- var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth" ), 10);
- var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10);
- var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth" ), 10);
-
- if (isNaN(bt)) { bt = 0; }
- if (isNaN(br)) { br = 0; }
- if (isNaN(bb)) { bb = 0; }
- if (isNaN(bl)) { bl = 0; }
-
-
- var newWidth = Math.max(0, el.offsetWidth - br - bl);
- var newHeight = Math.max(0, el.offsetHeight - bt - bb);
-
-
- DOM.setStyle( dragEl, "width", newWidth + "px" );
- DOM.setStyle( dragEl, "height", newHeight + "px" );
- }
- },
-
- // overrides YAHOO.util.DragDrop
- b4MouseDown: function(e) {
- var x = YAHOO.util.Event.getPageX(e);
- var y = YAHOO.util.Event.getPageY(e);
- this.autoOffset(x, y);
- this.setDragElPos(x, y);
- },
-
- // overrides YAHOO.util.DragDrop
- b4StartDrag: function(x, y) {
- // show the drag frame
- this.showFrame(x, y);
- },
-
- // overrides YAHOO.util.DragDrop
- b4EndDrag: function(e) {
- YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden");
- },
-
- // overrides YAHOO.util.DragDrop
- // By default we try to move the element to the last location of the frame.
- // This is so that the default behavior mirrors that of YAHOO.util.DD.
- endDrag: function(e) {
- var DOM = YAHOO.util.Dom;
- var lel = this.getEl();
- var del = this.getDragEl();
-
- // Show the drag frame briefly so we can get its position
- // del.style.visibility = "";
- DOM.setStyle(del, "visibility", "");
-
- // Hide the linked element before the move to get around a Safari
- // rendering bug.
- //lel.style.visibility = "hidden";
- DOM.setStyle(lel, "visibility", "hidden");
- YAHOO.util.DDM.moveToEl(lel, del);
- //del.style.visibility = "hidden";
- DOM.setStyle(del, "visibility", "hidden");
- //lel.style.visibility = "";
- DOM.setStyle(lel, "visibility", "");
- },
-
- toString: function() {
- return ("DDProxy " + this.id);
- }
-
-});
-/**
- * A DragDrop implementation that does not move, but can be a drop
- * target. You would get the same result by simply omitting implementation
- * for the event callbacks, but this way we reduce the processing cost of the
- * event listener and the callbacks.
- * @class DDTarget
- * @extends YAHOO.util.DragDrop
- * @constructor
- * @param {String} id the id of the element that is a drop target
- * @param {String} sGroup the group of related DragDrop objects
- * @param {object} config an object containing configurable attributes
- * Valid properties for DDTarget in addition to those in
- * DragDrop:
- * none
- */
-YAHOO.util.DDTarget = function(id, sGroup, config) {
- if (id) {
- this.initTarget(id, sGroup, config);
- }
-};
-
-// YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop();
-YAHOO.extend(YAHOO.util.DDTarget, YAHOO.util.DragDrop, {
- toString: function() {
- return ("DDTarget " + this.id);
- }
-});
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+(function() {
+
+var Event=YAHOO.util.Event;
+var Dom=YAHOO.util.Dom;
+
+/**
+ * Defines the interface and base operation of items that that can be
+ * dragged or can be drop targets. It was designed to be extended, overriding
+ * the event handlers for startDrag, onDrag, onDragOver, onDragOut.
+ * Up to three html elements can be associated with a DragDrop instance:
+ *
+ * linked element: the element that is passed into the constructor.
+ * This is the element which defines the boundaries for interaction with
+ * other DragDrop objects.
+ * handle element(s): The drag operation only occurs if the element that
+ * was clicked matches a handle element. By default this is the linked
+ * element, but there are times that you will want only a portion of the
+ * linked element to initiate the drag operation, and the setHandleElId()
+ * method provides a way to define this.
+ * drag element: this represents an the element that would be moved along
+ * with the cursor during a drag operation. By default, this is the linked
+ * element itself as in {@link YAHOO.util.DD}. setDragElId() lets you define
+ * a separate element that would be moved, as in {@link YAHOO.util.DDProxy}
+ *
+ *
+ * This class should not be instantiated until the onload event to ensure that
+ * the associated elements are available.
+ * The following would define a DragDrop obj that would interact with any
+ * other DragDrop obj in the "group1" group:
+ *
+ * dd = new YAHOO.util.DragDrop("div1", "group1");
+ *
+ * Since none of the event handlers have been implemented, nothing would
+ * actually happen if you were to run the code above. Normally you would
+ * override this class or one of the default implementations, but you can
+ * also override the methods you want on an instance of the class...
+ *
+ * dd.onDragDrop = function(e, id) {
+ * alert("dd was dropped on " + id);
+ * }
+ *
+ * @namespace YAHOO.util
+ * @class DragDrop
+ * @constructor
+ * @param {String} id of the element that is linked to this instance
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ * Valid properties for DragDrop:
+ * padding, isTarget, maintainOffset, primaryButtonOnly
+ */
+YAHOO.util.DragDrop = function(id, sGroup, config) {
+ if (id) {
+ this.init(id, sGroup, config);
+ }
+};
+
+YAHOO.util.DragDrop.prototype = {
+
+ /**
+ * The id of the element associated with this object. This is what we
+ * refer to as the "linked element" because the size and position of
+ * this element is used to determine when the drag and drop objects have
+ * interacted.
+ * @property id
+ * @type String
+ */
+ id: null,
+
+ /**
+ * Configuration attributes passed into the constructor
+ * @property config
+ * @type object
+ */
+ config: null,
+
+ /**
+ * The id of the element that will be dragged. By default this is same
+ * as the linked element , but could be changed to another element. Ex:
+ * YAHOO.util.DDProxy
+ * @property dragElId
+ * @type String
+ * @private
+ */
+ dragElId: null,
+
+ /**
+ * the id of the element that initiates the drag operation. By default
+ * this is the linked element, but could be changed to be a child of this
+ * element. This lets us do things like only starting the drag when the
+ * header element within the linked html element is clicked.
+ * @property handleElId
+ * @type String
+ * @private
+ */
+ handleElId: null,
+
+ /**
+ * An associative array of HTML tags that will be ignored if clicked.
+ * @property invalidHandleTypes
+ * @type {string: string}
+ */
+ invalidHandleTypes: null,
+
+ /**
+ * An associative array of ids for elements that will be ignored if clicked
+ * @property invalidHandleIds
+ * @type {string: string}
+ */
+ invalidHandleIds: null,
+
+ /**
+ * An indexted array of css class names for elements that will be ignored
+ * if clicked.
+ * @property invalidHandleClasses
+ * @type string[]
+ */
+ invalidHandleClasses: null,
+
+ /**
+ * The linked element's absolute X position at the time the drag was
+ * started
+ * @property startPageX
+ * @type int
+ * @private
+ */
+ startPageX: 0,
+
+ /**
+ * The linked element's absolute X position at the time the drag was
+ * started
+ * @property startPageY
+ * @type int
+ * @private
+ */
+ startPageY: 0,
+
+ /**
+ * The group defines a logical collection of DragDrop objects that are
+ * related. Instances only get events when interacting with other
+ * DragDrop object in the same group. This lets us define multiple
+ * groups using a single DragDrop subclass if we want.
+ * @property groups
+ * @type {string: string}
+ */
+ groups: null,
+
+ /**
+ * Individual drag/drop instances can be locked. This will prevent
+ * onmousedown start drag.
+ * @property locked
+ * @type boolean
+ * @private
+ */
+ locked: false,
+
+ /**
+ * Lock this instance
+ * @method lock
+ */
+ lock: function() { this.locked = true; },
+
+ /**
+ * Unlock this instace
+ * @method unlock
+ */
+ unlock: function() { this.locked = false; },
+
+ /**
+ * By default, all insances can be a drop target. This can be disabled by
+ * setting isTarget to false.
+ * @method isTarget
+ * @type boolean
+ */
+ isTarget: true,
+
+ /**
+ * The padding configured for this drag and drop object for calculating
+ * the drop zone intersection with this object.
+ * @method padding
+ * @type int[]
+ */
+ padding: null,
+
+ /**
+ * Cached reference to the linked element
+ * @property _domRef
+ * @private
+ */
+ _domRef: null,
+
+ /**
+ * Internal typeof flag
+ * @property __ygDragDrop
+ * @private
+ */
+ __ygDragDrop: true,
+
+ /**
+ * Set to true when horizontal contraints are applied
+ * @property constrainX
+ * @type boolean
+ * @private
+ */
+ constrainX: false,
+
+ /**
+ * Set to true when vertical contraints are applied
+ * @property constrainY
+ * @type boolean
+ * @private
+ */
+ constrainY: false,
+
+ /**
+ * The left constraint
+ * @property minX
+ * @type int
+ * @private
+ */
+ minX: 0,
+
+ /**
+ * The right constraint
+ * @property maxX
+ * @type int
+ * @private
+ */
+ maxX: 0,
+
+ /**
+ * The up constraint
+ * @property minY
+ * @type int
+ * @type int
+ * @private
+ */
+ minY: 0,
+
+ /**
+ * The down constraint
+ * @property maxY
+ * @type int
+ * @private
+ */
+ maxY: 0,
+
+ /**
+ * Maintain offsets when we resetconstraints. Set to true when you want
+ * the position of the element relative to its parent to stay the same
+ * when the page changes
+ *
+ * @property maintainOffset
+ * @type boolean
+ */
+ maintainOffset: false,
+
+ /**
+ * Array of pixel locations the element will snap to if we specified a
+ * horizontal graduation/interval. This array is generated automatically
+ * when you define a tick interval.
+ * @property xTicks
+ * @type int[]
+ */
+ xTicks: null,
+
+ /**
+ * Array of pixel locations the element will snap to if we specified a
+ * vertical graduation/interval. This array is generated automatically
+ * when you define a tick interval.
+ * @property yTicks
+ * @type int[]
+ */
+ yTicks: null,
+
+ /**
+ * By default the drag and drop instance will only respond to the primary
+ * button click (left button for a right-handed mouse). Set to true to
+ * allow drag and drop to start with any mouse click that is propogated
+ * by the browser
+ * @property primaryButtonOnly
+ * @type boolean
+ */
+ primaryButtonOnly: true,
+
+ /**
+ * The availabe property is false until the linked dom element is accessible.
+ * @property available
+ * @type boolean
+ */
+ available: false,
+
+ /**
+ * By default, drags can only be initiated if the mousedown occurs in the
+ * region the linked element is. This is done in part to work around a
+ * bug in some browsers that mis-report the mousedown if the previous
+ * mouseup happened outside of the window. This property is set to true
+ * if outer handles are defined.
+ *
+ * @property hasOuterHandles
+ * @type boolean
+ * @default false
+ */
+ hasOuterHandles: false,
+
+ /**
+ * Code that executes immediately before the startDrag event
+ * @method b4StartDrag
+ * @private
+ */
+ b4StartDrag: function(x, y) { },
+
+ /**
+ * Abstract method called after a drag/drop object is clicked
+ * and the drag or mousedown time thresholds have beeen met.
+ * @method startDrag
+ * @param {int} X click location
+ * @param {int} Y click location
+ */
+ startDrag: function(x, y) { /* override this */ },
+
+ /**
+ * Code that executes immediately before the onDrag event
+ * @method b4Drag
+ * @private
+ */
+ b4Drag: function(e) { },
+
+ /**
+ * Abstract method called during the onMouseMove event while dragging an
+ * object.
+ * @method onDrag
+ * @param {Event} e the mousemove event
+ */
+ onDrag: function(e) { /* override this */ },
+
+ /**
+ * Abstract method called when this element fist begins hovering over
+ * another DragDrop obj
+ * @method onDragEnter
+ * @param {Event} e the mousemove event
+ * @param {String|DragDrop[]} id In POINT mode, the element
+ * id this is hovering over. In INTERSECT mode, an array of one or more
+ * dragdrop items being hovered over.
+ */
+ onDragEnter: function(e, id) { /* override this */ },
+
+ /**
+ * Code that executes immediately before the onDragOver event
+ * @method b4DragOver
+ * @private
+ */
+ b4DragOver: function(e) { },
+
+ /**
+ * Abstract method called when this element is hovering over another
+ * DragDrop obj
+ * @method onDragOver
+ * @param {Event} e the mousemove event
+ * @param {String|DragDrop[]} id In POINT mode, the element
+ * id this is hovering over. In INTERSECT mode, an array of dd items
+ * being hovered over.
+ */
+ onDragOver: function(e, id) { /* override this */ },
+
+ /**
+ * Code that executes immediately before the onDragOut event
+ * @method b4DragOut
+ * @private
+ */
+ b4DragOut: function(e) { },
+
+ /**
+ * Abstract method called when we are no longer hovering over an element
+ * @method onDragOut
+ * @param {Event} e the mousemove event
+ * @param {String|DragDrop[]} id In POINT mode, the element
+ * id this was hovering over. In INTERSECT mode, an array of dd items
+ * that the mouse is no longer over.
+ */
+ onDragOut: function(e, id) { /* override this */ },
+
+ /**
+ * Code that executes immediately before the onDragDrop event
+ * @method b4DragDrop
+ * @private
+ */
+ b4DragDrop: function(e) { },
+
+ /**
+ * Abstract method called when this item is dropped on another DragDrop
+ * obj
+ * @method onDragDrop
+ * @param {Event} e the mouseup event
+ * @param {String|DragDrop[]} id In POINT mode, the element
+ * id this was dropped on. In INTERSECT mode, an array of dd items this
+ * was dropped on.
+ */
+ onDragDrop: function(e, id) { /* override this */ },
+
+ /**
+ * Abstract method called when this item is dropped on an area with no
+ * drop target
+ * @method onInvalidDrop
+ * @param {Event} e the mouseup event
+ */
+ onInvalidDrop: function(e) { /* override this */ },
+
+ /**
+ * Code that executes immediately before the endDrag event
+ * @method b4EndDrag
+ * @private
+ */
+ b4EndDrag: function(e) { },
+
+ /**
+ * Fired when we are done dragging the object
+ * @method endDrag
+ * @param {Event} e the mouseup event
+ */
+ endDrag: function(e) { /* override this */ },
+
+ /**
+ * Code executed immediately before the onMouseDown event
+ * @method b4MouseDown
+ * @param {Event} e the mousedown event
+ * @private
+ */
+ b4MouseDown: function(e) { },
+
+ /**
+ * Event handler that fires when a drag/drop obj gets a mousedown
+ * @method onMouseDown
+ * @param {Event} e the mousedown event
+ */
+ onMouseDown: function(e) { /* override this */ },
+
+ /**
+ * Event handler that fires when a drag/drop obj gets a mouseup
+ * @method onMouseUp
+ * @param {Event} e the mouseup event
+ */
+ onMouseUp: function(e) { /* override this */ },
+
+ /**
+ * Override the onAvailable method to do what is needed after the initial
+ * position was determined.
+ * @method onAvailable
+ */
+ onAvailable: function () {
+ },
+
+ /**
+ * Returns a reference to the linked element
+ * @method getEl
+ * @return {HTMLElement} the html element
+ */
+ getEl: function() {
+ if (!this._domRef) {
+ this._domRef = Dom.get(this.id);
+ }
+
+ return this._domRef;
+ },
+
+ /**
+ * Returns a reference to the actual element to drag. By default this is
+ * the same as the html element, but it can be assigned to another
+ * element. An example of this can be found in YAHOO.util.DDProxy
+ * @method getDragEl
+ * @return {HTMLElement} the html element
+ */
+ getDragEl: function() {
+ return Dom.get(this.dragElId);
+ },
+
+ /**
+ * Sets up the DragDrop object. Must be called in the constructor of any
+ * YAHOO.util.DragDrop subclass
+ * @method init
+ * @param id the id of the linked element
+ * @param {String} sGroup the group of related items
+ * @param {object} config configuration attributes
+ */
+ init: function(id, sGroup, config) {
+ this.initTarget(id, sGroup, config);
+ Event.on(this.id, "mousedown", this.handleMouseDown, this, true);
+ // Event.on(this.id, "selectstart", Event.preventDefault);
+ },
+
+ /**
+ * Initializes Targeting functionality only... the object does not
+ * get a mousedown handler.
+ * @method initTarget
+ * @param id the id of the linked element
+ * @param {String} sGroup the group of related items
+ * @param {object} config configuration attributes
+ */
+ initTarget: function(id, sGroup, config) {
+
+ // configuration attributes
+ this.config = config || {};
+
+ // create a local reference to the drag and drop manager
+ this.DDM = YAHOO.util.DDM;
+ // initialize the groups array
+ this.groups = {};
+
+ // assume that we have an element reference instead of an id if the
+ // parameter is not a string
+ if (typeof id !== "string") {
+ YAHOO.log("id is not a string, assuming it is an HTMLElement");
+ id = Dom.generateId(id);
+ }
+
+ // set the id
+ this.id = id;
+
+ // add to an interaction group
+ this.addToGroup((sGroup) ? sGroup : "default");
+
+ // We don't want to register this as the handle with the manager
+ // so we just set the id rather than calling the setter.
+ this.handleElId = id;
+
+ Event.onAvailable(id, this.handleOnAvailable, this, true);
+
+
+ // the linked element is the element that gets dragged by default
+ this.setDragElId(id);
+
+ // by default, clicked anchors will not start drag operations.
+ // @TODO what else should be here? Probably form fields.
+ this.invalidHandleTypes = { A: "A" };
+ this.invalidHandleIds = {};
+ this.invalidHandleClasses = [];
+
+ this.applyConfig();
+ },
+
+ /**
+ * Applies the configuration parameters that were passed into the constructor.
+ * This is supposed to happen at each level through the inheritance chain. So
+ * a DDProxy implentation will execute apply config on DDProxy, DD, and
+ * DragDrop in order to get all of the parameters that are available in
+ * each object.
+ * @method applyConfig
+ */
+ applyConfig: function() {
+
+ // configurable properties:
+ // padding, isTarget, maintainOffset, primaryButtonOnly
+ this.padding = this.config.padding || [0, 0, 0, 0];
+ this.isTarget = (this.config.isTarget !== false);
+ this.maintainOffset = (this.config.maintainOffset);
+ this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);
+
+ },
+
+ /**
+ * Executed when the linked element is available
+ * @method handleOnAvailable
+ * @private
+ */
+ handleOnAvailable: function() {
+ this.available = true;
+ this.resetConstraints();
+ this.onAvailable();
+ },
+
+ /**
+ * Configures the padding for the target zone in px. Effectively expands
+ * (or reduces) the virtual object size for targeting calculations.
+ * Supports css-style shorthand; if only one parameter is passed, all sides
+ * will have that padding, and if only two are passed, the top and bottom
+ * will have the first param, the left and right the second.
+ * @method setPadding
+ * @param {int} iTop Top pad
+ * @param {int} iRight Right pad
+ * @param {int} iBot Bot pad
+ * @param {int} iLeft Left pad
+ */
+ setPadding: function(iTop, iRight, iBot, iLeft) {
+ // this.padding = [iLeft, iRight, iTop, iBot];
+ if (!iRight && 0 !== iRight) {
+ this.padding = [iTop, iTop, iTop, iTop];
+ } else if (!iBot && 0 !== iBot) {
+ this.padding = [iTop, iRight, iTop, iRight];
+ } else {
+ this.padding = [iTop, iRight, iBot, iLeft];
+ }
+ },
+
+ /**
+ * Stores the initial placement of the linked element.
+ * @method setInitialPosition
+ * @param {int} diffX the X offset, default 0
+ * @param {int} diffY the Y offset, default 0
+ */
+ setInitPosition: function(diffX, diffY) {
+ var el = this.getEl();
+
+ if (!this.DDM.verifyEl(el)) {
+ return;
+ }
+
+ var dx = diffX || 0;
+ var dy = diffY || 0;
+
+ var p = Dom.getXY( el );
+
+ this.initPageX = p[0] - dx;
+ this.initPageY = p[1] - dy;
+
+ this.lastPageX = p[0];
+ this.lastPageY = p[1];
+
+
+ this.setStartPosition(p);
+ },
+
+ /**
+ * Sets the start position of the element. This is set when the obj
+ * is initialized, the reset when a drag is started.
+ * @method setStartPosition
+ * @param pos current position (from previous lookup)
+ * @private
+ */
+ setStartPosition: function(pos) {
+ var p = pos || Dom.getXY( this.getEl() );
+ this.deltaSetXY = null;
+
+ this.startPageX = p[0];
+ this.startPageY = p[1];
+ },
+
+ /**
+ * Add this instance to a group of related drag/drop objects. All
+ * instances belong to at least one group, and can belong to as many
+ * groups as needed.
+ * @method addToGroup
+ * @param sGroup {string} the name of the group
+ */
+ addToGroup: function(sGroup) {
+ this.groups[sGroup] = true;
+ this.DDM.regDragDrop(this, sGroup);
+ },
+
+ /**
+ * Remove's this instance from the supplied interaction group
+ * @method removeFromGroup
+ * @param {string} sGroup The group to drop
+ */
+ removeFromGroup: function(sGroup) {
+ if (this.groups[sGroup]) {
+ delete this.groups[sGroup];
+ }
+
+ this.DDM.removeDDFromGroup(this, sGroup);
+ },
+
+ /**
+ * Allows you to specify that an element other than the linked element
+ * will be moved with the cursor during a drag
+ * @method setDragElId
+ * @param id {string} the id of the element that will be used to initiate the drag
+ */
+ setDragElId: function(id) {
+ this.dragElId = id;
+ },
+
+ /**
+ * Allows you to specify a child of the linked element that should be
+ * used to initiate the drag operation. An example of this would be if
+ * you have a content div with text and links. Clicking anywhere in the
+ * content area would normally start the drag operation. Use this method
+ * to specify that an element inside of the content div is the element
+ * that starts the drag operation.
+ * @method setHandleElId
+ * @param id {string} the id of the element that will be used to
+ * initiate the drag.
+ */
+ setHandleElId: function(id) {
+ if (typeof id !== "string") {
+ YAHOO.log("id is not a string, assuming it is an HTMLElement");
+ id = Dom.generateId(id);
+ }
+ this.handleElId = id;
+ this.DDM.regHandle(this.id, id);
+ },
+
+ /**
+ * Allows you to set an element outside of the linked element as a drag
+ * handle
+ * @method setOuterHandleElId
+ * @param id the id of the element that will be used to initiate the drag
+ */
+ setOuterHandleElId: function(id) {
+ if (typeof id !== "string") {
+ YAHOO.log("id is not a string, assuming it is an HTMLElement");
+ id = Dom.generateId(id);
+ }
+ Event.on(id, "mousedown",
+ this.handleMouseDown, this, true);
+ this.setHandleElId(id);
+
+ this.hasOuterHandles = true;
+ },
+
+ /**
+ * Remove all drag and drop hooks for this element
+ * @method unreg
+ */
+ unreg: function() {
+ Event.removeListener(this.id, "mousedown",
+ this.handleMouseDown);
+ this._domRef = null;
+ this.DDM._remove(this);
+ },
+
+ /**
+ * Returns true if this instance is locked, or the drag drop mgr is locked
+ * (meaning that all drag/drop is disabled on the page.)
+ * @method isLocked
+ * @return {boolean} true if this obj or all drag/drop is locked, else
+ * false
+ */
+ isLocked: function() {
+ return (this.DDM.isLocked() || this.locked);
+ },
+
+ /**
+ * Fired when this object is clicked
+ * @method handleMouseDown
+ * @param {Event} e
+ * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)
+ * @private
+ */
+ handleMouseDown: function(e, oDD) {
+
+ var button = e.which || e.button;
+
+ if (this.primaryButtonOnly && button > 1) {
+ return;
+ }
+
+ if (this.isLocked()) {
+ return;
+ }
+
+ this.DDM.refreshCache(this.groups);
+ // var self = this;
+ // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);
+
+ // Only process the event if we really clicked within the linked
+ // element. The reason we make this check is that in the case that
+ // another element was moved between the clicked element and the
+ // cursor in the time between the mousedown and mouseup events. When
+ // this happens, the element gets the next mousedown event
+ // regardless of where on the screen it happened.
+ var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e));
+ if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) {
+ } else {
+ if (this.clickValidator(e)) {
+ // set the initial element position
+ this.setStartPosition();
+
+
+ this.b4MouseDown(e);
+ this.onMouseDown(e);
+ this.DDM.handleMouseDown(e, this);
+
+ this.DDM.stopEvent(e);
+ } else {
+
+
+ }
+ }
+ },
+
+ clickValidator: function(e) {
+ var target = Event.getTarget(e);
+ return ( this.isValidHandleChild(target) &&
+ (this.id == this.handleElId ||
+ this.DDM.handleWasClicked(target, this.id)) );
+ },
+
+ /**
+ * Allows you to specify a tag name that should not start a drag operation
+ * when clicked. This is designed to facilitate embedding links within a
+ * drag handle that do something other than start the drag.
+ * @method addInvalidHandleType
+ * @param {string} tagName the type of element to exclude
+ */
+ addInvalidHandleType: function(tagName) {
+ var type = tagName.toUpperCase();
+ this.invalidHandleTypes[type] = type;
+ },
+
+ /**
+ * Lets you to specify an element id for a child of a drag handle
+ * that should not initiate a drag
+ * @method addInvalidHandleId
+ * @param {string} id the element id of the element you wish to ignore
+ */
+ addInvalidHandleId: function(id) {
+ if (typeof id !== "string") {
+ YAHOO.log("id is not a string, assuming it is an HTMLElement");
+ id = Dom.generateId(id);
+ }
+ this.invalidHandleIds[id] = id;
+ },
+
+ /**
+ * Lets you specify a css class of elements that will not initiate a drag
+ * @method addInvalidHandleClass
+ * @param {string} cssClass the class of the elements you wish to ignore
+ */
+ addInvalidHandleClass: function(cssClass) {
+ this.invalidHandleClasses.push(cssClass);
+ },
+
+ /**
+ * Unsets an excluded tag name set by addInvalidHandleType
+ * @method removeInvalidHandleType
+ * @param {string} tagName the type of element to unexclude
+ */
+ removeInvalidHandleType: function(tagName) {
+ var type = tagName.toUpperCase();
+ // this.invalidHandleTypes[type] = null;
+ delete this.invalidHandleTypes[type];
+ },
+
+ /**
+ * Unsets an invalid handle id
+ * @method removeInvalidHandleId
+ * @param {string} id the id of the element to re-enable
+ */
+ removeInvalidHandleId: function(id) {
+ if (typeof id !== "string") {
+ YAHOO.log("id is not a string, assuming it is an HTMLElement");
+ id = Dom.generateId(id);
+ }
+ delete this.invalidHandleIds[id];
+ },
+
+ /**
+ * Unsets an invalid css class
+ * @method removeInvalidHandleClass
+ * @param {string} cssClass the class of the element(s) you wish to
+ * re-enable
+ */
+ removeInvalidHandleClass: function(cssClass) {
+ for (var i=0, len=this.invalidHandleClasses.length; i= this.minX; i = i - iTickSize) {
+ if (!tickMap[i]) {
+ this.xTicks[this.xTicks.length] = i;
+ tickMap[i] = true;
+ }
+ }
+
+ for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
+ if (!tickMap[i]) {
+ this.xTicks[this.xTicks.length] = i;
+ tickMap[i] = true;
+ }
+ }
+
+ this.xTicks.sort(this.DDM.numericSort) ;
+ },
+
+ /**
+ * Create the array of vertical tick marks if an interval was specified in
+ * setYConstraint().
+ * @method setYTicks
+ * @private
+ */
+ setYTicks: function(iStartY, iTickSize) {
+ this.yTicks = [];
+ this.yTickSize = iTickSize;
+
+ var tickMap = {};
+
+ for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
+ if (!tickMap[i]) {
+ this.yTicks[this.yTicks.length] = i;
+ tickMap[i] = true;
+ }
+ }
+
+ for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
+ if (!tickMap[i]) {
+ this.yTicks[this.yTicks.length] = i;
+ tickMap[i] = true;
+ }
+ }
+
+ this.yTicks.sort(this.DDM.numericSort) ;
+ },
+
+ /**
+ * By default, the element can be dragged any place on the screen. Use
+ * this method to limit the horizontal travel of the element. Pass in
+ * 0,0 for the parameters if you want to lock the drag to the y axis.
+ * @method setXConstraint
+ * @param {int} iLeft the number of pixels the element can move to the left
+ * @param {int} iRight the number of pixels the element can move to the
+ * right
+ * @param {int} iTickSize optional parameter for specifying that the
+ * element
+ * should move iTickSize pixels at a time.
+ */
+ setXConstraint: function(iLeft, iRight, iTickSize) {
+ this.leftConstraint = iLeft;
+ this.rightConstraint = iRight;
+
+ this.minX = this.initPageX - iLeft;
+ this.maxX = this.initPageX + iRight;
+ if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
+
+ this.constrainX = true;
+ },
+
+ /**
+ * Clears any constraints applied to this instance. Also clears ticks
+ * since they can't exist independent of a constraint at this time.
+ * @method clearConstraints
+ */
+ clearConstraints: function() {
+ this.constrainX = false;
+ this.constrainY = false;
+ this.clearTicks();
+ },
+
+ /**
+ * Clears any tick interval defined for this instance
+ * @method clearTicks
+ */
+ clearTicks: function() {
+ this.xTicks = null;
+ this.yTicks = null;
+ this.xTickSize = 0;
+ this.yTickSize = 0;
+ },
+
+ /**
+ * By default, the element can be dragged any place on the screen. Set
+ * this to limit the vertical travel of the element. Pass in 0,0 for the
+ * parameters if you want to lock the drag to the x axis.
+ * @method setYConstraint
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize optional parameter for specifying that the
+ * element should move iTickSize pixels at a time.
+ */
+ setYConstraint: function(iUp, iDown, iTickSize) {
+ this.topConstraint = iUp;
+ this.bottomConstraint = iDown;
+
+ this.minY = this.initPageY - iUp;
+ this.maxY = this.initPageY + iDown;
+ if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
+
+ this.constrainY = true;
+
+ },
+
+ /**
+ * resetConstraints must be called if you manually reposition a dd element.
+ * @method resetConstraints
+ * @param {boolean} maintainOffset
+ */
+ resetConstraints: function() {
+
+
+ // Maintain offsets if necessary
+ if (this.initPageX || this.initPageX === 0) {
+ // figure out how much this thing has moved
+ var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
+ var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
+
+ this.setInitPosition(dx, dy);
+
+ // This is the first time we have detected the element's position
+ } else {
+ this.setInitPosition();
+ }
+
+ if (this.constrainX) {
+ this.setXConstraint( this.leftConstraint,
+ this.rightConstraint,
+ this.xTickSize );
+ }
+
+ if (this.constrainY) {
+ this.setYConstraint( this.topConstraint,
+ this.bottomConstraint,
+ this.yTickSize );
+ }
+ },
+
+ /**
+ * Normally the drag element is moved pixel by pixel, but we can specify
+ * that it move a number of pixels at a time. This method resolves the
+ * location when we have it set up like this.
+ * @method getTick
+ * @param {int} val where we want to place the object
+ * @param {int[]} tickArray sorted array of valid points
+ * @return {int} the closest tick
+ * @private
+ */
+ getTick: function(val, tickArray) {
+
+ if (!tickArray) {
+ // If tick interval is not defined, it is effectively 1 pixel,
+ // so we return the value passed to us.
+ return val;
+ } else if (tickArray[0] >= val) {
+ // The value is lower than the first tick, so we return the first
+ // tick.
+ return tickArray[0];
+ } else {
+ for (var i=0, len=tickArray.length; i= val) {
+ var diff1 = val - tickArray[i];
+ var diff2 = tickArray[next] - val;
+ return (diff2 > diff1) ? tickArray[i] : tickArray[next];
+ }
+ }
+
+ // The value is larger than the last tick, so we return the last
+ // tick.
+ return tickArray[tickArray.length - 1];
+ }
+ },
+
+ /**
+ * toString method
+ * @method toString
+ * @return {string} string representation of the dd obj
+ */
+ toString: function() {
+ return ("DragDrop " + this.id);
+ }
+
+};
+
+})();
+/**
+ * The drag and drop utility provides a framework for building drag and drop
+ * applications. In addition to enabling drag and drop for specific elements,
+ * the drag and drop elements are tracked by the manager class, and the
+ * interactions between the various elements are tracked during the drag and
+ * the implementing code is notified about these important moments.
+ * @module dragdrop
+ * @title Drag and Drop
+ * @requires yahoo,dom,event
+ * @namespace YAHOO.util
+ */
+
+// Only load the library once. Rewriting the manager class would orphan
+// existing drag and drop instances.
+if (!YAHOO.util.DragDropMgr) {
+
+/**
+ * DragDropMgr is a singleton that tracks the element interaction for
+ * all DragDrop items in the window. Generally, you will not call
+ * this class directly, but it does have helper methods that could
+ * be useful in your DragDrop implementations.
+ * @class DragDropMgr
+ * @static
+ */
+YAHOO.util.DragDropMgr = function() {
+
+ var Event = YAHOO.util.Event;
+
+ return {
+
+ /**
+ * Two dimensional Array of registered DragDrop objects. The first
+ * dimension is the DragDrop item group, the second the DragDrop
+ * object.
+ * @property ids
+ * @type {string: string}
+ * @private
+ * @static
+ */
+ ids: {},
+
+ /**
+ * Array of element ids defined as drag handles. Used to determine
+ * if the element that generated the mousedown event is actually the
+ * handle and not the html element itself.
+ * @property handleIds
+ * @type {string: string}
+ * @private
+ * @static
+ */
+ handleIds: {},
+
+ /**
+ * the DragDrop object that is currently being dragged
+ * @property dragCurrent
+ * @type DragDrop
+ * @private
+ * @static
+ **/
+ dragCurrent: null,
+
+ /**
+ * the DragDrop object(s) that are being hovered over
+ * @property dragOvers
+ * @type Array
+ * @private
+ * @static
+ */
+ dragOvers: {},
+
+ /**
+ * the X distance between the cursor and the object being dragged
+ * @property deltaX
+ * @type int
+ * @private
+ * @static
+ */
+ deltaX: 0,
+
+ /**
+ * the Y distance between the cursor and the object being dragged
+ * @property deltaY
+ * @type int
+ * @private
+ * @static
+ */
+ deltaY: 0,
+
+ /**
+ * Flag to determine if we should prevent the default behavior of the
+ * events we define. By default this is true, but this can be set to
+ * false if you need the default behavior (not recommended)
+ * @property preventDefault
+ * @type boolean
+ * @static
+ */
+ preventDefault: true,
+
+ /**
+ * Flag to determine if we should stop the propagation of the events
+ * we generate. This is true by default but you may want to set it to
+ * false if the html element contains other features that require the
+ * mouse click.
+ * @property stopPropagation
+ * @type boolean
+ * @static
+ */
+ stopPropagation: true,
+
+ /**
+ * Internal flag that is set to true when drag and drop has been
+ * intialized
+ * @property initialized
+ * @private
+ * @static
+ */
+ initalized: false,
+
+ /**
+ * All drag and drop can be disabled.
+ * @property locked
+ * @private
+ * @static
+ */
+ locked: false,
+
+ /**
+ * Called the first time an element is registered.
+ * @method init
+ * @private
+ * @static
+ */
+ init: function() {
+ this.initialized = true;
+ },
+
+ /**
+ * In point mode, drag and drop interaction is defined by the
+ * location of the cursor during the drag/drop
+ * @property POINT
+ * @type int
+ * @static
+ */
+ POINT: 0,
+
+ /**
+ * In intersect mode, drag and drop interactio nis defined by the
+ * overlap of two or more drag and drop objects.
+ * @property INTERSECT
+ * @type int
+ * @static
+ */
+ INTERSECT: 1,
+
+ /**
+ * The current drag and drop mode. Default: POINT
+ * @property mode
+ * @type int
+ * @static
+ */
+ mode: 0,
+
+ /**
+ * Runs method on all drag and drop objects
+ * @method _execOnAll
+ * @private
+ * @static
+ */
+ _execOnAll: function(sMethod, args) {
+ for (var i in this.ids) {
+ for (var j in this.ids[i]) {
+ var oDD = this.ids[i][j];
+ if (! this.isTypeOfDD(oDD)) {
+ continue;
+ }
+ oDD[sMethod].apply(oDD, args);
+ }
+ }
+ },
+
+ /**
+ * Drag and drop initialization. Sets up the global event handlers
+ * @method _onLoad
+ * @private
+ * @static
+ */
+ _onLoad: function() {
+
+ this.init();
+
+
+ Event.on(document, "mouseup", this.handleMouseUp, this, true);
+ Event.on(document, "mousemove", this.handleMouseMove, this, true);
+ Event.on(window, "unload", this._onUnload, this, true);
+ Event.on(window, "resize", this._onResize, this, true);
+ // Event.on(window, "mouseout", this._test);
+
+ },
+
+ /**
+ * Reset constraints on all drag and drop objs
+ * @method _onResize
+ * @private
+ * @static
+ */
+ _onResize: function(e) {
+ this._execOnAll("resetConstraints", []);
+ },
+
+ /**
+ * Lock all drag and drop functionality
+ * @method lock
+ * @static
+ */
+ lock: function() { this.locked = true; },
+
+ /**
+ * Unlock all drag and drop functionality
+ * @method unlock
+ * @static
+ */
+ unlock: function() { this.locked = false; },
+
+ /**
+ * Is drag and drop locked?
+ * @method isLocked
+ * @return {boolean} True if drag and drop is locked, false otherwise.
+ * @static
+ */
+ isLocked: function() { return this.locked; },
+
+ /**
+ * Location cache that is set for all drag drop objects when a drag is
+ * initiated, cleared when the drag is finished.
+ * @property locationCache
+ * @private
+ * @static
+ */
+ locationCache: {},
+
+ /**
+ * Set useCache to false if you want to force object the lookup of each
+ * drag and drop linked element constantly during a drag.
+ * @property useCache
+ * @type boolean
+ * @static
+ */
+ useCache: true,
+
+ /**
+ * The number of pixels that the mouse needs to move after the
+ * mousedown before the drag is initiated. Default=3;
+ * @property clickPixelThresh
+ * @type int
+ * @static
+ */
+ clickPixelThresh: 3,
+
+ /**
+ * The number of milliseconds after the mousedown event to initiate the
+ * drag if we don't get a mouseup event. Default=1000
+ * @property clickTimeThresh
+ * @type int
+ * @static
+ */
+ clickTimeThresh: 1000,
+
+ /**
+ * Flag that indicates that either the drag pixel threshold or the
+ * mousdown time threshold has been met
+ * @property dragThreshMet
+ * @type boolean
+ * @private
+ * @static
+ */
+ dragThreshMet: false,
+
+ /**
+ * Timeout used for the click time threshold
+ * @property clickTimeout
+ * @type Object
+ * @private
+ * @static
+ */
+ clickTimeout: null,
+
+ /**
+ * The X position of the mousedown event stored for later use when a
+ * drag threshold is met.
+ * @property startX
+ * @type int
+ * @private
+ * @static
+ */
+ startX: 0,
+
+ /**
+ * The Y position of the mousedown event stored for later use when a
+ * drag threshold is met.
+ * @property startY
+ * @type int
+ * @private
+ * @static
+ */
+ startY: 0,
+
+ /**
+ * Each DragDrop instance must be registered with the DragDropMgr.
+ * This is executed in DragDrop.init()
+ * @method regDragDrop
+ * @param {DragDrop} oDD the DragDrop object to register
+ * @param {String} sGroup the name of the group this element belongs to
+ * @static
+ */
+ regDragDrop: function(oDD, sGroup) {
+ if (!this.initialized) { this.init(); }
+
+ if (!this.ids[sGroup]) {
+ this.ids[sGroup] = {};
+ }
+ this.ids[sGroup][oDD.id] = oDD;
+ },
+
+ /**
+ * Removes the supplied dd instance from the supplied group. Executed
+ * by DragDrop.removeFromGroup, so don't call this function directly.
+ * @method removeDDFromGroup
+ * @private
+ * @static
+ */
+ removeDDFromGroup: function(oDD, sGroup) {
+ if (!this.ids[sGroup]) {
+ this.ids[sGroup] = {};
+ }
+
+ var obj = this.ids[sGroup];
+ if (obj && obj[oDD.id]) {
+ delete obj[oDD.id];
+ }
+ },
+
+ /**
+ * Unregisters a drag and drop item. This is executed in
+ * DragDrop.unreg, use that method instead of calling this directly.
+ * @method _remove
+ * @private
+ * @static
+ */
+ _remove: function(oDD) {
+ for (var g in oDD.groups) {
+ if (g && this.ids[g][oDD.id]) {
+ delete this.ids[g][oDD.id];
+ }
+ }
+ delete this.handleIds[oDD.id];
+ },
+
+ /**
+ * Each DragDrop handle element must be registered. This is done
+ * automatically when executing DragDrop.setHandleElId()
+ * @method regHandle
+ * @param {String} sDDId the DragDrop id this element is a handle for
+ * @param {String} sHandleId the id of the element that is the drag
+ * handle
+ * @static
+ */
+ regHandle: function(sDDId, sHandleId) {
+ if (!this.handleIds[sDDId]) {
+ this.handleIds[sDDId] = {};
+ }
+ this.handleIds[sDDId][sHandleId] = sHandleId;
+ },
+
+ /**
+ * Utility function to determine if a given element has been
+ * registered as a drag drop item.
+ * @method isDragDrop
+ * @param {String} id the element id to check
+ * @return {boolean} true if this element is a DragDrop item,
+ * false otherwise
+ * @static
+ */
+ isDragDrop: function(id) {
+ return ( this.getDDById(id) ) ? true : false;
+ },
+
+ /**
+ * Returns the drag and drop instances that are in all groups the
+ * passed in instance belongs to.
+ * @method getRelated
+ * @param {DragDrop} p_oDD the obj to get related data for
+ * @param {boolean} bTargetsOnly if true, only return targetable objs
+ * @return {DragDrop[]} the related instances
+ * @static
+ */
+ getRelated: function(p_oDD, bTargetsOnly) {
+ var oDDs = [];
+ for (var i in p_oDD.groups) {
+ for (j in this.ids[i]) {
+ var dd = this.ids[i][j];
+ if (! this.isTypeOfDD(dd)) {
+ continue;
+ }
+ if (!bTargetsOnly || dd.isTarget) {
+ oDDs[oDDs.length] = dd;
+ }
+ }
+ }
+
+ return oDDs;
+ },
+
+ /**
+ * Returns true if the specified dd target is a legal target for
+ * the specifice drag obj
+ * @method isLegalTarget
+ * @param {DragDrop} the drag obj
+ * @param {DragDrop} the target
+ * @return {boolean} true if the target is a legal target for the
+ * dd obj
+ * @static
+ */
+ isLegalTarget: function (oDD, oTargetDD) {
+ var targets = this.getRelated(oDD, true);
+ for (var i=0, len=targets.length;i this.clickPixelThresh ||
+ diffY > this.clickPixelThresh) {
+ this.startDrag(this.startX, this.startY);
+ }
+ }
+
+ if (this.dragThreshMet) {
+ this.dragCurrent.b4Drag(e);
+ this.dragCurrent.onDrag(e);
+ this.fireEvents(e, false);
+ }
+
+ this.stopEvent(e);
+
+ return true;
+ },
+
+ /**
+ * Iterates over all of the DragDrop elements to find ones we are
+ * hovering over or dropping on
+ * @method fireEvents
+ * @param {Event} e the event
+ * @param {boolean} isDrop is this a drop op or a mouseover op?
+ * @private
+ * @static
+ */
+ fireEvents: function(e, isDrop) {
+ var dc = this.dragCurrent;
+
+ // If the user did the mouse up outside of the window, we could
+ // get here even though we have ended the drag.
+ if (!dc || dc.isLocked()) {
+ return;
+ }
+
+ var x = YAHOO.util.Event.getPageX(e);
+ var y = YAHOO.util.Event.getPageY(e);
+ var pt = new YAHOO.util.Point(x,y);
+
+ // cache the previous dragOver array
+ var oldOvers = [];
+
+ var outEvts = [];
+ var overEvts = [];
+ var dropEvts = [];
+ var enterEvts = [];
+
+ // Check to see if the object(s) we were hovering over is no longer
+ // being hovered over so we can fire the onDragOut event
+ for (var i in this.dragOvers) {
+
+ var ddo = this.dragOvers[i];
+
+ if (! this.isTypeOfDD(ddo)) {
+ continue;
+ }
+
+ if (! this.isOverTarget(pt, ddo, this.mode)) {
+ outEvts.push( ddo );
+ }
+
+ oldOvers[i] = true;
+ delete this.dragOvers[i];
+ }
+
+ for (var sGroup in dc.groups) {
+
+ if ("string" != typeof sGroup) {
+ continue;
+ }
+
+ for (i in this.ids[sGroup]) {
+ var oDD = this.ids[sGroup][i];
+ if (! this.isTypeOfDD(oDD)) {
+ continue;
+ }
+
+ if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {
+ if (this.isOverTarget(pt, oDD, this.mode)) {
+ // look for drop interactions
+ if (isDrop) {
+ dropEvts.push( oDD );
+ // look for drag enter and drag over interactions
+ } else {
+
+ // initial drag over: dragEnter fires
+ if (!oldOvers[oDD.id]) {
+ enterEvts.push( oDD );
+ // subsequent drag overs: dragOver fires
+ } else {
+ overEvts.push( oDD );
+ }
+
+ this.dragOvers[oDD.id] = oDD;
+ }
+ }
+ }
+ }
+ }
+
+ if (this.mode) {
+ if (outEvts.length) {
+ dc.b4DragOut(e, outEvts);
+ dc.onDragOut(e, outEvts);
+ }
+
+ if (enterEvts.length) {
+ dc.onDragEnter(e, enterEvts);
+ }
+
+ if (overEvts.length) {
+ dc.b4DragOver(e, overEvts);
+ dc.onDragOver(e, overEvts);
+ }
+
+ if (dropEvts.length) {
+ dc.b4DragDrop(e, dropEvts);
+ dc.onDragDrop(e, dropEvts);
+ }
+
+ } else {
+ // fire dragout events
+ var len = 0;
+ for (i=0, len=outEvts.length; i
+ * YAHOO.util.DragDropMgr.refreshCache(ddinstance.groups);
+ *
+ * Alternatively:
+ *
+ * YAHOO.util.DragDropMgr.refreshCache({group1:true, group2:true});
+ *
+ * @TODO this really should be an indexed array. Alternatively this
+ * method could accept both.
+ * @method refreshCache
+ * @param {Object} groups an associative array of groups to refresh
+ * @static
+ */
+ refreshCache: function(groups) {
+ for (var sGroup in groups) {
+ if ("string" != typeof sGroup) {
+ continue;
+ }
+ for (var i in this.ids[sGroup]) {
+ var oDD = this.ids[sGroup][i];
+
+ if (this.isTypeOfDD(oDD)) {
+ // if (this.isTypeOfDD(oDD) && oDD.isTarget) {
+ var loc = this.getLocation(oDD);
+ if (loc) {
+ this.locationCache[oDD.id] = loc;
+ } else {
+ delete this.locationCache[oDD.id];
+ // this will unregister the drag and drop object if
+ // the element is not in a usable state
+ // oDD.unreg();
+ }
+ }
+ }
+ }
+ },
+
+ /**
+ * This checks to make sure an element exists and is in the DOM. The
+ * main purpose is to handle cases where innerHTML is used to remove
+ * drag and drop objects from the DOM. IE provides an 'unspecified
+ * error' when trying to access the offsetParent of such an element
+ * @method verifyEl
+ * @param {HTMLElement} el the element to check
+ * @return {boolean} true if the element looks usable
+ * @static
+ */
+ verifyEl: function(el) {
+ try {
+ if (el) {
+ var parent = el.offsetParent;
+ if (parent) {
+ return true;
+ }
+ }
+ } catch(e) {
+ }
+
+ return false;
+ },
+
+ /**
+ * Returns a Region object containing the drag and drop element's position
+ * and size, including the padding configured for it
+ * @method getLocation
+ * @param {DragDrop} oDD the drag and drop object to get the
+ * location for
+ * @return {YAHOO.util.Region} a Region object representing the total area
+ * the element occupies, including any padding
+ * the instance is configured for.
+ * @static
+ */
+ getLocation: function(oDD) {
+ if (! this.isTypeOfDD(oDD)) {
+ return null;
+ }
+
+ var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
+
+ try {
+ pos= YAHOO.util.Dom.getXY(el);
+ } catch (e) { }
+
+ if (!pos) {
+ return null;
+ }
+
+ x1 = pos[0];
+ x2 = x1 + el.offsetWidth;
+ y1 = pos[1];
+ y2 = y1 + el.offsetHeight;
+
+ t = y1 - oDD.padding[0];
+ r = x2 + oDD.padding[1];
+ b = y2 + oDD.padding[2];
+ l = x1 - oDD.padding[3];
+
+ return new YAHOO.util.Region( t, r, b, l );
+ },
+
+ /**
+ * Checks the cursor location to see if it over the target
+ * @method isOverTarget
+ * @param {YAHOO.util.Point} pt The point to evaluate
+ * @param {DragDrop} oTarget the DragDrop object we are inspecting
+ * @return {boolean} true if the mouse is over the target
+ * @private
+ * @static
+ */
+ isOverTarget: function(pt, oTarget, intersect) {
+ // use cache if available
+ var loc = this.locationCache[oTarget.id];
+ if (!loc || !this.useCache) {
+ loc = this.getLocation(oTarget);
+ this.locationCache[oTarget.id] = loc;
+
+ }
+
+ if (!loc) {
+ return false;
+ }
+
+ oTarget.cursorIsOver = loc.contains( pt );
+
+ // DragDrop is using this as a sanity check for the initial mousedown
+ // in this case we are done. In POINT mode, if the drag obj has no
+ // contraints, we are also done. Otherwise we need to evaluate the
+ // location of the target as related to the actual location of the
+ // dragged element.
+ var dc = this.dragCurrent;
+ if (!dc || !dc.getTargetCoord ||
+ (!intersect && !dc.constrainX && !dc.constrainY)) {
+ return oTarget.cursorIsOver;
+ }
+
+ oTarget.overlap = null;
+
+ // Get the current location of the drag element, this is the
+ // location of the mouse event less the delta that represents
+ // where the original mousedown happened on the element. We
+ // need to consider constraints and ticks as well.
+ var pos = dc.getTargetCoord(pt.x, pt.y);
+
+ var el = dc.getDragEl();
+ var curRegion = new YAHOO.util.Region( pos.y,
+ pos.x + el.offsetWidth,
+ pos.y + el.offsetHeight,
+ pos.x );
+
+ var overlap = curRegion.intersect(loc);
+
+ if (overlap) {
+ oTarget.overlap = overlap;
+ return (intersect) ? true : oTarget.cursorIsOver;
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * unload event handler
+ * @method _onUnload
+ * @private
+ * @static
+ */
+ _onUnload: function(e, me) {
+ this.unregAll();
+ },
+
+ /**
+ * Cleans up the drag and drop events and objects.
+ * @method unregAll
+ * @private
+ * @static
+ */
+ unregAll: function() {
+
+ if (this.dragCurrent) {
+ this.stopDrag();
+ this.dragCurrent = null;
+ }
+
+ this._execOnAll("unreg", []);
+
+ for (i in this.elementCache) {
+ delete this.elementCache[i];
+ }
+
+ this.elementCache = {};
+ this.ids = {};
+ },
+
+ /**
+ * A cache of DOM elements
+ * @property elementCache
+ * @private
+ * @static
+ */
+ elementCache: {},
+
+ /**
+ * Get the wrapper for the DOM element specified
+ * @method getElWrapper
+ * @param {String} id the id of the element to get
+ * @return {YAHOO.util.DDM.ElementWrapper} the wrapped element
+ * @private
+ * @deprecated This wrapper isn't that useful
+ * @static
+ */
+ getElWrapper: function(id) {
+ var oWrapper = this.elementCache[id];
+ if (!oWrapper || !oWrapper.el) {
+ oWrapper = this.elementCache[id] =
+ new this.ElementWrapper(YAHOO.util.Dom.get(id));
+ }
+ return oWrapper;
+ },
+
+ /**
+ * Returns the actual DOM element
+ * @method getElement
+ * @param {String} id the id of the elment to get
+ * @return {Object} The element
+ * @deprecated use YAHOO.util.Dom.get instead
+ * @static
+ */
+ getElement: function(id) {
+ return YAHOO.util.Dom.get(id);
+ },
+
+ /**
+ * Returns the style property for the DOM element (i.e.,
+ * document.getElById(id).style)
+ * @method getCss
+ * @param {String} id the id of the elment to get
+ * @return {Object} The style property of the element
+ * @deprecated use YAHOO.util.Dom instead
+ * @static
+ */
+ getCss: function(id) {
+ var el = YAHOO.util.Dom.get(id);
+ return (el) ? el.style : null;
+ },
+
+ /**
+ * Inner class for cached elements
+ * @class DragDropMgr.ElementWrapper
+ * @for DragDropMgr
+ * @private
+ * @deprecated
+ */
+ ElementWrapper: function(el) {
+ /**
+ * The element
+ * @property el
+ */
+ this.el = el || null;
+ /**
+ * The element id
+ * @property id
+ */
+ this.id = this.el && el.id;
+ /**
+ * A reference to the style property
+ * @property css
+ */
+ this.css = this.el && el.style;
+ },
+
+ /**
+ * Returns the X position of an html element
+ * @method getPosX
+ * @param el the element for which to get the position
+ * @return {int} the X coordinate
+ * @for DragDropMgr
+ * @deprecated use YAHOO.util.Dom.getX instead
+ * @static
+ */
+ getPosX: function(el) {
+ return YAHOO.util.Dom.getX(el);
+ },
+
+ /**
+ * Returns the Y position of an html element
+ * @method getPosY
+ * @param el the element for which to get the position
+ * @return {int} the Y coordinate
+ * @deprecated use YAHOO.util.Dom.getY instead
+ * @static
+ */
+ getPosY: function(el) {
+ return YAHOO.util.Dom.getY(el);
+ },
+
+ /**
+ * Swap two nodes. In IE, we use the native method, for others we
+ * emulate the IE behavior
+ * @method swapNode
+ * @param n1 the first node to swap
+ * @param n2 the other node to swap
+ * @static
+ */
+ swapNode: function(n1, n2) {
+ if (n1.swapNode) {
+ n1.swapNode(n2);
+ } else {
+ var p = n2.parentNode;
+ var s = n2.nextSibling;
+
+ if (s == n1) {
+ p.insertBefore(n1, n2);
+ } else if (n2 == n1.nextSibling) {
+ p.insertBefore(n2, n1);
+ } else {
+ n1.parentNode.replaceChild(n2, n1);
+ p.insertBefore(n1, s);
+ }
+ }
+ },
+
+ /**
+ * Returns the current scroll position
+ * @method getScroll
+ * @private
+ * @static
+ */
+ getScroll: function () {
+ var t, l, dde=document.documentElement, db=document.body;
+ if (dde && (dde.scrollTop || dde.scrollLeft)) {
+ t = dde.scrollTop;
+ l = dde.scrollLeft;
+ } else if (db) {
+ t = db.scrollTop;
+ l = db.scrollLeft;
+ } else {
+ YAHOO.log("could not get scroll property");
+ }
+ return { top: t, left: l };
+ },
+
+ /**
+ * Returns the specified element style property
+ * @method getStyle
+ * @param {HTMLElement} el the element
+ * @param {string} styleProp the style property
+ * @return {string} The value of the style property
+ * @deprecated use YAHOO.util.Dom.getStyle
+ * @static
+ */
+ getStyle: function(el, styleProp) {
+ return YAHOO.util.Dom.getStyle(el, styleProp);
+ },
+
+ /**
+ * Gets the scrollTop
+ * @method getScrollTop
+ * @return {int} the document's scrollTop
+ * @static
+ */
+ getScrollTop: function () { return this.getScroll().top; },
+
+ /**
+ * Gets the scrollLeft
+ * @method getScrollLeft
+ * @return {int} the document's scrollTop
+ * @static
+ */
+ getScrollLeft: function () { return this.getScroll().left; },
+
+ /**
+ * Sets the x/y position of an element to the location of the
+ * target element.
+ * @method moveToEl
+ * @param {HTMLElement} moveEl The element to move
+ * @param {HTMLElement} targetEl The position reference element
+ * @static
+ */
+ moveToEl: function (moveEl, targetEl) {
+ var aCoord = YAHOO.util.Dom.getXY(targetEl);
+ YAHOO.util.Dom.setXY(moveEl, aCoord);
+ },
+
+ /**
+ * Gets the client height
+ * @method getClientHeight
+ * @return {int} client height in px
+ * @deprecated use YAHOO.util.Dom.getViewportHeight instead
+ * @static
+ */
+ getClientHeight: function() {
+ return YAHOO.util.Dom.getViewportHeight();
+ },
+
+ /**
+ * Gets the client width
+ * @method getClientWidth
+ * @return {int} client width in px
+ * @deprecated use YAHOO.util.Dom.getViewportWidth instead
+ * @static
+ */
+ getClientWidth: function() {
+ return YAHOO.util.Dom.getViewportWidth();
+ },
+
+ /**
+ * Numeric array sort function
+ * @method numericSort
+ * @static
+ */
+ numericSort: function(a, b) { return (a - b); },
+
+ /**
+ * Internal counter
+ * @property _timeoutCount
+ * @private
+ * @static
+ */
+ _timeoutCount: 0,
+
+ /**
+ * Trying to make the load order less important. Without this we get
+ * an error if this file is loaded before the Event Utility.
+ * @method _addListeners
+ * @private
+ * @static
+ */
+ _addListeners: function() {
+ var DDM = YAHOO.util.DDM;
+ if ( YAHOO.util.Event && document ) {
+ DDM._onLoad();
+ } else {
+ if (DDM._timeoutCount > 2000) {
+ } else {
+ setTimeout(DDM._addListeners, 10);
+ if (document && document.body) {
+ DDM._timeoutCount += 1;
+ }
+ }
+ }
+ },
+
+ /**
+ * Recursively searches the immediate parent and all child nodes for
+ * the handle element in order to determine wheter or not it was
+ * clicked.
+ * @method handleWasClicked
+ * @param node the html element to inspect
+ * @static
+ */
+ handleWasClicked: function(node, id) {
+ if (this.isHandle(id, node.id)) {
+ return true;
+ } else {
+ // check to see if this is a text node child of the one we want
+ var p = node.parentNode;
+
+ while (p) {
+ if (this.isHandle(id, p.id)) {
+ return true;
+ } else {
+ p = p.parentNode;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ };
+
+}();
+
+// shorter alias, save a few bytes
+YAHOO.util.DDM = YAHOO.util.DragDropMgr;
+YAHOO.util.DDM._addListeners();
+
+}
+
+/**
+ * A DragDrop implementation where the linked element follows the
+ * mouse cursor during a drag.
+ * @class DD
+ * @extends YAHOO.util.DragDrop
+ * @constructor
+ * @param {String} id the id of the linked element
+ * @param {String} sGroup the group of related DragDrop items
+ * @param {object} config an object containing configurable attributes
+ * Valid properties for DD:
+ * scroll
+ */
+YAHOO.util.DD = function(id, sGroup, config) {
+ if (id) {
+ this.init(id, sGroup, config);
+ }
+};
+
+YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
+
+ /**
+ * When set to true, the utility automatically tries to scroll the browser
+ * window wehn a drag and drop element is dragged near the viewport boundary.
+ * Defaults to true.
+ * @property scroll
+ * @type boolean
+ */
+ scroll: true,
+
+ /**
+ * Sets the pointer offset to the distance between the linked element's top
+ * left corner and the location the element was clicked
+ * @method autoOffset
+ * @param {int} iPageX the X coordinate of the click
+ * @param {int} iPageY the Y coordinate of the click
+ */
+ autoOffset: function(iPageX, iPageY) {
+ var x = iPageX - this.startPageX;
+ var y = iPageY - this.startPageY;
+ this.setDelta(x, y);
+ },
+
+ /**
+ * Sets the pointer offset. You can call this directly to force the
+ * offset to be in a particular location (e.g., pass in 0,0 to set it
+ * to the center of the object, as done in YAHOO.widget.Slider)
+ * @method setDelta
+ * @param {int} iDeltaX the distance from the left
+ * @param {int} iDeltaY the distance from the top
+ */
+ setDelta: function(iDeltaX, iDeltaY) {
+ this.deltaX = iDeltaX;
+ this.deltaY = iDeltaY;
+ },
+
+ /**
+ * Sets the drag element to the location of the mousedown or click event,
+ * maintaining the cursor location relative to the location on the element
+ * that was clicked. Override this if you want to place the element in a
+ * location other than where the cursor is.
+ * @method setDragElPos
+ * @param {int} iPageX the X coordinate of the mousedown or drag event
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event
+ */
+ setDragElPos: function(iPageX, iPageY) {
+ // the first time we do this, we are going to check to make sure
+ // the element has css positioning
+
+ var el = this.getDragEl();
+ this.alignElWithMouse(el, iPageX, iPageY);
+ },
+
+ /**
+ * Sets the element to the location of the mousedown or click event,
+ * maintaining the cursor location relative to the location on the element
+ * that was clicked. Override this if you want to place the element in a
+ * location other than where the cursor is.
+ * @method alignElWithMouse
+ * @param {HTMLElement} el the element to move
+ * @param {int} iPageX the X coordinate of the mousedown or drag event
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event
+ */
+ alignElWithMouse: function(el, iPageX, iPageY) {
+ var oCoord = this.getTargetCoord(iPageX, iPageY);
+
+ if (!this.deltaSetXY) {
+ var aCoord = [oCoord.x, oCoord.y];
+ YAHOO.util.Dom.setXY(el, aCoord);
+ var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );
+ var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );
+
+ this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
+ } else {
+ YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");
+ YAHOO.util.Dom.setStyle(el, "top", (oCoord.y + this.deltaSetXY[1]) + "px");
+ }
+
+ this.cachePosition(oCoord.x, oCoord.y);
+ this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
+ },
+
+ /**
+ * Saves the most recent position so that we can reset the constraints and
+ * tick marks on-demand. We need to know this so that we can calculate the
+ * number of pixels the element is offset from its original position.
+ * @method cachePosition
+ * @param iPageX the current x position (optional, this just makes it so we
+ * don't have to look it up again)
+ * @param iPageY the current y position (optional, this just makes it so we
+ * don't have to look it up again)
+ */
+ cachePosition: function(iPageX, iPageY) {
+ if (iPageX) {
+ this.lastPageX = iPageX;
+ this.lastPageY = iPageY;
+ } else {
+ var aCoord = YAHOO.util.Dom.getXY(this.getEl());
+ this.lastPageX = aCoord[0];
+ this.lastPageY = aCoord[1];
+ }
+ },
+
+ /**
+ * Auto-scroll the window if the dragged object has been moved beyond the
+ * visible window boundary.
+ * @method autoScroll
+ * @param {int} x the drag element's x position
+ * @param {int} y the drag element's y position
+ * @param {int} h the height of the drag element
+ * @param {int} w the width of the drag element
+ * @private
+ */
+ autoScroll: function(x, y, h, w) {
+
+ if (this.scroll) {
+ // The client height
+ var clientH = this.DDM.getClientHeight();
+
+ // The client width
+ var clientW = this.DDM.getClientWidth();
+
+ // The amt scrolled down
+ var st = this.DDM.getScrollTop();
+
+ // The amt scrolled right
+ var sl = this.DDM.getScrollLeft();
+
+ // Location of the bottom of the element
+ var bot = h + y;
+
+ // Location of the right of the element
+ var right = w + x;
+
+ // The distance from the cursor to the bottom of the visible area,
+ // adjusted so that we don't scroll if the cursor is beyond the
+ // element drag constraints
+ var toBot = (clientH + st - y - this.deltaY);
+
+ // The distance from the cursor to the right of the visible area
+ var toRight = (clientW + sl - x - this.deltaX);
+
+
+ // How close to the edge the cursor must be before we scroll
+ // var thresh = (document.all) ? 100 : 40;
+ var thresh = 40;
+
+ // How many pixels to scroll per autoscroll op. This helps to reduce
+ // clunky scrolling. IE is more sensitive about this ... it needs this
+ // value to be higher.
+ var scrAmt = (document.all) ? 80 : 30;
+
+ // Scroll down if we are near the bottom of the visible page and the
+ // obj extends below the crease
+ if ( bot > clientH && toBot < thresh ) {
+ window.scrollTo(sl, st + scrAmt);
+ }
+
+ // Scroll up if the window is scrolled down and the top of the object
+ // goes above the top border
+ if ( y < st && st > 0 && y - st < thresh ) {
+ window.scrollTo(sl, st - scrAmt);
+ }
+
+ // Scroll right if the obj is beyond the right border and the cursor is
+ // near the border.
+ if ( right > clientW && toRight < thresh ) {
+ window.scrollTo(sl + scrAmt, st);
+ }
+
+ // Scroll left if the window has been scrolled to the right and the obj
+ // extends past the left border
+ if ( x < sl && sl > 0 && x - sl < thresh ) {
+ window.scrollTo(sl - scrAmt, st);
+ }
+ }
+ },
+
+ /**
+ * Finds the location the element should be placed if we want to move
+ * it to where the mouse location less the click offset would place us.
+ * @method getTargetCoord
+ * @param {int} iPageX the X coordinate of the click
+ * @param {int} iPageY the Y coordinate of the click
+ * @return an object that contains the coordinates (Object.x and Object.y)
+ * @private
+ */
+ getTargetCoord: function(iPageX, iPageY) {
+
+
+ var x = iPageX - this.deltaX;
+ var y = iPageY - this.deltaY;
+
+ if (this.constrainX) {
+ if (x < this.minX) { x = this.minX; }
+ if (x > this.maxX) { x = this.maxX; }
+ }
+
+ if (this.constrainY) {
+ if (y < this.minY) { y = this.minY; }
+ if (y > this.maxY) { y = this.maxY; }
+ }
+
+ x = this.getTick(x, this.xTicks);
+ y = this.getTick(y, this.yTicks);
+
+
+ return {x:x, y:y};
+ },
+
+ /*
+ * Sets up config options specific to this class. Overrides
+ * YAHOO.util.DragDrop, but all versions of this method through the
+ * inheritance chain are called
+ */
+ applyConfig: function() {
+ YAHOO.util.DD.superclass.applyConfig.call(this);
+ this.scroll = (this.config.scroll !== false);
+ },
+
+ /*
+ * Event that fires prior to the onMouseDown event. Overrides
+ * YAHOO.util.DragDrop.
+ */
+ b4MouseDown: function(e) {
+ // this.resetConstraints();
+ this.autoOffset(YAHOO.util.Event.getPageX(e),
+ YAHOO.util.Event.getPageY(e));
+ },
+
+ /*
+ * Event that fires prior to the onDrag event. Overrides
+ * YAHOO.util.DragDrop.
+ */
+ b4Drag: function(e) {
+ this.setDragElPos(YAHOO.util.Event.getPageX(e),
+ YAHOO.util.Event.getPageY(e));
+ },
+
+ toString: function() {
+ return ("DD " + this.id);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Debugging ygDragDrop events that can be overridden
+ //////////////////////////////////////////////////////////////////////////
+ /*
+ startDrag: function(x, y) {
+ },
+
+ onDrag: function(e) {
+ },
+
+ onDragEnter: function(e, id) {
+ },
+
+ onDragOver: function(e, id) {
+ },
+
+ onDragOut: function(e, id) {
+ },
+
+ onDragDrop: function(e, id) {
+ },
+
+ endDrag: function(e) {
+ }
+
+ */
+
+});
+/**
+ * A DragDrop implementation that inserts an empty, bordered div into
+ * the document that follows the cursor during drag operations. At the time of
+ * the click, the frame div is resized to the dimensions of the linked html
+ * element, and moved to the exact location of the linked element.
+ *
+ * References to the "frame" element refer to the single proxy element that
+ * was created to be dragged in place of all DDProxy elements on the
+ * page.
+ *
+ * @class DDProxy
+ * @extends YAHOO.util.DD
+ * @constructor
+ * @param {String} id the id of the linked html element
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ * Valid properties for DDProxy in addition to those in DragDrop:
+ * resizeFrame, centerFrame, dragElId
+ */
+YAHOO.util.DDProxy = function(id, sGroup, config) {
+ if (id) {
+ this.init(id, sGroup, config);
+ this.initFrame();
+ }
+};
+
+/**
+ * The default drag frame div id
+ * @property YAHOO.util.DDProxy.dragElId
+ * @type String
+ * @static
+ */
+YAHOO.util.DDProxy.dragElId = "ygddfdiv";
+
+YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
+
+ /**
+ * By default we resize the drag frame to be the same size as the element
+ * we want to drag (this is to get the frame effect). We can turn it off
+ * if we want a different behavior.
+ * @property resizeFrame
+ * @type boolean
+ */
+ resizeFrame: true,
+
+ /**
+ * By default the frame is positioned exactly where the drag element is, so
+ * we use the cursor offset provided by YAHOO.util.DD. Another option that works only if
+ * you do not have constraints on the obj is to have the drag frame centered
+ * around the cursor. Set centerFrame to true for this effect.
+ * @property centerFrame
+ * @type boolean
+ */
+ centerFrame: false,
+
+ /**
+ * Creates the proxy element if it does not yet exist
+ * @method createFrame
+ */
+ createFrame: function() {
+ var self = this;
+ var body = document.body;
+
+ if (!body || !body.firstChild) {
+ setTimeout( function() { self.createFrame(); }, 50 );
+ return;
+ }
+
+ var div = this.getDragEl();
+
+ if (!div) {
+ div = document.createElement("div");
+ div.id = this.dragElId;
+ var s = div.style;
+
+ s.position = "absolute";
+ s.visibility = "hidden";
+ s.cursor = "move";
+ s.border = "2px solid #aaa";
+ s.zIndex = 999;
+
+ // appendChild can blow up IE if invoked prior to the window load event
+ // while rendering a table. It is possible there are other scenarios
+ // that would cause this to happen as well.
+ body.insertBefore(div, body.firstChild);
+ }
+ },
+
+ /**
+ * Initialization for the drag frame element. Must be called in the
+ * constructor of all subclasses
+ * @method initFrame
+ */
+ initFrame: function() {
+ this.createFrame();
+ },
+
+ applyConfig: function() {
+ YAHOO.util.DDProxy.superclass.applyConfig.call(this);
+
+ this.resizeFrame = (this.config.resizeFrame !== false);
+ this.centerFrame = (this.config.centerFrame);
+ this.setDragElId(this.config.dragElId || YAHOO.util.DDProxy.dragElId);
+ },
+
+ /**
+ * Resizes the drag frame to the dimensions of the clicked object, positions
+ * it over the object, and finally displays it
+ * @method showFrame
+ * @param {int} iPageX X click position
+ * @param {int} iPageY Y click position
+ * @private
+ */
+ showFrame: function(iPageX, iPageY) {
+ var el = this.getEl();
+ var dragEl = this.getDragEl();
+ var s = dragEl.style;
+
+ this._resizeProxy();
+
+ if (this.centerFrame) {
+ this.setDelta( Math.round(parseInt(s.width, 10)/2),
+ Math.round(parseInt(s.height, 10)/2) );
+ }
+
+ this.setDragElPos(iPageX, iPageY);
+
+ YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible");
+ },
+
+ /**
+ * The proxy is automatically resized to the dimensions of the linked
+ * element when a drag is initiated, unless resizeFrame is set to false
+ * @method _resizeProxy
+ * @private
+ */
+ _resizeProxy: function() {
+ if (this.resizeFrame) {
+ var DOM = YAHOO.util.Dom;
+ var el = this.getEl();
+ var dragEl = this.getDragEl();
+
+ var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth" ), 10);
+ var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth" ), 10);
+ var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10);
+ var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth" ), 10);
+
+ if (isNaN(bt)) { bt = 0; }
+ if (isNaN(br)) { br = 0; }
+ if (isNaN(bb)) { bb = 0; }
+ if (isNaN(bl)) { bl = 0; }
+
+
+ var newWidth = Math.max(0, el.offsetWidth - br - bl);
+ var newHeight = Math.max(0, el.offsetHeight - bt - bb);
+
+
+ DOM.setStyle( dragEl, "width", newWidth + "px" );
+ DOM.setStyle( dragEl, "height", newHeight + "px" );
+ }
+ },
+
+ // overrides YAHOO.util.DragDrop
+ b4MouseDown: function(e) {
+ var x = YAHOO.util.Event.getPageX(e);
+ var y = YAHOO.util.Event.getPageY(e);
+ this.autoOffset(x, y);
+ this.setDragElPos(x, y);
+ },
+
+ // overrides YAHOO.util.DragDrop
+ b4StartDrag: function(x, y) {
+ // show the drag frame
+ this.showFrame(x, y);
+ },
+
+ // overrides YAHOO.util.DragDrop
+ b4EndDrag: function(e) {
+ YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden");
+ },
+
+ // overrides YAHOO.util.DragDrop
+ // By default we try to move the element to the last location of the frame.
+ // This is so that the default behavior mirrors that of YAHOO.util.DD.
+ endDrag: function(e) {
+ var DOM = YAHOO.util.Dom;
+ var lel = this.getEl();
+ var del = this.getDragEl();
+
+ // Show the drag frame briefly so we can get its position
+ // del.style.visibility = "";
+ DOM.setStyle(del, "visibility", "");
+
+ // Hide the linked element before the move to get around a Safari
+ // rendering bug.
+ //lel.style.visibility = "hidden";
+ DOM.setStyle(lel, "visibility", "hidden");
+ YAHOO.util.DDM.moveToEl(lel, del);
+ //del.style.visibility = "hidden";
+ DOM.setStyle(del, "visibility", "hidden");
+ //lel.style.visibility = "";
+ DOM.setStyle(lel, "visibility", "");
+ },
+
+ toString: function() {
+ return ("DDProxy " + this.id);
+ }
+
+});
+/**
+ * A DragDrop implementation that does not move, but can be a drop
+ * target. You would get the same result by simply omitting implementation
+ * for the event callbacks, but this way we reduce the processing cost of the
+ * event listener and the callbacks.
+ * @class DDTarget
+ * @extends YAHOO.util.DragDrop
+ * @constructor
+ * @param {String} id the id of the element that is a drop target
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ * Valid properties for DDTarget in addition to those in
+ * DragDrop:
+ * none
+ */
+YAHOO.util.DDTarget = function(id, sGroup, config) {
+ if (id) {
+ this.initTarget(id, sGroup, config);
+ }
+};
+
+// YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop();
+YAHOO.extend(YAHOO.util.DDTarget, YAHOO.util.DragDrop, {
+ toString: function() {
+ return ("DDTarget " + this.id);
+ }
+});
diff --git a/thirdpartyjs/yui/event/README b/thirdpartyjs/yui/event/README
index e6b1f93..ee73ab2 100644
--- a/thirdpartyjs/yui/event/README
+++ b/thirdpartyjs/yui/event/README
@@ -1,122 +1,122 @@
-
-YUI Library - Event - Release Notes
-
-0.12.0
-
- * If the function argument is not provided to Event.removeListener, all
- all listeners for the specified event type on the element will be removed.
-
- * CustomEvent now has an optional parameter that defines the signature of
- the listeners for this event. Two signatures are supported:
-
- YAHOO.util.CustomEvent.LIST:
- param1: event name
- param2: array of arguments provided to fire()
- param3: the custom object supplied to subscribe()
-
- YAHOO.util.CustomEvent.FLAT:
- param1: the first argument provided to fire()
- param2: the custom object supplied to subscribe()
-
- The new flat signature makes it possible to provide a better API
- when using custom events, and it makes it possible to transparently
- wrap DOM events.
-
- * The parameters for overriding scope in both Event.addListener, and
- CustomEvent.subscribe have been augmented. In addition to the
- previous behavior where a true value would make the previous parameter
- the execution scope, an object can be supplied instead. If an object
- is provided, that object becomes the scope obj. This makes it possible
- to pass a both a custom object and adjust the scope to a different object.
-
- * Added EventProvider, which is a wrapper for CustomEvent that makes it
- possible to subscribe to events by name, whether or not the event has
- been created. This class was designed to be used with YAHOO.augment.
- EventProvider custom events are created with the new FLAT listener
- signature.
-
- * CustomEvent subscribers can return false to stop the propagation of
- the event.
-
- * CustomEvents now have an onSubscribe custom event that can used to the
- case where a subscriber subscribes to an one-time event that has already
- happened. Also provides a way for the implementer to defer initialization
- logic until after the first subscription.
-
- * Event.getCharCode now always returns keyCode if charCode is not available.
-
- * Added Event.onContentReady, which is similar to onAvailable, but it also
- checks simblings to try to determine when the element's children are
- available.
-
-0.11.4
-
- * Fixed a memory leak in IE6 that occurred when the utility was hosted in
- an iframe.
-
- * Fixed an issue with Safari click listeners when listeners were removed.
-
-0.11.3
-
- * The listener cache is now pruned when events are removed. This fixes
- a performance issue when adding many listeners, removing them, and
- adding them again repeatedly.
-
- * Safari click listeners will work correctly if a bound element is removed
- from the DOM and a new element with the same ID is added.
-
- * Removed the code that automatically unsubscribed custom event listeners.
-
-0.11.0
-
- * Added Event.purgeElement which will remove all listeners added via
- addListener from the supplied element. If an optional "type" parameter
- is supplied, only events of that type will be removed. Optionally, the
- purge can be performed recursively on the element's children as well.
-
- * Added Event.getListeners which will return all listeners attached to
- a given element.. either all listeners or listeners of a specific type.
-
- * getTarget now automatically resolves text nodes. The optional parameter
- for this feature is now deprecated.
-
- * getRelatedTarget now resolves text nodes for the browsers that return the
- text node rather than its host HTML element.
-
- * CustomEvent now logs the custom event activity if the logger widget is available
-
-0.10.0
-
- * Added Safari dblclick to the list of legacy events.
-
- * When multiple identical event handlers are defined, multiple calls
- to removeListener can now remove all of them.
-
- * removeListener works properly for unload events
-
- * Legacy event bookkeeping is more efficient, improving the performance for
- adding Safari click events.
-
- * _unload() is more efficient, improving the page transition experience in
- Safari in particular.
-
- * addListener, removeListener now return false if the function argument is
- not valid.
-
- * Fixed an operator precedence issue in getCharCode.
-
- * Added Event.getXY, which returns [Event.getPageX(e), Event.getPageY(e)]
-
- * Added Event.onAvailable, which will execute the callback when the element
- with the supplied id is found. Currently searches periodically until the
- window load event or for up to 10 seconds after the onAvailable method
- was executed.
-
- * The lazy listener attachment process now will poll beyond the window load
- event in order to better handle the case when a listener is defined
- late in the page but before the element is in the dom.
-
- * Fixed browser detection for Opera installations reporting as IE.
-
- * It is now possible to remove and re-add legacy events (Safari click event).
-
+
+YUI Library - Event - Release Notes
+
+0.12.0
+
+ * If the function argument is not provided to Event.removeListener, all
+ all listeners for the specified event type on the element will be removed.
+
+ * CustomEvent now has an optional parameter that defines the signature of
+ the listeners for this event. Two signatures are supported:
+
+ YAHOO.util.CustomEvent.LIST:
+ param1: event name
+ param2: array of arguments provided to fire()
+ param3: the custom object supplied to subscribe()
+
+ YAHOO.util.CustomEvent.FLAT:
+ param1: the first argument provided to fire()
+ param2: the custom object supplied to subscribe()
+
+ The new flat signature makes it possible to provide a better API
+ when using custom events, and it makes it possible to transparently
+ wrap DOM events.
+
+ * The parameters for overriding scope in both Event.addListener, and
+ CustomEvent.subscribe have been augmented. In addition to the
+ previous behavior where a true value would make the previous parameter
+ the execution scope, an object can be supplied instead. If an object
+ is provided, that object becomes the scope obj. This makes it possible
+ to pass a both a custom object and adjust the scope to a different object.
+
+ * Added EventProvider, which is a wrapper for CustomEvent that makes it
+ possible to subscribe to events by name, whether or not the event has
+ been created. This class was designed to be used with YAHOO.augment.
+ EventProvider custom events are created with the new FLAT listener
+ signature.
+
+ * CustomEvent subscribers can return false to stop the propagation of
+ the event.
+
+ * CustomEvents now have an onSubscribe custom event that can used to the
+ case where a subscriber subscribes to an one-time event that has already
+ happened. Also provides a way for the implementer to defer initialization
+ logic until after the first subscription.
+
+ * Event.getCharCode now always returns keyCode if charCode is not available.
+
+ * Added Event.onContentReady, which is similar to onAvailable, but it also
+ checks simblings to try to determine when the element's children are
+ available.
+
+0.11.4
+
+ * Fixed a memory leak in IE6 that occurred when the utility was hosted in
+ an iframe.
+
+ * Fixed an issue with Safari click listeners when listeners were removed.
+
+0.11.3
+
+ * The listener cache is now pruned when events are removed. This fixes
+ a performance issue when adding many listeners, removing them, and
+ adding them again repeatedly.
+
+ * Safari click listeners will work correctly if a bound element is removed
+ from the DOM and a new element with the same ID is added.
+
+ * Removed the code that automatically unsubscribed custom event listeners.
+
+0.11.0
+
+ * Added Event.purgeElement which will remove all listeners added via
+ addListener from the supplied element. If an optional "type" parameter
+ is supplied, only events of that type will be removed. Optionally, the
+ purge can be performed recursively on the element's children as well.
+
+ * Added Event.getListeners which will return all listeners attached to
+ a given element.. either all listeners or listeners of a specific type.
+
+ * getTarget now automatically resolves text nodes. The optional parameter
+ for this feature is now deprecated.
+
+ * getRelatedTarget now resolves text nodes for the browsers that return the
+ text node rather than its host HTML element.
+
+ * CustomEvent now logs the custom event activity if the logger widget is available
+
+0.10.0
+
+ * Added Safari dblclick to the list of legacy events.
+
+ * When multiple identical event handlers are defined, multiple calls
+ to removeListener can now remove all of them.
+
+ * removeListener works properly for unload events
+
+ * Legacy event bookkeeping is more efficient, improving the performance for
+ adding Safari click events.
+
+ * _unload() is more efficient, improving the page transition experience in
+ Safari in particular.
+
+ * addListener, removeListener now return false if the function argument is
+ not valid.
+
+ * Fixed an operator precedence issue in getCharCode.
+
+ * Added Event.getXY, which returns [Event.getPageX(e), Event.getPageY(e)]
+
+ * Added Event.onAvailable, which will execute the callback when the element
+ with the supplied id is found. Currently searches periodically until the
+ window load event or for up to 10 seconds after the onAvailable method
+ was executed.
+
+ * The lazy listener attachment process now will poll beyond the window load
+ event in order to better handle the case when a listener is defined
+ late in the page but before the element is in the dom.
+
+ * Fixed browser detection for Opera installations reporting as IE.
+
+ * It is now possible to remove and re-add legacy events (Safari click event).
+
diff --git a/thirdpartyjs/yui/event/event-debug.js b/thirdpartyjs/yui/event/event-debug.js
index 77094e3..1c7d023 100644
--- a/thirdpartyjs/yui/event/event-debug.js
+++ b/thirdpartyjs/yui/event/event-debug.js
@@ -1,1766 +1,1766 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-
-/**
- * The CustomEvent class lets you define events for your application
- * that can be subscribed to by one or more independent component.
- *
- * @param {String} type The type of event, which is passed to the callback
- * when the event fires
- * @param {Object} oScope The context the event will fire from. "this" will
- * refer to this object in the callback. Default value:
- * the window object. The listener can override this.
- * @param {boolean} silent pass true to prevent the event from writing to
- * the log system
- * @namespace YAHOO.util
- * @class CustomEvent
- * @constructor
- */
-YAHOO.util.CustomEvent = function(type, oScope, silent, signature) {
-
- /**
- * The type of event, returned to subscribers when the event fires
- * @property type
- * @type string
- */
- this.type = type;
-
- /**
- * The scope the the event will fire from by default. Defaults to the window
- * obj
- * @property scope
- * @type object
- */
- this.scope = oScope || window;
-
- /**
- * By default all custom events are logged in the debug build, set silent
- * to true to disable logging for this event.
- * @property silent
- * @type boolean
- */
- this.silent = silent;
-
- /**
- * Custom events support two styles of arguments provided to the event
- * subscribers.
- *
- * YAHOO.util.CustomEvent.LIST:
- *
- * param1: event name
- * param2: array of arguments sent to fire
- * param3: a custom object supplied by the subscriber
- *
- *
- * YAHOO.util.CustomEvent.FLAT
- *
- * param1: the first argument passed to fire. If you need to
- * pass multiple parameters, use and array or object literal
- * param2: a custom object supplied by the subscriber
- *
- *
- *
- * @property signature
- * @type int
- */
- this.signature = signature || YAHOO.util.CustomEvent.LIST;
-
- /**
- * The subscribers to this event
- * @property subscribers
- * @type Subscriber[]
- */
- this.subscribers = [];
-
- if (!this.silent) {
- YAHOO.log( "Creating " + this, "info", "Event" );
- }
-
- var onsubscribeType = "_YUICEOnSubscribe";
-
- // Only add subscribe events for events that are not generated by
- // CustomEvent
- if (type !== onsubscribeType) {
-
- /**
- * Custom events provide a custom event that fires whenever there is
- * a new subscriber to the event. This provides an opportunity to
- * handle the case where there is a non-repeating event that has
- * already fired has a new subscriber.
- *
- * @event subscribeEvent
- * @type YAHOO.util.CustomEvent
- * @param {Function} fn The function to execute
- * @param {Object} obj An object to be passed along when the event
- * fires
- * @param {boolean|Object} override If true, the obj passed in becomes
- * the execution scope of the listener.
- * if an object, that object becomes the
- * the execution scope.
- */
- this.subscribeEvent =
- new YAHOO.util.CustomEvent(onsubscribeType, this, true);
-
- }
-};
-
-/**
- * Subscriber listener sigature constant. The LIST type returns three
- * parameters: the event type, the array of args passed to fire, and
- * the optional custom object
- * @property YAHOO.util.CustomEvent.LIST
- * @static
- * @type int
- */
-YAHOO.util.CustomEvent.LIST = 0;
-
-/**
- * Subscriber listener sigature constant. The FLAT type returns two
- * parameters: the first argument passed to fire and the optional
- * custom object
- * @property YAHOO.util.CustomEvent.FLAT
- * @static
- * @type int
- */
-YAHOO.util.CustomEvent.FLAT = 1;
-
-YAHOO.util.CustomEvent.prototype = {
-
- /**
- * Subscribes the caller to this event
- * @method subscribe
- * @param {Function} fn The function to execute
- * @param {Object} obj An object to be passed along when the event
- * fires
- * @param {boolean|Object} override If true, the obj passed in becomes
- * the execution scope of the listener.
- * if an object, that object becomes the
- * the execution scope.
- */
- subscribe: function(fn, obj, override) {
- if (this.subscribeEvent) {
- this.subscribeEvent.fire(fn, obj, override);
- }
-
- this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, override) );
- },
-
- /**
- * Unsubscribes the caller from this event
- * @method unsubscribe
- * @param {Function} fn The function to execute
- * @param {Object} obj The custom object passed to subscribe (optional)
- * @return {boolean} True if the subscriber was found and detached.
- */
- unsubscribe: function(fn, obj) {
- var found = false;
- for (var i=0, len=this.subscribers.length; i
- * The type of event
- * All of the arguments fire() was executed with as an array
- * The custom object (if any) that was passed into the subscribe()
- * method
- *
- * @method fire
- * @param {Object*} arguments an arbitrary set of parameters to pass to
- * the handler.
- */
- fire: function() {
- var len=this.subscribers.length;
- if (!len && this.silent) {
- return true;
- }
-
- var args=[], ret=true, i;
-
- for (i=0; i" + (i+1) + ": " + s,
- "info", "Event" );
- }
-
- var scope = s.getScope(this.scope);
-
- if (this.signature == YAHOO.util.CustomEvent.FLAT) {
- var param = null;
- if (args.length > 0) {
- param = args[0];
- }
- ret = s.fn.call(scope, param, s.obj);
- } else {
- ret = s.fn.call(scope, this.type, args, s.obj);
- }
- if (false === ret) {
- if (!this.silent) {
- YAHOO.log("Event cancelled, subscriber " + i +
- " of " + len);
- }
-
- //break;
- return false;
- }
- }
- }
-
- return true;
- },
-
- /**
- * Removes all listeners
- * @method unsubscribeAll
- */
- unsubscribeAll: function() {
- for (var i=0, len=this.subscribers.length; i= 0) {
- cacheItem = listeners[index];
- }
-
- if (!el || !cacheItem) {
- // this.logger.debug("cached listener not found");
- return false;
- }
-
- // this.logger.debug("Removing handler: " + el + ", " + sType);
-
- if (this.useLegacyEvent(el, sType)) {
- var legacyIndex = this.getLegacyIndex(el, sType);
- var llist = legacyHandlers[legacyIndex];
- if (llist) {
- for (i=0, len=llist.length; i 0);
- }
-
- // onAvailable
- var notAvail = [];
- for (var i=0,len=onAvailStack.length; i 0) {
- for (var i=0,len=listeners.length; i 0) {
- j = listeners.length;
- while (j) {
- index = j-1;
- l = listeners[index];
- if (l) {
- EU.removeListener(l[EU.EL], l[EU.TYPE],
- l[EU.FN], index);
- }
- j = j - 1;
- }
- l=null;
-
- EU.clearCache();
- }
-
- for (i=0,len=legacyEvents.length; i
- *
- * scope: defines the default execution scope. If not defined
- * the default scope will be this instance.
- *
- *
- * silent: if true, the custom event will not generate log messages.
- * This is false by default.
- *
- *
- * onSubscribeCallback: specifies a callback to execute when the
- * event has a new subscriber. This will fire immediately for
- * each queued subscriber if any exist prior to the creation of
- * the event.
- *
- *
- *
- * @return {CustomEvent} the custom event
- *
- */
- createEvent: function(p_type, p_config) {
-
- this.__yui_events = this.__yui_events || {};
- var opts = p_config || {};
- var events = this.__yui_events;
-
- if (events[p_type]) {
- YAHOO.log("EventProvider: error, event already exists");
- } else {
-
- var scope = opts.scope || this;
- var silent = opts.silent || null;
-
- var ce = new YAHOO.util.CustomEvent(p_type, scope, silent,
- YAHOO.util.CustomEvent.FLAT);
- events[p_type] = ce;
-
- if (opts.onSubscribeCallback) {
- ce.subscribeEvent.subscribe(opts.onSubscribeCallback);
- }
-
- this.__yui_subscribers = this.__yui_subscribers || {};
- var qs = this.__yui_subscribers[p_type];
-
- if (qs) {
- for (var i=0; i
- * The first argument fire() was executed with
- * The custom object (if any) that was passed into the subscribe()
- * method
- *
- * @method fireEvent
- * @param p_type {string} the type, or name of the event
- * @param arguments {Object*} an arbitrary set of parameters to pass to
- * the handler.
- * @return {boolean} the return value from CustomEvent.fire, or null if
- * the custom event does not exist.
- */
- fireEvent: function(p_type, arg1, arg2, etc) {
-
- this.__yui_events = this.__yui_events || {};
- var ce = this.__yui_events[p_type];
-
- if (ce) {
- var args = [];
- for (var i=1; i
+ * YAHOO.util.CustomEvent.LIST:
+ *
+ * param1: event name
+ * param2: array of arguments sent to fire
+ * param3: a custom object supplied by the subscriber
+ *
+ *
+ * YAHOO.util.CustomEvent.FLAT
+ *
+ * param1: the first argument passed to fire. If you need to
+ * pass multiple parameters, use and array or object literal
+ * param2: a custom object supplied by the subscriber
+ *
+ *
+ *
+ * @property signature
+ * @type int
+ */
+ this.signature = signature || YAHOO.util.CustomEvent.LIST;
+
+ /**
+ * The subscribers to this event
+ * @property subscribers
+ * @type Subscriber[]
+ */
+ this.subscribers = [];
+
+ if (!this.silent) {
+ YAHOO.log( "Creating " + this, "info", "Event" );
+ }
+
+ var onsubscribeType = "_YUICEOnSubscribe";
+
+ // Only add subscribe events for events that are not generated by
+ // CustomEvent
+ if (type !== onsubscribeType) {
+
+ /**
+ * Custom events provide a custom event that fires whenever there is
+ * a new subscriber to the event. This provides an opportunity to
+ * handle the case where there is a non-repeating event that has
+ * already fired has a new subscriber.
+ *
+ * @event subscribeEvent
+ * @type YAHOO.util.CustomEvent
+ * @param {Function} fn The function to execute
+ * @param {Object} obj An object to be passed along when the event
+ * fires
+ * @param {boolean|Object} override If true, the obj passed in becomes
+ * the execution scope of the listener.
+ * if an object, that object becomes the
+ * the execution scope.
+ */
+ this.subscribeEvent =
+ new YAHOO.util.CustomEvent(onsubscribeType, this, true);
+
+ }
+};
+
+/**
+ * Subscriber listener sigature constant. The LIST type returns three
+ * parameters: the event type, the array of args passed to fire, and
+ * the optional custom object
+ * @property YAHOO.util.CustomEvent.LIST
+ * @static
+ * @type int
+ */
+YAHOO.util.CustomEvent.LIST = 0;
+
+/**
+ * Subscriber listener sigature constant. The FLAT type returns two
+ * parameters: the first argument passed to fire and the optional
+ * custom object
+ * @property YAHOO.util.CustomEvent.FLAT
+ * @static
+ * @type int
+ */
+YAHOO.util.CustomEvent.FLAT = 1;
+
+YAHOO.util.CustomEvent.prototype = {
+
+ /**
+ * Subscribes the caller to this event
+ * @method subscribe
+ * @param {Function} fn The function to execute
+ * @param {Object} obj An object to be passed along when the event
+ * fires
+ * @param {boolean|Object} override If true, the obj passed in becomes
+ * the execution scope of the listener.
+ * if an object, that object becomes the
+ * the execution scope.
+ */
+ subscribe: function(fn, obj, override) {
+ if (this.subscribeEvent) {
+ this.subscribeEvent.fire(fn, obj, override);
+ }
+
+ this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, override) );
+ },
+
+ /**
+ * Unsubscribes the caller from this event
+ * @method unsubscribe
+ * @param {Function} fn The function to execute
+ * @param {Object} obj The custom object passed to subscribe (optional)
+ * @return {boolean} True if the subscriber was found and detached.
+ */
+ unsubscribe: function(fn, obj) {
+ var found = false;
+ for (var i=0, len=this.subscribers.length; i
+ * The type of event
+ * All of the arguments fire() was executed with as an array
+ * The custom object (if any) that was passed into the subscribe()
+ * method
+ *
+ * @method fire
+ * @param {Object*} arguments an arbitrary set of parameters to pass to
+ * the handler.
+ */
+ fire: function() {
+ var len=this.subscribers.length;
+ if (!len && this.silent) {
+ return true;
+ }
+
+ var args=[], ret=true, i;
+
+ for (i=0; i" + (i+1) + ": " + s,
+ "info", "Event" );
+ }
+
+ var scope = s.getScope(this.scope);
+
+ if (this.signature == YAHOO.util.CustomEvent.FLAT) {
+ var param = null;
+ if (args.length > 0) {
+ param = args[0];
+ }
+ ret = s.fn.call(scope, param, s.obj);
+ } else {
+ ret = s.fn.call(scope, this.type, args, s.obj);
+ }
+ if (false === ret) {
+ if (!this.silent) {
+ YAHOO.log("Event cancelled, subscriber " + i +
+ " of " + len);
+ }
+
+ //break;
+ return false;
+ }
+ }
+ }
+
+ return true;
+ },
+
+ /**
+ * Removes all listeners
+ * @method unsubscribeAll
+ */
+ unsubscribeAll: function() {
+ for (var i=0, len=this.subscribers.length; i= 0) {
+ cacheItem = listeners[index];
+ }
+
+ if (!el || !cacheItem) {
+ // this.logger.debug("cached listener not found");
+ return false;
+ }
+
+ // this.logger.debug("Removing handler: " + el + ", " + sType);
+
+ if (this.useLegacyEvent(el, sType)) {
+ var legacyIndex = this.getLegacyIndex(el, sType);
+ var llist = legacyHandlers[legacyIndex];
+ if (llist) {
+ for (i=0, len=llist.length; i 0);
+ }
+
+ // onAvailable
+ var notAvail = [];
+ for (var i=0,len=onAvailStack.length; i 0) {
+ for (var i=0,len=listeners.length; i 0) {
+ j = listeners.length;
+ while (j) {
+ index = j-1;
+ l = listeners[index];
+ if (l) {
+ EU.removeListener(l[EU.EL], l[EU.TYPE],
+ l[EU.FN], index);
+ }
+ j = j - 1;
+ }
+ l=null;
+
+ EU.clearCache();
+ }
+
+ for (i=0,len=legacyEvents.length; i
+ *
+ * scope: defines the default execution scope. If not defined
+ * the default scope will be this instance.
+ *
+ *
+ * silent: if true, the custom event will not generate log messages.
+ * This is false by default.
+ *
+ *
+ * onSubscribeCallback: specifies a callback to execute when the
+ * event has a new subscriber. This will fire immediately for
+ * each queued subscriber if any exist prior to the creation of
+ * the event.
+ *
+ *
+ *
+ * @return {CustomEvent} the custom event
+ *
+ */
+ createEvent: function(p_type, p_config) {
+
+ this.__yui_events = this.__yui_events || {};
+ var opts = p_config || {};
+ var events = this.__yui_events;
+
+ if (events[p_type]) {
+ YAHOO.log("EventProvider: error, event already exists");
+ } else {
+
+ var scope = opts.scope || this;
+ var silent = opts.silent || null;
+
+ var ce = new YAHOO.util.CustomEvent(p_type, scope, silent,
+ YAHOO.util.CustomEvent.FLAT);
+ events[p_type] = ce;
+
+ if (opts.onSubscribeCallback) {
+ ce.subscribeEvent.subscribe(opts.onSubscribeCallback);
+ }
+
+ this.__yui_subscribers = this.__yui_subscribers || {};
+ var qs = this.__yui_subscribers[p_type];
+
+ if (qs) {
+ for (var i=0; i
+ * The first argument fire() was executed with
+ * The custom object (if any) that was passed into the subscribe()
+ * method
+ *
+ * @method fireEvent
+ * @param p_type {string} the type, or name of the event
+ * @param arguments {Object*} an arbitrary set of parameters to pass to
+ * the handler.
+ * @return {boolean} the return value from CustomEvent.fire, or null if
+ * the custom event does not exist.
+ */
+ fireEvent: function(p_type, arg1, arg2, etc) {
+
+ this.__yui_events = this.__yui_events || {};
+ var ce = this.__yui_events[p_type];
+
+ if (ce) {
+ var args = [];
+ for (var i=1; i
- * YAHOO.util.CustomEvent.LIST:
- *
- * param1: event name
- * param2: array of arguments sent to fire
- * param3: a custom object supplied by the subscriber
- *
- *
- * YAHOO.util.CustomEvent.FLAT
- *
- * param1: the first argument passed to fire. If you need to
- * pass multiple parameters, use and array or object literal
- * param2: a custom object supplied by the subscriber
- *
- *
- *
- * @property signature
- * @type int
- */
- this.signature = signature || YAHOO.util.CustomEvent.LIST;
-
- /**
- * The subscribers to this event
- * @property subscribers
- * @type Subscriber[]
- */
- this.subscribers = [];
-
- if (!this.silent) {
- }
-
- var onsubscribeType = "_YUICEOnSubscribe";
-
- // Only add subscribe events for events that are not generated by
- // CustomEvent
- if (type !== onsubscribeType) {
-
- /**
- * Custom events provide a custom event that fires whenever there is
- * a new subscriber to the event. This provides an opportunity to
- * handle the case where there is a non-repeating event that has
- * already fired has a new subscriber.
- *
- * @event subscribeEvent
- * @type YAHOO.util.CustomEvent
- * @param {Function} fn The function to execute
- * @param {Object} obj An object to be passed along when the event
- * fires
- * @param {boolean|Object} override If true, the obj passed in becomes
- * the execution scope of the listener.
- * if an object, that object becomes the
- * the execution scope.
- */
- this.subscribeEvent =
- new YAHOO.util.CustomEvent(onsubscribeType, this, true);
-
- }
-};
-
-/**
- * Subscriber listener sigature constant. The LIST type returns three
- * parameters: the event type, the array of args passed to fire, and
- * the optional custom object
- * @property YAHOO.util.CustomEvent.LIST
- * @static
- * @type int
- */
-YAHOO.util.CustomEvent.LIST = 0;
-
-/**
- * Subscriber listener sigature constant. The FLAT type returns two
- * parameters: the first argument passed to fire and the optional
- * custom object
- * @property YAHOO.util.CustomEvent.FLAT
- * @static
- * @type int
- */
-YAHOO.util.CustomEvent.FLAT = 1;
-
-YAHOO.util.CustomEvent.prototype = {
-
- /**
- * Subscribes the caller to this event
- * @method subscribe
- * @param {Function} fn The function to execute
- * @param {Object} obj An object to be passed along when the event
- * fires
- * @param {boolean|Object} override If true, the obj passed in becomes
- * the execution scope of the listener.
- * if an object, that object becomes the
- * the execution scope.
- */
- subscribe: function(fn, obj, override) {
- if (this.subscribeEvent) {
- this.subscribeEvent.fire(fn, obj, override);
- }
-
- this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, override) );
- },
-
- /**
- * Unsubscribes the caller from this event
- * @method unsubscribe
- * @param {Function} fn The function to execute
- * @param {Object} obj The custom object passed to subscribe (optional)
- * @return {boolean} True if the subscriber was found and detached.
- */
- unsubscribe: function(fn, obj) {
- var found = false;
- for (var i=0, len=this.subscribers.length; i
- * The type of event
- * All of the arguments fire() was executed with as an array
- * The custom object (if any) that was passed into the subscribe()
- * method
- *
- * @method fire
- * @param {Object*} arguments an arbitrary set of parameters to pass to
- * the handler.
- */
- fire: function() {
- var len=this.subscribers.length;
- if (!len && this.silent) {
- return true;
- }
-
- var args=[], ret=true, i;
-
- for (i=0; i 0) {
- param = args[0];
- }
- ret = s.fn.call(scope, param, s.obj);
- } else {
- ret = s.fn.call(scope, this.type, args, s.obj);
- }
- if (false === ret) {
- if (!this.silent) {
- }
-
- //break;
- return false;
- }
- }
- }
-
- return true;
- },
-
- /**
- * Removes all listeners
- * @method unsubscribeAll
- */
- unsubscribeAll: function() {
- for (var i=0, len=this.subscribers.length; i= 0) {
- cacheItem = listeners[index];
- }
-
- if (!el || !cacheItem) {
- return false;
- }
-
- if (this.useLegacyEvent(el, sType)) {
- var legacyIndex = this.getLegacyIndex(el, sType);
- var llist = legacyHandlers[legacyIndex];
- if (llist) {
- for (i=0, len=llist.length; i 0);
- }
-
- // onAvailable
- var notAvail = [];
- for (var i=0,len=onAvailStack.length; i 0) {
- for (var i=0,len=listeners.length; i 0) {
- j = listeners.length;
- while (j) {
- index = j-1;
- l = listeners[index];
- if (l) {
- EU.removeListener(l[EU.EL], l[EU.TYPE],
- l[EU.FN], index);
- }
- j = j - 1;
- }
- l=null;
-
- EU.clearCache();
- }
-
- for (i=0,len=legacyEvents.length; i
- *
- * scope: defines the default execution scope. If not defined
- * the default scope will be this instance.
- *
- *
- * silent: if true, the custom event will not generate log messages.
- * This is false by default.
- *
- *
- * onSubscribeCallback: specifies a callback to execute when the
- * event has a new subscriber. This will fire immediately for
- * each queued subscriber if any exist prior to the creation of
- * the event.
- *
- *
- *
- * @return {CustomEvent} the custom event
- *
- */
- createEvent: function(p_type, p_config) {
-
- this.__yui_events = this.__yui_events || {};
- var opts = p_config || {};
- var events = this.__yui_events;
-
- if (events[p_type]) {
- } else {
-
- var scope = opts.scope || this;
- var silent = opts.silent || null;
-
- var ce = new YAHOO.util.CustomEvent(p_type, scope, silent,
- YAHOO.util.CustomEvent.FLAT);
- events[p_type] = ce;
-
- if (opts.onSubscribeCallback) {
- ce.subscribeEvent.subscribe(opts.onSubscribeCallback);
- }
-
- this.__yui_subscribers = this.__yui_subscribers || {};
- var qs = this.__yui_subscribers[p_type];
-
- if (qs) {
- for (var i=0; i
- * The first argument fire() was executed with
- * The custom object (if any) that was passed into the subscribe()
- * method
- *
- * @method fireEvent
- * @param p_type {string} the type, or name of the event
- * @param arguments {Object*} an arbitrary set of parameters to pass to
- * the handler.
- * @return {boolean} the return value from CustomEvent.fire, or null if
- * the custom event does not exist.
- */
- fireEvent: function(p_type, arg1, arg2, etc) {
-
- this.__yui_events = this.__yui_events || {};
- var ce = this.__yui_events[p_type];
-
- if (ce) {
- var args = [];
- for (var i=1; i
+ * YAHOO.util.CustomEvent.LIST:
+ *
+ * param1: event name
+ * param2: array of arguments sent to fire
+ * param3: a custom object supplied by the subscriber
+ *
+ *
+ * YAHOO.util.CustomEvent.FLAT
+ *
+ * param1: the first argument passed to fire. If you need to
+ * pass multiple parameters, use and array or object literal
+ * param2: a custom object supplied by the subscriber
+ *
+ *
+ *
+ * @property signature
+ * @type int
+ */
+ this.signature = signature || YAHOO.util.CustomEvent.LIST;
+
+ /**
+ * The subscribers to this event
+ * @property subscribers
+ * @type Subscriber[]
+ */
+ this.subscribers = [];
+
+ if (!this.silent) {
+ }
+
+ var onsubscribeType = "_YUICEOnSubscribe";
+
+ // Only add subscribe events for events that are not generated by
+ // CustomEvent
+ if (type !== onsubscribeType) {
+
+ /**
+ * Custom events provide a custom event that fires whenever there is
+ * a new subscriber to the event. This provides an opportunity to
+ * handle the case where there is a non-repeating event that has
+ * already fired has a new subscriber.
+ *
+ * @event subscribeEvent
+ * @type YAHOO.util.CustomEvent
+ * @param {Function} fn The function to execute
+ * @param {Object} obj An object to be passed along when the event
+ * fires
+ * @param {boolean|Object} override If true, the obj passed in becomes
+ * the execution scope of the listener.
+ * if an object, that object becomes the
+ * the execution scope.
+ */
+ this.subscribeEvent =
+ new YAHOO.util.CustomEvent(onsubscribeType, this, true);
+
+ }
+};
+
+/**
+ * Subscriber listener sigature constant. The LIST type returns three
+ * parameters: the event type, the array of args passed to fire, and
+ * the optional custom object
+ * @property YAHOO.util.CustomEvent.LIST
+ * @static
+ * @type int
+ */
+YAHOO.util.CustomEvent.LIST = 0;
+
+/**
+ * Subscriber listener sigature constant. The FLAT type returns two
+ * parameters: the first argument passed to fire and the optional
+ * custom object
+ * @property YAHOO.util.CustomEvent.FLAT
+ * @static
+ * @type int
+ */
+YAHOO.util.CustomEvent.FLAT = 1;
+
+YAHOO.util.CustomEvent.prototype = {
+
+ /**
+ * Subscribes the caller to this event
+ * @method subscribe
+ * @param {Function} fn The function to execute
+ * @param {Object} obj An object to be passed along when the event
+ * fires
+ * @param {boolean|Object} override If true, the obj passed in becomes
+ * the execution scope of the listener.
+ * if an object, that object becomes the
+ * the execution scope.
+ */
+ subscribe: function(fn, obj, override) {
+ if (this.subscribeEvent) {
+ this.subscribeEvent.fire(fn, obj, override);
+ }
+
+ this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, override) );
+ },
+
+ /**
+ * Unsubscribes the caller from this event
+ * @method unsubscribe
+ * @param {Function} fn The function to execute
+ * @param {Object} obj The custom object passed to subscribe (optional)
+ * @return {boolean} True if the subscriber was found and detached.
+ */
+ unsubscribe: function(fn, obj) {
+ var found = false;
+ for (var i=0, len=this.subscribers.length; i
+ * The type of event
+ * All of the arguments fire() was executed with as an array
+ * The custom object (if any) that was passed into the subscribe()
+ * method
+ *
+ * @method fire
+ * @param {Object*} arguments an arbitrary set of parameters to pass to
+ * the handler.
+ */
+ fire: function() {
+ var len=this.subscribers.length;
+ if (!len && this.silent) {
+ return true;
+ }
+
+ var args=[], ret=true, i;
+
+ for (i=0; i 0) {
+ param = args[0];
+ }
+ ret = s.fn.call(scope, param, s.obj);
+ } else {
+ ret = s.fn.call(scope, this.type, args, s.obj);
+ }
+ if (false === ret) {
+ if (!this.silent) {
+ }
+
+ //break;
+ return false;
+ }
+ }
+ }
+
+ return true;
+ },
+
+ /**
+ * Removes all listeners
+ * @method unsubscribeAll
+ */
+ unsubscribeAll: function() {
+ for (var i=0, len=this.subscribers.length; i= 0) {
+ cacheItem = listeners[index];
+ }
+
+ if (!el || !cacheItem) {
+ return false;
+ }
+
+ if (this.useLegacyEvent(el, sType)) {
+ var legacyIndex = this.getLegacyIndex(el, sType);
+ var llist = legacyHandlers[legacyIndex];
+ if (llist) {
+ for (i=0, len=llist.length; i 0);
+ }
+
+ // onAvailable
+ var notAvail = [];
+ for (var i=0,len=onAvailStack.length; i 0) {
+ for (var i=0,len=listeners.length; i 0) {
+ j = listeners.length;
+ while (j) {
+ index = j-1;
+ l = listeners[index];
+ if (l) {
+ EU.removeListener(l[EU.EL], l[EU.TYPE],
+ l[EU.FN], index);
+ }
+ j = j - 1;
+ }
+ l=null;
+
+ EU.clearCache();
+ }
+
+ for (i=0,len=legacyEvents.length; i
+ *
+ * scope: defines the default execution scope. If not defined
+ * the default scope will be this instance.
+ *
+ *
+ * silent: if true, the custom event will not generate log messages.
+ * This is false by default.
+ *
+ *
+ * onSubscribeCallback: specifies a callback to execute when the
+ * event has a new subscriber. This will fire immediately for
+ * each queued subscriber if any exist prior to the creation of
+ * the event.
+ *
+ *
+ *
+ * @return {CustomEvent} the custom event
+ *
+ */
+ createEvent: function(p_type, p_config) {
+
+ this.__yui_events = this.__yui_events || {};
+ var opts = p_config || {};
+ var events = this.__yui_events;
+
+ if (events[p_type]) {
+ } else {
+
+ var scope = opts.scope || this;
+ var silent = opts.silent || null;
+
+ var ce = new YAHOO.util.CustomEvent(p_type, scope, silent,
+ YAHOO.util.CustomEvent.FLAT);
+ events[p_type] = ce;
+
+ if (opts.onSubscribeCallback) {
+ ce.subscribeEvent.subscribe(opts.onSubscribeCallback);
+ }
+
+ this.__yui_subscribers = this.__yui_subscribers || {};
+ var qs = this.__yui_subscribers[p_type];
+
+ if (qs) {
+ for (var i=0; i
+ * The first argument fire() was executed with
+ * The custom object (if any) that was passed into the subscribe()
+ * method
+ *
+ * @method fireEvent
+ * @param p_type {string} the type, or name of the event
+ * @param arguments {Object*} an arbitrary set of parameters to pass to
+ * the handler.
+ * @return {boolean} the return value from CustomEvent.fire, or null if
+ * the custom event does not exist.
+ */
+ fireEvent: function(p_type, arg1, arg2, etc) {
+
+ this.__yui_events = this.__yui_events || {};
+ var ce = this.__yui_events[p_type];
+
+ if (ce) {
+ var args = [];
+ for (var i=1; i Web Features >
- Advanced... > Disable or replace context menus
-
- Mac Firefox 1.5
- -------------------
- Preferences > Context >
- Advanced... > Disable or replace context menus
-
- Windows Firefox 1.0
- -------------------
- Tools > Options > Web Features >
- Advanced... > Disable or replace context menus
-
- Windows Firefox 1.5
- -------------------
- Tools > Options > Context >
- Advanced... > Disable or replace context menus
-
-
-*** version 0.11.0 ***
-
-Added the following features:
------------------------------
-* Overloaded the "addItem" and "insertItem" methods of MenuModule to accept a
- string or a MenuModuleItem instance
-
-* Added the ability to define a MenuItem instance as being "checked"
-
-
-Fixed the following bugs:
--------------------------
-* Changing the path for the submenu indicator image of one MenuModuleItem
- subclass will no longer affect other subclasses
-
-* MenuItem instances built from existing markup without anchor tags will no
- longer trigger a JavaScript error when clicked
-
-* Modified the implementation of the "imageRoot" property for the
- MenuModuleItem class so that it is set to a secure/non-secure path when the
- object is instantiated
-
-* Menu instances now resize in response to changes to the browser's font size
-
-* Modified the propagation of the MenuModule class's "submenualignment"
- configuration property so that it only applies to instances of the same type
-
-* Adjusted the specificity of the style rule that controls the position of a
- MenuItem instance's submenu indicator image to prevent it from wrapping in IE
-
-* Specified a width and height for submenu indicator images in the Menu
- stylesheet to ensure that Menu instances are always rendered at the correct
- width
-
-* Clicking a MenuItem instance will no longer trigger two HTTP GET requests
-
-* Users can now control or shift-click on MenuItem links
-
-
-Changes:
---------
-* In the Menu stylesheet (menu.css), switched from using "first" class to
- "first-of-type" class
-
-* Changed case of MenuModuleItem class's "subMenuIndicator" property
- to "submenuIndicator"
-
-
-*** version 0.11.3 ***
-
-Added the following features:
------------------------------
-
-* Added a "target" configuration property to the MenuModuleItem object that
- allows the user to specify the target of an item's anchor element. Items
- that make use of the "target" configuration property will require the user
- to click exactly on the item's anchor element to navigate to the specified
- URL.
-
-* Items without a "url" property set will automatically hide their parent
- menu instance(s) when clicked.
-
-
-Fixed the following bugs:
--------------------------
-
-* Items in a submenu should now navigate to their specified URL when clicked.
-
-* Removed MenuBar's use of "overflow:hidden." This fixes an issue in Firefox
- 1.5 in which submenus of a Menubar instance cannot overlay other absolutely
- positioned elements on the page.
-
-* Submenus of a Menubar instance will now automatically have their iframe shim
- enabled in IE<7.
-
-* Statically positioned Menubar and Menu instances will now render with the
- correct position and dimensions in Safari.
-
-* MenuModuleItem's "focus" method now checks to make sure that an item's
- "display" style property is not "none" before trying to set focus to its
- anchor element.
-
-* A ContextMenu instance will now hide all other ContextMenu instances before
- displaying itself.
-
-* Removed the dead space in front of an item's submenu indicator image in IE.
- This space was causing an item's submenu to flicker when the user hovered
- over it.
-
-
-Changes:
---------
-
-* Moved the DOM event handlers for every menu from the root DIV node of each
- instance to the document object. This change reduces the number of DOM event
- handlers used by Menu to eight, improving the cleanup time required by the
- Event utility.
-
-
-*** version 0.12 ***
-
-Added the following features:
------------------------------
-
-* Added the YAHOO.widget.MenuManager singleton class.
-
-* Added two new methods to YAHOO.widget.Menu:
-
- * "addItems" - Adds an array of items to a menu.
-
- * "getRoot" - Returns the root menu in a menu hierarchy.
-
-* Added two new events to YAHOO.widget.Menu:
-
- * "itemAddedEvent" - Fires when an item is added to a menu.
-
- * "itemRemovedEvent" - Fires when an item is removed from a menu.
-
-* Added two new properties to YAHOO.widget.Menu:
-
- * "itemData" - Array of items to be added to the menu.
-
- * "lazyLoad" - Boolean indicating if the menu's "lazy load" feature
- is enabled.
-
-* Added new configuration properties to YAHOO.widget.Menu:
-
- * "hidedelay" - Hides the menu after the specified number of milliseconds.
-
- * "showdelay" - Shows the menu after the specified number of milliseconds.
-
- * "container" - The containing element the menu should be rendered into.
-
- * "clicktohide" - Boolean indicating if the menu will automatically be
- hidden if the user clicks outside of it.
-
- * "autosubmenudisplay" - Boolean indicating if submenus are automatically
- made visible when the user mouses over the menu's items.
-
-* Added a "toString" method to YAHOO.widget.MenuItem, YAHOO.widget.MenuBarItem
- and YAHOO.widget.ContextMenuItem that returns the class name followed by the
- value of the item's "text" configuration property.
-
-
-Fixed the following bugs:
--------------------------
-
-* Setting a YAHOO.widget.ContextMenu instance's "trigger" configuration
- property will remove all previous triggers before setting up the new ones.
-
-* "destroy" method of YAHOO.widget.ContextMenu cleans up all DOM event handlers.
-
-* Clicking on a menu item with a submenu no longer hides/collapses the
- entire menu.
-
-* Clicking an item's submenu indicator image no longer collapses the
- entire menu.
-
-
-Changes:
---------
-
-* Deprecated the YAHOO.widget.MenuModule and YAHOO.widget.MenuModuleItem
- classes. The Base classes are now YAHOO.widget.Menu and
- YAHOO.widget.MenuItem.
-
-* "addItem" and "insertItem" methods of YAHOO.widget.Menu now accept an
- object literal representing YAHOO.widget.MenuItem configuration properties.
-
-* "clearActiveItem" now takes an argument: flag indicating if the Menu
- instance's active item should be blurred.
-
-* Switched the default value of the "visible" configuration property for
- YAHOO.widget.Menu to "false."
-
-* Switched the default value of the "constraintoviewport" configuration
- property for YAHOO.widget.Menu to "true."
-
-* Overloaded the "submenu" configuration property for YAHOO.widget.MenuItem
- so that it now can accept any of the following:
-
- * YAHOO.widget.Menu instance
- * Object literal representation of a menu
- * Element id
- * Element reference
-
-* "hide" and "show" methods of statically positioned menus now toggle the their
+Menu Release Notes
+
+*** version 0.10.0 ***
+
+* Initial release
+
+* Known issues:
+
+ * Some Firefox extensions disable the ability for JavaScript to prevent
+ the display of the browser's default context menu. These extensions
+ can cause the YUI ContextMenu to stop working. If you encounter this
+ problem, you can reset the context menu preference in Firefox back to
+ the default by making sure the "Disable or replace context menus"
+ preference is checked:
+
+ Mac Firefox 1.0:
+ -------------------
+ Preferences > Web Features >
+ Advanced... > Disable or replace context menus
+
+ Mac Firefox 1.5
+ -------------------
+ Preferences > Context >
+ Advanced... > Disable or replace context menus
+
+ Windows Firefox 1.0
+ -------------------
+ Tools > Options > Web Features >
+ Advanced... > Disable or replace context menus
+
+ Windows Firefox 1.5
+ -------------------
+ Tools > Options > Context >
+ Advanced... > Disable or replace context menus
+
+
+*** version 0.11.0 ***
+
+Added the following features:
+-----------------------------
+* Overloaded the "addItem" and "insertItem" methods of MenuModule to accept a
+ string or a MenuModuleItem instance
+
+* Added the ability to define a MenuItem instance as being "checked"
+
+
+Fixed the following bugs:
+-------------------------
+* Changing the path for the submenu indicator image of one MenuModuleItem
+ subclass will no longer affect other subclasses
+
+* MenuItem instances built from existing markup without anchor tags will no
+ longer trigger a JavaScript error when clicked
+
+* Modified the implementation of the "imageRoot" property for the
+ MenuModuleItem class so that it is set to a secure/non-secure path when the
+ object is instantiated
+
+* Menu instances now resize in response to changes to the browser's font size
+
+* Modified the propagation of the MenuModule class's "submenualignment"
+ configuration property so that it only applies to instances of the same type
+
+* Adjusted the specificity of the style rule that controls the position of a
+ MenuItem instance's submenu indicator image to prevent it from wrapping in IE
+
+* Specified a width and height for submenu indicator images in the Menu
+ stylesheet to ensure that Menu instances are always rendered at the correct
+ width
+
+* Clicking a MenuItem instance will no longer trigger two HTTP GET requests
+
+* Users can now control or shift-click on MenuItem links
+
+
+Changes:
+--------
+* In the Menu stylesheet (menu.css), switched from using "first" class to
+ "first-of-type" class
+
+* Changed case of MenuModuleItem class's "subMenuIndicator" property
+ to "submenuIndicator"
+
+
+*** version 0.11.3 ***
+
+Added the following features:
+-----------------------------
+
+* Added a "target" configuration property to the MenuModuleItem object that
+ allows the user to specify the target of an item's anchor element. Items
+ that make use of the "target" configuration property will require the user
+ to click exactly on the item's anchor element to navigate to the specified
+ URL.
+
+* Items without a "url" property set will automatically hide their parent
+ menu instance(s) when clicked.
+
+
+Fixed the following bugs:
+-------------------------
+
+* Items in a submenu should now navigate to their specified URL when clicked.
+
+* Removed MenuBar's use of "overflow:hidden." This fixes an issue in Firefox
+ 1.5 in which submenus of a Menubar instance cannot overlay other absolutely
+ positioned elements on the page.
+
+* Submenus of a Menubar instance will now automatically have their iframe shim
+ enabled in IE<7.
+
+* Statically positioned Menubar and Menu instances will now render with the
+ correct position and dimensions in Safari.
+
+* MenuModuleItem's "focus" method now checks to make sure that an item's
+ "display" style property is not "none" before trying to set focus to its
+ anchor element.
+
+* A ContextMenu instance will now hide all other ContextMenu instances before
+ displaying itself.
+
+* Removed the dead space in front of an item's submenu indicator image in IE.
+ This space was causing an item's submenu to flicker when the user hovered
+ over it.
+
+
+Changes:
+--------
+
+* Moved the DOM event handlers for every menu from the root DIV node of each
+ instance to the document object. This change reduces the number of DOM event
+ handlers used by Menu to eight, improving the cleanup time required by the
+ Event utility.
+
+
+*** version 0.12 ***
+
+Added the following features:
+-----------------------------
+
+* Added the YAHOO.widget.MenuManager singleton class.
+
+* Added two new methods to YAHOO.widget.Menu:
+
+ * "addItems" - Adds an array of items to a menu.
+
+ * "getRoot" - Returns the root menu in a menu hierarchy.
+
+* Added two new events to YAHOO.widget.Menu:
+
+ * "itemAddedEvent" - Fires when an item is added to a menu.
+
+ * "itemRemovedEvent" - Fires when an item is removed from a menu.
+
+* Added two new properties to YAHOO.widget.Menu:
+
+ * "itemData" - Array of items to be added to the menu.
+
+ * "lazyLoad" - Boolean indicating if the menu's "lazy load" feature
+ is enabled.
+
+* Added new configuration properties to YAHOO.widget.Menu:
+
+ * "hidedelay" - Hides the menu after the specified number of milliseconds.
+
+ * "showdelay" - Shows the menu after the specified number of milliseconds.
+
+ * "container" - The containing element the menu should be rendered into.
+
+ * "clicktohide" - Boolean indicating if the menu will automatically be
+ hidden if the user clicks outside of it.
+
+ * "autosubmenudisplay" - Boolean indicating if submenus are automatically
+ made visible when the user mouses over the menu's items.
+
+* Added a "toString" method to YAHOO.widget.MenuItem, YAHOO.widget.MenuBarItem
+ and YAHOO.widget.ContextMenuItem that returns the class name followed by the
+ value of the item's "text" configuration property.
+
+
+Fixed the following bugs:
+-------------------------
+
+* Setting a YAHOO.widget.ContextMenu instance's "trigger" configuration
+ property will remove all previous triggers before setting up the new ones.
+
+* "destroy" method of YAHOO.widget.ContextMenu cleans up all DOM event handlers.
+
+* Clicking on a menu item with a submenu no longer hides/collapses the
+ entire menu.
+
+* Clicking an item's submenu indicator image no longer collapses the
+ entire menu.
+
+
+Changes:
+--------
+
+* Deprecated the YAHOO.widget.MenuModule and YAHOO.widget.MenuModuleItem
+ classes. The Base classes are now YAHOO.widget.Menu and
+ YAHOO.widget.MenuItem.
+
+* "addItem" and "insertItem" methods of YAHOO.widget.Menu now accept an
+ object literal representing YAHOO.widget.MenuItem configuration properties.
+
+* "clearActiveItem" now takes an argument: flag indicating if the Menu
+ instance's active item should be blurred.
+
+* Switched the default value of the "visible" configuration property for
+ YAHOO.widget.Menu to "false."
+
+* Switched the default value of the "constraintoviewport" configuration
+ property for YAHOO.widget.Menu to "true."
+
+* Overloaded the "submenu" configuration property for YAHOO.widget.MenuItem
+ so that it now can accept any of the following:
+
+ * YAHOO.widget.Menu instance
+ * Object literal representation of a menu
+ * Element id
+ * Element reference
+
+* "hide" and "show" methods of statically positioned menus now toggle the their
element's "display" style property between "block" and "none."
\ No newline at end of file
diff --git a/thirdpartyjs/yui/menu/assets/menu.css b/thirdpartyjs/yui/menu/assets/menu.css
index 66490a3..e2dd208 100644
--- a/thirdpartyjs/yui/menu/assets/menu.css
+++ b/thirdpartyjs/yui/menu/assets/menu.css
@@ -1,297 +1,297 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.com/yui/license.txt
-Version: 0.12
-*/
-
-
-
-/* Menu styles */
-
-div.yuimenu {
-
- background-color:#f6f7ee;
- border:solid 1px #c4c4be;
- padding:1px;
-
-}
-
-/* Submenus are positioned absolute and hidden by default */
-
-div.yuimenu div.yuimenu,
-div.yuimenubar div.yuimenu {
-
- position:absolute;
- visibility:hidden;
-
-}
-
-/* MenuBar Styles */
-
-div.yuimenubar {
-
- background-color:#f6f7ee;
-
-}
-
-/*
- Applying a width triggers "haslayout" in IE so that the module's
- body clears its floated elements
-*/
-div.yuimenubar div.bd {
-
- width:100%;
-
-}
-
-/*
- Clear the module body for other browsers
-*/
-div.yuimenubar div.bd:after {
-
- content:'.';
- display:block;
- clear:both;
- visibility:hidden;
- height:0;
-
-}
-
-
-/* Matches the group title (H6) inside a Menu or MenuBar instance */
-
-div.yuimenu h6,
-div.yuimenubar h6 {
-
- font-size:100%;
- font-weight:normal;
- margin:0;
- border:solid 1px #c4c4be;
- color:#b9b9b9;
-
-}
-
-div.yuimenubar h6 {
-
- float:left;
- display:inline; /* Prevent margin doubling in IE */
- padding:4px 12px;
- border-width:0 1px 0 0;
-
-}
-
-div.yuimenu h6 {
-
- float:none;
- display:block;
- border-width:1px 0 0 0;
- padding:5px 10px 0 10px;
-
-}
-
-
-/* Matches the UL inside a Menu or MenuBar instance */
-
-div.yuimenubar ul {
-
- list-style-type:none;
- margin:0;
- padding:0;
-
-}
-
-div.yuimenu ul {
-
- list-style-type:none;
- border:solid 1px #c4c4be;
- border-width:1px 0 0 0;
- margin:0;
- padding:10px 0;
-
-}
-
-
-div.yuimenu ul.first-of-type,
-div.yuimenu ul.hastitle,
-div.yuimenu h6.first-of-type {
-
- border-width:0;
-
-}
-
-
-/* MenuItem and MenuBarItem styles */
-
-div.yuimenu li,
-div.yuimenubar li {
-
- font-size:85%;
- cursor:pointer;
- cursor:hand;
- white-space:nowrap;
- text-align:left;
-
-}
-
-div.yuimenu li.yuimenuitem {
-
- padding:2px 24px;
-
-}
-
-div.yuimenu li li,
-div.yuimenubar li li {
-
- font-size:100%;
-
-}
-
-
-/* Matches the help text for a menu item */
-
-div.yuimenu li em {
-
- font-style:normal;
- margin:0 0 0 40px;
-
-}
-
-div.yuimenu li a em {
-
- margin:0;
-
-}
-
-div.yuimenu li a,
-div.yuimenubar li a {
-
- /*
- "zoom:1" triggers "haslayout" in IE to ensure that the mouseover and
- mouseout events bubble to the parent LI in IE.
- */
- zoom:1;
- color:#000;
- text-decoration:none;
-
-}
-
-div.yuimenu li.hassubmenu,
-div.yuimenu li.hashelptext {
-
- text-align:right;
-
-}
-
-div.yuimenu li.hassubmenu a.hassubmenu,
-div.yuimenu li.hashelptext a.hashelptext {
-
- float:left;
- display:inline; /* Prevent margin doubling in IE */
- text-align:left;
-
-}
-
-
-/* Matches focused and selected menu items */
-
-div.yuimenu li.selected,
-div.yuimenubar li.selected {
-
- background-color:#8c8ad0;
-
-}
-
-div.yuimenu li.selected a.selected,
-div.yuimenubar li.selected a.selected {
-
- text-decoration:underline;
-
-}
-
-div.yuimenu li.selected a.selected,
-div.yuimenu li.selected em.selected,
-div.yuimenubar li.selected a.selected {
-
- color:#fff;
-
-}
-
-
-/* Matches disabled menu items */
-
-div.yuimenu li.disabled,
-div.yuimenubar li.disabled {
-
- cursor:default;
-
-}
-
-div.yuimenu li.disabled a.disabled,
-div.yuimenu li.disabled em.disabled,
-div.yuimenubar li.disabled a.disabled {
-
- color:#b9b9b9;
- cursor:default;
-
-}
-
-div.yuimenubar li.yuimenubaritem {
-
- float:left;
- display:inline; /* Prevent margin doubling in IE */
- border-width:0 0 0 1px;
- border-style:solid;
- border-color:#c4c4be;
- padding:4px 24px;
- margin:0;
-
-}
-
-div.yuimenubar li.yuimenubaritem.first-of-type {
-
- border-width:0;
-
-}
-
-
-/* Matches the submenu indicator for menu items */
-
-div.yuimenubar li.yuimenubaritem img {
-
- height:8px;
- width:8px;
- margin:0 0 0 10px;
- vertical-align:middle;
-
-}
-
-div.yuimenu li.yuimenuitem img {
-
- height:8px;
- width:8px;
- margin:0 -16px 0 0;
- padding-left:10px;
- border:0;
-
-}
-
-div.yuimenu li.checked {
-
- position:relative;
-
-}
-
-div.yuimenu li.checked img.checked {
-
- height:8px;
- width:8px;
- margin:0;
- padding:0;
- border:0;
- position:absolute;
- left:6px;
- _left:-16px; /* Underscore hack b/c this is for IE 6 only */
- top:.5em;
-
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.com/yui/license.txt
+Version: 0.12
+*/
+
+
+
+/* Menu styles */
+
+div.yuimenu {
+
+ background-color:#f6f7ee;
+ border:solid 1px #c4c4be;
+ padding:1px;
+
+}
+
+/* Submenus are positioned absolute and hidden by default */
+
+div.yuimenu div.yuimenu,
+div.yuimenubar div.yuimenu {
+
+ position:absolute;
+ visibility:hidden;
+
+}
+
+/* MenuBar Styles */
+
+div.yuimenubar {
+
+ background-color:#f6f7ee;
+
+}
+
+/*
+ Applying a width triggers "haslayout" in IE so that the module's
+ body clears its floated elements
+*/
+div.yuimenubar div.bd {
+
+ width:100%;
+
+}
+
+/*
+ Clear the module body for other browsers
+*/
+div.yuimenubar div.bd:after {
+
+ content:'.';
+ display:block;
+ clear:both;
+ visibility:hidden;
+ height:0;
+
+}
+
+
+/* Matches the group title (H6) inside a Menu or MenuBar instance */
+
+div.yuimenu h6,
+div.yuimenubar h6 {
+
+ font-size:100%;
+ font-weight:normal;
+ margin:0;
+ border:solid 1px #c4c4be;
+ color:#b9b9b9;
+
+}
+
+div.yuimenubar h6 {
+
+ float:left;
+ display:inline; /* Prevent margin doubling in IE */
+ padding:4px 12px;
+ border-width:0 1px 0 0;
+
+}
+
+div.yuimenu h6 {
+
+ float:none;
+ display:block;
+ border-width:1px 0 0 0;
+ padding:5px 10px 0 10px;
+
+}
+
+
+/* Matches the UL inside a Menu or MenuBar instance */
+
+div.yuimenubar ul {
+
+ list-style-type:none;
+ margin:0;
+ padding:0;
+
+}
+
+div.yuimenu ul {
+
+ list-style-type:none;
+ border:solid 1px #c4c4be;
+ border-width:1px 0 0 0;
+ margin:0;
+ padding:10px 0;
+
+}
+
+
+div.yuimenu ul.first-of-type,
+div.yuimenu ul.hastitle,
+div.yuimenu h6.first-of-type {
+
+ border-width:0;
+
+}
+
+
+/* MenuItem and MenuBarItem styles */
+
+div.yuimenu li,
+div.yuimenubar li {
+
+ font-size:85%;
+ cursor:pointer;
+ cursor:hand;
+ white-space:nowrap;
+ text-align:left;
+
+}
+
+div.yuimenu li.yuimenuitem {
+
+ padding:2px 24px;
+
+}
+
+div.yuimenu li li,
+div.yuimenubar li li {
+
+ font-size:100%;
+
+}
+
+
+/* Matches the help text for a menu item */
+
+div.yuimenu li em {
+
+ font-style:normal;
+ margin:0 0 0 40px;
+
+}
+
+div.yuimenu li a em {
+
+ margin:0;
+
+}
+
+div.yuimenu li a,
+div.yuimenubar li a {
+
+ /*
+ "zoom:1" triggers "haslayout" in IE to ensure that the mouseover and
+ mouseout events bubble to the parent LI in IE.
+ */
+ zoom:1;
+ color:#000;
+ text-decoration:none;
+
+}
+
+div.yuimenu li.hassubmenu,
+div.yuimenu li.hashelptext {
+
+ text-align:right;
+
+}
+
+div.yuimenu li.hassubmenu a.hassubmenu,
+div.yuimenu li.hashelptext a.hashelptext {
+
+ float:left;
+ display:inline; /* Prevent margin doubling in IE */
+ text-align:left;
+
+}
+
+
+/* Matches focused and selected menu items */
+
+div.yuimenu li.selected,
+div.yuimenubar li.selected {
+
+ background-color:#8c8ad0;
+
+}
+
+div.yuimenu li.selected a.selected,
+div.yuimenubar li.selected a.selected {
+
+ text-decoration:underline;
+
+}
+
+div.yuimenu li.selected a.selected,
+div.yuimenu li.selected em.selected,
+div.yuimenubar li.selected a.selected {
+
+ color:#fff;
+
+}
+
+
+/* Matches disabled menu items */
+
+div.yuimenu li.disabled,
+div.yuimenubar li.disabled {
+
+ cursor:default;
+
+}
+
+div.yuimenu li.disabled a.disabled,
+div.yuimenu li.disabled em.disabled,
+div.yuimenubar li.disabled a.disabled {
+
+ color:#b9b9b9;
+ cursor:default;
+
+}
+
+div.yuimenubar li.yuimenubaritem {
+
+ float:left;
+ display:inline; /* Prevent margin doubling in IE */
+ border-width:0 0 0 1px;
+ border-style:solid;
+ border-color:#c4c4be;
+ padding:4px 24px;
+ margin:0;
+
+}
+
+div.yuimenubar li.yuimenubaritem.first-of-type {
+
+ border-width:0;
+
+}
+
+
+/* Matches the submenu indicator for menu items */
+
+div.yuimenubar li.yuimenubaritem img {
+
+ height:8px;
+ width:8px;
+ margin:0 0 0 10px;
+ vertical-align:middle;
+
+}
+
+div.yuimenu li.yuimenuitem img {
+
+ height:8px;
+ width:8px;
+ margin:0 -16px 0 0;
+ padding-left:10px;
+ border:0;
+
+}
+
+div.yuimenu li.checked {
+
+ position:relative;
+
+}
+
+div.yuimenu li.checked img.checked {
+
+ height:8px;
+ width:8px;
+ margin:0;
+ padding:0;
+ border:0;
+ position:absolute;
+ left:6px;
+ _left:-16px; /* Underscore hack b/c this is for IE 6 only */
+ top:.5em;
+
}
\ No newline at end of file
diff --git a/thirdpartyjs/yui/menu/menu-debug.js b/thirdpartyjs/yui/menu/menu-debug.js
index 86776ac..60935fc 100644
--- a/thirdpartyjs/yui/menu/menu-debug.js
+++ b/thirdpartyjs/yui/menu/menu-debug.js
@@ -1,7224 +1,7224 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.com/yui/license.txt
-version: 0.12.0
-*/
-
-/**
-* @module menu
-* @description The Menu Library features a collection of widgets that make
-* it easy to add menus to your website or web application. With the Menu
-* Library you can create website fly-out menus, customized context menus, or
-* application-style menu bars with just a small amount of scripting.
-*
-* Screen-reader accessibility.
-* Keyboard and mouse navigation.
-* A rich event model that provides access to all of a menu's
-* interesting moments.
-* Support for
-* Progressive
-* Enhancement ; Menus can be created from simple,
-* semantic markup on the page or purely through JavaScript.
-*
-* @title Menu Library
-* @namespace YAHOO.widget
-* @requires Event, Dom, Container
-*/
-(function() {
-
-var Dom = YAHOO.util.Dom;
-var Event = YAHOO.util.Event;
-
-/**
-* Singleton that manages a collection of all menus and menu items. Listens for
-* DOM events at the document level and dispatches the events to the
-* corresponding menu or menu item.
-*
-* @namespace YAHOO.widget
-* @class MenuManager
-* @static
-*/
-YAHOO.widget.MenuManager = new function() {
-
- // Private member variables
-
-
- // Flag indicating if the DOM event handlers have been attached
-
- var m_bInitializedEventHandlers = false;
-
-
- // Collection of menus
-
- var m_oMenus = {};
-
-
- // Collection of menu items
-
- var m_oItems = {};
-
-
- // Collection of visible menus
-
- var m_oVisibleMenus = {};
-
-
- // Logger
-
- var m_oLogger = new YAHOO.widget.LogWriter(this.toString());
-
-
-
- // Private methods
-
-
- /**
- * Adds an item to the collection of known menu items.
- * @private
- * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem
- * instance to be added.
- */
- var addItem = function(p_oItem) {
-
- var sYUIId = Dom.generateId();
-
- if(p_oItem && m_oItems[sYUIId] != p_oItem) {
-
- p_oItem.element.setAttribute("yuiid", sYUIId);
-
- m_oItems[sYUIId] = p_oItem;
-
- p_oItem.destroyEvent.subscribe(onItemDestroy, p_oItem);
-
- m_oLogger.log("Item: " +
- p_oItem.toString() + " successfully registered.");
-
- }
-
- };
-
-
- /**
- * Removes an item from the collection of known menu items.
- * @private
- * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem
- * instance to be removed.
- */
- var removeItem = function(p_oItem) {
-
- var sYUIId = p_oItem.element.getAttribute("yuiid");
-
- if(sYUIId && m_oItems[sYUIId]) {
-
- delete m_oItems[sYUIId];
-
- m_oLogger.log("Item: " +
- p_oItem.toString() + " successfully unregistered.");
-
- }
-
- };
-
-
- /**
- * Finds the root DIV node of a menu or the root LI node of a menu item.
- * @private
- * @param {HTMLElement } p_oElement Object specifying
- * an HTML element.
- */
- var getMenuRootElement = function(p_oElement) {
-
- var oParentNode;
-
- if(p_oElement && p_oElement.tagName) {
-
- switch(p_oElement.tagName.toUpperCase()) {
-
- case "DIV":
-
- oParentNode = p_oElement.parentNode;
-
- // Check if the DIV is the inner "body" node of a menu
-
- if(
- Dom.hasClass(p_oElement, "bd") &&
- oParentNode &&
- oParentNode.tagName &&
- oParentNode.tagName.toUpperCase() == "DIV"
- ) {
-
- return oParentNode;
-
- }
- else {
-
- return p_oElement;
-
- }
-
- break;
-
- case "LI":
-
- return p_oElement;
-
- default:
-
- oParentNode = p_oElement.parentNode;
-
- if(oParentNode) {
-
- return getMenuRootElement(oParentNode);
-
- }
-
- break;
-
- }
-
- }
-
- };
-
-
-
- // Private event handlers
-
-
- /**
- * Generic, global event handler for all of a menu's DOM-based
- * events. This listens for events against the document object. If the
- * target of a given event is a member of a menu or menu item's DOM, the
- * instance's corresponding Custom Event is fired.
- * @private
- * @param {Event} p_oEvent Object representing the DOM event object passed
- * back by the event utility (YAHOO.util.Event).
- */
- var onDOMEvent = function(p_oEvent) {
-
- // Get the target node of the DOM event
-
- var oTarget = Event.getTarget(p_oEvent);
-
-
- // See if the target of the event was a menu, or a menu item
-
- var oElement = getMenuRootElement(oTarget);
-
- var oMenuItem;
- var oMenu;
-
-
- if(oElement) {
-
- var sTagName = oElement.tagName.toUpperCase();
-
- if(sTagName == "LI") {
-
- var sYUIId = oElement.getAttribute("yuiid");
-
- if(sYUIId) {
-
- oMenuItem = m_oItems[sYUIId];
- oMenu = oMenuItem.parent;
-
- }
-
- }
- else if(sTagName == "DIV") {
-
- if(oElement.id) {
-
- oMenu = m_oMenus[oElement.id];
-
- }
-
- }
-
- }
-
- if(oMenu) {
-
- // Map of DOM event names to CustomEvent names
-
- var oEventTypes = {
- "click": "clickEvent",
- "mousedown": "mouseDownEvent",
- "mouseup": "mouseUpEvent",
- "mouseover": "mouseOverEvent",
- "mouseout": "mouseOutEvent",
- "keydown": "keyDownEvent",
- "keyup": "keyUpEvent",
- "keypress": "keyPressEvent"
- };
-
- var sCustomEventType = oEventTypes[p_oEvent.type];
-
-
- // Fire the Custom Even that corresponds the current DOM event
-
- if(oMenuItem && !oMenuItem.cfg.getProperty("disabled")) {
-
- oMenuItem[sCustomEventType].fire(p_oEvent);
-
- }
-
- oMenu[sCustomEventType].fire(p_oEvent, oMenuItem);
-
- }
- else if(p_oEvent.type == "mousedown") {
-
-
- /*
- If the target of the event wasn't a menu, hide all
- dynamically positioned menus
- */
-
- var oActiveItem;
-
- for(var i in m_oMenus) {
-
- if(m_oMenus.hasOwnProperty(i)) {
-
- oMenu = m_oMenus[i];
-
- if(
- oMenu.cfg.getProperty("clicktohide") &&
- oMenu.cfg.getProperty("position") == "dynamic"
- ) {
-
- oMenu.hide();
-
- }
- else {
-
- oMenu.clearActiveItem(true);
-
- }
-
- }
-
- }
-
- }
-
- };
-
-
- /**
- * "destroy" event handler for a menu.
- * @private
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
- * fired the event.
- */
- var onMenuDestroy = function(p_sType, p_aArgs, p_oMenu) {
-
- this.removeMenu(p_oMenu);
-
- };
-
-
- /**
- * "destroy" event handler for a MenuItem instance.
- * @private
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- var onItemDestroy = function(p_sType, p_aArgs, p_oItem) {
-
- var sYUIId = p_oItem.element.getAttribute("yuiid");
-
- if(sYUIId) {
-
- delete m_oItems[sYUIId];
-
- }
-
- };
-
-
- /**
- * Event handler for when the "visible" configuration property
- * of a Menu instance changes.
- * @private
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
- * fired the event.
- */
- var onMenuVisibleConfigChange = function(p_sType, p_aArgs, p_oMenu) {
-
- var bVisible = p_aArgs[0];
-
- if(bVisible) {
-
- m_oVisibleMenus[p_oMenu.id] = p_oMenu;
-
- m_oLogger.log("Menu: " +
- p_oMenu.toString() +
- " registered with the collection of visible menus.");
-
- }
- else if(m_oVisibleMenus[p_oMenu.id]) {
-
- delete m_oVisibleMenus[p_oMenu.id];
-
- m_oLogger.log("Menu: " +
- p_oMenu.toString() +
- " unregistered from the collection of visible menus.");
-
- }
-
- };
-
-
- /**
- * "itemadded" event handler for a Menu instance.
- * @private
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- */
- var onItemAdded = function(p_sType, p_aArgs) {
-
- addItem(p_aArgs[0]);
-
- };
-
-
- /**
- * "itemremoved" event handler for a Menu instance.
- * @private
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- */
- var onItemRemoved = function(p_sType, p_aArgs) {
-
- removeItem(p_aArgs[0]);
-
- };
-
-
-
- // Privileged methods
-
-
- /**
- * @method addMenu
- * @description Adds a menu to the collection of known menus.
- * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance
- * to be added.
- */
- this.addMenu = function(p_oMenu) {
-
- if(p_oMenu && p_oMenu.id && !m_oMenus[p_oMenu.id]) {
-
- m_oMenus[p_oMenu.id] = p_oMenu;
-
-
- if(!m_bInitializedEventHandlers) {
-
- var oDoc = document;
-
- Event.addListener(oDoc, "mouseover", onDOMEvent, this, true);
- Event.addListener(oDoc, "mouseout", onDOMEvent, this, true);
- Event.addListener(oDoc, "mousedown", onDOMEvent, this, true);
- Event.addListener(oDoc, "mouseup", onDOMEvent, this, true);
- Event.addListener(oDoc, "click", onDOMEvent, this, true);
- Event.addListener(oDoc, "keydown", onDOMEvent, this, true);
- Event.addListener(oDoc, "keyup", onDOMEvent, this, true);
- Event.addListener(oDoc, "keypress", onDOMEvent, this, true);
-
- m_bInitializedEventHandlers = true;
-
- m_oLogger.log("DOM event handlers initialized.");
-
- }
-
- p_oMenu.destroyEvent.subscribe(onMenuDestroy, p_oMenu, this);
-
- p_oMenu.cfg.subscribeToConfigEvent(
- "visible",
- onMenuVisibleConfigChange,
- p_oMenu
- );
-
- p_oMenu.itemAddedEvent.subscribe(onItemAdded);
- p_oMenu.itemRemovedEvent.subscribe(onItemRemoved);
-
- m_oLogger.log("Menu: " +
- p_oMenu.toString() + " successfully registered.");
-
- }
-
- };
-
-
- /**
- * @method removeMenu
- * @description Removes a menu from the collection of known menus.
- * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance
- * to be removed.
- */
- this.removeMenu = function(p_oMenu) {
-
- if(p_oMenu && m_oMenus[p_oMenu.id]) {
-
- delete m_oMenus[p_oMenu.id];
-
- m_oLogger.log("Menu: " +
- p_oMenu.toString() + " successfully unregistered.");
-
- }
-
- };
-
-
- /**
- * @method hideVisible
- * @description Hides all visible, dynamically positioned menus.
- */
- this.hideVisible = function() {
-
- var oMenu;
-
- for(var i in m_oVisibleMenus) {
-
- if(m_oVisibleMenus.hasOwnProperty(i)) {
-
- oMenu = m_oVisibleMenus[i];
-
- if(oMenu.cfg.getProperty("position") == "dynamic") {
-
- oMenu.hide();
-
- }
-
- }
-
- }
-
- };
-
-
- /**
- * @method getMenus
- * @description Returns an array of all menus registered with the
- * menu manger.
- * @return {Array}
- */
- this.getMenus = function() {
-
- return m_oMenus;
-
- };
-
-
- /**
- * @method getMenu
- * @description Returns a menu with the specified id.
- * @param {String} p_sId String specifying the id of the menu to
- * be retrieved.
- * @return {YAHOO.widget.Menu}
- */
- this.getMenu = function(p_sId) {
-
- if(m_oMenus[p_sId]) {
-
- return m_oMenus[p_sId];
-
- }
-
- };
-
-
- /**
- * @method toString
- * @description Returns a string representing the menu manager.
- * @return {String}
- */
- this.toString = function() {
-
- return ("MenuManager");
-
- };
-
-};
-
-})();
-
-
-(function() {
-
-var Dom = YAHOO.util.Dom;
-var Event = YAHOO.util.Event;
-
-
-/**
-* The Menu class creates a container that holds a vertical list representing
-* a set of options or commands. Menu is the base class for all
-* menu containers.
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the menu.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source
-* for the menu.
-* @param {HTMLDivElement } p_oElement Object
-* specifying the <div> element of the menu.
-* @param {HTMLSelectElement } p_oElement
-* Object specifying the <select> element to be used as
-* the data source for the menu.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu. See configuration class documentation for
-* more details.
-* @namespace YAHOO.widget
-* @class Menu
-* @constructor
-* @extends YAHOO.widget.Overlay
-*/
-YAHOO.widget.Menu = function(p_oElement, p_oConfig) {
-
- if(p_oConfig) {
-
- this.parent = p_oConfig.parent;
-
- this.lazyLoad = p_oConfig.lazyLoad || p_oConfig.lazyload;
-
- this.itemData = p_oConfig.itemData || p_oConfig.itemdata;
-
- }
-
-
- YAHOO.widget.Menu.superclass.constructor.call(
- this,
- p_oElement,
- p_oConfig
- );
-
-};
-
-YAHOO.extend(YAHOO.widget.Menu, YAHOO.widget.Overlay, {
-
-
-
-// Constants
-
-
-/**
-* @property CSS_CLASS_NAME
-* @description String representing the CSS class(es) to be applied to the
-* menu's <div> element.
-* @default "yuimenu"
-* @final
-* @type String
-*/
-CSS_CLASS_NAME: "yuimenu",
-
-
-/**
-* @property ITEM_TYPE
-* @description Object representing the type of menu item to instantiate and
-* add when parsing the child nodes (either <li> element,
-* <optgroup> element or <option>)
-* of the menu's source HTML element.
-* @default YAHOO.widget.MenuItem
-* @final
-* @type YAHOO.widget.MenuItem
-*/
-ITEM_TYPE: null,
-
-
-/**
-* @property GROUP_TITLE_TAG_NAME
-* @description String representing the tagname of the HTML element used to
-* title the menu's item groups.
-* @default H6
-* @final
-* @type String
-*/
-GROUP_TITLE_TAG_NAME: "h6",
-
-
-
-// Private properties
-
-
-/**
-* @property _nHideDelayId
-* @description Number representing the time-out setting used to cancel the
-* hiding of a menu.
-* @default null
-* @private
-* @type Number
-*/
-_nHideDelayId: null,
-
-
-/**
-* @property _nShowDelayId
-* @description Number representing the time-out setting used to cancel the
-* showing of a menu.
-* @default null
-* @private
-* @type Number
-*/
-_nShowDelayId: null,
-
-
-/**
-* @property _hideDelayEventHandlersAssigned
-* @description Boolean indicating if the "mouseover" and "mouseout" event
-* handlers used for hiding the menu via a call to "window.setTimeout" have
-* already been assigned.
-* @default false
-* @private
-* @type Boolean
-*/
-_hideDelayEventHandlersAssigned: false,
-
-
-/**
-* @property _bHandledMouseOverEvent
-* @description Boolean indicating the current state of the menu's
-* "mouseover" event.
-* @default false
-* @private
-* @type Boolean
-*/
-_bHandledMouseOverEvent: false,
-
-
-/**
-* @property _bHandledMouseOutEvent
-* @description Boolean indicating the current state of the menu's
-* "mouseout" event.
-* @default false
-* @private
-* @type Boolean
-*/
-_bHandledMouseOutEvent: false,
-
-
-/**
-* @property _aGroupTitleElements
-* @description Array of HTML element used to title groups of menu items.
-* @default []
-* @private
-* @type Array
-*/
-_aGroupTitleElements: null,
-
-
-/**
-* @property _aItemGroups
-* @description Array of menu items.
-* @default []
-* @private
-* @type Array
-*/
-_aItemGroups: null,
-
-
-/**
-* @property _aListElements
-* @description Array of <ul> elements, each of which is
-* the parent node for each item's <li> element.
-* @default []
-* @private
-* @type Array
-*/
-_aListElements: null,
-
-
-
-// Public properties
-
-
-/**
-* @property lazyLoad
-* @description Boolean indicating if the menu's "lazy load" feature is
-* enabled. If set to "true," initialization and rendering of the menu's
-* items will be deferred until the first time it is made visible. This
-* property should be set via the constructor using the configuration
-* object literal.
-* @default false
-* @type Boolean
-*/
-lazyLoad: false,
-
-
-/**
-* @property itemData
-* @description Array of items to be added to the menu. The array can contain
-* strings representing the text for each item to be created, object literals
-* representing the menu item configuration properties, or MenuItem instances.
-* This property should be set via the constructor using the configuration
-* object literal.
-* @default null
-* @type Array
-*/
-itemData: null,
-
-
-/**
-* @property activeItem
-* @description Object reference to the item in the menu that has focus.
-* @default null
-* @type YAHOO.widget.MenuItem
-*/
-activeItem: null,
-
-
-/**
-* @property parent
-* @description Object reference to the menu's parent menu or menu item.
-* This property can be set via the constructor using the configuration
-* object literal.
-* @default null
-* @type YAHOO.widget.MenuItem
-*/
-parent: null,
-
-
-/**
-* @property srcElement
-* @description Object reference to the HTML element (either
-* <select> or <div>) used to
-* create the menu.
-* @default null
-* @type HTMLSelectElement |HTMLDivElement
-*/
-srcElement: null,
-
-
-
-// Events
-
-
-/**
-* @event mouseOverEvent
-* @description Fires when the mouse has entered the menu. Passes back
-* the DOM Event object as an argument.
-*/
-mouseOverEvent: null,
-
-
-/**
-* @event mouseOutEvent
-* @description Fires when the mouse has left the menu. Passes back the DOM
-* Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-mouseOutEvent: null,
-
-
-/**
-* @event mouseDownEvent
-* @description Fires when the user mouses down on the menu. Passes back the
-* DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-mouseDownEvent: null,
-
-
-/**
-* @event mouseUpEvent
-* @description Fires when the user releases a mouse button while the mouse is
-* over the menu. Passes back the DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-mouseUpEvent: null,
-
-
-/**
-* @event clickEvent
-* @description Fires when the user clicks the on the menu. Passes back the
-* DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-clickEvent: null,
-
-
-/**
-* @event keyPressEvent
-* @description Fires when the user presses an alphanumeric key when one of the
-* menu's items has focus. Passes back the DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-keyPressEvent: null,
-
-
-/**
-* @event keyDownEvent
-* @description Fires when the user presses a key when one of the menu's items
-* has focus. Passes back the DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-keyDownEvent: null,
-
-
-/**
-* @event keyUpEvent
-* @description Fires when the user releases a key when one of the menu's items
-* has focus. Passes back the DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-keyUpEvent: null,
-
-
-/**
-* @event itemAddedEvent
-* @description Fires when an item is added to the menu.
-* @type YAHOO.util.CustomEvent
-*/
-itemAddedEvent: null,
-
-
-/**
-* @event itemRemovedEvent
-* @description Fires when an item is removed to the menu.
-* @type YAHOO.util.CustomEvent
-*/
-itemRemovedEvent: null,
-
-
-/**
-* @method init
-* @description The Menu class's initialization method. This method is
-* automatically called by the constructor, and sets up all DOM references
-* for pre-existing markup, and creates required markup if it is not
-* already present.
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the menu.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source
-* for the menu.
-* @param {HTMLDivElement } p_oElement Object
-* specifying the <div> element of the menu.
-* @param {HTMLSelectElement } p_oElement
-* Object specifying the <select> element to be used as
-* the data source for the menu.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu. See configuration class documentation for
-* more details.
-*/
-init: function(p_oElement, p_oConfig) {
-
- this._aItemGroups = [];
- this._aListElements = [];
- this._aGroupTitleElements = [];
-
-
- if(!this.ITEM_TYPE) {
-
- this.ITEM_TYPE = YAHOO.widget.MenuItem;
-
- }
-
-
- var oElement;
-
- if(typeof p_oElement == "string") {
-
- oElement = document.getElementById(p_oElement);
-
- }
- else if(p_oElement.tagName) {
-
- oElement = p_oElement;
-
- }
-
-
- if(oElement && oElement.tagName) {
-
- switch(oElement.tagName.toUpperCase()) {
-
- case "DIV":
-
- this.srcElement = oElement;
-
- if(!oElement.id) {
-
- oElement.setAttribute("id", Dom.generateId());
-
- }
-
-
- /*
- Note: we don't pass the user config in here yet
- because we only want it executed once, at the lowest
- subclass level.
- */
-
- YAHOO.widget.Menu.superclass.init.call(this, oElement);
-
- this.beforeInitEvent.fire(YAHOO.widget.Menu);
-
- this.logger = new YAHOO.widget.LogWriter(this.toString());
-
- this.logger.log("Source element: " + this.srcElement.tagName);
-
- break;
-
- case "SELECT":
-
- this.srcElement = oElement;
-
-
- /*
- The source element is not something that we can use
- outright, so we need to create a new Overlay
-
- Note: we don't pass the user config in here yet
- because we only want it executed once, at the lowest
- subclass level.
- */
-
- YAHOO.widget.Menu.superclass.init.call(this, Dom.generateId());
-
- this.beforeInitEvent.fire(YAHOO.widget.Menu);
-
- this.logger = new YAHOO.widget.LogWriter(this.toString());
-
- this.logger.log("Source element: " + this.srcElement.tagName);
-
- break;
-
- }
-
- }
- else {
-
- /*
- Note: we don't pass the user config in here yet
- because we only want it executed once, at the lowest
- subclass level.
- */
-
- YAHOO.widget.Menu.superclass.init.call(this, p_oElement);
-
- this.beforeInitEvent.fire(YAHOO.widget.Menu);
-
- this.logger = new YAHOO.widget.LogWriter(this.toString());
-
- this.logger.log("No source element found. " +
- "Created element with id: " + this.id);
-
- }
-
-
- if(this.element) {
-
- var oEl = this.element;
-
- Dom.addClass(oEl, this.CSS_CLASS_NAME);
-
-
- // Subscribe to Custom Events
-
- this.initEvent.subscribe(this._onInit, this, true);
- this.beforeRenderEvent.subscribe(this._onBeforeRender, this, true);
- this.renderEvent.subscribe(this._onRender, this, true);
- this.beforeShowEvent.subscribe(this._onBeforeShow, this, true);
- this.showEvent.subscribe(this._onShow, this, true);
- this.beforeHideEvent.subscribe(this._onBeforeHide, this, true);
- this.mouseOverEvent.subscribe(this._onMouseOver, this, true);
- this.mouseOutEvent.subscribe(this._onMouseOut, this, true);
- this.clickEvent.subscribe(this._onClick, this, true);
- this.keyDownEvent.subscribe(this._onKeyDown, this, true);
-
-
- if(p_oConfig) {
-
- this.cfg.applyConfig(p_oConfig, true);
-
- }
-
-
- // Register the Menu instance with the MenuManager
-
- YAHOO.widget.MenuManager.addMenu(this);
-
-
- this.initEvent.fire(YAHOO.widget.Menu);
-
- }
-
-},
-
-
-
-// Private methods
-
-
-/**
-* @method _initSubTree
-* @description Iterates the childNodes of the source element to find nodes
-* used to instantiate menu and menu items.
-* @private
-*/
-_initSubTree: function() {
-
- var oNode;
-
- if(this.srcElement.tagName == "DIV") {
-
- /*
- Populate the collection of item groups and item
- group titles
- */
-
- oNode = this.body.firstChild;
-
- var nGroup = 0;
- var sGroupTitleTagName = this.GROUP_TITLE_TAG_NAME.toUpperCase();
-
- do {
-
- if(oNode && oNode.tagName) {
-
- switch(oNode.tagName.toUpperCase()) {
-
- case sGroupTitleTagName:
-
- this._aGroupTitleElements[nGroup] = oNode;
-
- break;
-
- case "UL":
-
- this._aListElements[nGroup] = oNode;
- this._aItemGroups[nGroup] = [];
- nGroup++;
-
- break;
-
- }
-
- }
-
- }
- while((oNode = oNode.nextSibling));
-
-
- /*
- Apply the "first-of-type" class to the first UL to mimic
- the "first-of-type" CSS3 psuedo class.
- */
-
- if(this._aListElements[0]) {
-
- Dom.addClass(this._aListElements[0], "first-of-type");
-
- }
-
- }
-
-
- oNode = null;
-
- this.logger.log("Searching DOM for items to initialize.");
-
- if(this.srcElement.tagName) {
-
- switch(this.srcElement.tagName.toUpperCase()) {
-
- case "DIV":
-
- if(this._aListElements.length > 0) {
-
- this.logger.log("Found " +
- this._aListElements.length +
- " item groups to initialize.");
-
- var i = this._aListElements.length - 1;
-
- do {
-
- oNode = this._aListElements[i].firstChild;
-
- this.logger.log("Scanning " +
- this._aListElements[i].childNodes.length +
- " child nodes for items to initialize.");
-
- do {
-
- if(oNode && oNode.tagName) {
-
- switch(oNode.tagName.toUpperCase()) {
-
- case "LI":
-
- this.logger.log("Initializing " +
- oNode.tagName + " node.");
-
- this.addItem(
- new this.ITEM_TYPE(
- oNode,
- { parent: this }
- ),
- i
- );
-
- break;
-
- }
-
- }
-
- }
- while((oNode = oNode.nextSibling));
-
- }
- while(i--);
-
- }
-
- break;
-
- case "SELECT":
-
- this.logger.log("Scanning " +
- this.srcElement.childNodes.length +
- " child nodes for items to initialize.");
-
- oNode = this.srcElement.firstChild;
-
- do {
-
- if(oNode && oNode.tagName) {
-
- switch(oNode.tagName.toUpperCase()) {
-
- case "OPTGROUP":
- case "OPTION":
-
- this.logger.log("Initializing " +
- oNode.tagName + " node.");
-
- this.addItem(
- new this.ITEM_TYPE(
- oNode,
- { parent: this }
- )
- );
-
- break;
-
- }
-
- }
-
- }
- while((oNode = oNode.nextSibling));
-
- break;
-
- }
-
- }
-
-},
-
-
-/**
-* @method _getFirstEnabledItem
-* @description Returns the first enabled item in the menu.
-* @return {YAHOO.widget.MenuItem}
-* @private
-*/
-_getFirstEnabledItem: function() {
-
- var nGroups = this._aItemGroups.length;
- var oItem;
- var aItemGroup;
-
- for(var i=0; i= aGroup.length);
-
-
- if(aGroup[p_nItemIndex]) {
-
- aGroup.splice(p_nItemIndex, 0, oItem);
-
- }
- else {
-
- aGroup[p_nItemIndex] = oItem;
-
- }
-
-
- oGroupItem = aGroup[p_nItemIndex];
-
- if(oGroupItem) {
-
- if(
- bAppend &&
- (
- !oGroupItem.element.parentNode ||
- oGroupItem.element.parentNode.nodeType == 11
- )
- ) {
-
- this._aListElements[nGroupIndex].appendChild(
- oGroupItem.element
- );
-
- }
- else {
-
-
- /**
- * Returns the next sibling of an item in an array.
- * @private
- * @param {p_aArray} Array to search.
- * @param {p_nStartIndex} Number indicating the index to
- * start searching the array.
- * @return {Object}
- */
- var getNextItemSibling =
-
- function(p_aArray, p_nStartIndex) {
-
- return (
- p_aArray[p_nStartIndex] ||
- getNextItemSibling(
- p_aArray,
- (p_nStartIndex+1)
- )
- );
-
- };
-
-
- var oNextItemSibling =
- getNextItemSibling(aGroup, (p_nItemIndex+1));
-
- if(
- oNextItemSibling &&
- (
- !oGroupItem.element.parentNode ||
- oGroupItem.element.parentNode.nodeType == 11
- )
- ) {
-
- this._aListElements[nGroupIndex].insertBefore(
- oGroupItem.element,
- oNextItemSibling.element
- );
-
- }
-
- }
-
-
- oGroupItem.parent = this;
-
- this._subscribeToItemEvents(oGroupItem);
-
- this._configureSubmenu(oGroupItem);
-
- this._updateItemProperties(nGroupIndex);
-
- this.logger.log("Item inserted." +
- " Text: " + oGroupItem.cfg.getProperty("text") + ", " +
- " Index: " + oGroupItem.index + ", " +
- " Group Index: " + oGroupItem.groupIndex);
-
- this.itemAddedEvent.fire(oGroupItem);
-
- return oGroupItem;
-
- }
-
- }
- else {
-
- var nItemIndex = aGroup.length;
-
- aGroup[nItemIndex] = oItem;
-
- oGroupItem = aGroup[nItemIndex];
-
-
- if(oGroupItem) {
-
- if(
- !Dom.isAncestor(
- this._aListElements[nGroupIndex],
- oGroupItem.element
- )
- ) {
-
- this._aListElements[nGroupIndex].appendChild(
- oGroupItem.element
- );
-
- }
-
- oGroupItem.element.setAttribute("groupindex", nGroupIndex);
- oGroupItem.element.setAttribute("index", nItemIndex);
-
- oGroupItem.parent = this;
-
- oGroupItem.index = nItemIndex;
- oGroupItem.groupIndex = nGroupIndex;
-
- this._subscribeToItemEvents(oGroupItem);
-
- this._configureSubmenu(oGroupItem);
-
- if(nItemIndex === 0) {
-
- Dom.addClass(oGroupItem.element, "first-of-type");
-
- }
-
- this.logger.log("Item added." +
- " Text: " + oGroupItem.cfg.getProperty("text") + ", " +
- " Index: " + oGroupItem.index + ", " +
- " Group Index: " + oGroupItem.groupIndex);
-
-
- this.itemAddedEvent.fire(oGroupItem);
-
- return oGroupItem;
-
- }
-
- }
-
- }
-
-},
-
-
-/**
-* @method _removeItemFromGroupByIndex
-* @description Removes a menu item from a group by index. Returns the menu
-* item that was removed.
-* @private
-* @param {Number} p_nGroupIndex Number indicating the group to which the menu
-* item belongs.
-* @param {Number} p_nItemIndex Number indicating the index of the menu item
-* to be removed.
-* @return {YAHOO.widget.MenuItem}
-*/
-_removeItemFromGroupByIndex: function(p_nGroupIndex, p_nItemIndex) {
-
- var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;
- var aGroup = this._getItemGroup(nGroupIndex);
-
- if(aGroup) {
-
- var aArray = aGroup.splice(p_nItemIndex, 1);
- var oItem = aArray[0];
-
- if(oItem) {
-
- // Update the index and className properties of each member
-
- this._updateItemProperties(nGroupIndex);
-
- if(aGroup.length === 0) {
-
- // Remove the UL
-
- var oUL = this._aListElements[nGroupIndex];
-
- if(this.body && oUL) {
-
- this.body.removeChild(oUL);
-
- }
-
- // Remove the group from the array of items
-
- this._aItemGroups.splice(nGroupIndex, 1);
-
-
- // Remove the UL from the array of ULs
-
- this._aListElements.splice(nGroupIndex, 1);
-
-
- /*
- Assign the "first-of-type" class to the new first UL
- in the collection
- */
-
- oUL = this._aListElements[0];
-
- if(oUL) {
-
- Dom.addClass(oUL, "first-of-type");
-
- }
-
- }
-
-
- this.itemRemovedEvent.fire(oItem);
-
-
- // Return a reference to the item that was removed
-
- return oItem;
-
- }
-
- }
-
-},
-
-
-/**
-* @method _removeItemFromGroupByValue
-* @description Removes a menu item from a group by reference. Returns the
-* menu item that was removed.
-* @private
-* @param {Number} p_nGroupIndex Number indicating the group to which the
-* menu item belongs.
-* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
-* instance to be removed.
-* @return {YAHOO.widget.MenuItem}
-*/
-_removeItemFromGroupByValue: function(p_nGroupIndex, p_oItem) {
-
- var aGroup = this._getItemGroup(p_nGroupIndex);
-
- if(aGroup) {
-
- var nItems = aGroup.length;
- var nItemIndex = -1;
-
- if(nItems > 0) {
-
- var i = nItems-1;
-
- do {
-
- if(aGroup[i] == p_oItem) {
-
- nItemIndex = i;
- break;
-
- }
-
- }
- while(i--);
-
- if(nItemIndex > -1) {
-
- return this._removeItemFromGroupByIndex(
- p_nGroupIndex,
- nItemIndex
- );
-
- }
-
- }
-
- }
-
-},
-
-
-/**
-* @method _updateItemProperties
-* @description Updates the "index," "groupindex," and "className" properties
-* of the menu items in the specified group.
-* @private
-* @param {Number} p_nGroupIndex Number indicating the group of items to update.
-*/
-_updateItemProperties: function(p_nGroupIndex) {
-
- var aGroup = this._getItemGroup(p_nGroupIndex);
- var nItems = aGroup.length;
-
- if(nItems > 0) {
-
- var i = nItems - 1;
- var oItem;
- var oLI;
-
- // Update the index and className properties of each member
-
- do {
-
- oItem = aGroup[i];
-
- if(oItem) {
-
- oLI = oItem.element;
-
- oItem.index = i;
- oItem.groupIndex = p_nGroupIndex;
-
- oLI.setAttribute("groupindex", p_nGroupIndex);
- oLI.setAttribute("index", i);
-
- Dom.removeClass(oLI, "first-of-type");
-
- }
-
- }
- while(i--);
-
-
- if(oLI) {
-
- Dom.addClass(oLI, "first-of-type");
-
- }
-
- }
-
-},
-
-
-/**
-* @method _createItemGroup
-* @description Creates a new menu item group (array) and its associated
-* <ul> element. Returns an aray of menu item groups.
-* @private
-* @param {Number} p_nIndex Number indicating the group to create.
-* @return {Array}
-*/
-_createItemGroup: function(p_nIndex) {
-
- if(!this._aItemGroups[p_nIndex]) {
-
- this._aItemGroups[p_nIndex] = [];
-
- var oUL = document.createElement("ul");
-
- this._aListElements[p_nIndex] = oUL;
-
- return this._aItemGroups[p_nIndex];
-
- }
-
-},
-
-
-/**
-* @method _getItemGroup
-* @description Returns the menu item group at the specified index.
-* @private
-* @param {Number} p_nIndex Number indicating the index of the menu item group
-* to be retrieved.
-* @return {Array}
-*/
-_getItemGroup: function(p_nIndex) {
-
- var nIndex = ((typeof p_nIndex == "number") ? p_nIndex : 0);
-
- return this._aItemGroups[nIndex];
-
-},
-
-
-/**
-* @method _configureSubmenu
-* @description Subscribes the menu item's submenu to its parent menu's events.
-* @private
-* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
-* instance with the submenu to be configured.
-*/
-_configureSubmenu: function(p_oItem) {
-
- var oSubmenu = p_oItem.cfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- /*
- Listen for configuration changes to the parent menu
- so they they can be applied to the submenu.
- */
-
- this.cfg.configChangedEvent.subscribe(
- this._onParentMenuConfigChange,
- oSubmenu,
- true
- );
-
- this.renderEvent.subscribe(
- this._onParentMenuRender,
- oSubmenu,
- true
- );
-
- oSubmenu.beforeShowEvent.subscribe(
- this._onSubmenuBeforeShow,
- oSubmenu,
- true
- );
-
- oSubmenu.showEvent.subscribe(
- this._onSubmenuShow,
- oSubmenu,
- true
- );
-
- oSubmenu.hideEvent.subscribe(
- this._onSubmenuHide,
- oSubmenu,
- true
- );
-
- }
-
-},
-
-
-/**
-* @method _subscribeToItemEvents
-* @description Subscribes a menu to a menu item's event.
-* @private
-* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
-* instance whose events should be subscribed to.
-*/
-_subscribeToItemEvents: function(p_oItem) {
-
- p_oItem.focusEvent.subscribe(this._onMenuItemFocus, p_oItem, this);
-
- p_oItem.blurEvent.subscribe(this._onMenuItemBlur, this, true);
-
- p_oItem.cfg.configChangedEvent.subscribe(
- this._onMenuItemConfigChange,
- p_oItem,
- this
- );
-
-},
-
-
-/**
-* @method _getOffsetWidth
-* @description Returns the offset width of the menu's
-* <div> element.
-* @private
-*/
-_getOffsetWidth: function() {
-
- var oClone = this.element.cloneNode(true);
-
- Dom.setStyle(oClone, "width", "");
-
- document.body.appendChild(oClone);
-
- var sWidth = oClone.offsetWidth;
-
- document.body.removeChild(oClone);
-
- return sWidth;
-
-},
-
-
-/**
-* @method _cancelHideDelay
-* @description Cancels the call to "hideMenu."
-* @private
-*/
-_cancelHideDelay: function() {
-
- var oRoot = this.getRoot();
-
- if(oRoot._nHideDelayId) {
-
- window.clearTimeout(oRoot._nHideDelayId);
-
- }
-
-},
-
-
-/**
-* @method _execHideDelay
-* @description Hides the menu after the number of milliseconds specified by
-* the "hidedelay" configuration property.
-* @private
-*/
-_execHideDelay: function() {
-
- this._cancelHideDelay();
-
- var oRoot = this.getRoot();
- var me = this;
-
- var hideMenu = function() {
-
- if(oRoot.activeItem) {
-
- oRoot.clearActiveItem();
-
- }
-
- if(oRoot == me && me.cfg.getProperty("position") == "dynamic") {
-
- me.hide();
-
- }
-
- };
-
-
- oRoot._nHideDelayId =
- window.setTimeout(hideMenu, oRoot.cfg.getProperty("hidedelay"));
-
-},
-
-
-/**
-* @method _cancelShowDelay
-* @description Cancels the call to the "showMenu."
-* @private
-*/
-_cancelShowDelay: function() {
-
- var oRoot = this.getRoot();
-
- if(oRoot._nShowDelayId) {
-
- window.clearTimeout(oRoot._nShowDelayId);
-
- }
-
-},
-
-
-/**
-* @method _execShowDelay
-* @description Shows the menu after the number of milliseconds specified by
-* the "showdelay" configuration property have ellapsed.
-* @private
-* @param {YAHOO.widget.Menu} p_oMenu Object specifying the menu that should
-* be made visible.
-*/
-_execShowDelay: function(p_oMenu) {
-
- this._cancelShowDelay();
-
- var oRoot = this.getRoot();
-
- var showMenu = function() {
-
- p_oMenu.show();
-
- };
-
-
- oRoot._nShowDelayId =
- window.setTimeout(showMenu, oRoot.cfg.getProperty("showdelay"));
-
-},
-
-
-
-// Protected methods
-
-
-/**
-* @method _onMouseOver
-* @description "mouseover" event handler for the menu.
-* @protected
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onMouseOver: function(p_sType, p_aArgs, p_oMenu) {
-
- var oEvent = p_aArgs[0];
- var oItem = p_aArgs[1];
- var oTarget = Event.getTarget(oEvent);
-
- if(
- !this._bHandledMouseOverEvent &&
- (oTarget == this.element || Dom.isAncestor(this.element, oTarget))
- ) {
-
- // MENU MOUSEOVER LOGIC HERE
-
- this.clearActiveItem();
-
- this._bHandledMouseOverEvent = true;
- this._bHandledMouseOutEvent = false;
-
- }
-
-
- if(
- oItem && !oItem.handledMouseOverEvent &&
- (oTarget == oItem.element || Dom.isAncestor(oItem.element, oTarget))
- ) {
-
- var oItemCfg = oItem.cfg;
-
- // Select and focus the current menu item
-
- oItemCfg.setProperty("selected", true);
- oItem.focus();
-
-
- if(this.cfg.getProperty("autosubmenudisplay")) {
-
- // Show the submenu this menu item
-
- var oSubmenu = oItemCfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- if(this.cfg.getProperty("showdelay") > 0) {
-
- this._execShowDelay(oSubmenu);
-
- }
- else {
-
- oSubmenu.show();
-
- }
-
- }
-
- }
-
- oItem.handledMouseOverEvent = true;
- oItem.handledMouseOutEvent = false;
-
- }
-
-},
-
-
-/**
-* @method _onMouseOut
-* @description "mouseout" event handler for the menu.
-* @protected
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onMouseOut: function(p_sType, p_aArgs, p_oMenu) {
-
- var oEvent = p_aArgs[0];
- var oItem = p_aArgs[1];
- var oRelatedTarget = Event.getRelatedTarget(oEvent);
- var bMovingToSubmenu = false;
-
- if(oItem) {
-
- var oItemCfg = oItem.cfg;
- var oSubmenu = oItemCfg.getProperty("submenu");
-
-
- if(
- oSubmenu &&
- (
- oRelatedTarget == oSubmenu.element ||
- Dom.isAncestor(oSubmenu.element, oRelatedTarget)
- )
- ) {
-
- bMovingToSubmenu = true;
-
- }
-
-
- if(
- !oItem.handledMouseOutEvent &&
- (
- (
- oRelatedTarget != oItem.element &&
- !Dom.isAncestor(oItem.element, oRelatedTarget)
- ) || bMovingToSubmenu
- )
- ) {
-
-
- if(this.cfg.getProperty("showdelay") > 0) {
-
- this._cancelShowDelay();
-
- }
-
-
- if(!bMovingToSubmenu) {
-
- oItemCfg.setProperty("selected", false);
-
- }
-
-
- if(this.cfg.getProperty("autosubmenudisplay")) {
-
- if(oSubmenu) {
-
- if(
- !(
- oRelatedTarget == oSubmenu.element ||
- YAHOO.util.Dom.isAncestor(
- oSubmenu.element,
- oRelatedTarget
- )
- )
- ) {
-
- oSubmenu.hide();
-
- }
-
- }
-
- }
-
- oItem.handledMouseOutEvent = true;
- oItem.handledMouseOverEvent = false;
-
- }
-
- }
-
-
- if(
- !this._bHandledMouseOutEvent &&
- (
- (
- oRelatedTarget != this.element &&
- !Dom.isAncestor(this.element, oRelatedTarget)
- )
- || bMovingToSubmenu
- )
- ) {
-
- this._bHandledMouseOutEvent = true;
- this._bHandledMouseOverEvent = false;
-
- }
-
-},
-
-
-/**
-* @method _onClick
-* @description "click" event handler for the menu.
-* @protected
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onClick: function(p_sType, p_aArgs, p_oMenu) {
-
- var oEvent = p_aArgs[0];
- var oItem = p_aArgs[1];
- var oTarget = Event.getTarget(oEvent);
-
- if(oItem) {
-
- var oItemCfg = oItem.cfg;
- var oSubmenu = oItemCfg.getProperty("submenu");
-
-
- /*
- ACCESSIBILITY FEATURE FOR SCREEN READERS:
- Expand/collapse the submenu when the user clicks
- on the submenu indicator image.
- */
-
- if(oTarget == oItem.submenuIndicator && oSubmenu) {
-
- if(oSubmenu.cfg.getProperty("visible")) {
-
- oSubmenu.hide();
-
- }
- else {
-
- this.clearActiveItem();
-
- this.activeItem = oItem;
-
- oItem.cfg.setProperty("selected", true);
-
- oSubmenu.show();
-
- }
-
- }
- else {
-
- var sURL = oItemCfg.getProperty("url");
- var bCurrentPageURL = (sURL.substr((sURL.length-1),1) == "#");
- var sTarget = oItemCfg.getProperty("target");
- var bHasTarget = (sTarget && sTarget.length > 0);
-
- /*
- Prevent the browser from following links
- equal to "#"
- */
-
- if(
- oTarget.tagName.toUpperCase() == "A" &&
- bCurrentPageURL && !bHasTarget
- ) {
-
- Event.preventDefault(oEvent);
-
- }
-
- if(
- oTarget.tagName.toUpperCase() != "A" &&
- !bCurrentPageURL && !bHasTarget
- ) {
-
- /*
- Follow the URL of the item regardless of
- whether or not the user clicked specifically
- on the anchor element.
- */
-
- document.location = sURL;
-
- }
-
-
- /*
- If the item doesn't navigate to a URL and it doesn't have
- a submenu, then collapse the menu tree.
- */
-
- if(bCurrentPageURL && !oSubmenu) {
-
- var oRoot = this.getRoot();
-
- if(oRoot.cfg.getProperty("position") == "static") {
-
- oRoot.clearActiveItem();
-
- }
- else {
-
- oRoot.hide();
-
- }
-
- }
-
- }
-
- }
-
-},
-
-
-/**
-* @method _onKeyDown
-* @description "keydown" event handler for the menu.
-* @protected
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onKeyDown: function(p_sType, p_aArgs, p_oMenu) {
-
- var oEvent = p_aArgs[0];
- var oItem = p_aArgs[1];
- var oSubmenu;
-
- if(oItem) {
-
- var oItemCfg = oItem.cfg;
- var oParentItem = this.parent;
- var oRoot;
- var oNextItem;
-
-
- switch(oEvent.keyCode) {
-
- case 38: // Up arrow
- case 40: // Down arrow
-
- if(
- oItem == this.activeItem &&
- !oItemCfg.getProperty("selected")
- ) {
-
- oItemCfg.setProperty("selected", true);
-
- }
- else {
-
- oNextItem = (oEvent.keyCode == 38) ?
- oItem.getPreviousEnabledSibling() :
- oItem.getNextEnabledSibling();
-
- if(oNextItem) {
-
- this.clearActiveItem();
-
- oNextItem.cfg.setProperty("selected", true);
- oNextItem.focus();
-
- }
-
- }
-
- Event.preventDefault(oEvent);
-
- break;
-
-
- case 39: // Right arrow
-
- oSubmenu = oItemCfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- if(!oItemCfg.getProperty("selected")) {
-
- oItemCfg.setProperty("selected", true);
-
- }
-
- oSubmenu.show();
-
- oSubmenu.setInitialSelection();
-
- }
- else {
-
- oRoot = this.getRoot();
-
- if(oRoot instanceof YAHOO.widget.MenuBar) {
-
- oNextItem = oRoot.activeItem.getNextEnabledSibling();
-
- if(oNextItem) {
-
- oRoot.clearActiveItem();
-
- oNextItem.cfg.setProperty("selected", true);
-
- oSubmenu = oNextItem.cfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- oSubmenu.show();
-
- }
-
- oNextItem.focus();
-
- }
-
- }
-
- }
-
-
- Event.preventDefault(oEvent);
-
- break;
-
-
- case 37: // Left arrow
-
- if(oParentItem) {
-
- var oParentMenu = oParentItem.parent;
-
- if(oParentMenu instanceof YAHOO.widget.MenuBar) {
-
- oNextItem =
- oParentMenu.activeItem.getPreviousEnabledSibling();
-
- if(oNextItem) {
-
- oParentMenu.clearActiveItem();
-
- oNextItem.cfg.setProperty("selected", true);
-
- oSubmenu = oNextItem.cfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- oSubmenu.show();
-
- }
-
- oNextItem.focus();
-
- }
-
- }
- else {
-
- this.hide();
-
- oParentItem.focus();
-
- }
-
- }
-
- Event.preventDefault(oEvent);
-
- break;
-
- }
-
-
- }
-
-
- if(oEvent.keyCode == 27) { // Esc key
-
- if(this.cfg.getProperty("position") == "dynamic") {
-
- this.hide();
-
- if(this.parent) {
-
- this.parent.focus();
-
- }
-
- }
- else if(this.activeItem) {
-
- oSubmenu = this.activeItem.cfg.getProperty("submenu");
-
- if(oSubmenu && oSubmenu.cfg.getProperty("visible")) {
-
- oSubmenu.hide();
- this.activeItem.focus();
-
- }
- else {
-
- this.activeItem.cfg.setProperty("selected", false);
- this.activeItem.blur();
-
- }
-
- }
-
-
- Event.preventDefault(oEvent);
-
- }
-
-},
-
-
-
-// Private methods
-
-
-/**
-* @method _onInit
-* @description "init" event handler for the menu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onInit: function(p_sType, p_aArgs, p_oMenu) {
-
- if(
- (
- (this.parent && !this.lazyLoad) ||
- (!this.parent && this.cfg.getProperty("position") == "static") ||
- (
- !this.parent &&
- !this.lazyLoad &&
- this.cfg.getProperty("position") == "dynamic"
- )
- ) &&
- this.getItemGroups().length === 0
- ) {
-
- if(this.srcElement) {
-
- this._initSubTree();
-
- }
-
-
- if(this.itemData) {
-
- this.addItems(this.itemData);
-
- }
-
- }
- else if(this.lazyLoad) {
-
- this.cfg.fireQueue();
-
- }
-
-},
-
-
-/**
-* @method _onBeforeRender
-* @description "beforerender" event handler for the menu. Appends all of the
-* <ul>, <li> and their accompanying
-* title elements to the body element of the menu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onBeforeRender: function(p_sType, p_aArgs, p_oMenu) {
-
- var oConfig = this.cfg;
- var oEl = this.element;
- var nListElements = this._aListElements.length;
-
-
- if(nListElements > 0) {
-
- var i = 0;
- var bFirstList = true;
- var oUL;
- var oGroupTitle;
-
-
- do {
-
- oUL = this._aListElements[i];
-
- if(oUL) {
-
- if(bFirstList) {
-
- Dom.addClass(oUL, "first-of-type");
- bFirstList = false;
-
- }
-
-
- if(!Dom.isAncestor(oEl, oUL)) {
-
- this.appendToBody(oUL);
-
- }
-
-
- oGroupTitle = this._aGroupTitleElements[i];
-
- if(oGroupTitle) {
-
- if(!Dom.isAncestor(oEl, oGroupTitle)) {
-
- oUL.parentNode.insertBefore(oGroupTitle, oUL);
-
- }
-
-
- Dom.addClass(oUL, "hastitle");
-
- }
-
- }
-
- i++;
-
- }
- while(i < nListElements);
-
- }
-
-},
-
-
-/**
-* @method _onRender
-* @description "render" event handler for the menu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onRender: function(p_sType, p_aArgs, p_oMenu) {
-
- if(this.cfg.getProperty("position") == "dynamic") {
-
- var sWidth =
- this.element.parentNode.tagName.toUpperCase() == "BODY" ?
- this.element.offsetWidth : this._getOffsetWidth();
-
- this.cfg.setProperty("width", (sWidth + "px"));
-
- }
-
-},
-
-
-/**
-* @method _onBeforeShow
-* @description "beforeshow" event handler for the menu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onBeforeShow: function(p_sType, p_aArgs, p_oMenu) {
-
- if(this.lazyLoad && this.getItemGroups().length === 0) {
-
- if(this.srcElement) {
-
- this._initSubTree();
-
- }
-
-
- if(this.itemData) {
-
- if(
- this.parent && this.parent.parent &&
- this.parent.parent.srcElement &&
- this.parent.parent.srcElement.tagName.toUpperCase() == "SELECT"
- ) {
-
- var nOptions = this.itemData.length;
-
- for(var n=0; n 0) {
-
- oConfig.showdelay = nShowDelay;
-
- }
-
-
- var nHideDelay = oParentMenu.cfg.getProperty("hidedelay");
-
- if(nHideDelay > 0) {
-
- oConfig.hidedelay = nHideDelay;
-
- }
-
-
- /*
- Only sync the "iframe" configuration property if the parent
- menu's "position" configuration is the same.
- */
-
- if(
- this.cfg.getProperty("position") ==
- oParentMenu.cfg.getProperty("position")
- ) {
-
- oConfig.iframe = oParentMenu.cfg.getProperty("iframe");
-
- }
-
-
- p_oSubmenu.cfg.applyConfig(oConfig);
-
-
- if(!this.lazyLoad) {
-
- if(Dom.inDocument(this.element)) {
-
- this.render();
-
- }
- else {
-
- this.render(this.parent.element);
-
- }
-
- }
-
-},
-
-
-/**
-* @method _onSubmenuBeforeShow
-* @description "beforeshow" event handler for a submenu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
-* subscribed to the event.
-*/
-_onSubmenuBeforeShow: function(p_sType, p_aArgs, p_oSubmenu) {
-
- var oParent = this.parent;
- var aAlignment = oParent.parent.cfg.getProperty("submenualignment");
-
- this.cfg.setProperty(
- "context",
- [oParent.element, aAlignment[0], aAlignment[1]]
- );
-
- oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;
-
-},
-
-
-/**
-* @method _onSubmenuShow
-* @description "show" event handler for a submenu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
-* subscribed to the event.
-*/
-_onSubmenuShow: function(p_sType, p_aArgs, p_oSubmenu) {
-
- var oParent = this.parent;
-
- oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;
-
-},
-
-
-/**
-* @method _onSubmenuHide
-* @description "hide" Custom Event handler for a submenu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
-* subscribed to the event.
-*/
-_onSubmenuHide: function(p_sType, p_aArgs, p_oSubmenu) {
-
- var oParent = this.parent;
-
- oParent.submenuIndicator.alt = oParent.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
-
-},
-
-
-/**
-* @method _onMenuItemFocus
-* @description "focus" event handler for the menu's items.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
-* that fired the event.
-*/
-_onMenuItemFocus: function(p_sType, p_aArgs, p_oItem) {
-
- this.activeItem = p_oItem;
-
-},
-
-
-/**
-* @method _onMenuItemBlur
-* @description "blur" event handler for the menu's items.
-* @private
-* @param {String} p_sType String representing the name of the event
-* that was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-*/
-_onMenuItemBlur: function(p_sType, p_aArgs) {
-
- this.activeItem = null;
-
-},
-
-
-/**
-* @method _onMenuItemConfigChange
-* @description "configchange" event handler for the menu's items.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
-* that fired the event.
-*/
-_onMenuItemConfigChange: function(p_sType, p_aArgs, p_oItem) {
-
- var sProperty = p_aArgs[0][0];
-
- switch(sProperty) {
-
- case "submenu":
-
- var oSubmenu = p_aArgs[0][1];
-
- if(oSubmenu) {
-
- this._configureSubmenu(p_oItem);
-
- }
-
- break;
-
- case "text":
- case "helptext":
-
- /*
- A change to an item's "text" or "helptext"
- configuration properties requires the width of the parent
- menu to be recalculated.
- */
-
- if(this.element.style.width) {
-
- var sWidth = this._getOffsetWidth() + "px";
-
- Dom.setStyle(this.element, "width", sWidth);
-
- }
-
- break;
-
- }
-
-},
-
-
-
-// Public event handlers for configuration properties
-
-
-/**
-* @method enforceConstraints
-* @description The default event handler executed when the moveEvent is fired,
-* if the "constraintoviewport" configuration property is set to true.
-* @param {String} type The name of the event that was fired.
-* @param {Array} args Collection of arguments sent when the
-* event was fired.
-* @param {Array} obj Array containing the current Menu instance
-* and the item that fired the event.
-*/
-enforceConstraints: function(type, args, obj) {
-
- var oConfig = this.cfg;
-
- var pos = args[0];
-
- var x = pos[0];
- var y = pos[1];
-
- var bod = document.getElementsByTagName('body')[0];
- var htm = document.getElementsByTagName('html')[0];
-
- var bodyOverflow = Dom.getStyle(bod, "overflow");
- var htmOverflow = Dom.getStyle(htm, "overflow");
-
- var offsetHeight = this.element.offsetHeight;
- var offsetWidth = this.element.offsetWidth;
-
- var viewPortWidth = Dom.getClientWidth();
- var viewPortHeight = Dom.getClientHeight();
-
- var scrollX = window.scrollX || document.body.scrollLeft;
- var scrollY = window.scrollY || document.body.scrollTop;
-
- var topConstraint = scrollY + 10;
- var leftConstraint = scrollX + 10;
- var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;
- var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;
-
- var aContext = oConfig.getProperty("context");
- var oContextElement = aContext ? aContext[0] : null;
-
-
- if (x < 10) {
-
- x = leftConstraint;
-
- } else if ((x + offsetWidth) > viewPortWidth) {
-
- if(
- oContextElement &&
- ((x - oContextElement.offsetWidth) > offsetWidth)
- ) {
-
- x = (x - (oContextElement.offsetWidth + offsetWidth));
-
- }
- else {
-
- x = rightConstraint;
-
- }
-
- }
-
- if (y < 10) {
-
- y = topConstraint;
-
- } else if (y > bottomConstraint) {
-
- if(oContextElement && (y > offsetHeight)) {
-
- y = ((y + oContextElement.offsetHeight) - offsetHeight);
-
- }
- else {
-
- y = bottomConstraint;
-
- }
-
- }
-
- oConfig.setProperty("x", x, true);
- oConfig.setProperty("y", y, true);
-
-},
-
-
-/**
-* @method configVisible
-* @description Event handler for when the "visible" configuration property
-* the menu changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-configVisible: function(p_sType, p_aArgs, p_oMenu) {
-
- if(this.cfg.getProperty("position") == "dynamic") {
-
- YAHOO.widget.Menu.superclass.configVisible.call(
- this,
- p_sType,
- p_aArgs,
- p_oMenu
- );
-
- }
- else {
-
- var bVisible = p_aArgs[0];
- var sDisplay = Dom.getStyle(this.element, "display");
-
- if(bVisible) {
-
- if(sDisplay != "block") {
- this.beforeShowEvent.fire();
- Dom.setStyle(this.element, "display", "block");
- this.showEvent.fire();
- }
-
- }
- else {
-
- if(sDisplay == "block") {
- this.beforeHideEvent.fire();
- Dom.setStyle(this.element, "display", "none");
- this.hideEvent.fire();
- }
-
- }
-
- }
-
-},
-
-
-/**
-* @method configPosition
-* @description Event handler for when the "position" configuration property
-* of the menu changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-configPosition: function(p_sType, p_aArgs, p_oMenu) {
-
- var sCSSPosition = p_aArgs[0] == "static" ? "static" : "absolute";
- var oCfg = this.cfg;
-
- Dom.setStyle(this.element, "position", sCSSPosition);
-
-
- if(sCSSPosition == "static") {
-
- /*
- Remove the iframe for statically positioned menus since it will
- intercept mouse events.
- */
-
- oCfg.setProperty("iframe", false);
-
-
- // Statically positioned menus are visible by default
-
- Dom.setStyle(this.element, "display", "block");
-
- oCfg.setProperty("visible", true);
-
- }
- else {
-
- /*
- Even though the "visible" property is queued to
- "false" by default, we need to set the "visibility" property to
- "hidden" since Overlay's "configVisible" implementation checks the
- element's "visibility" style property before deciding whether
- or not to show an Overlay instance.
- */
-
- Dom.setStyle(this.element, "visibility", "hidden");
-
- }
-
-
- if(sCSSPosition == "absolute") {
-
- var nZIndex = oCfg.getProperty("zindex");
-
- if(!nZIndex || nZIndex === 0) {
-
- nZIndex = this.parent ?
- (this.parent.parent.cfg.getProperty("zindex") + 1) : 1;
-
- oCfg.setProperty("zindex", nZIndex);
-
- }
-
- }
-
-},
-
-
-/**
-* @method configIframe
-* @description Event handler for when the "iframe" configuration property of
-* the menu changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-configIframe: function(p_sType, p_aArgs, p_oMenu) {
-
- if(this.cfg.getProperty("position") == "dynamic") {
-
- YAHOO.widget.Menu.superclass.configIframe.call(
- this,
- p_sType,
- p_aArgs,
- p_oMenu
- );
-
- }
-
-},
-
-
-/**
-* @method configHideDelay
-* @description Event handler for when the "hidedelay" configuration property
-* of the menu changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-configHideDelay: function(p_sType, p_aArgs, p_oMenu) {
-
- var nHideDelay = p_aArgs[0];
- var oMouseOutEvent = this.mouseOutEvent;
- var oMouseOverEvent = this.mouseOverEvent;
- var oKeyDownEvent = this.keyDownEvent;
-
- if(nHideDelay > 0) {
-
- /*
- Only assign event handlers once. This way the user change
- the value for the hidedelay as many times as they want.
- */
-
- if(!this._hideDelayEventHandlersAssigned) {
-
- oMouseOutEvent.subscribe(this._execHideDelay, true);
- oMouseOverEvent.subscribe(this._cancelHideDelay, this, true);
- oKeyDownEvent.subscribe(this._cancelHideDelay, this, true);
-
- this._hideDelayEventHandlersAssigned = true;
-
- }
-
- }
- else {
-
- oMouseOutEvent.unsubscribe(this._execHideDelay, this);
- oMouseOverEvent.unsubscribe(this._cancelHideDelay, this);
- oKeyDownEvent.unsubscribe(this._cancelHideDelay, this);
-
- this._hideDelayEventHandlersAssigned = false;
-
- }
-
-},
-
-
-/**
-* @method configContainer
-* @description Event handler for when the "container" configuration property
-of the menu changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-configContainer: function(p_sType, p_aArgs, p_oMenu) {
-
- var oElement = p_aArgs[0];
-
- if(typeof oElement == 'string') {
-
- this.cfg.setProperty(
- "container",
- document.getElementById(oElement),
- true
- );
-
- }
-
-},
-
-
-
-// Public methods
-
-
-/**
-* Event handler called when the resize monitor element's "resize" evet is fired.
-*/
-onDomResize: function(e, obj) {
-
- if(!this._handleResize) {
-
- this._handleResize = true;
- return;
-
- }
-
- var oConfig = this.cfg;
-
- if(oConfig.getProperty("position") == "dynamic") {
-
- oConfig.setProperty("width", (this._getOffsetWidth() + "px"));
-
- }
-
- YAHOO.widget.Menu.superclass.onDomResize.call(this, e, obj);
-
-},
-
-
-/**
-* @method initEvents
-* @description Initializes the custom events for the menu.
-*/
-initEvents: function() {
-
- YAHOO.widget.Menu.superclass.initEvents.call(this);
-
- // Create custom events
-
- var CustomEvent = YAHOO.util.CustomEvent;
-
- this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);
- this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);
- this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);
- this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);
- this.clickEvent = new CustomEvent("clickEvent", this);
- this.keyPressEvent = new CustomEvent("keyPressEvent", this);
- this.keyDownEvent = new CustomEvent("keyDownEvent", this);
- this.keyUpEvent = new CustomEvent("keyUpEvent", this);
- this.itemAddedEvent = new CustomEvent("itemAddedEvent", this);
- this.itemRemovedEvent = new CustomEvent("itemRemovedEvent", this);
-
-},
-
-
-/**
-* @method getRoot
-* @description Finds the menu's root menu.
-*/
-getRoot: function() {
-
- var oItem = this.parent;
-
- if(oItem) {
-
- var oParentMenu = oItem.parent;
-
- return oParentMenu ? oParentMenu.getRoot() : this;
-
- }
- else {
-
- return this;
-
- }
-
-},
-
-
-/**
-* @method toString
-* @description Returns a string representing the menu.
-* @return {String}
-*/
-toString: function() {
-
- return ("Menu " + this.id);
-
-},
-
-
-/**
-* @method setItemGroupTitle
-* @description Sets the title of a group of menu items.
-* @param {String} p_sGroupTitle String specifying the title of the group.
-* @param {Number} p_nGroupIndex Optional. Number specifying the group to which
-* the title belongs.
-*/
-setItemGroupTitle: function(p_sGroupTitle, p_nGroupIndex) {
-
- if(typeof p_sGroupTitle == "string" && p_sGroupTitle.length > 0) {
-
- var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;
- var oTitle = this._aGroupTitleElements[nGroupIndex];
-
-
- if(oTitle) {
-
- oTitle.innerHTML = p_sGroupTitle;
-
- }
- else {
-
- oTitle = document.createElement(this.GROUP_TITLE_TAG_NAME);
-
- oTitle.innerHTML = p_sGroupTitle;
-
- this._aGroupTitleElements[nGroupIndex] = oTitle;
-
- }
-
-
- var i = this._aGroupTitleElements.length - 1;
- var nFirstIndex;
-
- do {
-
- if(this._aGroupTitleElements[i]) {
-
- Dom.removeClass(this._aGroupTitleElements[i], "first-of-type");
-
- nFirstIndex = i;
-
- }
-
- }
- while(i--);
-
-
- if(nFirstIndex !== null) {
-
- Dom.addClass(
- this._aGroupTitleElements[nFirstIndex],
- "first-of-type"
- );
-
- }
-
- }
-
-},
-
-
-
-/**
-* @method addItem
-* @description Appends an item to the menu.
-* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
-* instance to be added to the menu.
-* @param {String} p_oItem String specifying the text of the item to be added
-* to the menu.
-* @param {Object} p_oItem Object literal containing a set of menu item
-* configuration properties.
-* @param {Number} p_nGroupIndex Optional. Number indicating the group to
-* which the item belongs.
-* @return {YAHOO.widget.MenuItem}
-*/
-addItem: function(p_oItem, p_nGroupIndex) {
-
- if(p_oItem) {
-
- return this._addItemToGroup(p_nGroupIndex, p_oItem);
-
- }
-
-},
-
-
-/**
-* @method addItems
-* @description Adds an array of items to the menu.
-* @param {Array} p_aItems Array of items to be added to the menu. The array
-* can contain strings specifying the text for each item to be created, object
-* literals specifying each of the menu item configuration properties,
-* or MenuItem instances.
-* @param {Number} p_nGroupIndex Optional. Number specifying the group to
-* which the items belongs.
-* @return {Array}
-*/
-addItems: function(p_aItems, p_nGroupIndex) {
-
- function isArray(p_oValue) {
-
- return (typeof p_oValue == "object" && p_oValue.constructor == Array);
-
- }
-
-
- if(isArray(p_aItems)) {
-
- var nItems = p_aItems.length;
- var aItems = [];
- var oItem;
-
-
- for(var i=0; i<div> element
-* (and accompanying child nodes) from the document.
-*/
-destroy: function() {
-
- // Remove Custom Event listeners
-
- this.mouseOverEvent.unsubscribeAll();
- this.mouseOutEvent.unsubscribeAll();
- this.mouseDownEvent.unsubscribeAll();
- this.mouseUpEvent.unsubscribeAll();
- this.clickEvent.unsubscribeAll();
- this.keyPressEvent.unsubscribeAll();
- this.keyDownEvent.unsubscribeAll();
- this.keyUpEvent.unsubscribeAll();
-
-
- var nItemGroups = this._aItemGroups.length;
- var nItems;
- var oItemGroup;
- var oItem;
- var i;
- var n;
-
-
- // Remove all items
-
- if(nItemGroups > 0) {
-
- i = nItemGroups - 1;
-
- do {
-
- oItemGroup = this._aItemGroups[i];
-
- if(oItemGroup) {
-
- nItems = oItemGroup.length;
-
- if(nItems > 0) {
-
- n = nItems - 1;
-
- do {
-
- oItem = this._aItemGroups[i][n];
-
- if(oItem) {
-
- oItem.destroy();
- }
-
- }
- while(n--);
-
- }
-
- }
-
- }
- while(i--);
-
- }
-
-
- // Continue with the superclass implementation of this method
-
- YAHOO.widget.Menu.superclass.destroy.call(this);
-
- this.logger.log("Destroyed.");
-
-},
-
-
-/**
-* @method setInitialFocus
-* @description Sets focus to the menu's first enabled item.
-*/
-setInitialFocus: function() {
-
- var oItem = this._getFirstEnabledItem();
-
- if(oItem) {
-
- oItem.focus();
- }
-
-},
-
-
-/**
-* @method setInitialSelection
-* @description Sets the "selected" configuration property of the menu's first
-* enabled item to "true."
-*/
-setInitialSelection: function() {
-
- var oItem = this._getFirstEnabledItem();
-
- if(oItem) {
-
- oItem.cfg.setProperty("selected", true);
- }
-
-},
-
-
-/**
-* @method clearActiveItem
-* @description Sets the "selected" configuration property of the menu's active
-* item to "false" and hides the item's submenu.
-* @param {Boolean} p_bBlur Boolean indicating if the menu's active item
-* should be blurred.
-*/
-clearActiveItem: function(p_bBlur) {
-
- if(this.cfg.getProperty("showdelay") > 0) {
-
- this._cancelShowDelay();
-
- }
-
-
- var oActiveItem = this.activeItem;
-
- if(oActiveItem) {
-
- var oConfig = oActiveItem.cfg;
-
- oConfig.setProperty("selected", false);
-
- var oSubmenu = oConfig.getProperty("submenu");
-
- if(oSubmenu) {
-
- oSubmenu.hide();
-
- }
-
- if(p_bBlur) {
-
- oActiveItem.blur();
-
- }
-
- }
-
-},
-
-
-/**
-* @description Initializes the class's configurable properties which can be
-* changed using the menu's Config object ("cfg").
-* @method initDefaultConfig
-*/
-initDefaultConfig: function() {
-
- YAHOO.widget.Menu.superclass.initDefaultConfig.call(this);
-
- var oConfig = this.cfg;
-
- // Add configuration properties
-
- /*
- Change the default value for the "visible" configuration
- property to "false" by re-adding the property.
- */
-
- /**
- * @config visible
- * @description Boolean indicating whether or not the menu is visible. If
- * the menu's "position" configuration property is set to "dynamic" (the
- * default), this property toggles the menu's <div>
- * element's "visibility" style property between "visible" (true) or
- * "hidden" (false). If the menu's "position" configuration property is
- * set to "static" this property toggles the menu's
- * <div> element's "display" style property
- * between "block" (true) or "none" (false).
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "visible",
- {
- value:false,
- handler:this.configVisible,
- validator:this.cfg.checkBoolean
- }
- );
-
-
- /*
- Change the default value for the "constraintoviewport" configuration
- property to "true" by re-adding the property.
- */
-
- /**
- * @config constraintoviewport
- * @description Boolean indicating if the menu will try to remain inside
- * the boundaries of the size of viewport.
- * @default true
- * @type Boolean
- */
- oConfig.addProperty(
- "constraintoviewport",
- {
- value:true,
- handler:this.configConstrainToViewport,
- validator:this.cfg.checkBoolean,
- supercedes:["iframe","x","y","xy"]
- }
- );
-
-
- /**
- * @config position
- * @description String indicating how a menu should be positioned on the
- * screen. Possible values are "static" and "dynamic." Static menus are
- * visible by default and reside in the normal flow of the document
- * (CSS position: static). Dynamic menus are hidden by default, reside
- * out of the normal flow of the document (CSS position: absolute), and
- * can overlay other elements on the screen.
- * @default dynamic
- * @type String
- */
- oConfig.addProperty(
- "position",
- {
- value: "dynamic",
- handler: this.configPosition,
- validator: this._checkPosition,
- supercedes: ["visible"]
- }
- );
-
-
- /**
- * @config submenualignment
- * @description Array defining how submenus should be aligned to their
- * parent menu item. The format is: [itemCorner, submenuCorner]. By default
- * a submenu's top left corner is aligned to its parent menu item's top
- * right corner.
- * @default ["tl","tr"]
- * @type Array
- */
- oConfig.addProperty("submenualignment", { value: ["tl","tr"] } );
-
-
- /**
- * @config autosubmenudisplay
- * @description Boolean indicating if submenus are automatically made
- * visible when the user mouses over the menu's items.
- * @default true
- * @type Boolean
- */
- oConfig.addProperty(
- "autosubmenudisplay",
- {
- value: true,
- validator: oConfig.checkBoolean
- }
- );
-
-
- /**
- * @config showdelay
- * @description Number indicating the time (in milliseconds) that should
- * expire before a submenu is made visible when the user mouses over
- * the menu's items.
- * @default 0
- * @type Number
- */
- oConfig.addProperty(
- "showdelay",
- {
- value: 0,
- validator: oConfig.checkNumber
- }
- );
-
-
- /**
- * @config hidedelay
- * @description Number indicating the time (in milliseconds) that should
- * expire before the menu is hidden.
- * @default 0
- * @type Number
- */
- oConfig.addProperty(
- "hidedelay",
- {
- value: 0,
- validator: oConfig.checkNumber,
- handler: this.configHideDelay,
- suppressEvent: true
- }
- );
-
-
- /**
- * @config clicktohide
- * @description Boolean indicating if the menu will automatically be
- * hidden if the user clicks outside of it.
- * @default true
- * @type Boolean
- */
- oConfig.addProperty(
- "clicktohide",
- {
- value: true,
- validator: oConfig.checkBoolean
- }
- );
-
-
- /**
- * @config container
- * @description HTML element reference or string specifying the id
- * attribute of the HTML element that the menu's markup should be rendered into.
- * @type HTMLElement |String
- * @default document.body
- */
- this.cfg.addProperty(
- "container",
- { value:document.body, handler:this.configContainer }
- );
-
-}
-
-}); // END YAHOO.extend
-
-})();
-
-
-/**
-* The base class for all menuing containers.
-*
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the menu module.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source for the
-* menu module.
-* @param {HTMLDivElement } p_oElement Object
-* specifying the <div> element of the menu module.
-* @param {HTMLSelectElement } p_oElement Object
-* specifying the <select> element to be used as the data
-* source for the menu module.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu module. See configuration class documentation for
-* more details.
-* @class MenuModule
-* @constructor
-* @extends YAHOO.widget.Overlay
-* @deprecated As of version 0.12, all MenuModule functionality has been
-* implemented directly in YAHOO.widget.Menu, making YAHOO.widget.Menu the base
-* class for all menuing containers.
-*/
-YAHOO.widget.MenuModule = YAHOO.widget.Menu;
-
-
-(function() {
-
-var Dom = YAHOO.util.Dom;
-var Module = YAHOO.widget.Module;
-var Menu = YAHOO.widget.Menu;
-
-
-/**
-* Creates an item for a menu.
-*
-* @param {String} p_oObject String specifying the text of the menu item.
-* @param {HTMLLIElement } p_oObject Object specifying
-* the <li> element of the menu item.
-* @param {HTMLOptGroupElement } p_oObject Object
-* specifying the <optgroup> element of the menu item.
-* @param {HTMLOptionElement } p_oObject Object
-* specifying the <option> element of the menu item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu item. See configuration class documentation
-* for more details.
-* @class MenuItem
-* @constructor
-*/
-YAHOO.widget.MenuItem = function(p_oObject, p_oConfig) {
-
- if(p_oObject) {
-
- if(p_oConfig) {
-
- this.parent = p_oConfig.parent;
- this.value = p_oConfig.value;
-
- }
-
- this.init(p_oObject, p_oConfig);
-
- }
-
-};
-
-YAHOO.widget.MenuItem.prototype = {
-
- // Constants
-
- /**
- * @property SUBMENU_INDICATOR_IMAGE_PATH
- * @description String representing the path to the image to be used for the
- * menu item's submenu arrow indicator.
- * @default "nt/ic/ut/alt1/menuarorght8_nrm_1.gif"
- * @final
- * @type String
- */
- SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarorght8_nrm_1.gif",
-
-
- /**
- * @property SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
- * @description String representing the path to the image to be used for the
- * submenu arrow indicator when the menu item is selected.
- * @default "nt/ic/ut/alt1/menuarorght8_hov_1.gif"
- * @final
- * @type String
- */
- SELECTED_SUBMENU_INDICATOR_IMAGE_PATH:
- "nt/ic/ut/alt1/menuarorght8_hov_1.gif",
-
-
- /**
- * @property DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
- * @description String representing the path to the image to be used for the
- * submenu arrow indicator when the menu item is disabled.
- * @default "nt/ic/ut/alt1/menuarorght8_dim_1.gif"
- * @final
- * @type String
- */
- DISABLED_SUBMENU_INDICATOR_IMAGE_PATH:
- "nt/ic/ut/alt1/menuarorght8_dim_1.gif",
-
-
- /**
- * @property COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT
- * @description String representing the alt text for the image to be used
- * for the submenu arrow indicator.
- * @default "Collapsed. Click to expand."
- * @final
- * @type String
- */
- COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT: "Collapsed. Click to expand.",
-
-
- /**
- * @property EXPANDED_SUBMENU_INDICATOR_ALT_TEXT
- * @description String representing the alt text for the image to be used
- * for the submenu arrow indicator when the submenu is visible.
- * @default "Expanded. Click to collapse."
- * @final
- * @type String
- */
- EXPANDED_SUBMENU_INDICATOR_ALT_TEXT: "Expanded. Click to collapse.",
-
-
- /**
- * @property DISABLED_SUBMENU_INDICATOR_ALT_TEXT
- * @description String representing the alt text for the image to be used
- * for the submenu arrow indicator when the menu item is disabled.
- * @default "Disabled."
- * @final
- * @type String
- */
- DISABLED_SUBMENU_INDICATOR_ALT_TEXT: "Disabled.",
-
-
- /**
- * @property CHECKED_IMAGE_PATH
- * @description String representing the path to the image to be used for
- * the checked state.
- * @default "nt/ic/ut/bsc/menuchk8_nrm_1.gif"
- * @final
- * @type String
- */
- CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_nrm_1.gif",
-
-
- /**
- * @property SELECTED_CHECKED_IMAGE_PATH
- * @description String representing the path to the image to be used for
- * the selected checked state.
- * @default "nt/ic/ut/bsc/menuchk8_hov_1.gif"
- * @final
- * @type String
- */
- SELECTED_CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_hov_1.gif",
-
-
- /**
- * @property DISABLED_CHECKED_IMAGE_PATH
- * @description String representing the path to the image to be used for
- * the disabled checked state.
- * @default "nt/ic/ut/bsc/menuchk8_dim_1.gif"
- * @final
- * @type String
- */
- DISABLED_CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_dim_1.gif",
-
-
- /**
- * @property CHECKED_IMAGE_ALT_TEXT
- * @description String representing the alt text for the image to be used
- * for the checked image.
- * @default "Checked."
- * @final
- * @type String
- */
- CHECKED_IMAGE_ALT_TEXT: "Checked.",
-
-
- /**
- * @property DISABLED_CHECKED_IMAGE_ALT_TEXT
- * @description String representing the alt text for the image to be used
- * for the checked image when the item is disabled.
- * @default "Checked. (Item disabled.)"
- * @final
- * @type String
- */
- DISABLED_CHECKED_IMAGE_ALT_TEXT: "Checked. (Item disabled.)",
-
-
- /**
- * @property CSS_CLASS_NAME
- * @description String representing the CSS class(es) to be applied to the
- * <li> element of the menu item.
- * @default "yuimenuitem"
- * @final
- * @type String
- */
- CSS_CLASS_NAME: "yuimenuitem",
-
-
- /**
- * @property SUBMENU_TYPE
- * @description Object representing the type of menu to instantiate and
- * add when parsing the child nodes of the menu item's source HTML element.
- * @final
- * @type YAHOO.widget.Menu
- */
- SUBMENU_TYPE: null,
-
-
- /**
- * @property IMG_ROOT
- * @description String representing the prefix path to use for
- * non-secure images.
- * @default "http://us.i1.yimg.com/us.yimg.com/i/"
- * @type String
- */
- IMG_ROOT: "http://us.i1.yimg.com/us.yimg.com/i/",
-
-
- /**
- * @property IMG_ROOT_SSL
- * @description String representing the prefix path to use for securely
- * served images.
- * @default "https://a248.e.akamai.net/sec.yimg.com/i/"
- * @type String
- */
- IMG_ROOT_SSL: "https://a248.e.akamai.net/sec.yimg.com/i/",
-
-
-
- // Private member variables
-
- /**
- * @property _oAnchor
- * @description Object reference to the menu item's
- * <a> element.
- * @default null
- * @private
- * @type HTMLAnchorElement
- */
- _oAnchor: null,
-
-
- /**
- * @property _oText
- * @description Object reference to the menu item's text node.
- * @default null
- * @private
- * @type TextNode
- */
- _oText: null,
-
-
- /**
- * @property _oHelpTextEM
- * @description Object reference to the menu item's help text
- * <em> element.
- * @default null
- * @private
- * @type HTMLElement
- */
- _oHelpTextEM: null,
-
-
- /**
- * @property _oSubmenu
- * @description Object reference to the menu item's submenu.
- * @default null
- * @private
- * @type YAHOO.widget.Menu
- */
- _oSubmenu: null,
-
-
- /**
- * @property _checkImage
- * @description Object reference to the menu item's checkmark image.
- * @default null
- * @private
- * @type HTMLImageElement
- */
- _checkImage: null,
-
-
-
- // Public properties
-
- /**
- * @property constructor
- * @description Object reference to the menu item's constructor function.
- * @default YAHOO.widget.MenuItem
- * @type YAHOO.widget.MenuItem
- */
- constructor: YAHOO.widget.MenuItem,
-
-
- /**
- * @property imageRoot
- * @description String representing the root path for all of the menu
- * item's images.
- * @type String
- */
- imageRoot: null,
-
-
- /**
- * @property isSecure
- * @description Boolean representing whether or not the current browsing
- * context is secure (HTTPS).
- * @type Boolean
- */
- isSecure: Module.prototype.isSecure,
-
-
- /**
- * @property index
- * @description Number indicating the ordinal position of the menu item in
- * its group.
- * @default null
- * @type Number
- */
- index: null,
-
-
- /**
- * @property groupIndex
- * @description Number indicating the index of the group to which the menu
- * item belongs.
- * @default null
- * @type Number
- */
- groupIndex: null,
-
-
- /**
- * @property parent
- * @description Object reference to the menu item's parent menu.
- * @default null
- * @type YAHOO.widget.Menu
- */
- parent: null,
-
-
- /**
- * @property element
- * @description Object reference to the menu item's
- * <li> element.
- * @default HTMLLIElement
- * @type HTMLLIElement
- */
- element: null,
-
-
- /**
- * @property srcElement
- * @description Object reference to the HTML element (either
- * <li>, <optgroup> or
- * <option>) used create the menu item.
- * @default HTMLLIElement |HTMLOptGroupElement |HTMLOptionElement
- * @type HTMLLIElement |
- * HTMLOptGroupElement |HTMLOptionElement
- */
- srcElement: null,
-
-
- /**
- * @property value
- * @description Object reference to the menu item's value.
- * @default null
- * @type Object
- */
- value: null,
-
-
- /**
- * @property submenuIndicator
- * @description Object reference to the <img> element
- * used to create the submenu indicator for the menu item.
- * @default HTMLImageElement
- * @type HTMLImageElement
- */
- submenuIndicator: null,
-
-
- /**
- * @property browser
- * @description String representing the browser.
- * @type String
- */
- browser: Module.prototype.browser,
-
-
-
- // Events
-
-
- /**
- * @event destroyEvent
- * @description Fires when the menu item's <li>
- * element is removed from its parent <ul> element.
- * @type YAHOO.util.CustomEvent
- */
- destroyEvent: null,
-
-
- /**
- * @event mouseOverEvent
- * @description Fires when the mouse has entered the menu item. Passes
- * back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- mouseOverEvent: null,
-
-
- /**
- * @event mouseOutEvent
- * @description Fires when the mouse has left the menu item. Passes back
- * the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- mouseOutEvent: null,
-
-
- /**
- * @event mouseDownEvent
- * @description Fires when the user mouses down on the menu item. Passes
- * back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- mouseDownEvent: null,
-
-
- /**
- * @event mouseUpEvent
- * @description Fires when the user releases a mouse button while the mouse
- * is over the menu item. Passes back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- mouseUpEvent: null,
-
-
- /**
- * @event clickEvent
- * @description Fires when the user clicks the on the menu item. Passes
- * back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- clickEvent: null,
-
-
- /**
- * @event keyPressEvent
- * @description Fires when the user presses an alphanumeric key when the
- * menu item has focus. Passes back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- keyPressEvent: null,
-
-
- /**
- * @event keyDownEvent
- * @description Fires when the user presses a key when the menu item has
- * focus. Passes back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- keyDownEvent: null,
-
-
- /**
- * @event keyUpEvent
- * @description Fires when the user releases a key when the menu item has
- * focus. Passes back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- keyUpEvent: null,
-
-
- /**
- * @event focusEvent
- * @description Fires when the menu item receives focus.
- * @type YAHOO.util.CustomEvent
- */
- focusEvent: null,
-
-
- /**
- * @event blurEvent
- * @description Fires when the menu item loses the input focus.
- * @type YAHOO.util.CustomEvent
- */
- blurEvent: null,
-
-
- /**
- * @method init
- * @description The MenuItem class's initialization method. This method is
- * automatically called by the constructor, and sets up all DOM references
- * for pre-existing markup, and creates required markup if it is not
- * already present.
- * @param {String} p_oObject String specifying the text of the menu item.
- * @param {HTMLLIElement } p_oObject Object specifying
- * the <li> element of the menu item.
- * @param {HTMLOptGroupElement } p_oObject Object
- * specifying the <optgroup> element of the menu item.
- * @param {HTMLOptionElement } p_oObject Object
- * specifying the <option> element of the menu item.
- * @param {Object} p_oConfig Optional. Object literal specifying the
- * configuration for the menu item. See configuration class documentation
- * for more details.
- */
- init: function(p_oObject, p_oConfig) {
-
- this.imageRoot = (this.isSecure) ? this.IMG_ROOT_SSL : this.IMG_ROOT;
-
-
- if(!this.SUBMENU_TYPE) {
-
- this.SUBMENU_TYPE = Menu;
-
- }
-
-
- // Create the config object
-
- this.cfg = new YAHOO.util.Config(this);
-
- this.initDefaultConfig();
-
- var oConfig = this.cfg;
-
-
- if(this._checkString(p_oObject)) {
-
- this._createRootNodeStructure();
-
- oConfig.setProperty("text", p_oObject);
-
- }
- else if(this._checkDOMNode(p_oObject)) {
-
- switch(p_oObject.tagName.toUpperCase()) {
-
- case "OPTION":
-
- this._createRootNodeStructure();
-
- oConfig.setProperty("text", p_oObject.text);
-
- this.srcElement = p_oObject;
-
- break;
-
- case "OPTGROUP":
-
- this._createRootNodeStructure();
-
- oConfig.setProperty("text", p_oObject.label);
-
- this.srcElement = p_oObject;
-
- this._initSubTree();
-
- break;
-
- case "LI":
-
- // Get the anchor node (if it exists)
-
- var oAnchor = this._getFirstElement(p_oObject, "A");
- var sURL = "#";
- var sTarget = null;
- var sText = null;
-
-
- // Capture the "text" and/or the "URL"
-
- if(oAnchor) {
-
- sURL = oAnchor.getAttribute("href");
- sTarget = oAnchor.getAttribute("target");
-
- if(oAnchor.innerText) {
-
- sText = oAnchor.innerText;
-
- }
- else {
-
- var oRange = oAnchor.ownerDocument.createRange();
-
- oRange.selectNodeContents(oAnchor);
-
- sText = oRange.toString();
-
- }
-
- }
- else {
-
- var oText = p_oObject.firstChild;
-
- sText = oText.nodeValue;
-
- oAnchor = document.createElement("a");
-
- oAnchor.setAttribute("href", sURL);
-
- p_oObject.replaceChild(oAnchor, oText);
-
- oAnchor.appendChild(oText);
-
- }
-
-
- this.srcElement = p_oObject;
- this.element = p_oObject;
- this._oAnchor = oAnchor;
-
-
- // Check if emphasis has been applied to the MenuItem
-
- var oEmphasisNode = this._getFirstElement(oAnchor);
- var bEmphasis = false;
- var bStrongEmphasis = false;
-
- if(oEmphasisNode) {
-
- // Set a reference to the text node
-
- this._oText = oEmphasisNode.firstChild;
-
- switch(oEmphasisNode.tagName.toUpperCase()) {
-
- case "EM":
-
- bEmphasis = true;
-
- break;
-
- case "STRONG":
-
- bStrongEmphasis = true;
-
- break;
-
- }
-
- }
- else {
-
- // Set a reference to the text node
-
- this._oText = oAnchor.firstChild;
-
- }
-
-
- /*
- Set these properties silently to sync up the
- configuration object without making changes to the
- element's DOM
- */
-
- oConfig.setProperty("text", sText, true);
- oConfig.setProperty("url", sURL, true);
- oConfig.setProperty("target", sTarget, true);
- oConfig.setProperty("emphasis", bEmphasis, true);
- oConfig.setProperty(
- "strongemphasis",
- bStrongEmphasis,
- true
- );
-
- this._initSubTree();
-
- break;
-
- }
-
- }
-
-
- if(this.element) {
-
-
- Dom.addClass(this.element, this.CSS_CLASS_NAME);
-
-
- // Create custom events
-
- var CustomEvent = YAHOO.util.CustomEvent;
-
- this.destroyEvent = new CustomEvent("destroyEvent", this);
- this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);
- this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);
- this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);
- this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);
- this.clickEvent = new CustomEvent("clickEvent", this);
- this.keyPressEvent = new CustomEvent("keyPressEvent", this);
- this.keyDownEvent = new CustomEvent("keyDownEvent", this);
- this.keyUpEvent = new CustomEvent("keyUpEvent", this);
- this.focusEvent = new CustomEvent("focusEvent", this);
- this.blurEvent = new CustomEvent("blurEvent", this);
-
-
- if(p_oConfig) {
-
- oConfig.applyConfig(p_oConfig);
-
- }
-
- oConfig.fireQueue();
-
- }
-
- },
-
-
-
- // Private methods
-
- /**
- * @method _getFirstElement
- * @description Returns an HTML element's first HTML element node.
- * @private
- * @param {HTMLElement } p_oElement Object
- * reference specifying the element to be evaluated.
- * @param {String} p_sTagName Optional. String specifying the tagname of
- * the element to be retrieved.
- * @return {HTMLElement }
- */
- _getFirstElement: function(p_oElement, p_sTagName) {
-
- var oElement;
-
- if(p_oElement.firstChild && p_oElement.firstChild.nodeType == 1) {
-
- oElement = p_oElement.firstChild;
-
- }
- else if(
- p_oElement.firstChild &&
- p_oElement.firstChild.nextSibling &&
- p_oElement.firstChild.nextSibling.nodeType == 1
- ) {
-
- oElement = p_oElement.firstChild.nextSibling;
-
- }
-
-
- if(p_sTagName) {
-
- return (oElement && oElement.tagName.toUpperCase() == p_sTagName) ?
- oElement : false;
-
- }
-
- return oElement;
-
- },
-
-
- /**
- * @method _checkString
- * @description Determines if an object is a string.
- * @private
- * @param {Object} p_oObject Object to be evaluated.
- * @return {Boolean}
- */
- _checkString: function(p_oObject) {
-
- return (typeof p_oObject == "string");
-
- },
-
-
- /**
- * @method _checkDOMNode
- * @description Determines if an object is an HTML element.
- * @private
- * @param {Object} p_oObject Object to be evaluated.
- * @return {Boolean}
- */
- _checkDOMNode: function(p_oObject) {
-
- return (p_oObject && p_oObject.tagName);
-
- },
-
-
- /**
- * @method _createRootNodeStructure
- * @description Creates the core DOM structure for the menu item.
- * @private
- */
- _createRootNodeStructure: function () {
-
- this.element = document.createElement("li");
-
- this._oText = document.createTextNode("");
-
- this._oAnchor = document.createElement("a");
- this._oAnchor.appendChild(this._oText);
-
- this.cfg.refireEvent("url");
-
- this.element.appendChild(this._oAnchor);
-
- },
-
-
- /**
- * @method _initSubTree
- * @description Iterates the source element's childNodes collection and uses
- * the child nodes to instantiate other menus.
- * @private
- */
- _initSubTree: function() {
-
- var oSrcEl = this.srcElement;
- var oConfig = this.cfg;
-
-
- if(oSrcEl.childNodes.length > 0) {
-
- if(
- this.parent.lazyLoad &&
- this.parent.srcElement &&
- this.parent.srcElement.tagName.toUpperCase() == "SELECT"
- ) {
-
- oConfig.setProperty(
- "submenu",
- { id: Dom.generateId(), itemdata: oSrcEl.childNodes }
- );
-
- }
- else {
-
- var oNode = oSrcEl.firstChild;
- var aOptions = [];
-
- do {
-
- if(oNode && oNode.tagName) {
-
- switch(oNode.tagName.toUpperCase()) {
-
- case "DIV":
-
- oConfig.setProperty("submenu", oNode);
-
- break;
-
- case "OPTION":
-
- aOptions[aOptions.length] = oNode;
-
- break;
-
- }
-
- }
-
- }
- while((oNode = oNode.nextSibling));
-
-
- var nOptions = aOptions.length;
-
- if(nOptions > 0) {
-
- var oMenu = new this.SUBMENU_TYPE(Dom.generateId());
-
- oConfig.setProperty("submenu", oMenu);
-
- for(var n=0; n 0) {
-
- oAnchor.setAttribute("target", sTarget);
-
- }
- else {
-
- oAnchor.removeAttribute("target");
-
- }
-
- },
-
-
- /**
- * @method configEmphasis
- * @description Event handler for when the "emphasis" configuration property
- * of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configEmphasis: function(p_sType, p_aArgs, p_oItem) {
-
- var bEmphasis = p_aArgs[0];
- var oAnchor = this._oAnchor;
- var oText = this._oText;
- var oConfig = this.cfg;
- var oEM;
-
-
- if(bEmphasis && oConfig.getProperty("strongemphasis")) {
-
- oConfig.setProperty("strongemphasis", false);
-
- }
-
-
- if(oAnchor) {
-
- if(bEmphasis) {
-
- oEM = document.createElement("em");
- oEM.appendChild(oText);
-
- oAnchor.appendChild(oEM);
-
- }
- else {
-
- oEM = this._getFirstElement(oAnchor, "EM");
-
- oAnchor.removeChild(oEM);
- oAnchor.appendChild(oText);
-
- }
-
- }
-
- },
-
-
- /**
- * @method configStrongEmphasis
- * @description Event handler for when the "strongemphasis" configuration
- * property of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configStrongEmphasis: function(p_sType, p_aArgs, p_oItem) {
-
- var bStrongEmphasis = p_aArgs[0];
- var oAnchor = this._oAnchor;
- var oText = this._oText;
- var oConfig = this.cfg;
- var oStrong;
-
- if(bStrongEmphasis && oConfig.getProperty("emphasis")) {
-
- oConfig.setProperty("emphasis", false);
-
- }
-
- if(oAnchor) {
-
- if(bStrongEmphasis) {
-
- oStrong = document.createElement("strong");
- oStrong.appendChild(oText);
-
- oAnchor.appendChild(oStrong);
-
- }
- else {
-
- oStrong = this._getFirstElement(oAnchor, "STRONG");
-
- oAnchor.removeChild(oStrong);
- oAnchor.appendChild(oText);
-
- }
-
- }
-
- },
-
-
- /**
- * @method configChecked
- * @description Event handler for when the "checked" configuration property
- * of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configChecked: function(p_sType, p_aArgs, p_oItem) {
-
- var bChecked = p_aArgs[0];
- var oEl = this.element;
- var oConfig = this.cfg;
- var oImg;
-
-
- if(bChecked) {
-
- this._preloadImage(this.CHECKED_IMAGE_PATH);
- this._preloadImage(this.SELECTED_CHECKED_IMAGE_PATH);
- this._preloadImage(this.DISABLED_CHECKED_IMAGE_PATH);
-
-
- oImg = document.createElement("img");
- oImg.src = (this.imageRoot + this.CHECKED_IMAGE_PATH);
- oImg.alt = this.CHECKED_IMAGE_ALT_TEXT;
-
- var oSubmenu = this.cfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- oEl.insertBefore(oImg, oSubmenu.element);
-
- }
- else {
-
- oEl.appendChild(oImg);
-
- }
-
-
- Dom.addClass([oEl, oImg], "checked");
-
- this._checkImage = oImg;
-
- if(oConfig.getProperty("disabled")) {
-
- oConfig.refireEvent("disabled");
-
- }
-
- if(oConfig.getProperty("selected")) {
-
- oConfig.refireEvent("selected");
-
- }
-
- }
- else {
-
- oImg = this._checkImage;
-
- Dom.removeClass([oEl, oImg], "checked");
-
- if(oImg) {
-
- oEl.removeChild(oImg);
-
- }
-
- this._checkImage = null;
-
- }
-
- },
-
-
-
- /**
- * @method configDisabled
- * @description Event handler for when the "disabled" configuration property
- * of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configDisabled: function(p_sType, p_aArgs, p_oItem) {
-
- var bDisabled = p_aArgs[0];
- var oAnchor = this._oAnchor;
- var aNodes = [this.element, oAnchor];
- var oEM = this._oHelpTextEM;
- var oConfig = this.cfg;
- var oImg;
- var sImgSrc;
- var sImgAlt;
-
-
- if(oEM) {
-
- aNodes[2] = oEM;
-
- }
-
-
- if(this.cfg.getProperty("checked")) {
-
- sImgAlt = this.CHECKED_IMAGE_ALT_TEXT;
- sImgSrc = this.CHECKED_IMAGE_PATH;
- oImg = this._checkImage;
-
- if(bDisabled) {
-
- sImgAlt = this.DISABLED_CHECKED_IMAGE_ALT_TEXT;
- sImgSrc = this.DISABLED_CHECKED_IMAGE_PATH;
-
- }
-
- oImg.src = document.images[(this.imageRoot + sImgSrc)].src;
- oImg.alt = sImgAlt;
-
- }
-
-
- oImg = this.submenuIndicator;
-
- if(bDisabled) {
-
- if(oConfig.getProperty("selected")) {
-
- oConfig.setProperty("selected", false);
-
- }
-
- oAnchor.removeAttribute("href");
-
- Dom.addClass(aNodes, "disabled");
-
- sImgSrc = this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH;
- sImgAlt = this.DISABLED_SUBMENU_INDICATOR_ALT_TEXT;
-
- }
- else {
-
- oAnchor.setAttribute("href", oConfig.getProperty("url"));
-
- Dom.removeClass(aNodes, "disabled");
-
- sImgSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;
- sImgAlt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
-
- }
-
-
- if(oImg) {
-
- oImg.src = this.imageRoot + sImgSrc;
- oImg.alt = sImgAlt;
-
- }
-
- },
-
-
- /**
- * @method configSelected
- * @description Event handler for when the "selected" configuration property
- * of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configSelected: function(p_sType, p_aArgs, p_oItem) {
-
- if(!this.cfg.getProperty("disabled")) {
-
- var bSelected = p_aArgs[0];
- var oEM = this._oHelpTextEM;
- var aNodes = [this.element, this._oAnchor];
- var oImg = this.submenuIndicator;
- var sImgSrc;
-
-
- if(oEM) {
-
- aNodes[aNodes.length] = oEM;
-
- }
-
- if(oImg) {
-
- aNodes[aNodes.length] = oImg;
-
- }
-
-
- if(this.cfg.getProperty("checked")) {
-
- sImgSrc = this.imageRoot + (bSelected ?
- this.SELECTED_CHECKED_IMAGE_PATH : this.CHECKED_IMAGE_PATH);
-
- this._checkImage.src = document.images[sImgSrc].src;
-
- }
-
-
- if(bSelected) {
-
- Dom.addClass(aNodes, "selected");
- sImgSrc = this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH;
-
- }
- else {
-
- Dom.removeClass(aNodes, "selected");
- sImgSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;
-
- }
-
- if(oImg) {
-
- oImg.src = document.images[(this.imageRoot + sImgSrc)].src;
-
- }
-
- }
-
- },
-
-
- /**
- * @method configSubmenu
- * @description Event handler for when the "submenu" configuration property
- * of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configSubmenu: function(p_sType, p_aArgs, p_oItem) {
-
- var oEl = this.element;
- var oSubmenu = p_aArgs[0];
- var oImg = this.submenuIndicator;
- var oConfig = this.cfg;
- var aNodes = [this.element, this._oAnchor];
- var oMenu;
- var bLazyLoad = this.parent && this.parent.lazyLoad;
-
-
- if(oSubmenu) {
-
- if(oSubmenu instanceof Menu) {
-
- oMenu = oSubmenu;
- oMenu.parent = this;
- oMenu.lazyLoad = bLazyLoad;
-
- }
- else if(
- typeof oSubmenu == "object" &&
- oSubmenu.id &&
- !oSubmenu.nodeType
- ) {
-
- var sSubmenuId = oSubmenu.id;
- var oSubmenuConfig = oSubmenu;
-
- delete oSubmenu["id"];
-
- oSubmenuConfig.lazyload = bLazyLoad;
- oSubmenuConfig.parent = this;
-
- oMenu = new this.SUBMENU_TYPE(sSubmenuId, oSubmenuConfig);
-
-
- // Set the value of the property to the Menu instance
-
- this.cfg.setProperty("submenu", oMenu, true);
-
- }
- else {
-
- oMenu = new this.SUBMENU_TYPE(
- oSubmenu,
- { lazyload: bLazyLoad, parent: this }
- );
-
-
- // Set the value of the property to the Menu instance
-
- this.cfg.setProperty("submenu", oMenu, true);
-
- }
-
-
- if(oMenu) {
-
- this._oSubmenu = oMenu;
-
-
- if(!oImg) {
-
- this._preloadImage(this.SUBMENU_INDICATOR_IMAGE_PATH);
- this._preloadImage(
- this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
- );
-
- this._preloadImage(
- this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
- );
-
- oImg = document.createElement("img");
-
- oImg.src =
- (this.imageRoot + this.SUBMENU_INDICATOR_IMAGE_PATH);
-
- oImg.alt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
-
- oEl.appendChild(oImg);
-
- this.submenuIndicator = oImg;
-
- Dom.addClass(aNodes, "hassubmenu");
-
-
- if(oConfig.getProperty("disabled")) {
-
- oConfig.refireEvent("disabled");
-
- }
-
- if(oConfig.getProperty("selected")) {
-
- oConfig.refireEvent("selected");
-
- }
-
- }
-
- }
-
- }
- else {
-
- Dom.removeClass(aNodes, "hassubmenu");
-
- if(oImg) {
-
- oEl.removeChild(oImg);
-
- }
-
- if(this._oSubmenu) {
-
- this._oSubmenu.destroy();
-
- }
-
- }
-
- },
-
-
- // Public methods
-
- /**
- * @method initDefaultConfig
- * @description Initializes an item's configurable properties.
- */
- initDefaultConfig : function() {
-
- var oConfig = this.cfg;
- var CheckBoolean = oConfig.checkBoolean;
-
-
- // Define the config properties
-
- /**
- * @config text
- * @description String specifying the text label for the menu item.
- * When building a menu from existing HTML the value of this property
- * will be interpreted from the menu's markup.
- * @default ""
- * @type String
- */
- oConfig.addProperty(
- "text",
- {
- value: "",
- handler: this.configText,
- validator: this._checkString,
- suppressEvent: true
- }
- );
-
-
- /**
- * @config helptext
- * @description String specifying additional instructional text to
- * accompany the text for the nenu item.
- * @default null
- * @type String|
- * HTMLElement
- */
- oConfig.addProperty("helptext", { handler: this.configHelpText });
-
-
- /**
- * @config url
- * @description String specifying the URL for the menu item's anchor's
- * "href" attribute. When building a menu from existing HTML the value
- * of this property will be interpreted from the menu's markup.
- * @default "#"
- * @type String
- */
- oConfig.addProperty(
- "url",
- { value: "#", handler: this.configURL, suppressEvent: true }
- );
-
-
- /**
- * @config target
- * @description String specifying the value for the "target" attribute
- * of the menu item's anchor element. Specifying a target will
- * require the user to click directly on the menu item's anchor node in
- * order to cause the browser to navigate to the specified URL.
- * When building a menu from existing HTML the value of this property
- * will be interpreted from the menu's markup.
- * @default null
- * @type String
- */
- oConfig.addProperty(
- "target",
- { handler: this.configTarget, suppressEvent: true }
- );
-
-
- /**
- * @config emphasis
- * @description Boolean indicating if the text of the menu item will be
- * rendered with emphasis. When building a menu from existing HTML the
- * value of this property will be interpreted from the menu's markup.
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "emphasis",
- {
- value: false,
- handler: this.configEmphasis,
- validator: CheckBoolean,
- suppressEvent: true
- }
- );
-
-
- /**
- * @config strongemphasis
- * @description Boolean indicating if the text of the menu item will be
- * rendered with strong emphasis. When building a menu from existing
- * HTML the value of this property will be interpreted from the
- * menu's markup.
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "strongemphasis",
- {
- value: false,
- handler: this.configStrongEmphasis,
- validator: CheckBoolean,
- suppressEvent: true
- }
- );
-
-
- /**
- * @config checked
- * @description Boolean indicating if the menu item should be rendered
- * with a checkmark.
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "checked",
- {
- value: false,
- handler: this.configChecked,
- validator: this.cfg.checkBoolean,
- suppressEvent: true,
- supercedes:["disabled"]
- }
- );
-
-
- /**
- * @config disabled
- * @description Boolean indicating if the menu item should be disabled.
- * (Disabled menu items are dimmed and will not respond to user input
- * or fire events.)
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "disabled",
- {
- value: false,
- handler: this.configDisabled,
- validator: CheckBoolean,
- suppressEvent: true
- }
- );
-
-
- /**
- * @config selected
- * @description Boolean indicating if the menu item should
- * be highlighted.
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "selected",
- {
- value: false,
- handler: this.configSelected,
- validator: CheckBoolean,
- suppressEvent: true
- }
- );
-
-
- /**
- * @config submenu
- * @description Object specifying the submenu to be appended to the
- * menu item. The value can be one of the following: Object
- * specifying a Menu instance. Object literal specifying the
- * menu to be created. Format: { id: [menu id], itemdata:
- * [array of values for
- * items ] }. String specifying the id attribute
- * of the <div> element of the menu.
- * Object specifying the <div> element of the
- * menu.
- * @default null
- * @type Menu|String|Object|
- * HTMLElement
- */
- oConfig.addProperty("submenu", { handler: this.configSubmenu });
-
- },
-
-
- /**
- * @method getNextEnabledSibling
- * @description Finds the menu item's next enabled sibling.
- * @return YAHOO.widget.MenuItem
- */
- getNextEnabledSibling: function() {
-
- if(this.parent instanceof Menu) {
-
- var nGroupIndex = this.groupIndex;
-
- /**
- * Finds the next item in an array.
- * @private
- * @param {p_aArray} Array to search.
- * @param {p_nStartIndex} Number indicating the index to
- * start searching the array.
- * @return {Object}
- */
- var getNextArrayItem = function(p_aArray, p_nStartIndex) {
-
- return p_aArray[p_nStartIndex] ||
- getNextArrayItem(p_aArray, (p_nStartIndex+1));
-
- };
-
-
- var aItemGroups = this.parent.getItemGroups();
- var oNextItem;
-
-
- if(this.index < (aItemGroups[nGroupIndex].length - 1)) {
-
- oNextItem = getNextArrayItem(
- aItemGroups[nGroupIndex],
- (this.index+1)
- );
-
- }
- else {
-
- var nNextGroupIndex;
-
- if(nGroupIndex < (aItemGroups.length - 1)) {
-
- nNextGroupIndex = nGroupIndex + 1;
-
- }
- else {
-
- nNextGroupIndex = 0;
-
- }
-
- var aNextGroup = getNextArrayItem(aItemGroups, nNextGroupIndex);
-
- // Retrieve the first menu item in the next group
-
- oNextItem = getNextArrayItem(aNextGroup, 0);
-
- }
-
- return (
- oNextItem.cfg.getProperty("disabled") ||
- oNextItem.element.style.display == "none"
- ) ?
- oNextItem.getNextEnabledSibling() : oNextItem;
-
- }
-
- },
-
-
- /**
- * @method getPreviousEnabledSibling
- * @description Finds the menu item's previous enabled sibling.
- * @return {YAHOO.widget.MenuItem}
- */
- getPreviousEnabledSibling: function() {
-
- if(this.parent instanceof Menu) {
-
- var nGroupIndex = this.groupIndex;
-
- /**
- * Returns the previous item in an array
- * @private
- * @param {p_aArray} Array to search.
- * @param {p_nStartIndex} Number indicating the index to
- * start searching the array.
- * @return {Object}
- */
- var getPreviousArrayItem = function(p_aArray, p_nStartIndex) {
-
- return p_aArray[p_nStartIndex] ||
- getPreviousArrayItem(p_aArray, (p_nStartIndex-1));
-
- };
-
-
- /**
- * Get the index of the first item in an array
- * @private
- * @param {p_aArray} Array to search.
- * @param {p_nStartIndex} Number indicating the index to
- * start searching the array.
- * @return {Object}
- */
- var getFirstItemIndex = function(p_aArray, p_nStartIndex) {
-
- return p_aArray[p_nStartIndex] ?
- p_nStartIndex :
- getFirstItemIndex(p_aArray, (p_nStartIndex+1));
-
- };
-
- var aItemGroups = this.parent.getItemGroups();
- var oPreviousItem;
-
- if(
- this.index > getFirstItemIndex(aItemGroups[nGroupIndex], 0)
- ) {
-
- oPreviousItem =
- getPreviousArrayItem(
- aItemGroups[nGroupIndex],
- (this.index-1)
- );
-
- }
- else {
-
- var nPreviousGroupIndex;
-
- if(nGroupIndex > getFirstItemIndex(aItemGroups, 0)) {
-
- nPreviousGroupIndex = nGroupIndex - 1;
-
- }
- else {
-
- nPreviousGroupIndex = aItemGroups.length - 1;
-
- }
-
- var aPreviousGroup =
- getPreviousArrayItem(aItemGroups, nPreviousGroupIndex);
-
- oPreviousItem =
- getPreviousArrayItem(
- aPreviousGroup,
- (aPreviousGroup.length - 1)
- );
-
- }
-
- return (
- oPreviousItem.cfg.getProperty("disabled") ||
- oPreviousItem.element.style.display == "none"
- ) ?
- oPreviousItem.getPreviousEnabledSibling() : oPreviousItem;
-
- }
-
- },
-
-
- /**
- * @method focus
- * @description Causes the menu item to receive the focus and fires the
- * focus event.
- */
- focus: function() {
-
- var oParent = this.parent;
- var oAnchor = this._oAnchor;
- var oActiveItem = oParent.activeItem;
-
- if(
- !this.cfg.getProperty("disabled") &&
- oParent &&
- oParent.cfg.getProperty("visible") &&
- this.element.style.display != "none"
- ) {
-
- if(oActiveItem) {
-
- oActiveItem.blur();
-
- }
-
- try {
-
- oAnchor.focus();
-
- }
- catch(e) {
-
- }
-
- this.focusEvent.fire();
-
- }
-
- },
-
-
- /**
- * @method blur
- * @description Causes the menu item to lose focus and fires the
- * onblur event.
- */
- blur: function() {
-
- var oParent = this.parent;
-
- if(
- !this.cfg.getProperty("disabled") &&
- oParent &&
- Dom.getStyle(oParent.element, "visibility") == "visible"
- ) {
-
- this._oAnchor.blur();
-
- this.blurEvent.fire();
-
- }
-
- },
-
-
- /**
- * @method destroy
- * @description Removes the menu item's <li> element
- * from its parent <ul> element.
- */
- destroy: function() {
-
- var oEl = this.element;
-
- if(oEl) {
-
- // Remove CustomEvent listeners
-
- this.mouseOverEvent.unsubscribeAll();
- this.mouseOutEvent.unsubscribeAll();
- this.mouseDownEvent.unsubscribeAll();
- this.mouseUpEvent.unsubscribeAll();
- this.clickEvent.unsubscribeAll();
- this.keyPressEvent.unsubscribeAll();
- this.keyDownEvent.unsubscribeAll();
- this.keyUpEvent.unsubscribeAll();
- this.focusEvent.unsubscribeAll();
- this.blurEvent.unsubscribeAll();
- this.cfg.configChangedEvent.unsubscribeAll();
-
-
- // Remove the element from the parent node
-
- var oParentNode = oEl.parentNode;
-
- if(oParentNode) {
-
- oParentNode.removeChild(oEl);
-
- this.destroyEvent.fire();
-
- }
-
- this.destroyEvent.unsubscribeAll();
-
- }
-
- },
-
-
- /**
- * @method toString
- * @description Returns a string representing the menu item.
- * @return {String}
- */
- toString: function() {
-
- return ("MenuItem: " + this.cfg.getProperty("text"));
-
- }
-
-};
-
-})();
-
-
-/**
-* Creates an item for a menu module.
-*
-* @param {String} p_oObject String specifying the text of the menu module item.
-* @param {HTMLLIElement } p_oObject Object specifying the
-* <li> element of the menu module item.
-* @param {HTMLOptGroupElement } p_oObject Object specifying
-* the <optgroup> element of the menu module item.
-* @param {HTMLOptionElement } p_oObject Object specifying the
-* <option> element of the menu module item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu module item. See configuration class documentation
-* for more details.
-* @class MenuModuleItem
-* @constructor
-* @deprecated As of version 0.12, all MenuModuleItem functionality has been
-* implemented directly in YAHOO.widget.MenuItem, making YAHOO.widget.MenuItem
-* the base class for all menu items.
-*/
-YAHOO.widget.MenuModuleItem = YAHOO.widget.MenuItem;
-
-
-/**
-* Creates a list of options or commands which are made visible in response to
-* an HTML element's "contextmenu" event ("mousedown" for Opera).
-*
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the context menu.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source for the
-* context menu.
-* @param {HTMLDivElement } p_oElement Object specifying the
-* <div> element of the context menu.
-* @param {HTMLSelectElement } p_oElement Object specifying
-* the <select> element to be used as the data source for
-* the context menu.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the context menu. See configuration class documentation
-* for more details.
-* @class ContextMenu
-* @constructor
-* @extends YAHOO.widget.Menu
-* @namespace YAHOO.widget
-*/
-YAHOO.widget.ContextMenu = function(p_oElement, p_oConfig) {
-
- YAHOO.widget.ContextMenu.superclass.constructor.call(
- this,
- p_oElement,
- p_oConfig
- );
-
-};
-
-
-YAHOO.extend(YAHOO.widget.ContextMenu, YAHOO.widget.Menu, {
-
-
-
-// Private properties
-
-
-/**
-* @property _oTrigger
-* @description Object reference to the current value of the "trigger"
-* configuration property.
-* @default null
-* @private
-* @type String|HTMLElement |Array
-*/
-_oTrigger: null,
-
-
-
-// Public properties
-
-
-/**
-* @property contextEventTarget
-* @description Object reference for the HTML element that was the target of the
-* "contextmenu" DOM event ("mousedown" for Opera) that triggered the display of
-* the context menu.
-* @default null
-* @type HTMLElement
-*/
-contextEventTarget: null,
-
-
-/**
-* @method init
-* @description The ContextMenu class's initialization method. This method is
-* automatically called by the constructor, and sets up all DOM references for
-* pre-existing markup, and creates required markup if it is not already present.
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the context menu.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source for
-* the context menu.
-* @param {HTMLDivElement } p_oElement Object specifying the
-* <div> element of the context menu.
-* @param {HTMLSelectElement } p_oElement Object specifying
-* the <select> element to be used as the data source for
-* the context menu.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the context menu. See configuration class documentation
-* for more details.
-*/
-init: function(p_oElement, p_oConfig) {
-
- if(!this.ITEM_TYPE) {
-
- this.ITEM_TYPE = YAHOO.widget.ContextMenuItem;
-
- }
-
-
- // Call the init of the superclass (YAHOO.widget.Menu)
-
- YAHOO.widget.ContextMenu.superclass.init.call(this, p_oElement);
-
-
- this.beforeInitEvent.fire(YAHOO.widget.ContextMenu);
-
-
- if(p_oConfig) {
-
- this.cfg.applyConfig(p_oConfig, true);
-
- }
-
-
- this.initEvent.fire(YAHOO.widget.ContextMenu);
-
-},
-
-
-
-// Private methods
-
-
-/**
-* @method _removeEventHandlers
-* @description Removes all of the DOM event handlers from the HTML element(s)
-* whose "context menu" event ("click" for Opera) trigger the display of
-* the context menu.
-* @private
-*/
-_removeEventHandlers: function() {
-
- var Event = YAHOO.util.Event;
- var oTrigger = this._oTrigger;
- var bOpera = (this.browser == "opera");
-
-
- // Remove the event handlers from the trigger(s)
-
- Event.removeListener(
- oTrigger,
- (bOpera ? "mousedown" : "contextmenu"),
- this._onTriggerContextMenu
- );
-
- if(bOpera) {
-
- Event.removeListener(oTrigger, "click", this._onTriggerClick);
-
- }
-
-},
-
-
-
-// Private event handlers
-
-
-/**
-* @method _onTriggerClick
-* @description "click" event handler for the HTML element(s) identified as the
-* "trigger" for the context menu. Used to cancel default behaviors in Opera.
-* @private
-* @param {Event} p_oEvent Object representing the DOM event object passed back
-* by the event utility (YAHOO.util.Event).
-* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
-* menu that is handling the event.
-*/
-_onTriggerClick: function(p_oEvent, p_oMenu) {
-
- if(p_oEvent.ctrlKey) {
-
- YAHOO.util.Event.stopEvent(p_oEvent);
-
- }
-
-},
-
-
-/**
-* @method _onTriggerContextMenu
-* @description "contextmenu" event handler ("mousedown" for Opera) for the HTML
-* element(s) that trigger the display of the context menu.
-* @private
-* @param {Event} p_oEvent Object representing the DOM event object passed back
-* by the event utility (YAHOO.util.Event).
-* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
-* menu that is handling the event.
-*/
-_onTriggerContextMenu: function(p_oEvent, p_oMenu) {
-
- // Hide any other ContextMenu instances that might be visible
-
- YAHOO.widget.MenuManager.hideVisible();
-
-
- var Event = YAHOO.util.Event;
- var oConfig = this.cfg;
-
- if(p_oEvent.type == "mousedown" && !p_oEvent.ctrlKey) {
-
- return;
-
- }
-
- this.contextEventTarget = Event.getTarget(p_oEvent);
-
-
- // Position and display the context menu
-
- var nX = Event.getPageX(p_oEvent);
- var nY = Event.getPageY(p_oEvent);
-
-
- oConfig.applyConfig( { xy:[nX, nY], visible:true } );
- oConfig.fireQueue();
-
-
- /*
- Prevent the browser's default context menu from appearing and
- stop the propagation of the "contextmenu" event so that
- other ContextMenu instances are not displayed.
- */
-
- Event.stopEvent(p_oEvent);
-
-},
-
-
-
-// Public methods
-
-
-/**
-* @method toString
-* @description Returns a string representing the context menu.
-* @return {String}
-*/
-toString: function() {
-
- return ("ContextMenu " + this.id);
-
-},
-
-
-/**
-* @method initDefaultConfig
-* @description Initializes the class's configurable properties which can be
-* changed using the context menu's Config object ("cfg").
-*/
-initDefaultConfig: function() {
-
- YAHOO.widget.ContextMenu.superclass.initDefaultConfig.call(this);
-
- /**
- * @config trigger
- * @description The HTML element(s) whose "contextmenu" event ("mousedown"
- * for Opera) trigger the display of the context menu. Can be a string
- * representing the id attribute of the HTML element, an object reference
- * for the HTML element, or an array of strings or HTML element references.
- * @default null
- * @type String|HTMLElement |Array
- */
- this.cfg.addProperty("trigger", { handler: this.configTrigger });
-
-},
-
-
-/**
-* @method destroy
-* @description Removes the context menu's <div> element
-* (and accompanying child nodes) from the document.
-*/
-destroy: function() {
-
- // Remove the DOM event handlers from the current trigger(s)
-
- this._removeEventHandlers();
-
-
- // Continue with the superclass implementation of this method
-
- YAHOO.widget.ContextMenu.superclass.destroy.call(this);
-
-},
-
-
-
-// Public event handlers for configuration properties
-
-
-/**
-* @method configTrigger
-* @description Event handler for when the value of the "trigger" configuration
-* property changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
-* menu that fired the event.
-*/
-configTrigger: function(p_sType, p_aArgs, p_oMenu) {
-
- var Event = YAHOO.util.Event;
- var oTrigger = p_aArgs[0];
-
- if(oTrigger) {
-
- /*
- If there is a current "trigger" - remove the event handlers
- from that element(s) before assigning new ones
- */
-
- if(this._oTrigger) {
-
- this._removeEventHandlers();
-
- }
-
- this._oTrigger = oTrigger;
-
-
- /*
- Listen for the "mousedown" event in Opera b/c it does not
- support the "contextmenu" event
- */
-
- var bOpera = (this.browser == "opera");
-
- Event.addListener(
- oTrigger,
- (bOpera ? "mousedown" : "contextmenu"),
- this._onTriggerContextMenu,
- this,
- true
- );
-
-
- /*
- Assign a "click" event handler to the trigger element(s) for
- Opera to prevent default browser behaviors.
- */
-
- if(bOpera) {
-
- Event.addListener(
- oTrigger,
- "click",
- this._onTriggerClick,
- this,
- true
- );
-
- }
-
- }
- else {
-
- this._removeEventHandlers();
-
- }
-
-}
-
-}); // END YAHOO.extend
-
-
-/**
-* Creates an item for a context menu.
-*
-* @param {String} p_oObject String specifying the text of the context menu item.
-* @param {HTMLLIElement } p_oObject Object specifying the
-* <li> element of the context menu item.
-* @param {HTMLOptGroupElement } p_oObject Object
-* specifying the <optgroup> element of the context
-* menu item.
-* @param {HTMLOptionElement } p_oObject Object specifying
-* the <option> element of the context menu item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the context menu item. See configuration class
-* documentation for more details.
-* @class ContextMenuItem
-* @constructor
-* @extends YAHOO.widget.MenuItem
-*/
-YAHOO.widget.ContextMenuItem = function(p_oObject, p_oConfig) {
-
- YAHOO.widget.ContextMenuItem.superclass.constructor.call(
- this,
- p_oObject,
- p_oConfig
- );
-
-};
-
-YAHOO.extend(YAHOO.widget.ContextMenuItem, YAHOO.widget.MenuItem, {
-
-
-/**
-* @method init
-* @description The ContextMenuItem class's initialization method. This method
-* is automatically called by the constructor, and sets up all DOM references
-* for pre-existing markup, and creates required markup if it is not
-* already present.
-* @param {String} p_oObject String specifying the text of the context menu item.
-* @param {HTMLLIElement } p_oObject Object specifying the
-* <li> element of the context menu item.
-* @param {HTMLOptGroupElement } p_oObject Object
-* specifying the <optgroup> element of the context
-* menu item.
-* @param {HTMLOptionElement } p_oObject Object specifying
-* the <option> element of the context menu item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the context menu item. See configuration class
-* documentation for more details.
-*/
-init: function(p_oObject, p_oConfig) {
-
- if(!this.SUBMENU_TYPE) {
-
- this.SUBMENU_TYPE = YAHOO.widget.ContextMenu;
-
- }
-
-
- /*
- Call the init of the superclass (YAHOO.widget.MenuItem)
- Note: We don't pass the user config in here yet
- because we only want it executed once, at the lowest
- subclass level.
- */
-
- YAHOO.widget.ContextMenuItem.superclass.init.call(this, p_oObject);
-
- var oConfig = this.cfg;
-
- if(p_oConfig) {
-
- oConfig.applyConfig(p_oConfig, true);
-
- }
-
- oConfig.fireQueue();
-
-},
-
-
-
-// Public methods
-
-
-/**
-* @method toString
-* @description Returns a string representing the context menu item.
-* @return {String}
-*/
-toString: function() {
-
- return ("MenuBarItem: " + this.cfg.getProperty("text"));
-
-}
-
-}); // END YAHOO.extend
-
-
-/**
-* Horizontal collection of items, each of which can contain a submenu.
-*
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the menu bar.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source for the
-* menu bar.
-* @param {HTMLDivElement } p_oElement Object specifying
-* the <div> element of the menu bar.
-* @param {HTMLSelectElement } p_oElement Object
-* specifying the <select> element to be used as the data
-* source for the menu bar.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu bar. See configuration class documentation for
-* more details.
-* @class Menubar
-* @constructor
-* @extends YAHOO.widget.Menu
-* @namespace YAHOO.widget
-*/
-YAHOO.widget.MenuBar = function(p_oElement, p_oConfig) {
-
- YAHOO.widget.MenuBar.superclass.constructor.call(
- this,
- p_oElement,
- p_oConfig
- );
-
-};
-
-YAHOO.extend(YAHOO.widget.MenuBar, YAHOO.widget.Menu, {
-
-/**
-* @method init
-* @description The MenuBar class's initialization method. This method is
-* automatically called by the constructor, and sets up all DOM references for
-* pre-existing markup, and creates required markup if it is not already present.
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the menu bar.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source for the
-* menu bar.
-* @param {HTMLDivElement } p_oElement Object specifying
-* the <div> element of the menu bar.
-* @param {HTMLSelectElement } p_oElement Object
-* specifying the <select> element to be used as the data
-* source for the menu bar.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu bar. See configuration class documentation for
-* more details.
-*/
-init: function(p_oElement, p_oConfig) {
-
- if(!this.ITEM_TYPE) {
-
- this.ITEM_TYPE = YAHOO.widget.MenuBarItem;
-
- }
-
-
- // Call the init of the superclass (YAHOO.widget.Menu)
-
- YAHOO.widget.MenuBar.superclass.init.call(this, p_oElement);
-
-
- this.beforeInitEvent.fire(YAHOO.widget.MenuBar);
-
-
- if(p_oConfig) {
-
- this.cfg.applyConfig(p_oConfig, true);
-
- }
-
- this.initEvent.fire(YAHOO.widget.MenuBar);
-
-},
-
-
-
-// Constants
-
-
-/**
-* @property CSS_CLASS_NAME
-* @description String representing the CSS class(es) to be applied to the menu
-* bar's <div> element.
-* @default "yuimenubar"
-* @final
-* @type String
-*/
-CSS_CLASS_NAME: "yuimenubar",
-
-
-
-// Protected event handlers
-
-
-/**
-* @method _onKeyDown
-* @description "keydown" Custom Event handler for the menu bar.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.MenuBar} p_oMenuBar Object representing the menu bar
-* that fired the event.
-*/
-_onKeyDown: function(p_sType, p_aArgs, p_oMenuBar) {
-
- var Event = YAHOO.util.Event;
- var oEvent = p_aArgs[0];
- var oItem = p_aArgs[1];
- var oItemCfg = oItem.cfg;
- var oSubmenu;
-
-
- switch(oEvent.keyCode) {
-
- case 27: // Esc key
-
- if(this.cfg.getProperty("position") == "dynamic") {
-
- this.hide();
-
- if(this.parent) {
-
- this.parent.focus();
-
- }
-
- }
- else if(this.activeItem) {
-
- oSubmenu = this.activeItem.cfg.getProperty("submenu");
-
- if(oSubmenu && oSubmenu.cfg.getProperty("visible")) {
-
- oSubmenu.hide();
- this.activeItem.focus();
-
- }
- else {
-
- this.activeItem.cfg.setProperty("selected", false);
- this.activeItem.blur();
-
- }
-
- }
-
-
- Event.preventDefault(oEvent);
-
- break;
-
- case 37: // Left arrow
- case 39: // Right arrow
-
- if(
- oItem == this.activeItem &&
- !oItemCfg.getProperty("selected")
- ) {
-
- oItemCfg.setProperty("selected", true);
-
- }
- else {
-
- var oNextItem = (oEvent.keyCode == 37) ?
- oItem.getPreviousEnabledSibling() :
- oItem.getNextEnabledSibling();
-
- if(oNextItem) {
-
- this.clearActiveItem();
-
- oNextItem.cfg.setProperty("selected", true);
-
-
- if(this.cfg.getProperty("autosubmenudisplay")) {
-
- oSubmenu = oNextItem.cfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- oSubmenu.show();
- oSubmenu.activeItem.blur();
- oSubmenu.activeItem = null;
-
- }
-
- }
-
- oNextItem.focus();
-
- }
-
- }
-
- Event.preventDefault(oEvent);
-
- break;
-
- case 40: // Down arrow
-
- if(this.activeItem != oItem) {
-
- this.clearActiveItem();
-
- oItemCfg.setProperty("selected", true);
- oItem.focus();
-
- }
-
- oSubmenu = oItemCfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- if(oSubmenu.cfg.getProperty("visible")) {
-
- oSubmenu.setInitialSelection();
- oSubmenu.setInitialFocus();
-
- }
- else {
-
- oSubmenu.show();
-
- }
-
- }
-
- Event.preventDefault(oEvent);
-
- break;
-
- }
-
-},
-
-
-/**
-* @method _onClick
-* @description "click" event handler for the menu bar.
-* @protected
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.MenuBar} p_oMenuBar Object representing the menu bar
-* that fired the event.
-*/
-_onClick: function(p_sType, p_aArgs, p_oMenuBar) {
-
- YAHOO.widget.MenuBar.superclass._onClick.call(
- this,
- p_sType,
- p_aArgs,
- p_oMenuBar
- );
-
-
- var oItem = p_aArgs[1];
-
- if(oItem) {
-
- var Event = YAHOO.util.Event;
- var Dom = YAHOO.util.Dom;
-
- var oEvent = p_aArgs[0];
- var oTarget = Event.getTarget(oEvent);
-
- var oActiveItem = this.activeItem;
- var oConfig = this.cfg;
-
-
- // Hide any other submenus that might be visible
-
- if(oActiveItem && oActiveItem != oItem) {
-
- this.clearActiveItem();
-
- }
-
-
- // Select and focus the current item
-
- oItem.cfg.setProperty("selected", true);
- oItem.focus();
-
-
- // Show the submenu for the item
-
- var oSubmenu = oItem.cfg.getProperty("submenu");
-
-
- if(oSubmenu && oTarget != oItem.submenuIndicator) {
-
- if(oSubmenu.cfg.getProperty("visible")) {
-
- oSubmenu.hide();
-
- }
- else {
-
- oSubmenu.show();
-
- }
-
- }
-
- }
-
-},
-
-
-
-// Public methods
-
-
-/**
-* @method toString
-* @description Returns a string representing the menu bar.
-* @return {String}
-*/
-toString: function() {
-
- return ("MenuBar " + this.id);
-
-},
-
-
-/**
-* @description Initializes the class's configurable properties which can be
-* changed using the menu bar's Config object ("cfg").
-* @method initDefaultConfig
-*/
-initDefaultConfig: function() {
-
- YAHOO.widget.MenuBar.superclass.initDefaultConfig.call(this);
-
- var oConfig = this.cfg;
-
- // Add configuration properties
-
-
- /*
- Set the default value for the "position" configuration property
- to "static" by re-adding the property.
- */
-
- /**
- * @config position
- * @description String indicating how a menu bar should be positioned on the
- * screen. Possible values are "static" and "dynamic." Static menu bars
- * are visible by default and reside in the normal flow of the document
- * (CSS position: static). Dynamic menu bars are hidden by default, reside
- * out of the normal flow of the document (CSS position: absolute), and can
- * overlay other elements on the screen.
- * @default static
- * @type String
- */
- oConfig.addProperty(
- "position",
- {
- value: "static",
- handler: this.configPosition,
- validator: this._checkPosition,
- supercedes: ["visible"]
- }
- );
-
-
- /*
- Set the default value for the "submenualignment" configuration property
- to ["tl","bl"] by re-adding the property.
- */
-
- /**
- * @config submenualignment
- * @description Array defining how submenus should be aligned to their
- * parent menu bar item. The format is: [itemCorner, submenuCorner].
- * @default ["tl","bl"]
- * @type Array
- */
- oConfig.addProperty("submenualignment", { value: ["tl","bl"] } );
-
-
- /*
- Change the default value for the "autosubmenudisplay" configuration
- property to "false" by re-adding the property.
- */
-
- /**
- * @config autosubmenudisplay
- * @description Boolean indicating if submenus are automatically made
- * visible when the user mouses over the menu bar's items.
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "autosubmenudisplay",
- { value: false, validator: oConfig.checkBoolean }
- );
-
-}
-
-}); // END YAHOO.extend
-
-
-/**
-* Creates an item for a menu bar.
-*
-* @param {String} p_oObject String specifying the text of the menu bar item.
-* @param {HTMLLIElement } p_oObject Object specifying the
-* <li> element of the menu bar item.
-* @param {HTMLOptGroupElement } p_oObject Object
-* specifying the <optgroup> element of the menu bar item.
-* @param {HTMLOptionElement } p_oObject Object specifying
-* the <option> element of the menu bar item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu bar item. See configuration class documentation
-* for more details.
-* @class MenuBarItem
-* @constructor
-* @extends YAHOO.widget.MenuItem
-*/
-YAHOO.widget.MenuBarItem = function(p_oObject, p_oConfig) {
-
- YAHOO.widget.MenuBarItem.superclass.constructor.call(
- this,
- p_oObject,
- p_oConfig
- );
-
-};
-
-YAHOO.extend(YAHOO.widget.MenuBarItem, YAHOO.widget.MenuItem, {
-
-
-/**
-* @method init
-* @description The MenuBarItem class's initialization method. This method is
-* automatically called by the constructor, and sets up all DOM references for
-* pre-existing markup, and creates required markup if it is not already present.
-* @param {String} p_oObject String specifying the text of the menu bar item.
-* @param {HTMLLIElement } p_oObject Object specifying the
-* <li> element of the menu bar item.
-* @param {HTMLOptGroupElement } p_oObject Object
-* specifying the <optgroup> element of the menu bar item.
-* @param {HTMLOptionElement } p_oObject Object specifying
-* the <option> element of the menu bar item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu bar item. See configuration class documentation
-* for more details.
-*/
-init: function(p_oObject, p_oConfig) {
-
- if(!this.SUBMENU_TYPE) {
-
- this.SUBMENU_TYPE = YAHOO.widget.Menu;
-
- }
-
-
- /*
- Call the init of the superclass (YAHOO.widget.MenuItem)
- Note: We don't pass the user config in here yet
- because we only want it executed once, at the lowest
- subclass level.
- */
-
- YAHOO.widget.MenuBarItem.superclass.init.call(this, p_oObject);
-
-
- var oConfig = this.cfg;
-
- if(p_oConfig) {
-
- oConfig.applyConfig(p_oConfig, true);
-
- }
-
- oConfig.fireQueue();
-
-},
-
-
-
-// Constants
-
-/**
-* @property CSS_CLASS_NAME
-* @description String representing the CSS class(es) to be applied to the
-* <li> element of the menu bar item.
-* @default "yuimenubaritem"
-* @final
-* @type String
-*/
-CSS_CLASS_NAME: "yuimenubaritem",
-
-
-/**
-* @property SUBMENU_INDICATOR_IMAGE_PATH
-* @description String representing the path to the image to be used for the
-* menu bar item's submenu arrow indicator.
-* @default "nt/ic/ut/alt1/menuarodwn8_nrm_1.gif"
-* @final
-* @type String
-*/
-SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_nrm_1.gif",
-
-
-/**
-* @property SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
-* @description String representing the path to the image to be used for the
-* submenu arrow indicator when the menu bar item is selected.
-* @default "nt/ic/ut/alt1/menuarodwn8_hov_1.gif"
-* @final
-* @type String
-*/
-SELECTED_SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_hov_1.gif",
-
-
-/**
-* @property DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
-* @description String representing the path to the image to be used for the
-* submenu arrow indicator when the menu bar item is disabled.
-* @default "nt/ic/ut/alt1/menuarodwn8_dim_1.gif"
-* @final
-* @type String
-*/
-DISABLED_SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_dim_1.gif",
-
-
-
-// Public methods
-
-
-/**
-* @method toString
-* @description Returns a string representing the menu bar item.
-* @return {String}
-*/
-toString: function() {
-
- return ("MenuBarItem: " + this.cfg.getProperty("text"));
-
-}
-
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.com/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+* @module menu
+* @description The Menu Library features a collection of widgets that make
+* it easy to add menus to your website or web application. With the Menu
+* Library you can create website fly-out menus, customized context menus, or
+* application-style menu bars with just a small amount of scripting.
+*
+* Screen-reader accessibility.
+* Keyboard and mouse navigation.
+* A rich event model that provides access to all of a menu's
+* interesting moments.
+* Support for
+* Progressive
+* Enhancement ; Menus can be created from simple,
+* semantic markup on the page or purely through JavaScript.
+*
+* @title Menu Library
+* @namespace YAHOO.widget
+* @requires Event, Dom, Container
+*/
+(function() {
+
+var Dom = YAHOO.util.Dom;
+var Event = YAHOO.util.Event;
+
+/**
+* Singleton that manages a collection of all menus and menu items. Listens for
+* DOM events at the document level and dispatches the events to the
+* corresponding menu or menu item.
+*
+* @namespace YAHOO.widget
+* @class MenuManager
+* @static
+*/
+YAHOO.widget.MenuManager = new function() {
+
+ // Private member variables
+
+
+ // Flag indicating if the DOM event handlers have been attached
+
+ var m_bInitializedEventHandlers = false;
+
+
+ // Collection of menus
+
+ var m_oMenus = {};
+
+
+ // Collection of menu items
+
+ var m_oItems = {};
+
+
+ // Collection of visible menus
+
+ var m_oVisibleMenus = {};
+
+
+ // Logger
+
+ var m_oLogger = new YAHOO.widget.LogWriter(this.toString());
+
+
+
+ // Private methods
+
+
+ /**
+ * Adds an item to the collection of known menu items.
+ * @private
+ * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem
+ * instance to be added.
+ */
+ var addItem = function(p_oItem) {
+
+ var sYUIId = Dom.generateId();
+
+ if(p_oItem && m_oItems[sYUIId] != p_oItem) {
+
+ p_oItem.element.setAttribute("yuiid", sYUIId);
+
+ m_oItems[sYUIId] = p_oItem;
+
+ p_oItem.destroyEvent.subscribe(onItemDestroy, p_oItem);
+
+ m_oLogger.log("Item: " +
+ p_oItem.toString() + " successfully registered.");
+
+ }
+
+ };
+
+
+ /**
+ * Removes an item from the collection of known menu items.
+ * @private
+ * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem
+ * instance to be removed.
+ */
+ var removeItem = function(p_oItem) {
+
+ var sYUIId = p_oItem.element.getAttribute("yuiid");
+
+ if(sYUIId && m_oItems[sYUIId]) {
+
+ delete m_oItems[sYUIId];
+
+ m_oLogger.log("Item: " +
+ p_oItem.toString() + " successfully unregistered.");
+
+ }
+
+ };
+
+
+ /**
+ * Finds the root DIV node of a menu or the root LI node of a menu item.
+ * @private
+ * @param {HTMLElement } p_oElement Object specifying
+ * an HTML element.
+ */
+ var getMenuRootElement = function(p_oElement) {
+
+ var oParentNode;
+
+ if(p_oElement && p_oElement.tagName) {
+
+ switch(p_oElement.tagName.toUpperCase()) {
+
+ case "DIV":
+
+ oParentNode = p_oElement.parentNode;
+
+ // Check if the DIV is the inner "body" node of a menu
+
+ if(
+ Dom.hasClass(p_oElement, "bd") &&
+ oParentNode &&
+ oParentNode.tagName &&
+ oParentNode.tagName.toUpperCase() == "DIV"
+ ) {
+
+ return oParentNode;
+
+ }
+ else {
+
+ return p_oElement;
+
+ }
+
+ break;
+
+ case "LI":
+
+ return p_oElement;
+
+ default:
+
+ oParentNode = p_oElement.parentNode;
+
+ if(oParentNode) {
+
+ return getMenuRootElement(oParentNode);
+
+ }
+
+ break;
+
+ }
+
+ }
+
+ };
+
+
+
+ // Private event handlers
+
+
+ /**
+ * Generic, global event handler for all of a menu's DOM-based
+ * events. This listens for events against the document object. If the
+ * target of a given event is a member of a menu or menu item's DOM, the
+ * instance's corresponding Custom Event is fired.
+ * @private
+ * @param {Event} p_oEvent Object representing the DOM event object passed
+ * back by the event utility (YAHOO.util.Event).
+ */
+ var onDOMEvent = function(p_oEvent) {
+
+ // Get the target node of the DOM event
+
+ var oTarget = Event.getTarget(p_oEvent);
+
+
+ // See if the target of the event was a menu, or a menu item
+
+ var oElement = getMenuRootElement(oTarget);
+
+ var oMenuItem;
+ var oMenu;
+
+
+ if(oElement) {
+
+ var sTagName = oElement.tagName.toUpperCase();
+
+ if(sTagName == "LI") {
+
+ var sYUIId = oElement.getAttribute("yuiid");
+
+ if(sYUIId) {
+
+ oMenuItem = m_oItems[sYUIId];
+ oMenu = oMenuItem.parent;
+
+ }
+
+ }
+ else if(sTagName == "DIV") {
+
+ if(oElement.id) {
+
+ oMenu = m_oMenus[oElement.id];
+
+ }
+
+ }
+
+ }
+
+ if(oMenu) {
+
+ // Map of DOM event names to CustomEvent names
+
+ var oEventTypes = {
+ "click": "clickEvent",
+ "mousedown": "mouseDownEvent",
+ "mouseup": "mouseUpEvent",
+ "mouseover": "mouseOverEvent",
+ "mouseout": "mouseOutEvent",
+ "keydown": "keyDownEvent",
+ "keyup": "keyUpEvent",
+ "keypress": "keyPressEvent"
+ };
+
+ var sCustomEventType = oEventTypes[p_oEvent.type];
+
+
+ // Fire the Custom Even that corresponds the current DOM event
+
+ if(oMenuItem && !oMenuItem.cfg.getProperty("disabled")) {
+
+ oMenuItem[sCustomEventType].fire(p_oEvent);
+
+ }
+
+ oMenu[sCustomEventType].fire(p_oEvent, oMenuItem);
+
+ }
+ else if(p_oEvent.type == "mousedown") {
+
+
+ /*
+ If the target of the event wasn't a menu, hide all
+ dynamically positioned menus
+ */
+
+ var oActiveItem;
+
+ for(var i in m_oMenus) {
+
+ if(m_oMenus.hasOwnProperty(i)) {
+
+ oMenu = m_oMenus[i];
+
+ if(
+ oMenu.cfg.getProperty("clicktohide") &&
+ oMenu.cfg.getProperty("position") == "dynamic"
+ ) {
+
+ oMenu.hide();
+
+ }
+ else {
+
+ oMenu.clearActiveItem(true);
+
+ }
+
+ }
+
+ }
+
+ }
+
+ };
+
+
+ /**
+ * "destroy" event handler for a menu.
+ * @private
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+ * fired the event.
+ */
+ var onMenuDestroy = function(p_sType, p_aArgs, p_oMenu) {
+
+ this.removeMenu(p_oMenu);
+
+ };
+
+
+ /**
+ * "destroy" event handler for a MenuItem instance.
+ * @private
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ var onItemDestroy = function(p_sType, p_aArgs, p_oItem) {
+
+ var sYUIId = p_oItem.element.getAttribute("yuiid");
+
+ if(sYUIId) {
+
+ delete m_oItems[sYUIId];
+
+ }
+
+ };
+
+
+ /**
+ * Event handler for when the "visible" configuration property
+ * of a Menu instance changes.
+ * @private
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+ * fired the event.
+ */
+ var onMenuVisibleConfigChange = function(p_sType, p_aArgs, p_oMenu) {
+
+ var bVisible = p_aArgs[0];
+
+ if(bVisible) {
+
+ m_oVisibleMenus[p_oMenu.id] = p_oMenu;
+
+ m_oLogger.log("Menu: " +
+ p_oMenu.toString() +
+ " registered with the collection of visible menus.");
+
+ }
+ else if(m_oVisibleMenus[p_oMenu.id]) {
+
+ delete m_oVisibleMenus[p_oMenu.id];
+
+ m_oLogger.log("Menu: " +
+ p_oMenu.toString() +
+ " unregistered from the collection of visible menus.");
+
+ }
+
+ };
+
+
+ /**
+ * "itemadded" event handler for a Menu instance.
+ * @private
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ */
+ var onItemAdded = function(p_sType, p_aArgs) {
+
+ addItem(p_aArgs[0]);
+
+ };
+
+
+ /**
+ * "itemremoved" event handler for a Menu instance.
+ * @private
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ */
+ var onItemRemoved = function(p_sType, p_aArgs) {
+
+ removeItem(p_aArgs[0]);
+
+ };
+
+
+
+ // Privileged methods
+
+
+ /**
+ * @method addMenu
+ * @description Adds a menu to the collection of known menus.
+ * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance
+ * to be added.
+ */
+ this.addMenu = function(p_oMenu) {
+
+ if(p_oMenu && p_oMenu.id && !m_oMenus[p_oMenu.id]) {
+
+ m_oMenus[p_oMenu.id] = p_oMenu;
+
+
+ if(!m_bInitializedEventHandlers) {
+
+ var oDoc = document;
+
+ Event.addListener(oDoc, "mouseover", onDOMEvent, this, true);
+ Event.addListener(oDoc, "mouseout", onDOMEvent, this, true);
+ Event.addListener(oDoc, "mousedown", onDOMEvent, this, true);
+ Event.addListener(oDoc, "mouseup", onDOMEvent, this, true);
+ Event.addListener(oDoc, "click", onDOMEvent, this, true);
+ Event.addListener(oDoc, "keydown", onDOMEvent, this, true);
+ Event.addListener(oDoc, "keyup", onDOMEvent, this, true);
+ Event.addListener(oDoc, "keypress", onDOMEvent, this, true);
+
+ m_bInitializedEventHandlers = true;
+
+ m_oLogger.log("DOM event handlers initialized.");
+
+ }
+
+ p_oMenu.destroyEvent.subscribe(onMenuDestroy, p_oMenu, this);
+
+ p_oMenu.cfg.subscribeToConfigEvent(
+ "visible",
+ onMenuVisibleConfigChange,
+ p_oMenu
+ );
+
+ p_oMenu.itemAddedEvent.subscribe(onItemAdded);
+ p_oMenu.itemRemovedEvent.subscribe(onItemRemoved);
+
+ m_oLogger.log("Menu: " +
+ p_oMenu.toString() + " successfully registered.");
+
+ }
+
+ };
+
+
+ /**
+ * @method removeMenu
+ * @description Removes a menu from the collection of known menus.
+ * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance
+ * to be removed.
+ */
+ this.removeMenu = function(p_oMenu) {
+
+ if(p_oMenu && m_oMenus[p_oMenu.id]) {
+
+ delete m_oMenus[p_oMenu.id];
+
+ m_oLogger.log("Menu: " +
+ p_oMenu.toString() + " successfully unregistered.");
+
+ }
+
+ };
+
+
+ /**
+ * @method hideVisible
+ * @description Hides all visible, dynamically positioned menus.
+ */
+ this.hideVisible = function() {
+
+ var oMenu;
+
+ for(var i in m_oVisibleMenus) {
+
+ if(m_oVisibleMenus.hasOwnProperty(i)) {
+
+ oMenu = m_oVisibleMenus[i];
+
+ if(oMenu.cfg.getProperty("position") == "dynamic") {
+
+ oMenu.hide();
+
+ }
+
+ }
+
+ }
+
+ };
+
+
+ /**
+ * @method getMenus
+ * @description Returns an array of all menus registered with the
+ * menu manger.
+ * @return {Array}
+ */
+ this.getMenus = function() {
+
+ return m_oMenus;
+
+ };
+
+
+ /**
+ * @method getMenu
+ * @description Returns a menu with the specified id.
+ * @param {String} p_sId String specifying the id of the menu to
+ * be retrieved.
+ * @return {YAHOO.widget.Menu}
+ */
+ this.getMenu = function(p_sId) {
+
+ if(m_oMenus[p_sId]) {
+
+ return m_oMenus[p_sId];
+
+ }
+
+ };
+
+
+ /**
+ * @method toString
+ * @description Returns a string representing the menu manager.
+ * @return {String}
+ */
+ this.toString = function() {
+
+ return ("MenuManager");
+
+ };
+
+};
+
+})();
+
+
+(function() {
+
+var Dom = YAHOO.util.Dom;
+var Event = YAHOO.util.Event;
+
+
+/**
+* The Menu class creates a container that holds a vertical list representing
+* a set of options or commands. Menu is the base class for all
+* menu containers.
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the menu.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source
+* for the menu.
+* @param {HTMLDivElement } p_oElement Object
+* specifying the <div> element of the menu.
+* @param {HTMLSelectElement } p_oElement
+* Object specifying the <select> element to be used as
+* the data source for the menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu. See configuration class documentation for
+* more details.
+* @namespace YAHOO.widget
+* @class Menu
+* @constructor
+* @extends YAHOO.widget.Overlay
+*/
+YAHOO.widget.Menu = function(p_oElement, p_oConfig) {
+
+ if(p_oConfig) {
+
+ this.parent = p_oConfig.parent;
+
+ this.lazyLoad = p_oConfig.lazyLoad || p_oConfig.lazyload;
+
+ this.itemData = p_oConfig.itemData || p_oConfig.itemdata;
+
+ }
+
+
+ YAHOO.widget.Menu.superclass.constructor.call(
+ this,
+ p_oElement,
+ p_oConfig
+ );
+
+};
+
+YAHOO.extend(YAHOO.widget.Menu, YAHOO.widget.Overlay, {
+
+
+
+// Constants
+
+
+/**
+* @property CSS_CLASS_NAME
+* @description String representing the CSS class(es) to be applied to the
+* menu's <div> element.
+* @default "yuimenu"
+* @final
+* @type String
+*/
+CSS_CLASS_NAME: "yuimenu",
+
+
+/**
+* @property ITEM_TYPE
+* @description Object representing the type of menu item to instantiate and
+* add when parsing the child nodes (either <li> element,
+* <optgroup> element or <option>)
+* of the menu's source HTML element.
+* @default YAHOO.widget.MenuItem
+* @final
+* @type YAHOO.widget.MenuItem
+*/
+ITEM_TYPE: null,
+
+
+/**
+* @property GROUP_TITLE_TAG_NAME
+* @description String representing the tagname of the HTML element used to
+* title the menu's item groups.
+* @default H6
+* @final
+* @type String
+*/
+GROUP_TITLE_TAG_NAME: "h6",
+
+
+
+// Private properties
+
+
+/**
+* @property _nHideDelayId
+* @description Number representing the time-out setting used to cancel the
+* hiding of a menu.
+* @default null
+* @private
+* @type Number
+*/
+_nHideDelayId: null,
+
+
+/**
+* @property _nShowDelayId
+* @description Number representing the time-out setting used to cancel the
+* showing of a menu.
+* @default null
+* @private
+* @type Number
+*/
+_nShowDelayId: null,
+
+
+/**
+* @property _hideDelayEventHandlersAssigned
+* @description Boolean indicating if the "mouseover" and "mouseout" event
+* handlers used for hiding the menu via a call to "window.setTimeout" have
+* already been assigned.
+* @default false
+* @private
+* @type Boolean
+*/
+_hideDelayEventHandlersAssigned: false,
+
+
+/**
+* @property _bHandledMouseOverEvent
+* @description Boolean indicating the current state of the menu's
+* "mouseover" event.
+* @default false
+* @private
+* @type Boolean
+*/
+_bHandledMouseOverEvent: false,
+
+
+/**
+* @property _bHandledMouseOutEvent
+* @description Boolean indicating the current state of the menu's
+* "mouseout" event.
+* @default false
+* @private
+* @type Boolean
+*/
+_bHandledMouseOutEvent: false,
+
+
+/**
+* @property _aGroupTitleElements
+* @description Array of HTML element used to title groups of menu items.
+* @default []
+* @private
+* @type Array
+*/
+_aGroupTitleElements: null,
+
+
+/**
+* @property _aItemGroups
+* @description Array of menu items.
+* @default []
+* @private
+* @type Array
+*/
+_aItemGroups: null,
+
+
+/**
+* @property _aListElements
+* @description Array of <ul> elements, each of which is
+* the parent node for each item's <li> element.
+* @default []
+* @private
+* @type Array
+*/
+_aListElements: null,
+
+
+
+// Public properties
+
+
+/**
+* @property lazyLoad
+* @description Boolean indicating if the menu's "lazy load" feature is
+* enabled. If set to "true," initialization and rendering of the menu's
+* items will be deferred until the first time it is made visible. This
+* property should be set via the constructor using the configuration
+* object literal.
+* @default false
+* @type Boolean
+*/
+lazyLoad: false,
+
+
+/**
+* @property itemData
+* @description Array of items to be added to the menu. The array can contain
+* strings representing the text for each item to be created, object literals
+* representing the menu item configuration properties, or MenuItem instances.
+* This property should be set via the constructor using the configuration
+* object literal.
+* @default null
+* @type Array
+*/
+itemData: null,
+
+
+/**
+* @property activeItem
+* @description Object reference to the item in the menu that has focus.
+* @default null
+* @type YAHOO.widget.MenuItem
+*/
+activeItem: null,
+
+
+/**
+* @property parent
+* @description Object reference to the menu's parent menu or menu item.
+* This property can be set via the constructor using the configuration
+* object literal.
+* @default null
+* @type YAHOO.widget.MenuItem
+*/
+parent: null,
+
+
+/**
+* @property srcElement
+* @description Object reference to the HTML element (either
+* <select> or <div>) used to
+* create the menu.
+* @default null
+* @type HTMLSelectElement |HTMLDivElement
+*/
+srcElement: null,
+
+
+
+// Events
+
+
+/**
+* @event mouseOverEvent
+* @description Fires when the mouse has entered the menu. Passes back
+* the DOM Event object as an argument.
+*/
+mouseOverEvent: null,
+
+
+/**
+* @event mouseOutEvent
+* @description Fires when the mouse has left the menu. Passes back the DOM
+* Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+mouseOutEvent: null,
+
+
+/**
+* @event mouseDownEvent
+* @description Fires when the user mouses down on the menu. Passes back the
+* DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+mouseDownEvent: null,
+
+
+/**
+* @event mouseUpEvent
+* @description Fires when the user releases a mouse button while the mouse is
+* over the menu. Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+mouseUpEvent: null,
+
+
+/**
+* @event clickEvent
+* @description Fires when the user clicks the on the menu. Passes back the
+* DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+clickEvent: null,
+
+
+/**
+* @event keyPressEvent
+* @description Fires when the user presses an alphanumeric key when one of the
+* menu's items has focus. Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+keyPressEvent: null,
+
+
+/**
+* @event keyDownEvent
+* @description Fires when the user presses a key when one of the menu's items
+* has focus. Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+keyDownEvent: null,
+
+
+/**
+* @event keyUpEvent
+* @description Fires when the user releases a key when one of the menu's items
+* has focus. Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+keyUpEvent: null,
+
+
+/**
+* @event itemAddedEvent
+* @description Fires when an item is added to the menu.
+* @type YAHOO.util.CustomEvent
+*/
+itemAddedEvent: null,
+
+
+/**
+* @event itemRemovedEvent
+* @description Fires when an item is removed to the menu.
+* @type YAHOO.util.CustomEvent
+*/
+itemRemovedEvent: null,
+
+
+/**
+* @method init
+* @description The Menu class's initialization method. This method is
+* automatically called by the constructor, and sets up all DOM references
+* for pre-existing markup, and creates required markup if it is not
+* already present.
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the menu.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source
+* for the menu.
+* @param {HTMLDivElement } p_oElement Object
+* specifying the <div> element of the menu.
+* @param {HTMLSelectElement } p_oElement
+* Object specifying the <select> element to be used as
+* the data source for the menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu. See configuration class documentation for
+* more details.
+*/
+init: function(p_oElement, p_oConfig) {
+
+ this._aItemGroups = [];
+ this._aListElements = [];
+ this._aGroupTitleElements = [];
+
+
+ if(!this.ITEM_TYPE) {
+
+ this.ITEM_TYPE = YAHOO.widget.MenuItem;
+
+ }
+
+
+ var oElement;
+
+ if(typeof p_oElement == "string") {
+
+ oElement = document.getElementById(p_oElement);
+
+ }
+ else if(p_oElement.tagName) {
+
+ oElement = p_oElement;
+
+ }
+
+
+ if(oElement && oElement.tagName) {
+
+ switch(oElement.tagName.toUpperCase()) {
+
+ case "DIV":
+
+ this.srcElement = oElement;
+
+ if(!oElement.id) {
+
+ oElement.setAttribute("id", Dom.generateId());
+
+ }
+
+
+ /*
+ Note: we don't pass the user config in here yet
+ because we only want it executed once, at the lowest
+ subclass level.
+ */
+
+ YAHOO.widget.Menu.superclass.init.call(this, oElement);
+
+ this.beforeInitEvent.fire(YAHOO.widget.Menu);
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+
+ this.logger.log("Source element: " + this.srcElement.tagName);
+
+ break;
+
+ case "SELECT":
+
+ this.srcElement = oElement;
+
+
+ /*
+ The source element is not something that we can use
+ outright, so we need to create a new Overlay
+
+ Note: we don't pass the user config in here yet
+ because we only want it executed once, at the lowest
+ subclass level.
+ */
+
+ YAHOO.widget.Menu.superclass.init.call(this, Dom.generateId());
+
+ this.beforeInitEvent.fire(YAHOO.widget.Menu);
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+
+ this.logger.log("Source element: " + this.srcElement.tagName);
+
+ break;
+
+ }
+
+ }
+ else {
+
+ /*
+ Note: we don't pass the user config in here yet
+ because we only want it executed once, at the lowest
+ subclass level.
+ */
+
+ YAHOO.widget.Menu.superclass.init.call(this, p_oElement);
+
+ this.beforeInitEvent.fire(YAHOO.widget.Menu);
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+
+ this.logger.log("No source element found. " +
+ "Created element with id: " + this.id);
+
+ }
+
+
+ if(this.element) {
+
+ var oEl = this.element;
+
+ Dom.addClass(oEl, this.CSS_CLASS_NAME);
+
+
+ // Subscribe to Custom Events
+
+ this.initEvent.subscribe(this._onInit, this, true);
+ this.beforeRenderEvent.subscribe(this._onBeforeRender, this, true);
+ this.renderEvent.subscribe(this._onRender, this, true);
+ this.beforeShowEvent.subscribe(this._onBeforeShow, this, true);
+ this.showEvent.subscribe(this._onShow, this, true);
+ this.beforeHideEvent.subscribe(this._onBeforeHide, this, true);
+ this.mouseOverEvent.subscribe(this._onMouseOver, this, true);
+ this.mouseOutEvent.subscribe(this._onMouseOut, this, true);
+ this.clickEvent.subscribe(this._onClick, this, true);
+ this.keyDownEvent.subscribe(this._onKeyDown, this, true);
+
+
+ if(p_oConfig) {
+
+ this.cfg.applyConfig(p_oConfig, true);
+
+ }
+
+
+ // Register the Menu instance with the MenuManager
+
+ YAHOO.widget.MenuManager.addMenu(this);
+
+
+ this.initEvent.fire(YAHOO.widget.Menu);
+
+ }
+
+},
+
+
+
+// Private methods
+
+
+/**
+* @method _initSubTree
+* @description Iterates the childNodes of the source element to find nodes
+* used to instantiate menu and menu items.
+* @private
+*/
+_initSubTree: function() {
+
+ var oNode;
+
+ if(this.srcElement.tagName == "DIV") {
+
+ /*
+ Populate the collection of item groups and item
+ group titles
+ */
+
+ oNode = this.body.firstChild;
+
+ var nGroup = 0;
+ var sGroupTitleTagName = this.GROUP_TITLE_TAG_NAME.toUpperCase();
+
+ do {
+
+ if(oNode && oNode.tagName) {
+
+ switch(oNode.tagName.toUpperCase()) {
+
+ case sGroupTitleTagName:
+
+ this._aGroupTitleElements[nGroup] = oNode;
+
+ break;
+
+ case "UL":
+
+ this._aListElements[nGroup] = oNode;
+ this._aItemGroups[nGroup] = [];
+ nGroup++;
+
+ break;
+
+ }
+
+ }
+
+ }
+ while((oNode = oNode.nextSibling));
+
+
+ /*
+ Apply the "first-of-type" class to the first UL to mimic
+ the "first-of-type" CSS3 psuedo class.
+ */
+
+ if(this._aListElements[0]) {
+
+ Dom.addClass(this._aListElements[0], "first-of-type");
+
+ }
+
+ }
+
+
+ oNode = null;
+
+ this.logger.log("Searching DOM for items to initialize.");
+
+ if(this.srcElement.tagName) {
+
+ switch(this.srcElement.tagName.toUpperCase()) {
+
+ case "DIV":
+
+ if(this._aListElements.length > 0) {
+
+ this.logger.log("Found " +
+ this._aListElements.length +
+ " item groups to initialize.");
+
+ var i = this._aListElements.length - 1;
+
+ do {
+
+ oNode = this._aListElements[i].firstChild;
+
+ this.logger.log("Scanning " +
+ this._aListElements[i].childNodes.length +
+ " child nodes for items to initialize.");
+
+ do {
+
+ if(oNode && oNode.tagName) {
+
+ switch(oNode.tagName.toUpperCase()) {
+
+ case "LI":
+
+ this.logger.log("Initializing " +
+ oNode.tagName + " node.");
+
+ this.addItem(
+ new this.ITEM_TYPE(
+ oNode,
+ { parent: this }
+ ),
+ i
+ );
+
+ break;
+
+ }
+
+ }
+
+ }
+ while((oNode = oNode.nextSibling));
+
+ }
+ while(i--);
+
+ }
+
+ break;
+
+ case "SELECT":
+
+ this.logger.log("Scanning " +
+ this.srcElement.childNodes.length +
+ " child nodes for items to initialize.");
+
+ oNode = this.srcElement.firstChild;
+
+ do {
+
+ if(oNode && oNode.tagName) {
+
+ switch(oNode.tagName.toUpperCase()) {
+
+ case "OPTGROUP":
+ case "OPTION":
+
+ this.logger.log("Initializing " +
+ oNode.tagName + " node.");
+
+ this.addItem(
+ new this.ITEM_TYPE(
+ oNode,
+ { parent: this }
+ )
+ );
+
+ break;
+
+ }
+
+ }
+
+ }
+ while((oNode = oNode.nextSibling));
+
+ break;
+
+ }
+
+ }
+
+},
+
+
+/**
+* @method _getFirstEnabledItem
+* @description Returns the first enabled item in the menu.
+* @return {YAHOO.widget.MenuItem}
+* @private
+*/
+_getFirstEnabledItem: function() {
+
+ var nGroups = this._aItemGroups.length;
+ var oItem;
+ var aItemGroup;
+
+ for(var i=0; i= aGroup.length);
+
+
+ if(aGroup[p_nItemIndex]) {
+
+ aGroup.splice(p_nItemIndex, 0, oItem);
+
+ }
+ else {
+
+ aGroup[p_nItemIndex] = oItem;
+
+ }
+
+
+ oGroupItem = aGroup[p_nItemIndex];
+
+ if(oGroupItem) {
+
+ if(
+ bAppend &&
+ (
+ !oGroupItem.element.parentNode ||
+ oGroupItem.element.parentNode.nodeType == 11
+ )
+ ) {
+
+ this._aListElements[nGroupIndex].appendChild(
+ oGroupItem.element
+ );
+
+ }
+ else {
+
+
+ /**
+ * Returns the next sibling of an item in an array.
+ * @private
+ * @param {p_aArray} Array to search.
+ * @param {p_nStartIndex} Number indicating the index to
+ * start searching the array.
+ * @return {Object}
+ */
+ var getNextItemSibling =
+
+ function(p_aArray, p_nStartIndex) {
+
+ return (
+ p_aArray[p_nStartIndex] ||
+ getNextItemSibling(
+ p_aArray,
+ (p_nStartIndex+1)
+ )
+ );
+
+ };
+
+
+ var oNextItemSibling =
+ getNextItemSibling(aGroup, (p_nItemIndex+1));
+
+ if(
+ oNextItemSibling &&
+ (
+ !oGroupItem.element.parentNode ||
+ oGroupItem.element.parentNode.nodeType == 11
+ )
+ ) {
+
+ this._aListElements[nGroupIndex].insertBefore(
+ oGroupItem.element,
+ oNextItemSibling.element
+ );
+
+ }
+
+ }
+
+
+ oGroupItem.parent = this;
+
+ this._subscribeToItemEvents(oGroupItem);
+
+ this._configureSubmenu(oGroupItem);
+
+ this._updateItemProperties(nGroupIndex);
+
+ this.logger.log("Item inserted." +
+ " Text: " + oGroupItem.cfg.getProperty("text") + ", " +
+ " Index: " + oGroupItem.index + ", " +
+ " Group Index: " + oGroupItem.groupIndex);
+
+ this.itemAddedEvent.fire(oGroupItem);
+
+ return oGroupItem;
+
+ }
+
+ }
+ else {
+
+ var nItemIndex = aGroup.length;
+
+ aGroup[nItemIndex] = oItem;
+
+ oGroupItem = aGroup[nItemIndex];
+
+
+ if(oGroupItem) {
+
+ if(
+ !Dom.isAncestor(
+ this._aListElements[nGroupIndex],
+ oGroupItem.element
+ )
+ ) {
+
+ this._aListElements[nGroupIndex].appendChild(
+ oGroupItem.element
+ );
+
+ }
+
+ oGroupItem.element.setAttribute("groupindex", nGroupIndex);
+ oGroupItem.element.setAttribute("index", nItemIndex);
+
+ oGroupItem.parent = this;
+
+ oGroupItem.index = nItemIndex;
+ oGroupItem.groupIndex = nGroupIndex;
+
+ this._subscribeToItemEvents(oGroupItem);
+
+ this._configureSubmenu(oGroupItem);
+
+ if(nItemIndex === 0) {
+
+ Dom.addClass(oGroupItem.element, "first-of-type");
+
+ }
+
+ this.logger.log("Item added." +
+ " Text: " + oGroupItem.cfg.getProperty("text") + ", " +
+ " Index: " + oGroupItem.index + ", " +
+ " Group Index: " + oGroupItem.groupIndex);
+
+
+ this.itemAddedEvent.fire(oGroupItem);
+
+ return oGroupItem;
+
+ }
+
+ }
+
+ }
+
+},
+
+
+/**
+* @method _removeItemFromGroupByIndex
+* @description Removes a menu item from a group by index. Returns the menu
+* item that was removed.
+* @private
+* @param {Number} p_nGroupIndex Number indicating the group to which the menu
+* item belongs.
+* @param {Number} p_nItemIndex Number indicating the index of the menu item
+* to be removed.
+* @return {YAHOO.widget.MenuItem}
+*/
+_removeItemFromGroupByIndex: function(p_nGroupIndex, p_nItemIndex) {
+
+ var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;
+ var aGroup = this._getItemGroup(nGroupIndex);
+
+ if(aGroup) {
+
+ var aArray = aGroup.splice(p_nItemIndex, 1);
+ var oItem = aArray[0];
+
+ if(oItem) {
+
+ // Update the index and className properties of each member
+
+ this._updateItemProperties(nGroupIndex);
+
+ if(aGroup.length === 0) {
+
+ // Remove the UL
+
+ var oUL = this._aListElements[nGroupIndex];
+
+ if(this.body && oUL) {
+
+ this.body.removeChild(oUL);
+
+ }
+
+ // Remove the group from the array of items
+
+ this._aItemGroups.splice(nGroupIndex, 1);
+
+
+ // Remove the UL from the array of ULs
+
+ this._aListElements.splice(nGroupIndex, 1);
+
+
+ /*
+ Assign the "first-of-type" class to the new first UL
+ in the collection
+ */
+
+ oUL = this._aListElements[0];
+
+ if(oUL) {
+
+ Dom.addClass(oUL, "first-of-type");
+
+ }
+
+ }
+
+
+ this.itemRemovedEvent.fire(oItem);
+
+
+ // Return a reference to the item that was removed
+
+ return oItem;
+
+ }
+
+ }
+
+},
+
+
+/**
+* @method _removeItemFromGroupByValue
+* @description Removes a menu item from a group by reference. Returns the
+* menu item that was removed.
+* @private
+* @param {Number} p_nGroupIndex Number indicating the group to which the
+* menu item belongs.
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
+* instance to be removed.
+* @return {YAHOO.widget.MenuItem}
+*/
+_removeItemFromGroupByValue: function(p_nGroupIndex, p_oItem) {
+
+ var aGroup = this._getItemGroup(p_nGroupIndex);
+
+ if(aGroup) {
+
+ var nItems = aGroup.length;
+ var nItemIndex = -1;
+
+ if(nItems > 0) {
+
+ var i = nItems-1;
+
+ do {
+
+ if(aGroup[i] == p_oItem) {
+
+ nItemIndex = i;
+ break;
+
+ }
+
+ }
+ while(i--);
+
+ if(nItemIndex > -1) {
+
+ return this._removeItemFromGroupByIndex(
+ p_nGroupIndex,
+ nItemIndex
+ );
+
+ }
+
+ }
+
+ }
+
+},
+
+
+/**
+* @method _updateItemProperties
+* @description Updates the "index," "groupindex," and "className" properties
+* of the menu items in the specified group.
+* @private
+* @param {Number} p_nGroupIndex Number indicating the group of items to update.
+*/
+_updateItemProperties: function(p_nGroupIndex) {
+
+ var aGroup = this._getItemGroup(p_nGroupIndex);
+ var nItems = aGroup.length;
+
+ if(nItems > 0) {
+
+ var i = nItems - 1;
+ var oItem;
+ var oLI;
+
+ // Update the index and className properties of each member
+
+ do {
+
+ oItem = aGroup[i];
+
+ if(oItem) {
+
+ oLI = oItem.element;
+
+ oItem.index = i;
+ oItem.groupIndex = p_nGroupIndex;
+
+ oLI.setAttribute("groupindex", p_nGroupIndex);
+ oLI.setAttribute("index", i);
+
+ Dom.removeClass(oLI, "first-of-type");
+
+ }
+
+ }
+ while(i--);
+
+
+ if(oLI) {
+
+ Dom.addClass(oLI, "first-of-type");
+
+ }
+
+ }
+
+},
+
+
+/**
+* @method _createItemGroup
+* @description Creates a new menu item group (array) and its associated
+* <ul> element. Returns an aray of menu item groups.
+* @private
+* @param {Number} p_nIndex Number indicating the group to create.
+* @return {Array}
+*/
+_createItemGroup: function(p_nIndex) {
+
+ if(!this._aItemGroups[p_nIndex]) {
+
+ this._aItemGroups[p_nIndex] = [];
+
+ var oUL = document.createElement("ul");
+
+ this._aListElements[p_nIndex] = oUL;
+
+ return this._aItemGroups[p_nIndex];
+
+ }
+
+},
+
+
+/**
+* @method _getItemGroup
+* @description Returns the menu item group at the specified index.
+* @private
+* @param {Number} p_nIndex Number indicating the index of the menu item group
+* to be retrieved.
+* @return {Array}
+*/
+_getItemGroup: function(p_nIndex) {
+
+ var nIndex = ((typeof p_nIndex == "number") ? p_nIndex : 0);
+
+ return this._aItemGroups[nIndex];
+
+},
+
+
+/**
+* @method _configureSubmenu
+* @description Subscribes the menu item's submenu to its parent menu's events.
+* @private
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
+* instance with the submenu to be configured.
+*/
+_configureSubmenu: function(p_oItem) {
+
+ var oSubmenu = p_oItem.cfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ /*
+ Listen for configuration changes to the parent menu
+ so they they can be applied to the submenu.
+ */
+
+ this.cfg.configChangedEvent.subscribe(
+ this._onParentMenuConfigChange,
+ oSubmenu,
+ true
+ );
+
+ this.renderEvent.subscribe(
+ this._onParentMenuRender,
+ oSubmenu,
+ true
+ );
+
+ oSubmenu.beforeShowEvent.subscribe(
+ this._onSubmenuBeforeShow,
+ oSubmenu,
+ true
+ );
+
+ oSubmenu.showEvent.subscribe(
+ this._onSubmenuShow,
+ oSubmenu,
+ true
+ );
+
+ oSubmenu.hideEvent.subscribe(
+ this._onSubmenuHide,
+ oSubmenu,
+ true
+ );
+
+ }
+
+},
+
+
+/**
+* @method _subscribeToItemEvents
+* @description Subscribes a menu to a menu item's event.
+* @private
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
+* instance whose events should be subscribed to.
+*/
+_subscribeToItemEvents: function(p_oItem) {
+
+ p_oItem.focusEvent.subscribe(this._onMenuItemFocus, p_oItem, this);
+
+ p_oItem.blurEvent.subscribe(this._onMenuItemBlur, this, true);
+
+ p_oItem.cfg.configChangedEvent.subscribe(
+ this._onMenuItemConfigChange,
+ p_oItem,
+ this
+ );
+
+},
+
+
+/**
+* @method _getOffsetWidth
+* @description Returns the offset width of the menu's
+* <div> element.
+* @private
+*/
+_getOffsetWidth: function() {
+
+ var oClone = this.element.cloneNode(true);
+
+ Dom.setStyle(oClone, "width", "");
+
+ document.body.appendChild(oClone);
+
+ var sWidth = oClone.offsetWidth;
+
+ document.body.removeChild(oClone);
+
+ return sWidth;
+
+},
+
+
+/**
+* @method _cancelHideDelay
+* @description Cancels the call to "hideMenu."
+* @private
+*/
+_cancelHideDelay: function() {
+
+ var oRoot = this.getRoot();
+
+ if(oRoot._nHideDelayId) {
+
+ window.clearTimeout(oRoot._nHideDelayId);
+
+ }
+
+},
+
+
+/**
+* @method _execHideDelay
+* @description Hides the menu after the number of milliseconds specified by
+* the "hidedelay" configuration property.
+* @private
+*/
+_execHideDelay: function() {
+
+ this._cancelHideDelay();
+
+ var oRoot = this.getRoot();
+ var me = this;
+
+ var hideMenu = function() {
+
+ if(oRoot.activeItem) {
+
+ oRoot.clearActiveItem();
+
+ }
+
+ if(oRoot == me && me.cfg.getProperty("position") == "dynamic") {
+
+ me.hide();
+
+ }
+
+ };
+
+
+ oRoot._nHideDelayId =
+ window.setTimeout(hideMenu, oRoot.cfg.getProperty("hidedelay"));
+
+},
+
+
+/**
+* @method _cancelShowDelay
+* @description Cancels the call to the "showMenu."
+* @private
+*/
+_cancelShowDelay: function() {
+
+ var oRoot = this.getRoot();
+
+ if(oRoot._nShowDelayId) {
+
+ window.clearTimeout(oRoot._nShowDelayId);
+
+ }
+
+},
+
+
+/**
+* @method _execShowDelay
+* @description Shows the menu after the number of milliseconds specified by
+* the "showdelay" configuration property have ellapsed.
+* @private
+* @param {YAHOO.widget.Menu} p_oMenu Object specifying the menu that should
+* be made visible.
+*/
+_execShowDelay: function(p_oMenu) {
+
+ this._cancelShowDelay();
+
+ var oRoot = this.getRoot();
+
+ var showMenu = function() {
+
+ p_oMenu.show();
+
+ };
+
+
+ oRoot._nShowDelayId =
+ window.setTimeout(showMenu, oRoot.cfg.getProperty("showdelay"));
+
+},
+
+
+
+// Protected methods
+
+
+/**
+* @method _onMouseOver
+* @description "mouseover" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onMouseOver: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oEvent = p_aArgs[0];
+ var oItem = p_aArgs[1];
+ var oTarget = Event.getTarget(oEvent);
+
+ if(
+ !this._bHandledMouseOverEvent &&
+ (oTarget == this.element || Dom.isAncestor(this.element, oTarget))
+ ) {
+
+ // MENU MOUSEOVER LOGIC HERE
+
+ this.clearActiveItem();
+
+ this._bHandledMouseOverEvent = true;
+ this._bHandledMouseOutEvent = false;
+
+ }
+
+
+ if(
+ oItem && !oItem.handledMouseOverEvent &&
+ (oTarget == oItem.element || Dom.isAncestor(oItem.element, oTarget))
+ ) {
+
+ var oItemCfg = oItem.cfg;
+
+ // Select and focus the current menu item
+
+ oItemCfg.setProperty("selected", true);
+ oItem.focus();
+
+
+ if(this.cfg.getProperty("autosubmenudisplay")) {
+
+ // Show the submenu this menu item
+
+ var oSubmenu = oItemCfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ if(this.cfg.getProperty("showdelay") > 0) {
+
+ this._execShowDelay(oSubmenu);
+
+ }
+ else {
+
+ oSubmenu.show();
+
+ }
+
+ }
+
+ }
+
+ oItem.handledMouseOverEvent = true;
+ oItem.handledMouseOutEvent = false;
+
+ }
+
+},
+
+
+/**
+* @method _onMouseOut
+* @description "mouseout" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onMouseOut: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oEvent = p_aArgs[0];
+ var oItem = p_aArgs[1];
+ var oRelatedTarget = Event.getRelatedTarget(oEvent);
+ var bMovingToSubmenu = false;
+
+ if(oItem) {
+
+ var oItemCfg = oItem.cfg;
+ var oSubmenu = oItemCfg.getProperty("submenu");
+
+
+ if(
+ oSubmenu &&
+ (
+ oRelatedTarget == oSubmenu.element ||
+ Dom.isAncestor(oSubmenu.element, oRelatedTarget)
+ )
+ ) {
+
+ bMovingToSubmenu = true;
+
+ }
+
+
+ if(
+ !oItem.handledMouseOutEvent &&
+ (
+ (
+ oRelatedTarget != oItem.element &&
+ !Dom.isAncestor(oItem.element, oRelatedTarget)
+ ) || bMovingToSubmenu
+ )
+ ) {
+
+
+ if(this.cfg.getProperty("showdelay") > 0) {
+
+ this._cancelShowDelay();
+
+ }
+
+
+ if(!bMovingToSubmenu) {
+
+ oItemCfg.setProperty("selected", false);
+
+ }
+
+
+ if(this.cfg.getProperty("autosubmenudisplay")) {
+
+ if(oSubmenu) {
+
+ if(
+ !(
+ oRelatedTarget == oSubmenu.element ||
+ YAHOO.util.Dom.isAncestor(
+ oSubmenu.element,
+ oRelatedTarget
+ )
+ )
+ ) {
+
+ oSubmenu.hide();
+
+ }
+
+ }
+
+ }
+
+ oItem.handledMouseOutEvent = true;
+ oItem.handledMouseOverEvent = false;
+
+ }
+
+ }
+
+
+ if(
+ !this._bHandledMouseOutEvent &&
+ (
+ (
+ oRelatedTarget != this.element &&
+ !Dom.isAncestor(this.element, oRelatedTarget)
+ )
+ || bMovingToSubmenu
+ )
+ ) {
+
+ this._bHandledMouseOutEvent = true;
+ this._bHandledMouseOverEvent = false;
+
+ }
+
+},
+
+
+/**
+* @method _onClick
+* @description "click" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onClick: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oEvent = p_aArgs[0];
+ var oItem = p_aArgs[1];
+ var oTarget = Event.getTarget(oEvent);
+
+ if(oItem) {
+
+ var oItemCfg = oItem.cfg;
+ var oSubmenu = oItemCfg.getProperty("submenu");
+
+
+ /*
+ ACCESSIBILITY FEATURE FOR SCREEN READERS:
+ Expand/collapse the submenu when the user clicks
+ on the submenu indicator image.
+ */
+
+ if(oTarget == oItem.submenuIndicator && oSubmenu) {
+
+ if(oSubmenu.cfg.getProperty("visible")) {
+
+ oSubmenu.hide();
+
+ }
+ else {
+
+ this.clearActiveItem();
+
+ this.activeItem = oItem;
+
+ oItem.cfg.setProperty("selected", true);
+
+ oSubmenu.show();
+
+ }
+
+ }
+ else {
+
+ var sURL = oItemCfg.getProperty("url");
+ var bCurrentPageURL = (sURL.substr((sURL.length-1),1) == "#");
+ var sTarget = oItemCfg.getProperty("target");
+ var bHasTarget = (sTarget && sTarget.length > 0);
+
+ /*
+ Prevent the browser from following links
+ equal to "#"
+ */
+
+ if(
+ oTarget.tagName.toUpperCase() == "A" &&
+ bCurrentPageURL && !bHasTarget
+ ) {
+
+ Event.preventDefault(oEvent);
+
+ }
+
+ if(
+ oTarget.tagName.toUpperCase() != "A" &&
+ !bCurrentPageURL && !bHasTarget
+ ) {
+
+ /*
+ Follow the URL of the item regardless of
+ whether or not the user clicked specifically
+ on the anchor element.
+ */
+
+ document.location = sURL;
+
+ }
+
+
+ /*
+ If the item doesn't navigate to a URL and it doesn't have
+ a submenu, then collapse the menu tree.
+ */
+
+ if(bCurrentPageURL && !oSubmenu) {
+
+ var oRoot = this.getRoot();
+
+ if(oRoot.cfg.getProperty("position") == "static") {
+
+ oRoot.clearActiveItem();
+
+ }
+ else {
+
+ oRoot.hide();
+
+ }
+
+ }
+
+ }
+
+ }
+
+},
+
+
+/**
+* @method _onKeyDown
+* @description "keydown" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onKeyDown: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oEvent = p_aArgs[0];
+ var oItem = p_aArgs[1];
+ var oSubmenu;
+
+ if(oItem) {
+
+ var oItemCfg = oItem.cfg;
+ var oParentItem = this.parent;
+ var oRoot;
+ var oNextItem;
+
+
+ switch(oEvent.keyCode) {
+
+ case 38: // Up arrow
+ case 40: // Down arrow
+
+ if(
+ oItem == this.activeItem &&
+ !oItemCfg.getProperty("selected")
+ ) {
+
+ oItemCfg.setProperty("selected", true);
+
+ }
+ else {
+
+ oNextItem = (oEvent.keyCode == 38) ?
+ oItem.getPreviousEnabledSibling() :
+ oItem.getNextEnabledSibling();
+
+ if(oNextItem) {
+
+ this.clearActiveItem();
+
+ oNextItem.cfg.setProperty("selected", true);
+ oNextItem.focus();
+
+ }
+
+ }
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+
+ case 39: // Right arrow
+
+ oSubmenu = oItemCfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ if(!oItemCfg.getProperty("selected")) {
+
+ oItemCfg.setProperty("selected", true);
+
+ }
+
+ oSubmenu.show();
+
+ oSubmenu.setInitialSelection();
+
+ }
+ else {
+
+ oRoot = this.getRoot();
+
+ if(oRoot instanceof YAHOO.widget.MenuBar) {
+
+ oNextItem = oRoot.activeItem.getNextEnabledSibling();
+
+ if(oNextItem) {
+
+ oRoot.clearActiveItem();
+
+ oNextItem.cfg.setProperty("selected", true);
+
+ oSubmenu = oNextItem.cfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ oSubmenu.show();
+
+ }
+
+ oNextItem.focus();
+
+ }
+
+ }
+
+ }
+
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+
+ case 37: // Left arrow
+
+ if(oParentItem) {
+
+ var oParentMenu = oParentItem.parent;
+
+ if(oParentMenu instanceof YAHOO.widget.MenuBar) {
+
+ oNextItem =
+ oParentMenu.activeItem.getPreviousEnabledSibling();
+
+ if(oNextItem) {
+
+ oParentMenu.clearActiveItem();
+
+ oNextItem.cfg.setProperty("selected", true);
+
+ oSubmenu = oNextItem.cfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ oSubmenu.show();
+
+ }
+
+ oNextItem.focus();
+
+ }
+
+ }
+ else {
+
+ this.hide();
+
+ oParentItem.focus();
+
+ }
+
+ }
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+ }
+
+
+ }
+
+
+ if(oEvent.keyCode == 27) { // Esc key
+
+ if(this.cfg.getProperty("position") == "dynamic") {
+
+ this.hide();
+
+ if(this.parent) {
+
+ this.parent.focus();
+
+ }
+
+ }
+ else if(this.activeItem) {
+
+ oSubmenu = this.activeItem.cfg.getProperty("submenu");
+
+ if(oSubmenu && oSubmenu.cfg.getProperty("visible")) {
+
+ oSubmenu.hide();
+ this.activeItem.focus();
+
+ }
+ else {
+
+ this.activeItem.cfg.setProperty("selected", false);
+ this.activeItem.blur();
+
+ }
+
+ }
+
+
+ Event.preventDefault(oEvent);
+
+ }
+
+},
+
+
+
+// Private methods
+
+
+/**
+* @method _onInit
+* @description "init" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onInit: function(p_sType, p_aArgs, p_oMenu) {
+
+ if(
+ (
+ (this.parent && !this.lazyLoad) ||
+ (!this.parent && this.cfg.getProperty("position") == "static") ||
+ (
+ !this.parent &&
+ !this.lazyLoad &&
+ this.cfg.getProperty("position") == "dynamic"
+ )
+ ) &&
+ this.getItemGroups().length === 0
+ ) {
+
+ if(this.srcElement) {
+
+ this._initSubTree();
+
+ }
+
+
+ if(this.itemData) {
+
+ this.addItems(this.itemData);
+
+ }
+
+ }
+ else if(this.lazyLoad) {
+
+ this.cfg.fireQueue();
+
+ }
+
+},
+
+
+/**
+* @method _onBeforeRender
+* @description "beforerender" event handler for the menu. Appends all of the
+* <ul>, <li> and their accompanying
+* title elements to the body element of the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onBeforeRender: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oConfig = this.cfg;
+ var oEl = this.element;
+ var nListElements = this._aListElements.length;
+
+
+ if(nListElements > 0) {
+
+ var i = 0;
+ var bFirstList = true;
+ var oUL;
+ var oGroupTitle;
+
+
+ do {
+
+ oUL = this._aListElements[i];
+
+ if(oUL) {
+
+ if(bFirstList) {
+
+ Dom.addClass(oUL, "first-of-type");
+ bFirstList = false;
+
+ }
+
+
+ if(!Dom.isAncestor(oEl, oUL)) {
+
+ this.appendToBody(oUL);
+
+ }
+
+
+ oGroupTitle = this._aGroupTitleElements[i];
+
+ if(oGroupTitle) {
+
+ if(!Dom.isAncestor(oEl, oGroupTitle)) {
+
+ oUL.parentNode.insertBefore(oGroupTitle, oUL);
+
+ }
+
+
+ Dom.addClass(oUL, "hastitle");
+
+ }
+
+ }
+
+ i++;
+
+ }
+ while(i < nListElements);
+
+ }
+
+},
+
+
+/**
+* @method _onRender
+* @description "render" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onRender: function(p_sType, p_aArgs, p_oMenu) {
+
+ if(this.cfg.getProperty("position") == "dynamic") {
+
+ var sWidth =
+ this.element.parentNode.tagName.toUpperCase() == "BODY" ?
+ this.element.offsetWidth : this._getOffsetWidth();
+
+ this.cfg.setProperty("width", (sWidth + "px"));
+
+ }
+
+},
+
+
+/**
+* @method _onBeforeShow
+* @description "beforeshow" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onBeforeShow: function(p_sType, p_aArgs, p_oMenu) {
+
+ if(this.lazyLoad && this.getItemGroups().length === 0) {
+
+ if(this.srcElement) {
+
+ this._initSubTree();
+
+ }
+
+
+ if(this.itemData) {
+
+ if(
+ this.parent && this.parent.parent &&
+ this.parent.parent.srcElement &&
+ this.parent.parent.srcElement.tagName.toUpperCase() == "SELECT"
+ ) {
+
+ var nOptions = this.itemData.length;
+
+ for(var n=0; n 0) {
+
+ oConfig.showdelay = nShowDelay;
+
+ }
+
+
+ var nHideDelay = oParentMenu.cfg.getProperty("hidedelay");
+
+ if(nHideDelay > 0) {
+
+ oConfig.hidedelay = nHideDelay;
+
+ }
+
+
+ /*
+ Only sync the "iframe" configuration property if the parent
+ menu's "position" configuration is the same.
+ */
+
+ if(
+ this.cfg.getProperty("position") ==
+ oParentMenu.cfg.getProperty("position")
+ ) {
+
+ oConfig.iframe = oParentMenu.cfg.getProperty("iframe");
+
+ }
+
+
+ p_oSubmenu.cfg.applyConfig(oConfig);
+
+
+ if(!this.lazyLoad) {
+
+ if(Dom.inDocument(this.element)) {
+
+ this.render();
+
+ }
+ else {
+
+ this.render(this.parent.element);
+
+ }
+
+ }
+
+},
+
+
+/**
+* @method _onSubmenuBeforeShow
+* @description "beforeshow" event handler for a submenu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
+* subscribed to the event.
+*/
+_onSubmenuBeforeShow: function(p_sType, p_aArgs, p_oSubmenu) {
+
+ var oParent = this.parent;
+ var aAlignment = oParent.parent.cfg.getProperty("submenualignment");
+
+ this.cfg.setProperty(
+ "context",
+ [oParent.element, aAlignment[0], aAlignment[1]]
+ );
+
+ oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;
+
+},
+
+
+/**
+* @method _onSubmenuShow
+* @description "show" event handler for a submenu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
+* subscribed to the event.
+*/
+_onSubmenuShow: function(p_sType, p_aArgs, p_oSubmenu) {
+
+ var oParent = this.parent;
+
+ oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;
+
+},
+
+
+/**
+* @method _onSubmenuHide
+* @description "hide" Custom Event handler for a submenu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
+* subscribed to the event.
+*/
+_onSubmenuHide: function(p_sType, p_aArgs, p_oSubmenu) {
+
+ var oParent = this.parent;
+
+ oParent.submenuIndicator.alt = oParent.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
+
+},
+
+
+/**
+* @method _onMenuItemFocus
+* @description "focus" event handler for the menu's items.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+* that fired the event.
+*/
+_onMenuItemFocus: function(p_sType, p_aArgs, p_oItem) {
+
+ this.activeItem = p_oItem;
+
+},
+
+
+/**
+* @method _onMenuItemBlur
+* @description "blur" event handler for the menu's items.
+* @private
+* @param {String} p_sType String representing the name of the event
+* that was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onMenuItemBlur: function(p_sType, p_aArgs) {
+
+ this.activeItem = null;
+
+},
+
+
+/**
+* @method _onMenuItemConfigChange
+* @description "configchange" event handler for the menu's items.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+* that fired the event.
+*/
+_onMenuItemConfigChange: function(p_sType, p_aArgs, p_oItem) {
+
+ var sProperty = p_aArgs[0][0];
+
+ switch(sProperty) {
+
+ case "submenu":
+
+ var oSubmenu = p_aArgs[0][1];
+
+ if(oSubmenu) {
+
+ this._configureSubmenu(p_oItem);
+
+ }
+
+ break;
+
+ case "text":
+ case "helptext":
+
+ /*
+ A change to an item's "text" or "helptext"
+ configuration properties requires the width of the parent
+ menu to be recalculated.
+ */
+
+ if(this.element.style.width) {
+
+ var sWidth = this._getOffsetWidth() + "px";
+
+ Dom.setStyle(this.element, "width", sWidth);
+
+ }
+
+ break;
+
+ }
+
+},
+
+
+
+// Public event handlers for configuration properties
+
+
+/**
+* @method enforceConstraints
+* @description The default event handler executed when the moveEvent is fired,
+* if the "constraintoviewport" configuration property is set to true.
+* @param {String} type The name of the event that was fired.
+* @param {Array} args Collection of arguments sent when the
+* event was fired.
+* @param {Array} obj Array containing the current Menu instance
+* and the item that fired the event.
+*/
+enforceConstraints: function(type, args, obj) {
+
+ var oConfig = this.cfg;
+
+ var pos = args[0];
+
+ var x = pos[0];
+ var y = pos[1];
+
+ var bod = document.getElementsByTagName('body')[0];
+ var htm = document.getElementsByTagName('html')[0];
+
+ var bodyOverflow = Dom.getStyle(bod, "overflow");
+ var htmOverflow = Dom.getStyle(htm, "overflow");
+
+ var offsetHeight = this.element.offsetHeight;
+ var offsetWidth = this.element.offsetWidth;
+
+ var viewPortWidth = Dom.getClientWidth();
+ var viewPortHeight = Dom.getClientHeight();
+
+ var scrollX = window.scrollX || document.body.scrollLeft;
+ var scrollY = window.scrollY || document.body.scrollTop;
+
+ var topConstraint = scrollY + 10;
+ var leftConstraint = scrollX + 10;
+ var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;
+ var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;
+
+ var aContext = oConfig.getProperty("context");
+ var oContextElement = aContext ? aContext[0] : null;
+
+
+ if (x < 10) {
+
+ x = leftConstraint;
+
+ } else if ((x + offsetWidth) > viewPortWidth) {
+
+ if(
+ oContextElement &&
+ ((x - oContextElement.offsetWidth) > offsetWidth)
+ ) {
+
+ x = (x - (oContextElement.offsetWidth + offsetWidth));
+
+ }
+ else {
+
+ x = rightConstraint;
+
+ }
+
+ }
+
+ if (y < 10) {
+
+ y = topConstraint;
+
+ } else if (y > bottomConstraint) {
+
+ if(oContextElement && (y > offsetHeight)) {
+
+ y = ((y + oContextElement.offsetHeight) - offsetHeight);
+
+ }
+ else {
+
+ y = bottomConstraint;
+
+ }
+
+ }
+
+ oConfig.setProperty("x", x, true);
+ oConfig.setProperty("y", y, true);
+
+},
+
+
+/**
+* @method configVisible
+* @description Event handler for when the "visible" configuration property
+* the menu changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+configVisible: function(p_sType, p_aArgs, p_oMenu) {
+
+ if(this.cfg.getProperty("position") == "dynamic") {
+
+ YAHOO.widget.Menu.superclass.configVisible.call(
+ this,
+ p_sType,
+ p_aArgs,
+ p_oMenu
+ );
+
+ }
+ else {
+
+ var bVisible = p_aArgs[0];
+ var sDisplay = Dom.getStyle(this.element, "display");
+
+ if(bVisible) {
+
+ if(sDisplay != "block") {
+ this.beforeShowEvent.fire();
+ Dom.setStyle(this.element, "display", "block");
+ this.showEvent.fire();
+ }
+
+ }
+ else {
+
+ if(sDisplay == "block") {
+ this.beforeHideEvent.fire();
+ Dom.setStyle(this.element, "display", "none");
+ this.hideEvent.fire();
+ }
+
+ }
+
+ }
+
+},
+
+
+/**
+* @method configPosition
+* @description Event handler for when the "position" configuration property
+* of the menu changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+configPosition: function(p_sType, p_aArgs, p_oMenu) {
+
+ var sCSSPosition = p_aArgs[0] == "static" ? "static" : "absolute";
+ var oCfg = this.cfg;
+
+ Dom.setStyle(this.element, "position", sCSSPosition);
+
+
+ if(sCSSPosition == "static") {
+
+ /*
+ Remove the iframe for statically positioned menus since it will
+ intercept mouse events.
+ */
+
+ oCfg.setProperty("iframe", false);
+
+
+ // Statically positioned menus are visible by default
+
+ Dom.setStyle(this.element, "display", "block");
+
+ oCfg.setProperty("visible", true);
+
+ }
+ else {
+
+ /*
+ Even though the "visible" property is queued to
+ "false" by default, we need to set the "visibility" property to
+ "hidden" since Overlay's "configVisible" implementation checks the
+ element's "visibility" style property before deciding whether
+ or not to show an Overlay instance.
+ */
+
+ Dom.setStyle(this.element, "visibility", "hidden");
+
+ }
+
+
+ if(sCSSPosition == "absolute") {
+
+ var nZIndex = oCfg.getProperty("zindex");
+
+ if(!nZIndex || nZIndex === 0) {
+
+ nZIndex = this.parent ?
+ (this.parent.parent.cfg.getProperty("zindex") + 1) : 1;
+
+ oCfg.setProperty("zindex", nZIndex);
+
+ }
+
+ }
+
+},
+
+
+/**
+* @method configIframe
+* @description Event handler for when the "iframe" configuration property of
+* the menu changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+configIframe: function(p_sType, p_aArgs, p_oMenu) {
+
+ if(this.cfg.getProperty("position") == "dynamic") {
+
+ YAHOO.widget.Menu.superclass.configIframe.call(
+ this,
+ p_sType,
+ p_aArgs,
+ p_oMenu
+ );
+
+ }
+
+},
+
+
+/**
+* @method configHideDelay
+* @description Event handler for when the "hidedelay" configuration property
+* of the menu changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+configHideDelay: function(p_sType, p_aArgs, p_oMenu) {
+
+ var nHideDelay = p_aArgs[0];
+ var oMouseOutEvent = this.mouseOutEvent;
+ var oMouseOverEvent = this.mouseOverEvent;
+ var oKeyDownEvent = this.keyDownEvent;
+
+ if(nHideDelay > 0) {
+
+ /*
+ Only assign event handlers once. This way the user change
+ the value for the hidedelay as many times as they want.
+ */
+
+ if(!this._hideDelayEventHandlersAssigned) {
+
+ oMouseOutEvent.subscribe(this._execHideDelay, true);
+ oMouseOverEvent.subscribe(this._cancelHideDelay, this, true);
+ oKeyDownEvent.subscribe(this._cancelHideDelay, this, true);
+
+ this._hideDelayEventHandlersAssigned = true;
+
+ }
+
+ }
+ else {
+
+ oMouseOutEvent.unsubscribe(this._execHideDelay, this);
+ oMouseOverEvent.unsubscribe(this._cancelHideDelay, this);
+ oKeyDownEvent.unsubscribe(this._cancelHideDelay, this);
+
+ this._hideDelayEventHandlersAssigned = false;
+
+ }
+
+},
+
+
+/**
+* @method configContainer
+* @description Event handler for when the "container" configuration property
+of the menu changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+configContainer: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oElement = p_aArgs[0];
+
+ if(typeof oElement == 'string') {
+
+ this.cfg.setProperty(
+ "container",
+ document.getElementById(oElement),
+ true
+ );
+
+ }
+
+},
+
+
+
+// Public methods
+
+
+/**
+* Event handler called when the resize monitor element's "resize" evet is fired.
+*/
+onDomResize: function(e, obj) {
+
+ if(!this._handleResize) {
+
+ this._handleResize = true;
+ return;
+
+ }
+
+ var oConfig = this.cfg;
+
+ if(oConfig.getProperty("position") == "dynamic") {
+
+ oConfig.setProperty("width", (this._getOffsetWidth() + "px"));
+
+ }
+
+ YAHOO.widget.Menu.superclass.onDomResize.call(this, e, obj);
+
+},
+
+
+/**
+* @method initEvents
+* @description Initializes the custom events for the menu.
+*/
+initEvents: function() {
+
+ YAHOO.widget.Menu.superclass.initEvents.call(this);
+
+ // Create custom events
+
+ var CustomEvent = YAHOO.util.CustomEvent;
+
+ this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);
+ this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);
+ this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);
+ this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);
+ this.clickEvent = new CustomEvent("clickEvent", this);
+ this.keyPressEvent = new CustomEvent("keyPressEvent", this);
+ this.keyDownEvent = new CustomEvent("keyDownEvent", this);
+ this.keyUpEvent = new CustomEvent("keyUpEvent", this);
+ this.itemAddedEvent = new CustomEvent("itemAddedEvent", this);
+ this.itemRemovedEvent = new CustomEvent("itemRemovedEvent", this);
+
+},
+
+
+/**
+* @method getRoot
+* @description Finds the menu's root menu.
+*/
+getRoot: function() {
+
+ var oItem = this.parent;
+
+ if(oItem) {
+
+ var oParentMenu = oItem.parent;
+
+ return oParentMenu ? oParentMenu.getRoot() : this;
+
+ }
+ else {
+
+ return this;
+
+ }
+
+},
+
+
+/**
+* @method toString
+* @description Returns a string representing the menu.
+* @return {String}
+*/
+toString: function() {
+
+ return ("Menu " + this.id);
+
+},
+
+
+/**
+* @method setItemGroupTitle
+* @description Sets the title of a group of menu items.
+* @param {String} p_sGroupTitle String specifying the title of the group.
+* @param {Number} p_nGroupIndex Optional. Number specifying the group to which
+* the title belongs.
+*/
+setItemGroupTitle: function(p_sGroupTitle, p_nGroupIndex) {
+
+ if(typeof p_sGroupTitle == "string" && p_sGroupTitle.length > 0) {
+
+ var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;
+ var oTitle = this._aGroupTitleElements[nGroupIndex];
+
+
+ if(oTitle) {
+
+ oTitle.innerHTML = p_sGroupTitle;
+
+ }
+ else {
+
+ oTitle = document.createElement(this.GROUP_TITLE_TAG_NAME);
+
+ oTitle.innerHTML = p_sGroupTitle;
+
+ this._aGroupTitleElements[nGroupIndex] = oTitle;
+
+ }
+
+
+ var i = this._aGroupTitleElements.length - 1;
+ var nFirstIndex;
+
+ do {
+
+ if(this._aGroupTitleElements[i]) {
+
+ Dom.removeClass(this._aGroupTitleElements[i], "first-of-type");
+
+ nFirstIndex = i;
+
+ }
+
+ }
+ while(i--);
+
+
+ if(nFirstIndex !== null) {
+
+ Dom.addClass(
+ this._aGroupTitleElements[nFirstIndex],
+ "first-of-type"
+ );
+
+ }
+
+ }
+
+},
+
+
+
+/**
+* @method addItem
+* @description Appends an item to the menu.
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
+* instance to be added to the menu.
+* @param {String} p_oItem String specifying the text of the item to be added
+* to the menu.
+* @param {Object} p_oItem Object literal containing a set of menu item
+* configuration properties.
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to
+* which the item belongs.
+* @return {YAHOO.widget.MenuItem}
+*/
+addItem: function(p_oItem, p_nGroupIndex) {
+
+ if(p_oItem) {
+
+ return this._addItemToGroup(p_nGroupIndex, p_oItem);
+
+ }
+
+},
+
+
+/**
+* @method addItems
+* @description Adds an array of items to the menu.
+* @param {Array} p_aItems Array of items to be added to the menu. The array
+* can contain strings specifying the text for each item to be created, object
+* literals specifying each of the menu item configuration properties,
+* or MenuItem instances.
+* @param {Number} p_nGroupIndex Optional. Number specifying the group to
+* which the items belongs.
+* @return {Array}
+*/
+addItems: function(p_aItems, p_nGroupIndex) {
+
+ function isArray(p_oValue) {
+
+ return (typeof p_oValue == "object" && p_oValue.constructor == Array);
+
+ }
+
+
+ if(isArray(p_aItems)) {
+
+ var nItems = p_aItems.length;
+ var aItems = [];
+ var oItem;
+
+
+ for(var i=0; i<div> element
+* (and accompanying child nodes) from the document.
+*/
+destroy: function() {
+
+ // Remove Custom Event listeners
+
+ this.mouseOverEvent.unsubscribeAll();
+ this.mouseOutEvent.unsubscribeAll();
+ this.mouseDownEvent.unsubscribeAll();
+ this.mouseUpEvent.unsubscribeAll();
+ this.clickEvent.unsubscribeAll();
+ this.keyPressEvent.unsubscribeAll();
+ this.keyDownEvent.unsubscribeAll();
+ this.keyUpEvent.unsubscribeAll();
+
+
+ var nItemGroups = this._aItemGroups.length;
+ var nItems;
+ var oItemGroup;
+ var oItem;
+ var i;
+ var n;
+
+
+ // Remove all items
+
+ if(nItemGroups > 0) {
+
+ i = nItemGroups - 1;
+
+ do {
+
+ oItemGroup = this._aItemGroups[i];
+
+ if(oItemGroup) {
+
+ nItems = oItemGroup.length;
+
+ if(nItems > 0) {
+
+ n = nItems - 1;
+
+ do {
+
+ oItem = this._aItemGroups[i][n];
+
+ if(oItem) {
+
+ oItem.destroy();
+ }
+
+ }
+ while(n--);
+
+ }
+
+ }
+
+ }
+ while(i--);
+
+ }
+
+
+ // Continue with the superclass implementation of this method
+
+ YAHOO.widget.Menu.superclass.destroy.call(this);
+
+ this.logger.log("Destroyed.");
+
+},
+
+
+/**
+* @method setInitialFocus
+* @description Sets focus to the menu's first enabled item.
+*/
+setInitialFocus: function() {
+
+ var oItem = this._getFirstEnabledItem();
+
+ if(oItem) {
+
+ oItem.focus();
+ }
+
+},
+
+
+/**
+* @method setInitialSelection
+* @description Sets the "selected" configuration property of the menu's first
+* enabled item to "true."
+*/
+setInitialSelection: function() {
+
+ var oItem = this._getFirstEnabledItem();
+
+ if(oItem) {
+
+ oItem.cfg.setProperty("selected", true);
+ }
+
+},
+
+
+/**
+* @method clearActiveItem
+* @description Sets the "selected" configuration property of the menu's active
+* item to "false" and hides the item's submenu.
+* @param {Boolean} p_bBlur Boolean indicating if the menu's active item
+* should be blurred.
+*/
+clearActiveItem: function(p_bBlur) {
+
+ if(this.cfg.getProperty("showdelay") > 0) {
+
+ this._cancelShowDelay();
+
+ }
+
+
+ var oActiveItem = this.activeItem;
+
+ if(oActiveItem) {
+
+ var oConfig = oActiveItem.cfg;
+
+ oConfig.setProperty("selected", false);
+
+ var oSubmenu = oConfig.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ oSubmenu.hide();
+
+ }
+
+ if(p_bBlur) {
+
+ oActiveItem.blur();
+
+ }
+
+ }
+
+},
+
+
+/**
+* @description Initializes the class's configurable properties which can be
+* changed using the menu's Config object ("cfg").
+* @method initDefaultConfig
+*/
+initDefaultConfig: function() {
+
+ YAHOO.widget.Menu.superclass.initDefaultConfig.call(this);
+
+ var oConfig = this.cfg;
+
+ // Add configuration properties
+
+ /*
+ Change the default value for the "visible" configuration
+ property to "false" by re-adding the property.
+ */
+
+ /**
+ * @config visible
+ * @description Boolean indicating whether or not the menu is visible. If
+ * the menu's "position" configuration property is set to "dynamic" (the
+ * default), this property toggles the menu's <div>
+ * element's "visibility" style property between "visible" (true) or
+ * "hidden" (false). If the menu's "position" configuration property is
+ * set to "static" this property toggles the menu's
+ * <div> element's "display" style property
+ * between "block" (true) or "none" (false).
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "visible",
+ {
+ value:false,
+ handler:this.configVisible,
+ validator:this.cfg.checkBoolean
+ }
+ );
+
+
+ /*
+ Change the default value for the "constraintoviewport" configuration
+ property to "true" by re-adding the property.
+ */
+
+ /**
+ * @config constraintoviewport
+ * @description Boolean indicating if the menu will try to remain inside
+ * the boundaries of the size of viewport.
+ * @default true
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "constraintoviewport",
+ {
+ value:true,
+ handler:this.configConstrainToViewport,
+ validator:this.cfg.checkBoolean,
+ supercedes:["iframe","x","y","xy"]
+ }
+ );
+
+
+ /**
+ * @config position
+ * @description String indicating how a menu should be positioned on the
+ * screen. Possible values are "static" and "dynamic." Static menus are
+ * visible by default and reside in the normal flow of the document
+ * (CSS position: static). Dynamic menus are hidden by default, reside
+ * out of the normal flow of the document (CSS position: absolute), and
+ * can overlay other elements on the screen.
+ * @default dynamic
+ * @type String
+ */
+ oConfig.addProperty(
+ "position",
+ {
+ value: "dynamic",
+ handler: this.configPosition,
+ validator: this._checkPosition,
+ supercedes: ["visible"]
+ }
+ );
+
+
+ /**
+ * @config submenualignment
+ * @description Array defining how submenus should be aligned to their
+ * parent menu item. The format is: [itemCorner, submenuCorner]. By default
+ * a submenu's top left corner is aligned to its parent menu item's top
+ * right corner.
+ * @default ["tl","tr"]
+ * @type Array
+ */
+ oConfig.addProperty("submenualignment", { value: ["tl","tr"] } );
+
+
+ /**
+ * @config autosubmenudisplay
+ * @description Boolean indicating if submenus are automatically made
+ * visible when the user mouses over the menu's items.
+ * @default true
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "autosubmenudisplay",
+ {
+ value: true,
+ validator: oConfig.checkBoolean
+ }
+ );
+
+
+ /**
+ * @config showdelay
+ * @description Number indicating the time (in milliseconds) that should
+ * expire before a submenu is made visible when the user mouses over
+ * the menu's items.
+ * @default 0
+ * @type Number
+ */
+ oConfig.addProperty(
+ "showdelay",
+ {
+ value: 0,
+ validator: oConfig.checkNumber
+ }
+ );
+
+
+ /**
+ * @config hidedelay
+ * @description Number indicating the time (in milliseconds) that should
+ * expire before the menu is hidden.
+ * @default 0
+ * @type Number
+ */
+ oConfig.addProperty(
+ "hidedelay",
+ {
+ value: 0,
+ validator: oConfig.checkNumber,
+ handler: this.configHideDelay,
+ suppressEvent: true
+ }
+ );
+
+
+ /**
+ * @config clicktohide
+ * @description Boolean indicating if the menu will automatically be
+ * hidden if the user clicks outside of it.
+ * @default true
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "clicktohide",
+ {
+ value: true,
+ validator: oConfig.checkBoolean
+ }
+ );
+
+
+ /**
+ * @config container
+ * @description HTML element reference or string specifying the id
+ * attribute of the HTML element that the menu's markup should be rendered into.
+ * @type HTMLElement |String
+ * @default document.body
+ */
+ this.cfg.addProperty(
+ "container",
+ { value:document.body, handler:this.configContainer }
+ );
+
+}
+
+}); // END YAHOO.extend
+
+})();
+
+
+/**
+* The base class for all menuing containers.
+*
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the menu module.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source for the
+* menu module.
+* @param {HTMLDivElement } p_oElement Object
+* specifying the <div> element of the menu module.
+* @param {HTMLSelectElement } p_oElement Object
+* specifying the <select> element to be used as the data
+* source for the menu module.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu module. See configuration class documentation for
+* more details.
+* @class MenuModule
+* @constructor
+* @extends YAHOO.widget.Overlay
+* @deprecated As of version 0.12, all MenuModule functionality has been
+* implemented directly in YAHOO.widget.Menu, making YAHOO.widget.Menu the base
+* class for all menuing containers.
+*/
+YAHOO.widget.MenuModule = YAHOO.widget.Menu;
+
+
+(function() {
+
+var Dom = YAHOO.util.Dom;
+var Module = YAHOO.widget.Module;
+var Menu = YAHOO.widget.Menu;
+
+
+/**
+* Creates an item for a menu.
+*
+* @param {String} p_oObject String specifying the text of the menu item.
+* @param {HTMLLIElement } p_oObject Object specifying
+* the <li> element of the menu item.
+* @param {HTMLOptGroupElement } p_oObject Object
+* specifying the <optgroup> element of the menu item.
+* @param {HTMLOptionElement } p_oObject Object
+* specifying the <option> element of the menu item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu item. See configuration class documentation
+* for more details.
+* @class MenuItem
+* @constructor
+*/
+YAHOO.widget.MenuItem = function(p_oObject, p_oConfig) {
+
+ if(p_oObject) {
+
+ if(p_oConfig) {
+
+ this.parent = p_oConfig.parent;
+ this.value = p_oConfig.value;
+
+ }
+
+ this.init(p_oObject, p_oConfig);
+
+ }
+
+};
+
+YAHOO.widget.MenuItem.prototype = {
+
+ // Constants
+
+ /**
+ * @property SUBMENU_INDICATOR_IMAGE_PATH
+ * @description String representing the path to the image to be used for the
+ * menu item's submenu arrow indicator.
+ * @default "nt/ic/ut/alt1/menuarorght8_nrm_1.gif"
+ * @final
+ * @type String
+ */
+ SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarorght8_nrm_1.gif",
+
+
+ /**
+ * @property SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
+ * @description String representing the path to the image to be used for the
+ * submenu arrow indicator when the menu item is selected.
+ * @default "nt/ic/ut/alt1/menuarorght8_hov_1.gif"
+ * @final
+ * @type String
+ */
+ SELECTED_SUBMENU_INDICATOR_IMAGE_PATH:
+ "nt/ic/ut/alt1/menuarorght8_hov_1.gif",
+
+
+ /**
+ * @property DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
+ * @description String representing the path to the image to be used for the
+ * submenu arrow indicator when the menu item is disabled.
+ * @default "nt/ic/ut/alt1/menuarorght8_dim_1.gif"
+ * @final
+ * @type String
+ */
+ DISABLED_SUBMENU_INDICATOR_IMAGE_PATH:
+ "nt/ic/ut/alt1/menuarorght8_dim_1.gif",
+
+
+ /**
+ * @property COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT
+ * @description String representing the alt text for the image to be used
+ * for the submenu arrow indicator.
+ * @default "Collapsed. Click to expand."
+ * @final
+ * @type String
+ */
+ COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT: "Collapsed. Click to expand.",
+
+
+ /**
+ * @property EXPANDED_SUBMENU_INDICATOR_ALT_TEXT
+ * @description String representing the alt text for the image to be used
+ * for the submenu arrow indicator when the submenu is visible.
+ * @default "Expanded. Click to collapse."
+ * @final
+ * @type String
+ */
+ EXPANDED_SUBMENU_INDICATOR_ALT_TEXT: "Expanded. Click to collapse.",
+
+
+ /**
+ * @property DISABLED_SUBMENU_INDICATOR_ALT_TEXT
+ * @description String representing the alt text for the image to be used
+ * for the submenu arrow indicator when the menu item is disabled.
+ * @default "Disabled."
+ * @final
+ * @type String
+ */
+ DISABLED_SUBMENU_INDICATOR_ALT_TEXT: "Disabled.",
+
+
+ /**
+ * @property CHECKED_IMAGE_PATH
+ * @description String representing the path to the image to be used for
+ * the checked state.
+ * @default "nt/ic/ut/bsc/menuchk8_nrm_1.gif"
+ * @final
+ * @type String
+ */
+ CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_nrm_1.gif",
+
+
+ /**
+ * @property SELECTED_CHECKED_IMAGE_PATH
+ * @description String representing the path to the image to be used for
+ * the selected checked state.
+ * @default "nt/ic/ut/bsc/menuchk8_hov_1.gif"
+ * @final
+ * @type String
+ */
+ SELECTED_CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_hov_1.gif",
+
+
+ /**
+ * @property DISABLED_CHECKED_IMAGE_PATH
+ * @description String representing the path to the image to be used for
+ * the disabled checked state.
+ * @default "nt/ic/ut/bsc/menuchk8_dim_1.gif"
+ * @final
+ * @type String
+ */
+ DISABLED_CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_dim_1.gif",
+
+
+ /**
+ * @property CHECKED_IMAGE_ALT_TEXT
+ * @description String representing the alt text for the image to be used
+ * for the checked image.
+ * @default "Checked."
+ * @final
+ * @type String
+ */
+ CHECKED_IMAGE_ALT_TEXT: "Checked.",
+
+
+ /**
+ * @property DISABLED_CHECKED_IMAGE_ALT_TEXT
+ * @description String representing the alt text for the image to be used
+ * for the checked image when the item is disabled.
+ * @default "Checked. (Item disabled.)"
+ * @final
+ * @type String
+ */
+ DISABLED_CHECKED_IMAGE_ALT_TEXT: "Checked. (Item disabled.)",
+
+
+ /**
+ * @property CSS_CLASS_NAME
+ * @description String representing the CSS class(es) to be applied to the
+ * <li> element of the menu item.
+ * @default "yuimenuitem"
+ * @final
+ * @type String
+ */
+ CSS_CLASS_NAME: "yuimenuitem",
+
+
+ /**
+ * @property SUBMENU_TYPE
+ * @description Object representing the type of menu to instantiate and
+ * add when parsing the child nodes of the menu item's source HTML element.
+ * @final
+ * @type YAHOO.widget.Menu
+ */
+ SUBMENU_TYPE: null,
+
+
+ /**
+ * @property IMG_ROOT
+ * @description String representing the prefix path to use for
+ * non-secure images.
+ * @default "http://us.i1.yimg.com/us.yimg.com/i/"
+ * @type String
+ */
+ IMG_ROOT: "http://us.i1.yimg.com/us.yimg.com/i/",
+
+
+ /**
+ * @property IMG_ROOT_SSL
+ * @description String representing the prefix path to use for securely
+ * served images.
+ * @default "https://a248.e.akamai.net/sec.yimg.com/i/"
+ * @type String
+ */
+ IMG_ROOT_SSL: "https://a248.e.akamai.net/sec.yimg.com/i/",
+
+
+
+ // Private member variables
+
+ /**
+ * @property _oAnchor
+ * @description Object reference to the menu item's
+ * <a> element.
+ * @default null
+ * @private
+ * @type HTMLAnchorElement
+ */
+ _oAnchor: null,
+
+
+ /**
+ * @property _oText
+ * @description Object reference to the menu item's text node.
+ * @default null
+ * @private
+ * @type TextNode
+ */
+ _oText: null,
+
+
+ /**
+ * @property _oHelpTextEM
+ * @description Object reference to the menu item's help text
+ * <em> element.
+ * @default null
+ * @private
+ * @type HTMLElement
+ */
+ _oHelpTextEM: null,
+
+
+ /**
+ * @property _oSubmenu
+ * @description Object reference to the menu item's submenu.
+ * @default null
+ * @private
+ * @type YAHOO.widget.Menu
+ */
+ _oSubmenu: null,
+
+
+ /**
+ * @property _checkImage
+ * @description Object reference to the menu item's checkmark image.
+ * @default null
+ * @private
+ * @type HTMLImageElement
+ */
+ _checkImage: null,
+
+
+
+ // Public properties
+
+ /**
+ * @property constructor
+ * @description Object reference to the menu item's constructor function.
+ * @default YAHOO.widget.MenuItem
+ * @type YAHOO.widget.MenuItem
+ */
+ constructor: YAHOO.widget.MenuItem,
+
+
+ /**
+ * @property imageRoot
+ * @description String representing the root path for all of the menu
+ * item's images.
+ * @type String
+ */
+ imageRoot: null,
+
+
+ /**
+ * @property isSecure
+ * @description Boolean representing whether or not the current browsing
+ * context is secure (HTTPS).
+ * @type Boolean
+ */
+ isSecure: Module.prototype.isSecure,
+
+
+ /**
+ * @property index
+ * @description Number indicating the ordinal position of the menu item in
+ * its group.
+ * @default null
+ * @type Number
+ */
+ index: null,
+
+
+ /**
+ * @property groupIndex
+ * @description Number indicating the index of the group to which the menu
+ * item belongs.
+ * @default null
+ * @type Number
+ */
+ groupIndex: null,
+
+
+ /**
+ * @property parent
+ * @description Object reference to the menu item's parent menu.
+ * @default null
+ * @type YAHOO.widget.Menu
+ */
+ parent: null,
+
+
+ /**
+ * @property element
+ * @description Object reference to the menu item's
+ * <li> element.
+ * @default HTMLLIElement
+ * @type HTMLLIElement
+ */
+ element: null,
+
+
+ /**
+ * @property srcElement
+ * @description Object reference to the HTML element (either
+ * <li>, <optgroup> or
+ * <option>) used create the menu item.
+ * @default HTMLLIElement |HTMLOptGroupElement |HTMLOptionElement
+ * @type HTMLLIElement |
+ * HTMLOptGroupElement |HTMLOptionElement
+ */
+ srcElement: null,
+
+
+ /**
+ * @property value
+ * @description Object reference to the menu item's value.
+ * @default null
+ * @type Object
+ */
+ value: null,
+
+
+ /**
+ * @property submenuIndicator
+ * @description Object reference to the <img> element
+ * used to create the submenu indicator for the menu item.
+ * @default HTMLImageElement
+ * @type HTMLImageElement
+ */
+ submenuIndicator: null,
+
+
+ /**
+ * @property browser
+ * @description String representing the browser.
+ * @type String
+ */
+ browser: Module.prototype.browser,
+
+
+
+ // Events
+
+
+ /**
+ * @event destroyEvent
+ * @description Fires when the menu item's <li>
+ * element is removed from its parent <ul> element.
+ * @type YAHOO.util.CustomEvent
+ */
+ destroyEvent: null,
+
+
+ /**
+ * @event mouseOverEvent
+ * @description Fires when the mouse has entered the menu item. Passes
+ * back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ mouseOverEvent: null,
+
+
+ /**
+ * @event mouseOutEvent
+ * @description Fires when the mouse has left the menu item. Passes back
+ * the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ mouseOutEvent: null,
+
+
+ /**
+ * @event mouseDownEvent
+ * @description Fires when the user mouses down on the menu item. Passes
+ * back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ mouseDownEvent: null,
+
+
+ /**
+ * @event mouseUpEvent
+ * @description Fires when the user releases a mouse button while the mouse
+ * is over the menu item. Passes back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ mouseUpEvent: null,
+
+
+ /**
+ * @event clickEvent
+ * @description Fires when the user clicks the on the menu item. Passes
+ * back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ clickEvent: null,
+
+
+ /**
+ * @event keyPressEvent
+ * @description Fires when the user presses an alphanumeric key when the
+ * menu item has focus. Passes back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ keyPressEvent: null,
+
+
+ /**
+ * @event keyDownEvent
+ * @description Fires when the user presses a key when the menu item has
+ * focus. Passes back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ keyDownEvent: null,
+
+
+ /**
+ * @event keyUpEvent
+ * @description Fires when the user releases a key when the menu item has
+ * focus. Passes back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ keyUpEvent: null,
+
+
+ /**
+ * @event focusEvent
+ * @description Fires when the menu item receives focus.
+ * @type YAHOO.util.CustomEvent
+ */
+ focusEvent: null,
+
+
+ /**
+ * @event blurEvent
+ * @description Fires when the menu item loses the input focus.
+ * @type YAHOO.util.CustomEvent
+ */
+ blurEvent: null,
+
+
+ /**
+ * @method init
+ * @description The MenuItem class's initialization method. This method is
+ * automatically called by the constructor, and sets up all DOM references
+ * for pre-existing markup, and creates required markup if it is not
+ * already present.
+ * @param {String} p_oObject String specifying the text of the menu item.
+ * @param {HTMLLIElement } p_oObject Object specifying
+ * the <li> element of the menu item.
+ * @param {HTMLOptGroupElement } p_oObject Object
+ * specifying the <optgroup> element of the menu item.
+ * @param {HTMLOptionElement } p_oObject Object
+ * specifying the <option> element of the menu item.
+ * @param {Object} p_oConfig Optional. Object literal specifying the
+ * configuration for the menu item. See configuration class documentation
+ * for more details.
+ */
+ init: function(p_oObject, p_oConfig) {
+
+ this.imageRoot = (this.isSecure) ? this.IMG_ROOT_SSL : this.IMG_ROOT;
+
+
+ if(!this.SUBMENU_TYPE) {
+
+ this.SUBMENU_TYPE = Menu;
+
+ }
+
+
+ // Create the config object
+
+ this.cfg = new YAHOO.util.Config(this);
+
+ this.initDefaultConfig();
+
+ var oConfig = this.cfg;
+
+
+ if(this._checkString(p_oObject)) {
+
+ this._createRootNodeStructure();
+
+ oConfig.setProperty("text", p_oObject);
+
+ }
+ else if(this._checkDOMNode(p_oObject)) {
+
+ switch(p_oObject.tagName.toUpperCase()) {
+
+ case "OPTION":
+
+ this._createRootNodeStructure();
+
+ oConfig.setProperty("text", p_oObject.text);
+
+ this.srcElement = p_oObject;
+
+ break;
+
+ case "OPTGROUP":
+
+ this._createRootNodeStructure();
+
+ oConfig.setProperty("text", p_oObject.label);
+
+ this.srcElement = p_oObject;
+
+ this._initSubTree();
+
+ break;
+
+ case "LI":
+
+ // Get the anchor node (if it exists)
+
+ var oAnchor = this._getFirstElement(p_oObject, "A");
+ var sURL = "#";
+ var sTarget = null;
+ var sText = null;
+
+
+ // Capture the "text" and/or the "URL"
+
+ if(oAnchor) {
+
+ sURL = oAnchor.getAttribute("href");
+ sTarget = oAnchor.getAttribute("target");
+
+ if(oAnchor.innerText) {
+
+ sText = oAnchor.innerText;
+
+ }
+ else {
+
+ var oRange = oAnchor.ownerDocument.createRange();
+
+ oRange.selectNodeContents(oAnchor);
+
+ sText = oRange.toString();
+
+ }
+
+ }
+ else {
+
+ var oText = p_oObject.firstChild;
+
+ sText = oText.nodeValue;
+
+ oAnchor = document.createElement("a");
+
+ oAnchor.setAttribute("href", sURL);
+
+ p_oObject.replaceChild(oAnchor, oText);
+
+ oAnchor.appendChild(oText);
+
+ }
+
+
+ this.srcElement = p_oObject;
+ this.element = p_oObject;
+ this._oAnchor = oAnchor;
+
+
+ // Check if emphasis has been applied to the MenuItem
+
+ var oEmphasisNode = this._getFirstElement(oAnchor);
+ var bEmphasis = false;
+ var bStrongEmphasis = false;
+
+ if(oEmphasisNode) {
+
+ // Set a reference to the text node
+
+ this._oText = oEmphasisNode.firstChild;
+
+ switch(oEmphasisNode.tagName.toUpperCase()) {
+
+ case "EM":
+
+ bEmphasis = true;
+
+ break;
+
+ case "STRONG":
+
+ bStrongEmphasis = true;
+
+ break;
+
+ }
+
+ }
+ else {
+
+ // Set a reference to the text node
+
+ this._oText = oAnchor.firstChild;
+
+ }
+
+
+ /*
+ Set these properties silently to sync up the
+ configuration object without making changes to the
+ element's DOM
+ */
+
+ oConfig.setProperty("text", sText, true);
+ oConfig.setProperty("url", sURL, true);
+ oConfig.setProperty("target", sTarget, true);
+ oConfig.setProperty("emphasis", bEmphasis, true);
+ oConfig.setProperty(
+ "strongemphasis",
+ bStrongEmphasis,
+ true
+ );
+
+ this._initSubTree();
+
+ break;
+
+ }
+
+ }
+
+
+ if(this.element) {
+
+
+ Dom.addClass(this.element, this.CSS_CLASS_NAME);
+
+
+ // Create custom events
+
+ var CustomEvent = YAHOO.util.CustomEvent;
+
+ this.destroyEvent = new CustomEvent("destroyEvent", this);
+ this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);
+ this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);
+ this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);
+ this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);
+ this.clickEvent = new CustomEvent("clickEvent", this);
+ this.keyPressEvent = new CustomEvent("keyPressEvent", this);
+ this.keyDownEvent = new CustomEvent("keyDownEvent", this);
+ this.keyUpEvent = new CustomEvent("keyUpEvent", this);
+ this.focusEvent = new CustomEvent("focusEvent", this);
+ this.blurEvent = new CustomEvent("blurEvent", this);
+
+
+ if(p_oConfig) {
+
+ oConfig.applyConfig(p_oConfig);
+
+ }
+
+ oConfig.fireQueue();
+
+ }
+
+ },
+
+
+
+ // Private methods
+
+ /**
+ * @method _getFirstElement
+ * @description Returns an HTML element's first HTML element node.
+ * @private
+ * @param {HTMLElement } p_oElement Object
+ * reference specifying the element to be evaluated.
+ * @param {String} p_sTagName Optional. String specifying the tagname of
+ * the element to be retrieved.
+ * @return {HTMLElement }
+ */
+ _getFirstElement: function(p_oElement, p_sTagName) {
+
+ var oElement;
+
+ if(p_oElement.firstChild && p_oElement.firstChild.nodeType == 1) {
+
+ oElement = p_oElement.firstChild;
+
+ }
+ else if(
+ p_oElement.firstChild &&
+ p_oElement.firstChild.nextSibling &&
+ p_oElement.firstChild.nextSibling.nodeType == 1
+ ) {
+
+ oElement = p_oElement.firstChild.nextSibling;
+
+ }
+
+
+ if(p_sTagName) {
+
+ return (oElement && oElement.tagName.toUpperCase() == p_sTagName) ?
+ oElement : false;
+
+ }
+
+ return oElement;
+
+ },
+
+
+ /**
+ * @method _checkString
+ * @description Determines if an object is a string.
+ * @private
+ * @param {Object} p_oObject Object to be evaluated.
+ * @return {Boolean}
+ */
+ _checkString: function(p_oObject) {
+
+ return (typeof p_oObject == "string");
+
+ },
+
+
+ /**
+ * @method _checkDOMNode
+ * @description Determines if an object is an HTML element.
+ * @private
+ * @param {Object} p_oObject Object to be evaluated.
+ * @return {Boolean}
+ */
+ _checkDOMNode: function(p_oObject) {
+
+ return (p_oObject && p_oObject.tagName);
+
+ },
+
+
+ /**
+ * @method _createRootNodeStructure
+ * @description Creates the core DOM structure for the menu item.
+ * @private
+ */
+ _createRootNodeStructure: function () {
+
+ this.element = document.createElement("li");
+
+ this._oText = document.createTextNode("");
+
+ this._oAnchor = document.createElement("a");
+ this._oAnchor.appendChild(this._oText);
+
+ this.cfg.refireEvent("url");
+
+ this.element.appendChild(this._oAnchor);
+
+ },
+
+
+ /**
+ * @method _initSubTree
+ * @description Iterates the source element's childNodes collection and uses
+ * the child nodes to instantiate other menus.
+ * @private
+ */
+ _initSubTree: function() {
+
+ var oSrcEl = this.srcElement;
+ var oConfig = this.cfg;
+
+
+ if(oSrcEl.childNodes.length > 0) {
+
+ if(
+ this.parent.lazyLoad &&
+ this.parent.srcElement &&
+ this.parent.srcElement.tagName.toUpperCase() == "SELECT"
+ ) {
+
+ oConfig.setProperty(
+ "submenu",
+ { id: Dom.generateId(), itemdata: oSrcEl.childNodes }
+ );
+
+ }
+ else {
+
+ var oNode = oSrcEl.firstChild;
+ var aOptions = [];
+
+ do {
+
+ if(oNode && oNode.tagName) {
+
+ switch(oNode.tagName.toUpperCase()) {
+
+ case "DIV":
+
+ oConfig.setProperty("submenu", oNode);
+
+ break;
+
+ case "OPTION":
+
+ aOptions[aOptions.length] = oNode;
+
+ break;
+
+ }
+
+ }
+
+ }
+ while((oNode = oNode.nextSibling));
+
+
+ var nOptions = aOptions.length;
+
+ if(nOptions > 0) {
+
+ var oMenu = new this.SUBMENU_TYPE(Dom.generateId());
+
+ oConfig.setProperty("submenu", oMenu);
+
+ for(var n=0; n 0) {
+
+ oAnchor.setAttribute("target", sTarget);
+
+ }
+ else {
+
+ oAnchor.removeAttribute("target");
+
+ }
+
+ },
+
+
+ /**
+ * @method configEmphasis
+ * @description Event handler for when the "emphasis" configuration property
+ * of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configEmphasis: function(p_sType, p_aArgs, p_oItem) {
+
+ var bEmphasis = p_aArgs[0];
+ var oAnchor = this._oAnchor;
+ var oText = this._oText;
+ var oConfig = this.cfg;
+ var oEM;
+
+
+ if(bEmphasis && oConfig.getProperty("strongemphasis")) {
+
+ oConfig.setProperty("strongemphasis", false);
+
+ }
+
+
+ if(oAnchor) {
+
+ if(bEmphasis) {
+
+ oEM = document.createElement("em");
+ oEM.appendChild(oText);
+
+ oAnchor.appendChild(oEM);
+
+ }
+ else {
+
+ oEM = this._getFirstElement(oAnchor, "EM");
+
+ oAnchor.removeChild(oEM);
+ oAnchor.appendChild(oText);
+
+ }
+
+ }
+
+ },
+
+
+ /**
+ * @method configStrongEmphasis
+ * @description Event handler for when the "strongemphasis" configuration
+ * property of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configStrongEmphasis: function(p_sType, p_aArgs, p_oItem) {
+
+ var bStrongEmphasis = p_aArgs[0];
+ var oAnchor = this._oAnchor;
+ var oText = this._oText;
+ var oConfig = this.cfg;
+ var oStrong;
+
+ if(bStrongEmphasis && oConfig.getProperty("emphasis")) {
+
+ oConfig.setProperty("emphasis", false);
+
+ }
+
+ if(oAnchor) {
+
+ if(bStrongEmphasis) {
+
+ oStrong = document.createElement("strong");
+ oStrong.appendChild(oText);
+
+ oAnchor.appendChild(oStrong);
+
+ }
+ else {
+
+ oStrong = this._getFirstElement(oAnchor, "STRONG");
+
+ oAnchor.removeChild(oStrong);
+ oAnchor.appendChild(oText);
+
+ }
+
+ }
+
+ },
+
+
+ /**
+ * @method configChecked
+ * @description Event handler for when the "checked" configuration property
+ * of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configChecked: function(p_sType, p_aArgs, p_oItem) {
+
+ var bChecked = p_aArgs[0];
+ var oEl = this.element;
+ var oConfig = this.cfg;
+ var oImg;
+
+
+ if(bChecked) {
+
+ this._preloadImage(this.CHECKED_IMAGE_PATH);
+ this._preloadImage(this.SELECTED_CHECKED_IMAGE_PATH);
+ this._preloadImage(this.DISABLED_CHECKED_IMAGE_PATH);
+
+
+ oImg = document.createElement("img");
+ oImg.src = (this.imageRoot + this.CHECKED_IMAGE_PATH);
+ oImg.alt = this.CHECKED_IMAGE_ALT_TEXT;
+
+ var oSubmenu = this.cfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ oEl.insertBefore(oImg, oSubmenu.element);
+
+ }
+ else {
+
+ oEl.appendChild(oImg);
+
+ }
+
+
+ Dom.addClass([oEl, oImg], "checked");
+
+ this._checkImage = oImg;
+
+ if(oConfig.getProperty("disabled")) {
+
+ oConfig.refireEvent("disabled");
+
+ }
+
+ if(oConfig.getProperty("selected")) {
+
+ oConfig.refireEvent("selected");
+
+ }
+
+ }
+ else {
+
+ oImg = this._checkImage;
+
+ Dom.removeClass([oEl, oImg], "checked");
+
+ if(oImg) {
+
+ oEl.removeChild(oImg);
+
+ }
+
+ this._checkImage = null;
+
+ }
+
+ },
+
+
+
+ /**
+ * @method configDisabled
+ * @description Event handler for when the "disabled" configuration property
+ * of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configDisabled: function(p_sType, p_aArgs, p_oItem) {
+
+ var bDisabled = p_aArgs[0];
+ var oAnchor = this._oAnchor;
+ var aNodes = [this.element, oAnchor];
+ var oEM = this._oHelpTextEM;
+ var oConfig = this.cfg;
+ var oImg;
+ var sImgSrc;
+ var sImgAlt;
+
+
+ if(oEM) {
+
+ aNodes[2] = oEM;
+
+ }
+
+
+ if(this.cfg.getProperty("checked")) {
+
+ sImgAlt = this.CHECKED_IMAGE_ALT_TEXT;
+ sImgSrc = this.CHECKED_IMAGE_PATH;
+ oImg = this._checkImage;
+
+ if(bDisabled) {
+
+ sImgAlt = this.DISABLED_CHECKED_IMAGE_ALT_TEXT;
+ sImgSrc = this.DISABLED_CHECKED_IMAGE_PATH;
+
+ }
+
+ oImg.src = document.images[(this.imageRoot + sImgSrc)].src;
+ oImg.alt = sImgAlt;
+
+ }
+
+
+ oImg = this.submenuIndicator;
+
+ if(bDisabled) {
+
+ if(oConfig.getProperty("selected")) {
+
+ oConfig.setProperty("selected", false);
+
+ }
+
+ oAnchor.removeAttribute("href");
+
+ Dom.addClass(aNodes, "disabled");
+
+ sImgSrc = this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH;
+ sImgAlt = this.DISABLED_SUBMENU_INDICATOR_ALT_TEXT;
+
+ }
+ else {
+
+ oAnchor.setAttribute("href", oConfig.getProperty("url"));
+
+ Dom.removeClass(aNodes, "disabled");
+
+ sImgSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;
+ sImgAlt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
+
+ }
+
+
+ if(oImg) {
+
+ oImg.src = this.imageRoot + sImgSrc;
+ oImg.alt = sImgAlt;
+
+ }
+
+ },
+
+
+ /**
+ * @method configSelected
+ * @description Event handler for when the "selected" configuration property
+ * of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configSelected: function(p_sType, p_aArgs, p_oItem) {
+
+ if(!this.cfg.getProperty("disabled")) {
+
+ var bSelected = p_aArgs[0];
+ var oEM = this._oHelpTextEM;
+ var aNodes = [this.element, this._oAnchor];
+ var oImg = this.submenuIndicator;
+ var sImgSrc;
+
+
+ if(oEM) {
+
+ aNodes[aNodes.length] = oEM;
+
+ }
+
+ if(oImg) {
+
+ aNodes[aNodes.length] = oImg;
+
+ }
+
+
+ if(this.cfg.getProperty("checked")) {
+
+ sImgSrc = this.imageRoot + (bSelected ?
+ this.SELECTED_CHECKED_IMAGE_PATH : this.CHECKED_IMAGE_PATH);
+
+ this._checkImage.src = document.images[sImgSrc].src;
+
+ }
+
+
+ if(bSelected) {
+
+ Dom.addClass(aNodes, "selected");
+ sImgSrc = this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH;
+
+ }
+ else {
+
+ Dom.removeClass(aNodes, "selected");
+ sImgSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;
+
+ }
+
+ if(oImg) {
+
+ oImg.src = document.images[(this.imageRoot + sImgSrc)].src;
+
+ }
+
+ }
+
+ },
+
+
+ /**
+ * @method configSubmenu
+ * @description Event handler for when the "submenu" configuration property
+ * of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configSubmenu: function(p_sType, p_aArgs, p_oItem) {
+
+ var oEl = this.element;
+ var oSubmenu = p_aArgs[0];
+ var oImg = this.submenuIndicator;
+ var oConfig = this.cfg;
+ var aNodes = [this.element, this._oAnchor];
+ var oMenu;
+ var bLazyLoad = this.parent && this.parent.lazyLoad;
+
+
+ if(oSubmenu) {
+
+ if(oSubmenu instanceof Menu) {
+
+ oMenu = oSubmenu;
+ oMenu.parent = this;
+ oMenu.lazyLoad = bLazyLoad;
+
+ }
+ else if(
+ typeof oSubmenu == "object" &&
+ oSubmenu.id &&
+ !oSubmenu.nodeType
+ ) {
+
+ var sSubmenuId = oSubmenu.id;
+ var oSubmenuConfig = oSubmenu;
+
+ delete oSubmenu["id"];
+
+ oSubmenuConfig.lazyload = bLazyLoad;
+ oSubmenuConfig.parent = this;
+
+ oMenu = new this.SUBMENU_TYPE(sSubmenuId, oSubmenuConfig);
+
+
+ // Set the value of the property to the Menu instance
+
+ this.cfg.setProperty("submenu", oMenu, true);
+
+ }
+ else {
+
+ oMenu = new this.SUBMENU_TYPE(
+ oSubmenu,
+ { lazyload: bLazyLoad, parent: this }
+ );
+
+
+ // Set the value of the property to the Menu instance
+
+ this.cfg.setProperty("submenu", oMenu, true);
+
+ }
+
+
+ if(oMenu) {
+
+ this._oSubmenu = oMenu;
+
+
+ if(!oImg) {
+
+ this._preloadImage(this.SUBMENU_INDICATOR_IMAGE_PATH);
+ this._preloadImage(
+ this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
+ );
+
+ this._preloadImage(
+ this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
+ );
+
+ oImg = document.createElement("img");
+
+ oImg.src =
+ (this.imageRoot + this.SUBMENU_INDICATOR_IMAGE_PATH);
+
+ oImg.alt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
+
+ oEl.appendChild(oImg);
+
+ this.submenuIndicator = oImg;
+
+ Dom.addClass(aNodes, "hassubmenu");
+
+
+ if(oConfig.getProperty("disabled")) {
+
+ oConfig.refireEvent("disabled");
+
+ }
+
+ if(oConfig.getProperty("selected")) {
+
+ oConfig.refireEvent("selected");
+
+ }
+
+ }
+
+ }
+
+ }
+ else {
+
+ Dom.removeClass(aNodes, "hassubmenu");
+
+ if(oImg) {
+
+ oEl.removeChild(oImg);
+
+ }
+
+ if(this._oSubmenu) {
+
+ this._oSubmenu.destroy();
+
+ }
+
+ }
+
+ },
+
+
+ // Public methods
+
+ /**
+ * @method initDefaultConfig
+ * @description Initializes an item's configurable properties.
+ */
+ initDefaultConfig : function() {
+
+ var oConfig = this.cfg;
+ var CheckBoolean = oConfig.checkBoolean;
+
+
+ // Define the config properties
+
+ /**
+ * @config text
+ * @description String specifying the text label for the menu item.
+ * When building a menu from existing HTML the value of this property
+ * will be interpreted from the menu's markup.
+ * @default ""
+ * @type String
+ */
+ oConfig.addProperty(
+ "text",
+ {
+ value: "",
+ handler: this.configText,
+ validator: this._checkString,
+ suppressEvent: true
+ }
+ );
+
+
+ /**
+ * @config helptext
+ * @description String specifying additional instructional text to
+ * accompany the text for the nenu item.
+ * @default null
+ * @type String|
+ * HTMLElement
+ */
+ oConfig.addProperty("helptext", { handler: this.configHelpText });
+
+
+ /**
+ * @config url
+ * @description String specifying the URL for the menu item's anchor's
+ * "href" attribute. When building a menu from existing HTML the value
+ * of this property will be interpreted from the menu's markup.
+ * @default "#"
+ * @type String
+ */
+ oConfig.addProperty(
+ "url",
+ { value: "#", handler: this.configURL, suppressEvent: true }
+ );
+
+
+ /**
+ * @config target
+ * @description String specifying the value for the "target" attribute
+ * of the menu item's anchor element. Specifying a target will
+ * require the user to click directly on the menu item's anchor node in
+ * order to cause the browser to navigate to the specified URL.
+ * When building a menu from existing HTML the value of this property
+ * will be interpreted from the menu's markup.
+ * @default null
+ * @type String
+ */
+ oConfig.addProperty(
+ "target",
+ { handler: this.configTarget, suppressEvent: true }
+ );
+
+
+ /**
+ * @config emphasis
+ * @description Boolean indicating if the text of the menu item will be
+ * rendered with emphasis. When building a menu from existing HTML the
+ * value of this property will be interpreted from the menu's markup.
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "emphasis",
+ {
+ value: false,
+ handler: this.configEmphasis,
+ validator: CheckBoolean,
+ suppressEvent: true
+ }
+ );
+
+
+ /**
+ * @config strongemphasis
+ * @description Boolean indicating if the text of the menu item will be
+ * rendered with strong emphasis. When building a menu from existing
+ * HTML the value of this property will be interpreted from the
+ * menu's markup.
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "strongemphasis",
+ {
+ value: false,
+ handler: this.configStrongEmphasis,
+ validator: CheckBoolean,
+ suppressEvent: true
+ }
+ );
+
+
+ /**
+ * @config checked
+ * @description Boolean indicating if the menu item should be rendered
+ * with a checkmark.
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "checked",
+ {
+ value: false,
+ handler: this.configChecked,
+ validator: this.cfg.checkBoolean,
+ suppressEvent: true,
+ supercedes:["disabled"]
+ }
+ );
+
+
+ /**
+ * @config disabled
+ * @description Boolean indicating if the menu item should be disabled.
+ * (Disabled menu items are dimmed and will not respond to user input
+ * or fire events.)
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "disabled",
+ {
+ value: false,
+ handler: this.configDisabled,
+ validator: CheckBoolean,
+ suppressEvent: true
+ }
+ );
+
+
+ /**
+ * @config selected
+ * @description Boolean indicating if the menu item should
+ * be highlighted.
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "selected",
+ {
+ value: false,
+ handler: this.configSelected,
+ validator: CheckBoolean,
+ suppressEvent: true
+ }
+ );
+
+
+ /**
+ * @config submenu
+ * @description Object specifying the submenu to be appended to the
+ * menu item. The value can be one of the following: Object
+ * specifying a Menu instance. Object literal specifying the
+ * menu to be created. Format: { id: [menu id], itemdata:
+ * [array of values for
+ * items ] }. String specifying the id attribute
+ * of the <div> element of the menu.
+ * Object specifying the <div> element of the
+ * menu.
+ * @default null
+ * @type Menu|String|Object|
+ * HTMLElement
+ */
+ oConfig.addProperty("submenu", { handler: this.configSubmenu });
+
+ },
+
+
+ /**
+ * @method getNextEnabledSibling
+ * @description Finds the menu item's next enabled sibling.
+ * @return YAHOO.widget.MenuItem
+ */
+ getNextEnabledSibling: function() {
+
+ if(this.parent instanceof Menu) {
+
+ var nGroupIndex = this.groupIndex;
+
+ /**
+ * Finds the next item in an array.
+ * @private
+ * @param {p_aArray} Array to search.
+ * @param {p_nStartIndex} Number indicating the index to
+ * start searching the array.
+ * @return {Object}
+ */
+ var getNextArrayItem = function(p_aArray, p_nStartIndex) {
+
+ return p_aArray[p_nStartIndex] ||
+ getNextArrayItem(p_aArray, (p_nStartIndex+1));
+
+ };
+
+
+ var aItemGroups = this.parent.getItemGroups();
+ var oNextItem;
+
+
+ if(this.index < (aItemGroups[nGroupIndex].length - 1)) {
+
+ oNextItem = getNextArrayItem(
+ aItemGroups[nGroupIndex],
+ (this.index+1)
+ );
+
+ }
+ else {
+
+ var nNextGroupIndex;
+
+ if(nGroupIndex < (aItemGroups.length - 1)) {
+
+ nNextGroupIndex = nGroupIndex + 1;
+
+ }
+ else {
+
+ nNextGroupIndex = 0;
+
+ }
+
+ var aNextGroup = getNextArrayItem(aItemGroups, nNextGroupIndex);
+
+ // Retrieve the first menu item in the next group
+
+ oNextItem = getNextArrayItem(aNextGroup, 0);
+
+ }
+
+ return (
+ oNextItem.cfg.getProperty("disabled") ||
+ oNextItem.element.style.display == "none"
+ ) ?
+ oNextItem.getNextEnabledSibling() : oNextItem;
+
+ }
+
+ },
+
+
+ /**
+ * @method getPreviousEnabledSibling
+ * @description Finds the menu item's previous enabled sibling.
+ * @return {YAHOO.widget.MenuItem}
+ */
+ getPreviousEnabledSibling: function() {
+
+ if(this.parent instanceof Menu) {
+
+ var nGroupIndex = this.groupIndex;
+
+ /**
+ * Returns the previous item in an array
+ * @private
+ * @param {p_aArray} Array to search.
+ * @param {p_nStartIndex} Number indicating the index to
+ * start searching the array.
+ * @return {Object}
+ */
+ var getPreviousArrayItem = function(p_aArray, p_nStartIndex) {
+
+ return p_aArray[p_nStartIndex] ||
+ getPreviousArrayItem(p_aArray, (p_nStartIndex-1));
+
+ };
+
+
+ /**
+ * Get the index of the first item in an array
+ * @private
+ * @param {p_aArray} Array to search.
+ * @param {p_nStartIndex} Number indicating the index to
+ * start searching the array.
+ * @return {Object}
+ */
+ var getFirstItemIndex = function(p_aArray, p_nStartIndex) {
+
+ return p_aArray[p_nStartIndex] ?
+ p_nStartIndex :
+ getFirstItemIndex(p_aArray, (p_nStartIndex+1));
+
+ };
+
+ var aItemGroups = this.parent.getItemGroups();
+ var oPreviousItem;
+
+ if(
+ this.index > getFirstItemIndex(aItemGroups[nGroupIndex], 0)
+ ) {
+
+ oPreviousItem =
+ getPreviousArrayItem(
+ aItemGroups[nGroupIndex],
+ (this.index-1)
+ );
+
+ }
+ else {
+
+ var nPreviousGroupIndex;
+
+ if(nGroupIndex > getFirstItemIndex(aItemGroups, 0)) {
+
+ nPreviousGroupIndex = nGroupIndex - 1;
+
+ }
+ else {
+
+ nPreviousGroupIndex = aItemGroups.length - 1;
+
+ }
+
+ var aPreviousGroup =
+ getPreviousArrayItem(aItemGroups, nPreviousGroupIndex);
+
+ oPreviousItem =
+ getPreviousArrayItem(
+ aPreviousGroup,
+ (aPreviousGroup.length - 1)
+ );
+
+ }
+
+ return (
+ oPreviousItem.cfg.getProperty("disabled") ||
+ oPreviousItem.element.style.display == "none"
+ ) ?
+ oPreviousItem.getPreviousEnabledSibling() : oPreviousItem;
+
+ }
+
+ },
+
+
+ /**
+ * @method focus
+ * @description Causes the menu item to receive the focus and fires the
+ * focus event.
+ */
+ focus: function() {
+
+ var oParent = this.parent;
+ var oAnchor = this._oAnchor;
+ var oActiveItem = oParent.activeItem;
+
+ if(
+ !this.cfg.getProperty("disabled") &&
+ oParent &&
+ oParent.cfg.getProperty("visible") &&
+ this.element.style.display != "none"
+ ) {
+
+ if(oActiveItem) {
+
+ oActiveItem.blur();
+
+ }
+
+ try {
+
+ oAnchor.focus();
+
+ }
+ catch(e) {
+
+ }
+
+ this.focusEvent.fire();
+
+ }
+
+ },
+
+
+ /**
+ * @method blur
+ * @description Causes the menu item to lose focus and fires the
+ * onblur event.
+ */
+ blur: function() {
+
+ var oParent = this.parent;
+
+ if(
+ !this.cfg.getProperty("disabled") &&
+ oParent &&
+ Dom.getStyle(oParent.element, "visibility") == "visible"
+ ) {
+
+ this._oAnchor.blur();
+
+ this.blurEvent.fire();
+
+ }
+
+ },
+
+
+ /**
+ * @method destroy
+ * @description Removes the menu item's <li> element
+ * from its parent <ul> element.
+ */
+ destroy: function() {
+
+ var oEl = this.element;
+
+ if(oEl) {
+
+ // Remove CustomEvent listeners
+
+ this.mouseOverEvent.unsubscribeAll();
+ this.mouseOutEvent.unsubscribeAll();
+ this.mouseDownEvent.unsubscribeAll();
+ this.mouseUpEvent.unsubscribeAll();
+ this.clickEvent.unsubscribeAll();
+ this.keyPressEvent.unsubscribeAll();
+ this.keyDownEvent.unsubscribeAll();
+ this.keyUpEvent.unsubscribeAll();
+ this.focusEvent.unsubscribeAll();
+ this.blurEvent.unsubscribeAll();
+ this.cfg.configChangedEvent.unsubscribeAll();
+
+
+ // Remove the element from the parent node
+
+ var oParentNode = oEl.parentNode;
+
+ if(oParentNode) {
+
+ oParentNode.removeChild(oEl);
+
+ this.destroyEvent.fire();
+
+ }
+
+ this.destroyEvent.unsubscribeAll();
+
+ }
+
+ },
+
+
+ /**
+ * @method toString
+ * @description Returns a string representing the menu item.
+ * @return {String}
+ */
+ toString: function() {
+
+ return ("MenuItem: " + this.cfg.getProperty("text"));
+
+ }
+
+};
+
+})();
+
+
+/**
+* Creates an item for a menu module.
+*
+* @param {String} p_oObject String specifying the text of the menu module item.
+* @param {HTMLLIElement } p_oObject Object specifying the
+* <li> element of the menu module item.
+* @param {HTMLOptGroupElement } p_oObject Object specifying
+* the <optgroup> element of the menu module item.
+* @param {HTMLOptionElement } p_oObject Object specifying the
+* <option> element of the menu module item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu module item. See configuration class documentation
+* for more details.
+* @class MenuModuleItem
+* @constructor
+* @deprecated As of version 0.12, all MenuModuleItem functionality has been
+* implemented directly in YAHOO.widget.MenuItem, making YAHOO.widget.MenuItem
+* the base class for all menu items.
+*/
+YAHOO.widget.MenuModuleItem = YAHOO.widget.MenuItem;
+
+
+/**
+* Creates a list of options or commands which are made visible in response to
+* an HTML element's "contextmenu" event ("mousedown" for Opera).
+*
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the context menu.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source for the
+* context menu.
+* @param {HTMLDivElement } p_oElement Object specifying the
+* <div> element of the context menu.
+* @param {HTMLSelectElement } p_oElement Object specifying
+* the <select> element to be used as the data source for
+* the context menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the context menu. See configuration class documentation
+* for more details.
+* @class ContextMenu
+* @constructor
+* @extends YAHOO.widget.Menu
+* @namespace YAHOO.widget
+*/
+YAHOO.widget.ContextMenu = function(p_oElement, p_oConfig) {
+
+ YAHOO.widget.ContextMenu.superclass.constructor.call(
+ this,
+ p_oElement,
+ p_oConfig
+ );
+
+};
+
+
+YAHOO.extend(YAHOO.widget.ContextMenu, YAHOO.widget.Menu, {
+
+
+
+// Private properties
+
+
+/**
+* @property _oTrigger
+* @description Object reference to the current value of the "trigger"
+* configuration property.
+* @default null
+* @private
+* @type String|HTMLElement |Array
+*/
+_oTrigger: null,
+
+
+
+// Public properties
+
+
+/**
+* @property contextEventTarget
+* @description Object reference for the HTML element that was the target of the
+* "contextmenu" DOM event ("mousedown" for Opera) that triggered the display of
+* the context menu.
+* @default null
+* @type HTMLElement
+*/
+contextEventTarget: null,
+
+
+/**
+* @method init
+* @description The ContextMenu class's initialization method. This method is
+* automatically called by the constructor, and sets up all DOM references for
+* pre-existing markup, and creates required markup if it is not already present.
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the context menu.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source for
+* the context menu.
+* @param {HTMLDivElement } p_oElement Object specifying the
+* <div> element of the context menu.
+* @param {HTMLSelectElement } p_oElement Object specifying
+* the <select> element to be used as the data source for
+* the context menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the context menu. See configuration class documentation
+* for more details.
+*/
+init: function(p_oElement, p_oConfig) {
+
+ if(!this.ITEM_TYPE) {
+
+ this.ITEM_TYPE = YAHOO.widget.ContextMenuItem;
+
+ }
+
+
+ // Call the init of the superclass (YAHOO.widget.Menu)
+
+ YAHOO.widget.ContextMenu.superclass.init.call(this, p_oElement);
+
+
+ this.beforeInitEvent.fire(YAHOO.widget.ContextMenu);
+
+
+ if(p_oConfig) {
+
+ this.cfg.applyConfig(p_oConfig, true);
+
+ }
+
+
+ this.initEvent.fire(YAHOO.widget.ContextMenu);
+
+},
+
+
+
+// Private methods
+
+
+/**
+* @method _removeEventHandlers
+* @description Removes all of the DOM event handlers from the HTML element(s)
+* whose "context menu" event ("click" for Opera) trigger the display of
+* the context menu.
+* @private
+*/
+_removeEventHandlers: function() {
+
+ var Event = YAHOO.util.Event;
+ var oTrigger = this._oTrigger;
+ var bOpera = (this.browser == "opera");
+
+
+ // Remove the event handlers from the trigger(s)
+
+ Event.removeListener(
+ oTrigger,
+ (bOpera ? "mousedown" : "contextmenu"),
+ this._onTriggerContextMenu
+ );
+
+ if(bOpera) {
+
+ Event.removeListener(oTrigger, "click", this._onTriggerClick);
+
+ }
+
+},
+
+
+
+// Private event handlers
+
+
+/**
+* @method _onTriggerClick
+* @description "click" event handler for the HTML element(s) identified as the
+* "trigger" for the context menu. Used to cancel default behaviors in Opera.
+* @private
+* @param {Event} p_oEvent Object representing the DOM event object passed back
+* by the event utility (YAHOO.util.Event).
+* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
+* menu that is handling the event.
+*/
+_onTriggerClick: function(p_oEvent, p_oMenu) {
+
+ if(p_oEvent.ctrlKey) {
+
+ YAHOO.util.Event.stopEvent(p_oEvent);
+
+ }
+
+},
+
+
+/**
+* @method _onTriggerContextMenu
+* @description "contextmenu" event handler ("mousedown" for Opera) for the HTML
+* element(s) that trigger the display of the context menu.
+* @private
+* @param {Event} p_oEvent Object representing the DOM event object passed back
+* by the event utility (YAHOO.util.Event).
+* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
+* menu that is handling the event.
+*/
+_onTriggerContextMenu: function(p_oEvent, p_oMenu) {
+
+ // Hide any other ContextMenu instances that might be visible
+
+ YAHOO.widget.MenuManager.hideVisible();
+
+
+ var Event = YAHOO.util.Event;
+ var oConfig = this.cfg;
+
+ if(p_oEvent.type == "mousedown" && !p_oEvent.ctrlKey) {
+
+ return;
+
+ }
+
+ this.contextEventTarget = Event.getTarget(p_oEvent);
+
+
+ // Position and display the context menu
+
+ var nX = Event.getPageX(p_oEvent);
+ var nY = Event.getPageY(p_oEvent);
+
+
+ oConfig.applyConfig( { xy:[nX, nY], visible:true } );
+ oConfig.fireQueue();
+
+
+ /*
+ Prevent the browser's default context menu from appearing and
+ stop the propagation of the "contextmenu" event so that
+ other ContextMenu instances are not displayed.
+ */
+
+ Event.stopEvent(p_oEvent);
+
+},
+
+
+
+// Public methods
+
+
+/**
+* @method toString
+* @description Returns a string representing the context menu.
+* @return {String}
+*/
+toString: function() {
+
+ return ("ContextMenu " + this.id);
+
+},
+
+
+/**
+* @method initDefaultConfig
+* @description Initializes the class's configurable properties which can be
+* changed using the context menu's Config object ("cfg").
+*/
+initDefaultConfig: function() {
+
+ YAHOO.widget.ContextMenu.superclass.initDefaultConfig.call(this);
+
+ /**
+ * @config trigger
+ * @description The HTML element(s) whose "contextmenu" event ("mousedown"
+ * for Opera) trigger the display of the context menu. Can be a string
+ * representing the id attribute of the HTML element, an object reference
+ * for the HTML element, or an array of strings or HTML element references.
+ * @default null
+ * @type String|HTMLElement |Array
+ */
+ this.cfg.addProperty("trigger", { handler: this.configTrigger });
+
+},
+
+
+/**
+* @method destroy
+* @description Removes the context menu's <div> element
+* (and accompanying child nodes) from the document.
+*/
+destroy: function() {
+
+ // Remove the DOM event handlers from the current trigger(s)
+
+ this._removeEventHandlers();
+
+
+ // Continue with the superclass implementation of this method
+
+ YAHOO.widget.ContextMenu.superclass.destroy.call(this);
+
+},
+
+
+
+// Public event handlers for configuration properties
+
+
+/**
+* @method configTrigger
+* @description Event handler for when the value of the "trigger" configuration
+* property changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
+* menu that fired the event.
+*/
+configTrigger: function(p_sType, p_aArgs, p_oMenu) {
+
+ var Event = YAHOO.util.Event;
+ var oTrigger = p_aArgs[0];
+
+ if(oTrigger) {
+
+ /*
+ If there is a current "trigger" - remove the event handlers
+ from that element(s) before assigning new ones
+ */
+
+ if(this._oTrigger) {
+
+ this._removeEventHandlers();
+
+ }
+
+ this._oTrigger = oTrigger;
+
+
+ /*
+ Listen for the "mousedown" event in Opera b/c it does not
+ support the "contextmenu" event
+ */
+
+ var bOpera = (this.browser == "opera");
+
+ Event.addListener(
+ oTrigger,
+ (bOpera ? "mousedown" : "contextmenu"),
+ this._onTriggerContextMenu,
+ this,
+ true
+ );
+
+
+ /*
+ Assign a "click" event handler to the trigger element(s) for
+ Opera to prevent default browser behaviors.
+ */
+
+ if(bOpera) {
+
+ Event.addListener(
+ oTrigger,
+ "click",
+ this._onTriggerClick,
+ this,
+ true
+ );
+
+ }
+
+ }
+ else {
+
+ this._removeEventHandlers();
+
+ }
+
+}
+
+}); // END YAHOO.extend
+
+
+/**
+* Creates an item for a context menu.
+*
+* @param {String} p_oObject String specifying the text of the context menu item.
+* @param {HTMLLIElement } p_oObject Object specifying the
+* <li> element of the context menu item.
+* @param {HTMLOptGroupElement } p_oObject Object
+* specifying the <optgroup> element of the context
+* menu item.
+* @param {HTMLOptionElement } p_oObject Object specifying
+* the <option> element of the context menu item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the context menu item. See configuration class
+* documentation for more details.
+* @class ContextMenuItem
+* @constructor
+* @extends YAHOO.widget.MenuItem
+*/
+YAHOO.widget.ContextMenuItem = function(p_oObject, p_oConfig) {
+
+ YAHOO.widget.ContextMenuItem.superclass.constructor.call(
+ this,
+ p_oObject,
+ p_oConfig
+ );
+
+};
+
+YAHOO.extend(YAHOO.widget.ContextMenuItem, YAHOO.widget.MenuItem, {
+
+
+/**
+* @method init
+* @description The ContextMenuItem class's initialization method. This method
+* is automatically called by the constructor, and sets up all DOM references
+* for pre-existing markup, and creates required markup if it is not
+* already present.
+* @param {String} p_oObject String specifying the text of the context menu item.
+* @param {HTMLLIElement } p_oObject Object specifying the
+* <li> element of the context menu item.
+* @param {HTMLOptGroupElement } p_oObject Object
+* specifying the <optgroup> element of the context
+* menu item.
+* @param {HTMLOptionElement } p_oObject Object specifying
+* the <option> element of the context menu item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the context menu item. See configuration class
+* documentation for more details.
+*/
+init: function(p_oObject, p_oConfig) {
+
+ if(!this.SUBMENU_TYPE) {
+
+ this.SUBMENU_TYPE = YAHOO.widget.ContextMenu;
+
+ }
+
+
+ /*
+ Call the init of the superclass (YAHOO.widget.MenuItem)
+ Note: We don't pass the user config in here yet
+ because we only want it executed once, at the lowest
+ subclass level.
+ */
+
+ YAHOO.widget.ContextMenuItem.superclass.init.call(this, p_oObject);
+
+ var oConfig = this.cfg;
+
+ if(p_oConfig) {
+
+ oConfig.applyConfig(p_oConfig, true);
+
+ }
+
+ oConfig.fireQueue();
+
+},
+
+
+
+// Public methods
+
+
+/**
+* @method toString
+* @description Returns a string representing the context menu item.
+* @return {String}
+*/
+toString: function() {
+
+ return ("MenuBarItem: " + this.cfg.getProperty("text"));
+
+}
+
+}); // END YAHOO.extend
+
+
+/**
+* Horizontal collection of items, each of which can contain a submenu.
+*
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the menu bar.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source for the
+* menu bar.
+* @param {HTMLDivElement } p_oElement Object specifying
+* the <div> element of the menu bar.
+* @param {HTMLSelectElement } p_oElement Object
+* specifying the <select> element to be used as the data
+* source for the menu bar.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu bar. See configuration class documentation for
+* more details.
+* @class Menubar
+* @constructor
+* @extends YAHOO.widget.Menu
+* @namespace YAHOO.widget
+*/
+YAHOO.widget.MenuBar = function(p_oElement, p_oConfig) {
+
+ YAHOO.widget.MenuBar.superclass.constructor.call(
+ this,
+ p_oElement,
+ p_oConfig
+ );
+
+};
+
+YAHOO.extend(YAHOO.widget.MenuBar, YAHOO.widget.Menu, {
+
+/**
+* @method init
+* @description The MenuBar class's initialization method. This method is
+* automatically called by the constructor, and sets up all DOM references for
+* pre-existing markup, and creates required markup if it is not already present.
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the menu bar.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source for the
+* menu bar.
+* @param {HTMLDivElement } p_oElement Object specifying
+* the <div> element of the menu bar.
+* @param {HTMLSelectElement } p_oElement Object
+* specifying the <select> element to be used as the data
+* source for the menu bar.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu bar. See configuration class documentation for
+* more details.
+*/
+init: function(p_oElement, p_oConfig) {
+
+ if(!this.ITEM_TYPE) {
+
+ this.ITEM_TYPE = YAHOO.widget.MenuBarItem;
+
+ }
+
+
+ // Call the init of the superclass (YAHOO.widget.Menu)
+
+ YAHOO.widget.MenuBar.superclass.init.call(this, p_oElement);
+
+
+ this.beforeInitEvent.fire(YAHOO.widget.MenuBar);
+
+
+ if(p_oConfig) {
+
+ this.cfg.applyConfig(p_oConfig, true);
+
+ }
+
+ this.initEvent.fire(YAHOO.widget.MenuBar);
+
+},
+
+
+
+// Constants
+
+
+/**
+* @property CSS_CLASS_NAME
+* @description String representing the CSS class(es) to be applied to the menu
+* bar's <div> element.
+* @default "yuimenubar"
+* @final
+* @type String
+*/
+CSS_CLASS_NAME: "yuimenubar",
+
+
+
+// Protected event handlers
+
+
+/**
+* @method _onKeyDown
+* @description "keydown" Custom Event handler for the menu bar.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.MenuBar} p_oMenuBar Object representing the menu bar
+* that fired the event.
+*/
+_onKeyDown: function(p_sType, p_aArgs, p_oMenuBar) {
+
+ var Event = YAHOO.util.Event;
+ var oEvent = p_aArgs[0];
+ var oItem = p_aArgs[1];
+ var oItemCfg = oItem.cfg;
+ var oSubmenu;
+
+
+ switch(oEvent.keyCode) {
+
+ case 27: // Esc key
+
+ if(this.cfg.getProperty("position") == "dynamic") {
+
+ this.hide();
+
+ if(this.parent) {
+
+ this.parent.focus();
+
+ }
+
+ }
+ else if(this.activeItem) {
+
+ oSubmenu = this.activeItem.cfg.getProperty("submenu");
+
+ if(oSubmenu && oSubmenu.cfg.getProperty("visible")) {
+
+ oSubmenu.hide();
+ this.activeItem.focus();
+
+ }
+ else {
+
+ this.activeItem.cfg.setProperty("selected", false);
+ this.activeItem.blur();
+
+ }
+
+ }
+
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+ case 37: // Left arrow
+ case 39: // Right arrow
+
+ if(
+ oItem == this.activeItem &&
+ !oItemCfg.getProperty("selected")
+ ) {
+
+ oItemCfg.setProperty("selected", true);
+
+ }
+ else {
+
+ var oNextItem = (oEvent.keyCode == 37) ?
+ oItem.getPreviousEnabledSibling() :
+ oItem.getNextEnabledSibling();
+
+ if(oNextItem) {
+
+ this.clearActiveItem();
+
+ oNextItem.cfg.setProperty("selected", true);
+
+
+ if(this.cfg.getProperty("autosubmenudisplay")) {
+
+ oSubmenu = oNextItem.cfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ oSubmenu.show();
+ oSubmenu.activeItem.blur();
+ oSubmenu.activeItem = null;
+
+ }
+
+ }
+
+ oNextItem.focus();
+
+ }
+
+ }
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+ case 40: // Down arrow
+
+ if(this.activeItem != oItem) {
+
+ this.clearActiveItem();
+
+ oItemCfg.setProperty("selected", true);
+ oItem.focus();
+
+ }
+
+ oSubmenu = oItemCfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ if(oSubmenu.cfg.getProperty("visible")) {
+
+ oSubmenu.setInitialSelection();
+ oSubmenu.setInitialFocus();
+
+ }
+ else {
+
+ oSubmenu.show();
+
+ }
+
+ }
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+ }
+
+},
+
+
+/**
+* @method _onClick
+* @description "click" event handler for the menu bar.
+* @protected
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.MenuBar} p_oMenuBar Object representing the menu bar
+* that fired the event.
+*/
+_onClick: function(p_sType, p_aArgs, p_oMenuBar) {
+
+ YAHOO.widget.MenuBar.superclass._onClick.call(
+ this,
+ p_sType,
+ p_aArgs,
+ p_oMenuBar
+ );
+
+
+ var oItem = p_aArgs[1];
+
+ if(oItem) {
+
+ var Event = YAHOO.util.Event;
+ var Dom = YAHOO.util.Dom;
+
+ var oEvent = p_aArgs[0];
+ var oTarget = Event.getTarget(oEvent);
+
+ var oActiveItem = this.activeItem;
+ var oConfig = this.cfg;
+
+
+ // Hide any other submenus that might be visible
+
+ if(oActiveItem && oActiveItem != oItem) {
+
+ this.clearActiveItem();
+
+ }
+
+
+ // Select and focus the current item
+
+ oItem.cfg.setProperty("selected", true);
+ oItem.focus();
+
+
+ // Show the submenu for the item
+
+ var oSubmenu = oItem.cfg.getProperty("submenu");
+
+
+ if(oSubmenu && oTarget != oItem.submenuIndicator) {
+
+ if(oSubmenu.cfg.getProperty("visible")) {
+
+ oSubmenu.hide();
+
+ }
+ else {
+
+ oSubmenu.show();
+
+ }
+
+ }
+
+ }
+
+},
+
+
+
+// Public methods
+
+
+/**
+* @method toString
+* @description Returns a string representing the menu bar.
+* @return {String}
+*/
+toString: function() {
+
+ return ("MenuBar " + this.id);
+
+},
+
+
+/**
+* @description Initializes the class's configurable properties which can be
+* changed using the menu bar's Config object ("cfg").
+* @method initDefaultConfig
+*/
+initDefaultConfig: function() {
+
+ YAHOO.widget.MenuBar.superclass.initDefaultConfig.call(this);
+
+ var oConfig = this.cfg;
+
+ // Add configuration properties
+
+
+ /*
+ Set the default value for the "position" configuration property
+ to "static" by re-adding the property.
+ */
+
+ /**
+ * @config position
+ * @description String indicating how a menu bar should be positioned on the
+ * screen. Possible values are "static" and "dynamic." Static menu bars
+ * are visible by default and reside in the normal flow of the document
+ * (CSS position: static). Dynamic menu bars are hidden by default, reside
+ * out of the normal flow of the document (CSS position: absolute), and can
+ * overlay other elements on the screen.
+ * @default static
+ * @type String
+ */
+ oConfig.addProperty(
+ "position",
+ {
+ value: "static",
+ handler: this.configPosition,
+ validator: this._checkPosition,
+ supercedes: ["visible"]
+ }
+ );
+
+
+ /*
+ Set the default value for the "submenualignment" configuration property
+ to ["tl","bl"] by re-adding the property.
+ */
+
+ /**
+ * @config submenualignment
+ * @description Array defining how submenus should be aligned to their
+ * parent menu bar item. The format is: [itemCorner, submenuCorner].
+ * @default ["tl","bl"]
+ * @type Array
+ */
+ oConfig.addProperty("submenualignment", { value: ["tl","bl"] } );
+
+
+ /*
+ Change the default value for the "autosubmenudisplay" configuration
+ property to "false" by re-adding the property.
+ */
+
+ /**
+ * @config autosubmenudisplay
+ * @description Boolean indicating if submenus are automatically made
+ * visible when the user mouses over the menu bar's items.
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "autosubmenudisplay",
+ { value: false, validator: oConfig.checkBoolean }
+ );
+
+}
+
+}); // END YAHOO.extend
+
+
+/**
+* Creates an item for a menu bar.
+*
+* @param {String} p_oObject String specifying the text of the menu bar item.
+* @param {HTMLLIElement } p_oObject Object specifying the
+* <li> element of the menu bar item.
+* @param {HTMLOptGroupElement } p_oObject Object
+* specifying the <optgroup> element of the menu bar item.
+* @param {HTMLOptionElement } p_oObject Object specifying
+* the <option> element of the menu bar item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu bar item. See configuration class documentation
+* for more details.
+* @class MenuBarItem
+* @constructor
+* @extends YAHOO.widget.MenuItem
+*/
+YAHOO.widget.MenuBarItem = function(p_oObject, p_oConfig) {
+
+ YAHOO.widget.MenuBarItem.superclass.constructor.call(
+ this,
+ p_oObject,
+ p_oConfig
+ );
+
+};
+
+YAHOO.extend(YAHOO.widget.MenuBarItem, YAHOO.widget.MenuItem, {
+
+
+/**
+* @method init
+* @description The MenuBarItem class's initialization method. This method is
+* automatically called by the constructor, and sets up all DOM references for
+* pre-existing markup, and creates required markup if it is not already present.
+* @param {String} p_oObject String specifying the text of the menu bar item.
+* @param {HTMLLIElement } p_oObject Object specifying the
+* <li> element of the menu bar item.
+* @param {HTMLOptGroupElement } p_oObject Object
+* specifying the <optgroup> element of the menu bar item.
+* @param {HTMLOptionElement } p_oObject Object specifying
+* the <option> element of the menu bar item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu bar item. See configuration class documentation
+* for more details.
+*/
+init: function(p_oObject, p_oConfig) {
+
+ if(!this.SUBMENU_TYPE) {
+
+ this.SUBMENU_TYPE = YAHOO.widget.Menu;
+
+ }
+
+
+ /*
+ Call the init of the superclass (YAHOO.widget.MenuItem)
+ Note: We don't pass the user config in here yet
+ because we only want it executed once, at the lowest
+ subclass level.
+ */
+
+ YAHOO.widget.MenuBarItem.superclass.init.call(this, p_oObject);
+
+
+ var oConfig = this.cfg;
+
+ if(p_oConfig) {
+
+ oConfig.applyConfig(p_oConfig, true);
+
+ }
+
+ oConfig.fireQueue();
+
+},
+
+
+
+// Constants
+
+/**
+* @property CSS_CLASS_NAME
+* @description String representing the CSS class(es) to be applied to the
+* <li> element of the menu bar item.
+* @default "yuimenubaritem"
+* @final
+* @type String
+*/
+CSS_CLASS_NAME: "yuimenubaritem",
+
+
+/**
+* @property SUBMENU_INDICATOR_IMAGE_PATH
+* @description String representing the path to the image to be used for the
+* menu bar item's submenu arrow indicator.
+* @default "nt/ic/ut/alt1/menuarodwn8_nrm_1.gif"
+* @final
+* @type String
+*/
+SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_nrm_1.gif",
+
+
+/**
+* @property SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
+* @description String representing the path to the image to be used for the
+* submenu arrow indicator when the menu bar item is selected.
+* @default "nt/ic/ut/alt1/menuarodwn8_hov_1.gif"
+* @final
+* @type String
+*/
+SELECTED_SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_hov_1.gif",
+
+
+/**
+* @property DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
+* @description String representing the path to the image to be used for the
+* submenu arrow indicator when the menu bar item is disabled.
+* @default "nt/ic/ut/alt1/menuarodwn8_dim_1.gif"
+* @final
+* @type String
+*/
+DISABLED_SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_dim_1.gif",
+
+
+
+// Public methods
+
+
+/**
+* @method toString
+* @description Returns a string representing the menu bar item.
+* @return {String}
+*/
+toString: function() {
+
+ return ("MenuBarItem: " + this.cfg.getProperty("text"));
+
+}
+
}); // END YAHOO.extend
\ No newline at end of file
diff --git a/thirdpartyjs/yui/menu/menu.js b/thirdpartyjs/yui/menu/menu.js
index 48956e7..fa1986c 100644
--- a/thirdpartyjs/yui/menu/menu.js
+++ b/thirdpartyjs/yui/menu/menu.js
@@ -1,6779 +1,6779 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.com/yui/license.txt
-version: 0.12.0
-*/
-
-/**
-* @module menu
-* @description The Menu Library features a collection of widgets that make
-* it easy to add menus to your website or web application. With the Menu
-* Library you can create website fly-out menus, customized context menus, or
-* application-style menu bars with just a small amount of scripting.
-*
-* Screen-reader accessibility.
-* Keyboard and mouse navigation.
-* A rich event model that provides access to all of a menu's
-* interesting moments.
-* Support for
-* Progressive
-* Enhancement ; Menus can be created from simple,
-* semantic markup on the page or purely through JavaScript.
-*
-* @title Menu Library
-* @namespace YAHOO.widget
-* @requires Event, Dom, Container
-*/
-(function() {
-
-var Dom = YAHOO.util.Dom;
-var Event = YAHOO.util.Event;
-
-/**
-* Singleton that manages a collection of all menus and menu items. Listens for
-* DOM events at the document level and dispatches the events to the
-* corresponding menu or menu item.
-*
-* @namespace YAHOO.widget
-* @class MenuManager
-* @static
-*/
-YAHOO.widget.MenuManager = new function() {
-
- // Private member variables
-
- // Flag indicating if the DOM event handlers have been attached
-
- var m_bInitializedEventHandlers = false;
-
- // Collection of menus
-
- var m_oMenus = {};
-
-
- // Collection of menu items
-
- var m_oItems = {};
-
- // Collection of visible menus
-
- var m_oVisibleMenus = {};
-
- // Logger
-
-
- // Private methods
-
- /**
- * Adds an item to the collection of known menu items.
- * @private
- * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem
- * instance to be added.
- */
- var addItem = function(p_oItem) {
-
- var sYUIId = Dom.generateId();
-
- if(p_oItem && m_oItems[sYUIId] != p_oItem) {
-
- p_oItem.element.setAttribute("yuiid", sYUIId);
-
- m_oItems[sYUIId] = p_oItem;
-
- p_oItem.destroyEvent.subscribe(onItemDestroy, p_oItem);
-
-
- }
-
- };
-
- /**
- * Removes an item from the collection of known menu items.
- * @private
- * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem
- * instance to be removed.
- */
- var removeItem = function(p_oItem) {
-
- var sYUIId = p_oItem.element.getAttribute("yuiid");
-
- if(sYUIId && m_oItems[sYUIId]) {
-
- delete m_oItems[sYUIId];
-
-
- }
-
- };
-
- /**
- * Finds the root DIV node of a menu or the root LI node of a menu item.
- * @private
- * @param {HTMLElement } p_oElement Object specifying
- * an HTML element.
- */
- var getMenuRootElement = function(p_oElement) {
-
- var oParentNode;
-
- if(p_oElement && p_oElement.tagName) {
-
- switch(p_oElement.tagName.toUpperCase()) {
-
- case "DIV":
-
- oParentNode = p_oElement.parentNode;
-
- // Check if the DIV is the inner "body" node of a menu
-
- if(
- Dom.hasClass(p_oElement, "bd") &&
- oParentNode &&
- oParentNode.tagName &&
- oParentNode.tagName.toUpperCase() == "DIV"
- ) {
-
- return oParentNode;
-
- }
- else {
-
- return p_oElement;
-
- }
-
- break;
-
- case "LI":
-
- return p_oElement;
-
- default:
-
- oParentNode = p_oElement.parentNode;
-
- if(oParentNode) {
-
- return getMenuRootElement(oParentNode);
-
- }
-
- break;
-
- }
-
- }
-
- };
-
- // Private event handlers
-
- /**
- * Generic, global event handler for all of a menu's DOM-based
- * events. This listens for events against the document object. If the
- * target of a given event is a member of a menu or menu item's DOM, the
- * instance's corresponding Custom Event is fired.
- * @private
- * @param {Event} p_oEvent Object representing the DOM event object passed
- * back by the event utility (YAHOO.util.Event).
- */
- var onDOMEvent = function(p_oEvent) {
-
- // Get the target node of the DOM event
-
- var oTarget = Event.getTarget(p_oEvent);
-
- // See if the target of the event was a menu, or a menu item
-
- var oElement = getMenuRootElement(oTarget);
-
- var oMenuItem;
- var oMenu;
-
- if(oElement) {
-
- var sTagName = oElement.tagName.toUpperCase();
-
- if(sTagName == "LI") {
-
- var sYUIId = oElement.getAttribute("yuiid");
-
- if(sYUIId) {
-
- oMenuItem = m_oItems[sYUIId];
- oMenu = oMenuItem.parent;
-
- }
-
- }
- else if(sTagName == "DIV") {
-
- if(oElement.id) {
-
- oMenu = m_oMenus[oElement.id];
-
- }
-
- }
-
- }
-
- if(oMenu) {
-
- // Map of DOM event names to CustomEvent names
-
- var oEventTypes = {
- "click": "clickEvent",
- "mousedown": "mouseDownEvent",
- "mouseup": "mouseUpEvent",
- "mouseover": "mouseOverEvent",
- "mouseout": "mouseOutEvent",
- "keydown": "keyDownEvent",
- "keyup": "keyUpEvent",
- "keypress": "keyPressEvent"
- };
-
- var sCustomEventType = oEventTypes[p_oEvent.type];
-
- // Fire the Custom Even that corresponds the current DOM event
-
- if(oMenuItem && !oMenuItem.cfg.getProperty("disabled")) {
-
- oMenuItem[sCustomEventType].fire(p_oEvent);
-
- }
-
- oMenu[sCustomEventType].fire(p_oEvent, oMenuItem);
-
- }
- else if(p_oEvent.type == "mousedown") {
-
- /*
- If the target of the event wasn't a menu, hide all
- dynamically positioned menus
- */
-
- var oActiveItem;
-
- for(var i in m_oMenus) {
-
- if(m_oMenus.hasOwnProperty(i)) {
-
- oMenu = m_oMenus[i];
-
- if(
- oMenu.cfg.getProperty("clicktohide") &&
- oMenu.cfg.getProperty("position") == "dynamic"
- ) {
-
- oMenu.hide();
-
- }
- else {
-
- oMenu.clearActiveItem(true);
-
- }
-
- }
-
- }
-
- }
-
- };
-
- /**
- * "destroy" event handler for a menu.
- * @private
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
- * fired the event.
- */
- var onMenuDestroy = function(p_sType, p_aArgs, p_oMenu) {
-
- this.removeMenu(p_oMenu);
-
- };
-
- /**
- * "destroy" event handler for a MenuItem instance.
- * @private
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- var onItemDestroy = function(p_sType, p_aArgs, p_oItem) {
-
- var sYUIId = p_oItem.element.getAttribute("yuiid");
-
- if(sYUIId) {
-
- delete m_oItems[sYUIId];
-
- }
-
- };
-
- /**
- * Event handler for when the "visible" configuration property
- * of a Menu instance changes.
- * @private
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
- * fired the event.
- */
- var onMenuVisibleConfigChange = function(p_sType, p_aArgs, p_oMenu) {
-
- var bVisible = p_aArgs[0];
-
- if(bVisible) {
-
- m_oVisibleMenus[p_oMenu.id] = p_oMenu;
-
-
- }
- else if(m_oVisibleMenus[p_oMenu.id]) {
-
- delete m_oVisibleMenus[p_oMenu.id];
-
-
- }
-
- };
-
- /**
- * "itemadded" event handler for a Menu instance.
- * @private
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- */
- var onItemAdded = function(p_sType, p_aArgs) {
-
- addItem(p_aArgs[0]);
-
- };
-
-
- /**
- * "itemremoved" event handler for a Menu instance.
- * @private
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- */
- var onItemRemoved = function(p_sType, p_aArgs) {
-
- removeItem(p_aArgs[0]);
-
- };
-
- // Privileged methods
-
- /**
- * @method addMenu
- * @description Adds a menu to the collection of known menus.
- * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance
- * to be added.
- */
- this.addMenu = function(p_oMenu) {
-
- if(p_oMenu && p_oMenu.id && !m_oMenus[p_oMenu.id]) {
-
- m_oMenus[p_oMenu.id] = p_oMenu;
-
-
- if(!m_bInitializedEventHandlers) {
-
- var oDoc = document;
-
- Event.addListener(oDoc, "mouseover", onDOMEvent, this, true);
- Event.addListener(oDoc, "mouseout", onDOMEvent, this, true);
- Event.addListener(oDoc, "mousedown", onDOMEvent, this, true);
- Event.addListener(oDoc, "mouseup", onDOMEvent, this, true);
- Event.addListener(oDoc, "click", onDOMEvent, this, true);
- Event.addListener(oDoc, "keydown", onDOMEvent, this, true);
- Event.addListener(oDoc, "keyup", onDOMEvent, this, true);
- Event.addListener(oDoc, "keypress", onDOMEvent, this, true);
-
- m_bInitializedEventHandlers = true;
-
-
- }
-
- p_oMenu.destroyEvent.subscribe(onMenuDestroy, p_oMenu, this);
-
- p_oMenu.cfg.subscribeToConfigEvent(
- "visible",
- onMenuVisibleConfigChange,
- p_oMenu
- );
-
- p_oMenu.itemAddedEvent.subscribe(onItemAdded);
- p_oMenu.itemRemovedEvent.subscribe(onItemRemoved);
-
-
- }
-
- };
-
- /**
- * @method removeMenu
- * @description Removes a menu from the collection of known menus.
- * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance
- * to be removed.
- */
- this.removeMenu = function(p_oMenu) {
-
- if(p_oMenu && m_oMenus[p_oMenu.id]) {
-
- delete m_oMenus[p_oMenu.id];
-
-
- }
-
- };
-
- /**
- * @method hideVisible
- * @description Hides all visible, dynamically positioned menus.
- */
- this.hideVisible = function() {
-
- var oMenu;
-
- for(var i in m_oVisibleMenus) {
-
- if(m_oVisibleMenus.hasOwnProperty(i)) {
-
- oMenu = m_oVisibleMenus[i];
-
- if(oMenu.cfg.getProperty("position") == "dynamic") {
-
- oMenu.hide();
-
- }
-
- }
-
- }
-
- };
-
- /**
- * @method getMenus
- * @description Returns an array of all menus registered with the
- * menu manger.
- * @return {Array}
- */
- this.getMenus = function() {
-
- return m_oMenus;
-
- };
-
- /**
- * @method getMenu
- * @description Returns a menu with the specified id.
- * @param {String} p_sId String specifying the id of the menu to
- * be retrieved.
- * @return {YAHOO.widget.Menu}
- */
- this.getMenu = function(p_sId) {
-
- if(m_oMenus[p_sId]) {
-
- return m_oMenus[p_sId];
-
- }
-
- };
-
-
- /**
- * @method toString
- * @description Returns a string representing the menu manager.
- * @return {String}
- */
- this.toString = function() {
-
- return ("MenuManager");
-
- };
-
-};
-
-})();
-
-(function() {
-
-var Dom = YAHOO.util.Dom;
-var Event = YAHOO.util.Event;
-
-/**
-* The Menu class creates a container that holds a vertical list representing
-* a set of options or commands. Menu is the base class for all
-* menu containers.
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the menu.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source
-* for the menu.
-* @param {HTMLDivElement } p_oElement Object
-* specifying the <div> element of the menu.
-* @param {HTMLSelectElement } p_oElement
-* Object specifying the <select> element to be used as
-* the data source for the menu.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu. See configuration class documentation for
-* more details.
-* @namespace YAHOO.widget
-* @class Menu
-* @constructor
-* @extends YAHOO.widget.Overlay
-*/
-YAHOO.widget.Menu = function(p_oElement, p_oConfig) {
-
- if(p_oConfig) {
-
- this.parent = p_oConfig.parent;
-
- this.lazyLoad = p_oConfig.lazyLoad || p_oConfig.lazyload;
-
- this.itemData = p_oConfig.itemData || p_oConfig.itemdata;
-
- }
-
- YAHOO.widget.Menu.superclass.constructor.call(
- this,
- p_oElement,
- p_oConfig
- );
-
-};
-
-YAHOO.extend(YAHOO.widget.Menu, YAHOO.widget.Overlay, {
-
-// Constants
-
-/**
-* @property CSS_CLASS_NAME
-* @description String representing the CSS class(es) to be applied to the
-* menu's <div> element.
-* @default "yuimenu"
-* @final
-* @type String
-*/
-CSS_CLASS_NAME: "yuimenu",
-
-/**
-* @property ITEM_TYPE
-* @description Object representing the type of menu item to instantiate and
-* add when parsing the child nodes (either <li> element,
-* <optgroup> element or <option>)
-* of the menu's source HTML element.
-* @default YAHOO.widget.MenuItem
-* @final
-* @type YAHOO.widget.MenuItem
-*/
-ITEM_TYPE: null,
-
-/**
-* @property GROUP_TITLE_TAG_NAME
-* @description String representing the tagname of the HTML element used to
-* title the menu's item groups.
-* @default H6
-* @final
-* @type String
-*/
-GROUP_TITLE_TAG_NAME: "h6",
-
-// Private properties
-
-/**
-* @property _nHideDelayId
-* @description Number representing the time-out setting used to cancel the
-* hiding of a menu.
-* @default null
-* @private
-* @type Number
-*/
-_nHideDelayId: null,
-
-/**
-* @property _nShowDelayId
-* @description Number representing the time-out setting used to cancel the
-* showing of a menu.
-* @default null
-* @private
-* @type Number
-*/
-_nShowDelayId: null,
-
-/**
-* @property _hideDelayEventHandlersAssigned
-* @description Boolean indicating if the "mouseover" and "mouseout" event
-* handlers used for hiding the menu via a call to "window.setTimeout" have
-* already been assigned.
-* @default false
-* @private
-* @type Boolean
-*/
-_hideDelayEventHandlersAssigned: false,
-
-/**
-* @property _bHandledMouseOverEvent
-* @description Boolean indicating the current state of the menu's
-* "mouseover" event.
-* @default false
-* @private
-* @type Boolean
-*/
-_bHandledMouseOverEvent: false,
-
-/**
-* @property _bHandledMouseOutEvent
-* @description Boolean indicating the current state of the menu's
-* "mouseout" event.
-* @default false
-* @private
-* @type Boolean
-*/
-_bHandledMouseOutEvent: false,
-
-/**
-* @property _aGroupTitleElements
-* @description Array of HTML element used to title groups of menu items.
-* @default []
-* @private
-* @type Array
-*/
-_aGroupTitleElements: null,
-
-/**
-* @property _aItemGroups
-* @description Array of menu items.
-* @default []
-* @private
-* @type Array
-*/
-_aItemGroups: null,
-
-/**
-* @property _aListElements
-* @description Array of <ul> elements, each of which is
-* the parent node for each item's <li> element.
-* @default []
-* @private
-* @type Array
-*/
-_aListElements: null,
-
-// Public properties
-
-/**
-* @property lazyLoad
-* @description Boolean indicating if the menu's "lazy load" feature is
-* enabled. If set to "true," initialization and rendering of the menu's
-* items will be deferred until the first time it is made visible. This
-* property should be set via the constructor using the configuration
-* object literal.
-* @default false
-* @type Boolean
-*/
-lazyLoad: false,
-
-/**
-* @property itemData
-* @description Array of items to be added to the menu. The array can contain
-* strings representing the text for each item to be created, object literals
-* representing the menu item configuration properties, or MenuItem instances.
-* This property should be set via the constructor using the configuration
-* object literal.
-* @default null
-* @type Array
-*/
-itemData: null,
-
-/**
-* @property activeItem
-* @description Object reference to the item in the menu that has focus.
-* @default null
-* @type YAHOO.widget.MenuItem
-*/
-activeItem: null,
-
-/**
-* @property parent
-* @description Object reference to the menu's parent menu or menu item.
-* This property can be set via the constructor using the configuration
-* object literal.
-* @default null
-* @type YAHOO.widget.MenuItem
-*/
-parent: null,
-
-/**
-* @property srcElement
-* @description Object reference to the HTML element (either
-* <select> or <div>) used to
-* create the menu.
-* @default null
-* @type HTMLSelectElement |HTMLDivElement
-*/
-srcElement: null,
-
-// Events
-
-/**
-* @event mouseOverEvent
-* @description Fires when the mouse has entered the menu. Passes back
-* the DOM Event object as an argument.
-*/
-mouseOverEvent: null,
-
-/**
-* @event mouseOutEvent
-* @description Fires when the mouse has left the menu. Passes back the DOM
-* Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-mouseOutEvent: null,
-
-/**
-* @event mouseDownEvent
-* @description Fires when the user mouses down on the menu. Passes back the
-* DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-mouseDownEvent: null,
-
-/**
-* @event mouseUpEvent
-* @description Fires when the user releases a mouse button while the mouse is
-* over the menu. Passes back the DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-mouseUpEvent: null,
-
-/**
-* @event clickEvent
-* @description Fires when the user clicks the on the menu. Passes back the
-* DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-clickEvent: null,
-
-/**
-* @event keyPressEvent
-* @description Fires when the user presses an alphanumeric key when one of the
-* menu's items has focus. Passes back the DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-keyPressEvent: null,
-
-/**
-* @event keyDownEvent
-* @description Fires when the user presses a key when one of the menu's items
-* has focus. Passes back the DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-keyDownEvent: null,
-
-/**
-* @event keyUpEvent
-* @description Fires when the user releases a key when one of the menu's items
-* has focus. Passes back the DOM Event object as an argument.
-* @type YAHOO.util.CustomEvent
-*/
-keyUpEvent: null,
-
-/**
-* @event itemAddedEvent
-* @description Fires when an item is added to the menu.
-* @type YAHOO.util.CustomEvent
-*/
-itemAddedEvent: null,
-
-/**
-* @event itemRemovedEvent
-* @description Fires when an item is removed to the menu.
-* @type YAHOO.util.CustomEvent
-*/
-itemRemovedEvent: null,
-
-/**
-* @method init
-* @description The Menu class's initialization method. This method is
-* automatically called by the constructor, and sets up all DOM references
-* for pre-existing markup, and creates required markup if it is not
-* already present.
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the menu.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source
-* for the menu.
-* @param {HTMLDivElement } p_oElement Object
-* specifying the <div> element of the menu.
-* @param {HTMLSelectElement } p_oElement
-* Object specifying the <select> element to be used as
-* the data source for the menu.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu. See configuration class documentation for
-* more details.
-*/
-init: function(p_oElement, p_oConfig) {
-
- this._aItemGroups = [];
- this._aListElements = [];
- this._aGroupTitleElements = [];
-
- if(!this.ITEM_TYPE) {
-
- this.ITEM_TYPE = YAHOO.widget.MenuItem;
-
- }
-
- var oElement;
-
- if(typeof p_oElement == "string") {
-
- oElement = document.getElementById(p_oElement);
-
- }
- else if(p_oElement.tagName) {
-
- oElement = p_oElement;
-
- }
-
- if(oElement && oElement.tagName) {
-
- switch(oElement.tagName.toUpperCase()) {
-
- case "DIV":
-
- this.srcElement = oElement;
-
- if(!oElement.id) {
-
- oElement.setAttribute("id", Dom.generateId());
-
- }
-
- /*
- Note: we don't pass the user config in here yet
- because we only want it executed once, at the lowest
- subclass level.
- */
-
- YAHOO.widget.Menu.superclass.init.call(this, oElement);
-
- this.beforeInitEvent.fire(YAHOO.widget.Menu);
-
-
- break;
-
- case "SELECT":
-
- this.srcElement = oElement;
-
-
- /*
- The source element is not something that we can use
- outright, so we need to create a new Overlay
-
- Note: we don't pass the user config in here yet
- because we only want it executed once, at the lowest
- subclass level.
- */
-
- YAHOO.widget.Menu.superclass.init.call(this, Dom.generateId());
-
- this.beforeInitEvent.fire(YAHOO.widget.Menu);
-
- break;
-
- }
-
- }
- else {
-
- /*
- Note: we don't pass the user config in here yet
- because we only want it executed once, at the lowest
- subclass level.
- */
-
- YAHOO.widget.Menu.superclass.init.call(this, p_oElement);
-
- this.beforeInitEvent.fire(YAHOO.widget.Menu);
-
- }
-
- if(this.element) {
-
- var oEl = this.element;
-
- Dom.addClass(oEl, this.CSS_CLASS_NAME);
-
- // Subscribe to Custom Events
-
- this.initEvent.subscribe(this._onInit, this, true);
- this.beforeRenderEvent.subscribe(this._onBeforeRender, this, true);
- this.renderEvent.subscribe(this._onRender, this, true);
- this.beforeShowEvent.subscribe(this._onBeforeShow, this, true);
- this.showEvent.subscribe(this._onShow, this, true);
- this.beforeHideEvent.subscribe(this._onBeforeHide, this, true);
- this.mouseOverEvent.subscribe(this._onMouseOver, this, true);
- this.mouseOutEvent.subscribe(this._onMouseOut, this, true);
- this.clickEvent.subscribe(this._onClick, this, true);
- this.keyDownEvent.subscribe(this._onKeyDown, this, true);
-
- if(p_oConfig) {
-
- this.cfg.applyConfig(p_oConfig, true);
-
- }
-
- // Register the Menu instance with the MenuManager
-
- YAHOO.widget.MenuManager.addMenu(this);
-
-
- this.initEvent.fire(YAHOO.widget.Menu);
-
- }
-
-},
-
-// Private methods
-
-/**
-* @method _initSubTree
-* @description Iterates the childNodes of the source element to find nodes
-* used to instantiate menu and menu items.
-* @private
-*/
-_initSubTree: function() {
-
- var oNode;
-
- if(this.srcElement.tagName == "DIV") {
-
- /*
- Populate the collection of item groups and item
- group titles
- */
-
- oNode = this.body.firstChild;
-
- var nGroup = 0;
- var sGroupTitleTagName = this.GROUP_TITLE_TAG_NAME.toUpperCase();
-
- do {
-
- if(oNode && oNode.tagName) {
-
- switch(oNode.tagName.toUpperCase()) {
-
- case sGroupTitleTagName:
-
- this._aGroupTitleElements[nGroup] = oNode;
-
- break;
-
- case "UL":
-
- this._aListElements[nGroup] = oNode;
- this._aItemGroups[nGroup] = [];
- nGroup++;
-
- break;
-
- }
-
- }
-
- }
- while((oNode = oNode.nextSibling));
-
- /*
- Apply the "first-of-type" class to the first UL to mimic
- the "first-of-type" CSS3 psuedo class.
- */
-
- if(this._aListElements[0]) {
-
- Dom.addClass(this._aListElements[0], "first-of-type");
-
- }
-
- }
-
- oNode = null;
-
- if(this.srcElement.tagName) {
-
- switch(this.srcElement.tagName.toUpperCase()) {
-
- case "DIV":
-
- if(this._aListElements.length > 0) {
-
-
- var i = this._aListElements.length - 1;
-
- do {
-
- oNode = this._aListElements[i].firstChild;
-
-
- do {
-
- if(oNode && oNode.tagName) {
-
- switch(oNode.tagName.toUpperCase()) {
-
- case "LI":
-
-
- this.addItem(
- new this.ITEM_TYPE(
- oNode,
- { parent: this }
- ),
- i
- );
-
- break;
-
- }
-
- }
-
- }
- while((oNode = oNode.nextSibling));
-
- }
- while(i--);
-
- }
-
- break;
-
- case "SELECT":
-
-
- oNode = this.srcElement.firstChild;
-
- do {
-
- if(oNode && oNode.tagName) {
-
- switch(oNode.tagName.toUpperCase()) {
-
- case "OPTGROUP":
- case "OPTION":
-
-
- this.addItem(
- new this.ITEM_TYPE(
- oNode,
- { parent: this }
- )
- );
-
- break;
-
- }
-
- }
-
- }
- while((oNode = oNode.nextSibling));
-
- break;
-
- }
-
- }
-
-},
-
-/**
-* @method _getFirstEnabledItem
-* @description Returns the first enabled item in the menu.
-* @return {YAHOO.widget.MenuItem}
-* @private
-*/
-_getFirstEnabledItem: function() {
-
- var nGroups = this._aItemGroups.length;
- var oItem;
- var aItemGroup;
-
- for(var i=0; i= aGroup.length);
-
- if(aGroup[p_nItemIndex]) {
-
- aGroup.splice(p_nItemIndex, 0, oItem);
-
- }
- else {
-
- aGroup[p_nItemIndex] = oItem;
-
- }
-
- oGroupItem = aGroup[p_nItemIndex];
-
- if(oGroupItem) {
-
- if(
- bAppend &&
- (
- !oGroupItem.element.parentNode ||
- oGroupItem.element.parentNode.nodeType == 11
- )
- ) {
-
- this._aListElements[nGroupIndex].appendChild(
- oGroupItem.element
- );
-
- }
- else {
-
-
- /**
- * Returns the next sibling of an item in an array.
- * @private
- * @param {p_aArray} Array to search.
- * @param {p_nStartIndex} Number indicating the index to
- * start searching the array.
- * @return {Object}
- */
- var getNextItemSibling =
-
- function(p_aArray, p_nStartIndex) {
-
- return (
- p_aArray[p_nStartIndex] ||
- getNextItemSibling(
- p_aArray,
- (p_nStartIndex+1)
- )
- );
-
- };
-
-
- var oNextItemSibling =
- getNextItemSibling(aGroup, (p_nItemIndex+1));
-
- if(
- oNextItemSibling &&
- (
- !oGroupItem.element.parentNode ||
- oGroupItem.element.parentNode.nodeType == 11
- )
- ) {
-
- this._aListElements[nGroupIndex].insertBefore(
- oGroupItem.element,
- oNextItemSibling.element
- );
-
- }
-
- }
-
-
- oGroupItem.parent = this;
-
- this._subscribeToItemEvents(oGroupItem);
-
- this._configureSubmenu(oGroupItem);
-
- this._updateItemProperties(nGroupIndex);
-
-
- this.itemAddedEvent.fire(oGroupItem);
-
- return oGroupItem;
-
- }
-
- }
- else {
-
- var nItemIndex = aGroup.length;
-
- aGroup[nItemIndex] = oItem;
-
- oGroupItem = aGroup[nItemIndex];
-
-
- if(oGroupItem) {
-
- if(
- !Dom.isAncestor(
- this._aListElements[nGroupIndex],
- oGroupItem.element
- )
- ) {
-
- this._aListElements[nGroupIndex].appendChild(
- oGroupItem.element
- );
-
- }
-
- oGroupItem.element.setAttribute("groupindex", nGroupIndex);
- oGroupItem.element.setAttribute("index", nItemIndex);
-
- oGroupItem.parent = this;
-
- oGroupItem.index = nItemIndex;
- oGroupItem.groupIndex = nGroupIndex;
-
- this._subscribeToItemEvents(oGroupItem);
-
- this._configureSubmenu(oGroupItem);
-
- if(nItemIndex === 0) {
-
- Dom.addClass(oGroupItem.element, "first-of-type");
-
- }
-
-
-
- this.itemAddedEvent.fire(oGroupItem);
-
- return oGroupItem;
-
- }
-
- }
-
- }
-
-},
-
-/**
-* @method _removeItemFromGroupByIndex
-* @description Removes a menu item from a group by index. Returns the menu
-* item that was removed.
-* @private
-* @param {Number} p_nGroupIndex Number indicating the group to which the menu
-* item belongs.
-* @param {Number} p_nItemIndex Number indicating the index of the menu item
-* to be removed.
-* @return {YAHOO.widget.MenuItem}
-*/
-_removeItemFromGroupByIndex: function(p_nGroupIndex, p_nItemIndex) {
-
- var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;
- var aGroup = this._getItemGroup(nGroupIndex);
-
- if(aGroup) {
-
- var aArray = aGroup.splice(p_nItemIndex, 1);
- var oItem = aArray[0];
-
- if(oItem) {
-
- // Update the index and className properties of each member
-
- this._updateItemProperties(nGroupIndex);
-
- if(aGroup.length === 0) {
-
- // Remove the UL
-
- var oUL = this._aListElements[nGroupIndex];
-
- if(this.body && oUL) {
-
- this.body.removeChild(oUL);
-
- }
-
- // Remove the group from the array of items
-
- this._aItemGroups.splice(nGroupIndex, 1);
-
-
- // Remove the UL from the array of ULs
-
- this._aListElements.splice(nGroupIndex, 1);
-
-
- /*
- Assign the "first-of-type" class to the new first UL
- in the collection
- */
-
- oUL = this._aListElements[0];
-
- if(oUL) {
-
- Dom.addClass(oUL, "first-of-type");
-
- }
-
- }
-
-
- this.itemRemovedEvent.fire(oItem);
-
- // Return a reference to the item that was removed
-
- return oItem;
-
- }
-
- }
-
-},
-
-/**
-* @method _removeItemFromGroupByValue
-* @description Removes a menu item from a group by reference. Returns the
-* menu item that was removed.
-* @private
-* @param {Number} p_nGroupIndex Number indicating the group to which the
-* menu item belongs.
-* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
-* instance to be removed.
-* @return {YAHOO.widget.MenuItem}
-*/
-_removeItemFromGroupByValue: function(p_nGroupIndex, p_oItem) {
-
- var aGroup = this._getItemGroup(p_nGroupIndex);
-
- if(aGroup) {
-
- var nItems = aGroup.length;
- var nItemIndex = -1;
-
- if(nItems > 0) {
-
- var i = nItems-1;
-
- do {
-
- if(aGroup[i] == p_oItem) {
-
- nItemIndex = i;
- break;
-
- }
-
- }
- while(i--);
-
- if(nItemIndex > -1) {
-
- return this._removeItemFromGroupByIndex(
- p_nGroupIndex,
- nItemIndex
- );
-
- }
-
- }
-
- }
-
-},
-
-/**
-* @method _updateItemProperties
-* @description Updates the "index," "groupindex," and "className" properties
-* of the menu items in the specified group.
-* @private
-* @param {Number} p_nGroupIndex Number indicating the group of items to update.
-*/
-_updateItemProperties: function(p_nGroupIndex) {
-
- var aGroup = this._getItemGroup(p_nGroupIndex);
- var nItems = aGroup.length;
-
- if(nItems > 0) {
-
- var i = nItems - 1;
- var oItem;
- var oLI;
-
- // Update the index and className properties of each member
-
- do {
-
- oItem = aGroup[i];
-
- if(oItem) {
-
- oLI = oItem.element;
-
- oItem.index = i;
- oItem.groupIndex = p_nGroupIndex;
-
- oLI.setAttribute("groupindex", p_nGroupIndex);
- oLI.setAttribute("index", i);
-
- Dom.removeClass(oLI, "first-of-type");
-
- }
-
- }
- while(i--);
-
- if(oLI) {
-
- Dom.addClass(oLI, "first-of-type");
-
- }
-
- }
-
-},
-
-/**
-* @method _createItemGroup
-* @description Creates a new menu item group (array) and its associated
-* <ul> element. Returns an aray of menu item groups.
-* @private
-* @param {Number} p_nIndex Number indicating the group to create.
-* @return {Array}
-*/
-_createItemGroup: function(p_nIndex) {
-
- if(!this._aItemGroups[p_nIndex]) {
-
- this._aItemGroups[p_nIndex] = [];
-
- var oUL = document.createElement("ul");
-
- this._aListElements[p_nIndex] = oUL;
-
- return this._aItemGroups[p_nIndex];
-
- }
-
-},
-
-/**
-* @method _getItemGroup
-* @description Returns the menu item group at the specified index.
-* @private
-* @param {Number} p_nIndex Number indicating the index of the menu item group
-* to be retrieved.
-* @return {Array}
-*/
-_getItemGroup: function(p_nIndex) {
-
- var nIndex = ((typeof p_nIndex == "number") ? p_nIndex : 0);
-
- return this._aItemGroups[nIndex];
-
-},
-
-/**
-* @method _configureSubmenu
-* @description Subscribes the menu item's submenu to its parent menu's events.
-* @private
-* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
-* instance with the submenu to be configured.
-*/
-_configureSubmenu: function(p_oItem) {
-
- var oSubmenu = p_oItem.cfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- /*
- Listen for configuration changes to the parent menu
- so they they can be applied to the submenu.
- */
-
- this.cfg.configChangedEvent.subscribe(
- this._onParentMenuConfigChange,
- oSubmenu,
- true
- );
-
- this.renderEvent.subscribe(
- this._onParentMenuRender,
- oSubmenu,
- true
- );
-
- oSubmenu.beforeShowEvent.subscribe(
- this._onSubmenuBeforeShow,
- oSubmenu,
- true
- );
-
- oSubmenu.showEvent.subscribe(
- this._onSubmenuShow,
- oSubmenu,
- true
- );
-
- oSubmenu.hideEvent.subscribe(
- this._onSubmenuHide,
- oSubmenu,
- true
- );
-
- }
-
-},
-
-/**
-* @method _subscribeToItemEvents
-* @description Subscribes a menu to a menu item's event.
-* @private
-* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
-* instance whose events should be subscribed to.
-*/
-_subscribeToItemEvents: function(p_oItem) {
-
- p_oItem.focusEvent.subscribe(this._onMenuItemFocus, p_oItem, this);
-
- p_oItem.blurEvent.subscribe(this._onMenuItemBlur, this, true);
-
- p_oItem.cfg.configChangedEvent.subscribe(
- this._onMenuItemConfigChange,
- p_oItem,
- this
- );
-
-},
-
-/**
-* @method _getOffsetWidth
-* @description Returns the offset width of the menu's
-* <div> element.
-* @private
-*/
-_getOffsetWidth: function() {
-
- var oClone = this.element.cloneNode(true);
-
- Dom.setStyle(oClone, "width", "");
-
- document.body.appendChild(oClone);
-
- var sWidth = oClone.offsetWidth;
-
- document.body.removeChild(oClone);
-
- return sWidth;
-
-},
-
-/**
-* @method _cancelHideDelay
-* @description Cancels the call to "hideMenu."
-* @private
-*/
-_cancelHideDelay: function() {
-
- var oRoot = this.getRoot();
-
- if(oRoot._nHideDelayId) {
-
- window.clearTimeout(oRoot._nHideDelayId);
-
- }
-
-},
-
-/**
-* @method _execHideDelay
-* @description Hides the menu after the number of milliseconds specified by
-* the "hidedelay" configuration property.
-* @private
-*/
-_execHideDelay: function() {
-
- this._cancelHideDelay();
-
- var oRoot = this.getRoot();
- var me = this;
-
- var hideMenu = function() {
-
- if(oRoot.activeItem) {
-
- oRoot.clearActiveItem();
-
- }
-
- if(oRoot == me && me.cfg.getProperty("position") == "dynamic") {
-
- me.hide();
-
- }
-
- };
-
- oRoot._nHideDelayId =
- window.setTimeout(hideMenu, oRoot.cfg.getProperty("hidedelay"));
-
-},
-
-/**
-* @method _cancelShowDelay
-* @description Cancels the call to the "showMenu."
-* @private
-*/
-_cancelShowDelay: function() {
-
- var oRoot = this.getRoot();
-
- if(oRoot._nShowDelayId) {
-
- window.clearTimeout(oRoot._nShowDelayId);
-
- }
-
-},
-
-/**
-* @method _execShowDelay
-* @description Shows the menu after the number of milliseconds specified by
-* the "showdelay" configuration property have ellapsed.
-* @private
-* @param {YAHOO.widget.Menu} p_oMenu Object specifying the menu that should
-* be made visible.
-*/
-_execShowDelay: function(p_oMenu) {
-
- this._cancelShowDelay();
-
- var oRoot = this.getRoot();
-
- var showMenu = function() {
-
- p_oMenu.show();
-
- };
-
- oRoot._nShowDelayId =
- window.setTimeout(showMenu, oRoot.cfg.getProperty("showdelay"));
-
-},
-
-// Protected methods
-
-/**
-* @method _onMouseOver
-* @description "mouseover" event handler for the menu.
-* @protected
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onMouseOver: function(p_sType, p_aArgs, p_oMenu) {
-
- var oEvent = p_aArgs[0];
- var oItem = p_aArgs[1];
- var oTarget = Event.getTarget(oEvent);
-
- if(
- !this._bHandledMouseOverEvent &&
- (oTarget == this.element || Dom.isAncestor(this.element, oTarget))
- ) {
-
- // MENU MOUSEOVER LOGIC HERE
-
- this.clearActiveItem();
-
- this._bHandledMouseOverEvent = true;
- this._bHandledMouseOutEvent = false;
-
- }
-
- if(
- oItem && !oItem.handledMouseOverEvent &&
- (oTarget == oItem.element || Dom.isAncestor(oItem.element, oTarget))
- ) {
-
- var oItemCfg = oItem.cfg;
-
- // Select and focus the current menu item
-
- oItemCfg.setProperty("selected", true);
- oItem.focus();
-
- if(this.cfg.getProperty("autosubmenudisplay")) {
-
- // Show the submenu this menu item
-
- var oSubmenu = oItemCfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- if(this.cfg.getProperty("showdelay") > 0) {
-
- this._execShowDelay(oSubmenu);
-
- }
- else {
-
- oSubmenu.show();
-
- }
-
- }
-
- }
-
- oItem.handledMouseOverEvent = true;
- oItem.handledMouseOutEvent = false;
-
- }
-
-},
-
-/**
-* @method _onMouseOut
-* @description "mouseout" event handler for the menu.
-* @protected
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onMouseOut: function(p_sType, p_aArgs, p_oMenu) {
-
- var oEvent = p_aArgs[0];
- var oItem = p_aArgs[1];
- var oRelatedTarget = Event.getRelatedTarget(oEvent);
- var bMovingToSubmenu = false;
-
- if(oItem) {
-
- var oItemCfg = oItem.cfg;
- var oSubmenu = oItemCfg.getProperty("submenu");
-
- if(
- oSubmenu &&
- (
- oRelatedTarget == oSubmenu.element ||
- Dom.isAncestor(oSubmenu.element, oRelatedTarget)
- )
- ) {
-
- bMovingToSubmenu = true;
-
- }
-
- if(
- !oItem.handledMouseOutEvent &&
- (
- (
- oRelatedTarget != oItem.element &&
- !Dom.isAncestor(oItem.element, oRelatedTarget)
- ) || bMovingToSubmenu
- )
- ) {
-
- if(this.cfg.getProperty("showdelay") > 0) {
-
- this._cancelShowDelay();
-
- }
-
- if(!bMovingToSubmenu) {
-
- oItemCfg.setProperty("selected", false);
-
- }
-
- if(this.cfg.getProperty("autosubmenudisplay")) {
-
- if(oSubmenu) {
-
- if(
- !(
- oRelatedTarget == oSubmenu.element ||
- YAHOO.util.Dom.isAncestor(
- oSubmenu.element,
- oRelatedTarget
- )
- )
- ) {
-
- oSubmenu.hide();
-
- }
-
- }
-
- }
-
- oItem.handledMouseOutEvent = true;
- oItem.handledMouseOverEvent = false;
-
- }
-
- }
-
- if(
- !this._bHandledMouseOutEvent &&
- (
- (
- oRelatedTarget != this.element &&
- !Dom.isAncestor(this.element, oRelatedTarget)
- )
- || bMovingToSubmenu
- )
- ) {
-
- this._bHandledMouseOutEvent = true;
- this._bHandledMouseOverEvent = false;
-
- }
-
-},
-
-/**
-* @method _onClick
-* @description "click" event handler for the menu.
-* @protected
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onClick: function(p_sType, p_aArgs, p_oMenu) {
-
- var oEvent = p_aArgs[0];
- var oItem = p_aArgs[1];
- var oTarget = Event.getTarget(oEvent);
-
- if(oItem) {
-
- var oItemCfg = oItem.cfg;
- var oSubmenu = oItemCfg.getProperty("submenu");
-
- /*
- ACCESSIBILITY FEATURE FOR SCREEN READERS:
- Expand/collapse the submenu when the user clicks
- on the submenu indicator image.
- */
-
- if(oTarget == oItem.submenuIndicator && oSubmenu) {
-
- if(oSubmenu.cfg.getProperty("visible")) {
-
- oSubmenu.hide();
-
- }
- else {
-
- this.clearActiveItem();
-
- this.activeItem = oItem;
-
- oItem.cfg.setProperty("selected", true);
-
- oSubmenu.show();
-
- }
-
- }
- else {
-
- var sURL = oItemCfg.getProperty("url");
- var bCurrentPageURL = (sURL.substr((sURL.length-1),1) == "#");
- var sTarget = oItemCfg.getProperty("target");
- var bHasTarget = (sTarget && sTarget.length > 0);
-
- /*
- Prevent the browser from following links
- equal to "#"
- */
-
- if(
- oTarget.tagName.toUpperCase() == "A" &&
- bCurrentPageURL && !bHasTarget
- ) {
-
- Event.preventDefault(oEvent);
-
- }
-
- if(
- oTarget.tagName.toUpperCase() != "A" &&
- !bCurrentPageURL && !bHasTarget
- ) {
-
- /*
- Follow the URL of the item regardless of
- whether or not the user clicked specifically
- on the anchor element.
- */
-
- document.location = sURL;
-
- }
-
- /*
- If the item doesn't navigate to a URL and it doesn't have
- a submenu, then collapse the menu tree.
- */
-
- if(bCurrentPageURL && !oSubmenu) {
-
- var oRoot = this.getRoot();
-
- if(oRoot.cfg.getProperty("position") == "static") {
-
- oRoot.clearActiveItem();
-
- }
- else {
-
- oRoot.hide();
-
- }
-
- }
-
- }
-
- }
-
-},
-
-/**
-* @method _onKeyDown
-* @description "keydown" event handler for the menu.
-* @protected
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onKeyDown: function(p_sType, p_aArgs, p_oMenu) {
-
- var oEvent = p_aArgs[0];
- var oItem = p_aArgs[1];
- var oSubmenu;
-
- if(oItem) {
-
- var oItemCfg = oItem.cfg;
- var oParentItem = this.parent;
- var oRoot;
- var oNextItem;
-
- switch(oEvent.keyCode) {
-
- case 38: // Up arrow
- case 40: // Down arrow
-
- if(
- oItem == this.activeItem &&
- !oItemCfg.getProperty("selected")
- ) {
-
- oItemCfg.setProperty("selected", true);
-
- }
- else {
-
- oNextItem = (oEvent.keyCode == 38) ?
- oItem.getPreviousEnabledSibling() :
- oItem.getNextEnabledSibling();
-
- if(oNextItem) {
-
- this.clearActiveItem();
-
- oNextItem.cfg.setProperty("selected", true);
- oNextItem.focus();
-
- }
-
- }
-
- Event.preventDefault(oEvent);
-
- break;
-
-
- case 39: // Right arrow
-
- oSubmenu = oItemCfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- if(!oItemCfg.getProperty("selected")) {
-
- oItemCfg.setProperty("selected", true);
-
- }
-
- oSubmenu.show();
-
- oSubmenu.setInitialSelection();
-
- }
- else {
-
- oRoot = this.getRoot();
-
- if(oRoot instanceof YAHOO.widget.MenuBar) {
-
- oNextItem = oRoot.activeItem.getNextEnabledSibling();
-
- if(oNextItem) {
-
- oRoot.clearActiveItem();
-
- oNextItem.cfg.setProperty("selected", true);
-
- oSubmenu = oNextItem.cfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- oSubmenu.show();
-
- }
-
- oNextItem.focus();
-
- }
-
- }
-
- }
-
-
- Event.preventDefault(oEvent);
-
- break;
-
-
- case 37: // Left arrow
-
- if(oParentItem) {
-
- var oParentMenu = oParentItem.parent;
-
- if(oParentMenu instanceof YAHOO.widget.MenuBar) {
-
- oNextItem =
- oParentMenu.activeItem.getPreviousEnabledSibling();
-
- if(oNextItem) {
-
- oParentMenu.clearActiveItem();
-
- oNextItem.cfg.setProperty("selected", true);
-
- oSubmenu = oNextItem.cfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- oSubmenu.show();
-
- }
-
- oNextItem.focus();
-
- }
-
- }
- else {
-
- this.hide();
-
- oParentItem.focus();
-
- }
-
- }
-
- Event.preventDefault(oEvent);
-
- break;
-
- }
-
- }
-
- if(oEvent.keyCode == 27) { // Esc key
-
- if(this.cfg.getProperty("position") == "dynamic") {
-
- this.hide();
-
- if(this.parent) {
-
- this.parent.focus();
-
- }
-
- }
- else if(this.activeItem) {
-
- oSubmenu = this.activeItem.cfg.getProperty("submenu");
-
- if(oSubmenu && oSubmenu.cfg.getProperty("visible")) {
-
- oSubmenu.hide();
- this.activeItem.focus();
-
- }
- else {
-
- this.activeItem.cfg.setProperty("selected", false);
- this.activeItem.blur();
-
- }
-
- }
-
- Event.preventDefault(oEvent);
-
- }
-
-},
-
-// Private methods
-
-/**
-* @method _onInit
-* @description "init" event handler for the menu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onInit: function(p_sType, p_aArgs, p_oMenu) {
-
- if(
- (
- (this.parent && !this.lazyLoad) ||
- (!this.parent && this.cfg.getProperty("position") == "static") ||
- (
- !this.parent &&
- !this.lazyLoad &&
- this.cfg.getProperty("position") == "dynamic"
- )
- ) &&
- this.getItemGroups().length === 0
- ) {
-
- if(this.srcElement) {
-
- this._initSubTree();
-
- }
-
- if(this.itemData) {
-
- this.addItems(this.itemData);
-
- }
-
- }
- else if(this.lazyLoad) {
-
- this.cfg.fireQueue();
-
- }
-
-},
-
-/**
-* @method _onBeforeRender
-* @description "beforerender" event handler for the menu. Appends all of the
-* <ul>, <li> and their accompanying
-* title elements to the body element of the menu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onBeforeRender: function(p_sType, p_aArgs, p_oMenu) {
-
- var oConfig = this.cfg;
- var oEl = this.element;
- var nListElements = this._aListElements.length;
-
- if(nListElements > 0) {
-
- var i = 0;
- var bFirstList = true;
- var oUL;
- var oGroupTitle;
-
- do {
-
- oUL = this._aListElements[i];
-
- if(oUL) {
-
- if(bFirstList) {
-
- Dom.addClass(oUL, "first-of-type");
- bFirstList = false;
-
- }
-
- if(!Dom.isAncestor(oEl, oUL)) {
-
- this.appendToBody(oUL);
-
- }
-
- oGroupTitle = this._aGroupTitleElements[i];
-
- if(oGroupTitle) {
-
- if(!Dom.isAncestor(oEl, oGroupTitle)) {
-
- oUL.parentNode.insertBefore(oGroupTitle, oUL);
-
- }
-
- Dom.addClass(oUL, "hastitle");
-
- }
-
- }
-
- i++;
-
- }
- while(i < nListElements);
-
- }
-
-},
-
-/**
-* @method _onRender
-* @description "render" event handler for the menu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onRender: function(p_sType, p_aArgs, p_oMenu) {
-
- if(this.cfg.getProperty("position") == "dynamic") {
-
- var sWidth =
- this.element.parentNode.tagName.toUpperCase() == "BODY" ?
- this.element.offsetWidth : this._getOffsetWidth();
-
- this.cfg.setProperty("width", (sWidth + "px"));
-
- }
-
-},
-
-/**
-* @method _onBeforeShow
-* @description "beforeshow" event handler for the menu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-_onBeforeShow: function(p_sType, p_aArgs, p_oMenu) {
-
- if(this.lazyLoad && this.getItemGroups().length === 0) {
-
- if(this.srcElement) {
-
- this._initSubTree();
-
- }
-
- if(this.itemData) {
-
- if(
- this.parent && this.parent.parent &&
- this.parent.parent.srcElement &&
- this.parent.parent.srcElement.tagName.toUpperCase() == "SELECT"
- ) {
-
- var nOptions = this.itemData.length;
-
- for(var n=0; n 0) {
-
- oConfig.showdelay = nShowDelay;
-
- }
-
- var nHideDelay = oParentMenu.cfg.getProperty("hidedelay");
-
- if(nHideDelay > 0) {
-
- oConfig.hidedelay = nHideDelay;
-
- }
-
- /*
- Only sync the "iframe" configuration property if the parent
- menu's "position" configuration is the same.
- */
-
- if(
- this.cfg.getProperty("position") ==
- oParentMenu.cfg.getProperty("position")
- ) {
-
- oConfig.iframe = oParentMenu.cfg.getProperty("iframe");
-
- }
-
-
- p_oSubmenu.cfg.applyConfig(oConfig);
-
- if(!this.lazyLoad) {
-
- if(Dom.inDocument(this.element)) {
-
- this.render();
-
- }
- else {
-
- this.render(this.parent.element);
-
- }
-
- }
-
-},
-
-/**
-* @method _onSubmenuBeforeShow
-* @description "beforeshow" event handler for a submenu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
-* subscribed to the event.
-*/
-_onSubmenuBeforeShow: function(p_sType, p_aArgs, p_oSubmenu) {
-
- var oParent = this.parent;
- var aAlignment = oParent.parent.cfg.getProperty("submenualignment");
-
- this.cfg.setProperty(
- "context",
- [oParent.element, aAlignment[0], aAlignment[1]]
- );
-
- oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;
-
-},
-
-/**
-* @method _onSubmenuShow
-* @description "show" event handler for a submenu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
-* subscribed to the event.
-*/
-_onSubmenuShow: function(p_sType, p_aArgs, p_oSubmenu) {
-
- var oParent = this.parent;
-
- oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;
-
-},
-
-/**
-* @method _onSubmenuHide
-* @description "hide" Custom Event handler for a submenu.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
-* subscribed to the event.
-*/
-_onSubmenuHide: function(p_sType, p_aArgs, p_oSubmenu) {
-
- var oParent = this.parent;
-
- oParent.submenuIndicator.alt = oParent.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
-
-},
-
-/**
-* @method _onMenuItemFocus
-* @description "focus" event handler for the menu's items.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
-* that fired the event.
-*/
-_onMenuItemFocus: function(p_sType, p_aArgs, p_oItem) {
-
- this.activeItem = p_oItem;
-
-},
-
-/**
-* @method _onMenuItemBlur
-* @description "blur" event handler for the menu's items.
-* @private
-* @param {String} p_sType String representing the name of the event
-* that was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-*/
-_onMenuItemBlur: function(p_sType, p_aArgs) {
-
- this.activeItem = null;
-
-},
-
-/**
-* @method _onMenuItemConfigChange
-* @description "configchange" event handler for the menu's items.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
-* that fired the event.
-*/
-_onMenuItemConfigChange: function(p_sType, p_aArgs, p_oItem) {
-
- var sProperty = p_aArgs[0][0];
-
- switch(sProperty) {
-
- case "submenu":
-
- var oSubmenu = p_aArgs[0][1];
-
- if(oSubmenu) {
-
- this._configureSubmenu(p_oItem);
-
- }
-
- break;
-
- case "text":
- case "helptext":
-
- /*
- A change to an item's "text" or "helptext"
- configuration properties requires the width of the parent
- menu to be recalculated.
- */
-
- if(this.element.style.width) {
-
- var sWidth = this._getOffsetWidth() + "px";
-
- Dom.setStyle(this.element, "width", sWidth);
-
- }
-
- break;
-
- }
-
-},
-
-// Public event handlers for configuration properties
-
-/**
-* @method enforceConstraints
-* @description The default event handler executed when the moveEvent is fired,
-* if the "constraintoviewport" configuration property is set to true.
-* @param {String} type The name of the event that was fired.
-* @param {Array} args Collection of arguments sent when the
-* event was fired.
-* @param {Array} obj Array containing the current Menu instance
-* and the item that fired the event.
-*/
-enforceConstraints: function(type, args, obj) {
-
- var oConfig = this.cfg;
-
- var pos = args[0];
-
- var x = pos[0];
- var y = pos[1];
-
- var bod = document.getElementsByTagName('body')[0];
- var htm = document.getElementsByTagName('html')[0];
-
- var bodyOverflow = Dom.getStyle(bod, "overflow");
- var htmOverflow = Dom.getStyle(htm, "overflow");
-
- var offsetHeight = this.element.offsetHeight;
- var offsetWidth = this.element.offsetWidth;
-
- var viewPortWidth = Dom.getClientWidth();
- var viewPortHeight = Dom.getClientHeight();
-
- var scrollX = window.scrollX || document.body.scrollLeft;
- var scrollY = window.scrollY || document.body.scrollTop;
-
- var topConstraint = scrollY + 10;
- var leftConstraint = scrollX + 10;
- var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;
- var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;
-
- var aContext = oConfig.getProperty("context");
- var oContextElement = aContext ? aContext[0] : null;
-
-
- if (x < 10) {
-
- x = leftConstraint;
-
- } else if ((x + offsetWidth) > viewPortWidth) {
-
- if(
- oContextElement &&
- ((x - oContextElement.offsetWidth) > offsetWidth)
- ) {
-
- x = (x - (oContextElement.offsetWidth + offsetWidth));
-
- }
- else {
-
- x = rightConstraint;
-
- }
-
- }
-
- if (y < 10) {
-
- y = topConstraint;
-
- } else if (y > bottomConstraint) {
-
- if(oContextElement && (y > offsetHeight)) {
-
- y = ((y + oContextElement.offsetHeight) - offsetHeight);
-
- }
- else {
-
- y = bottomConstraint;
-
- }
-
- }
-
- oConfig.setProperty("x", x, true);
- oConfig.setProperty("y", y, true);
-
-},
-
-/**
-* @method configVisible
-* @description Event handler for when the "visible" configuration property
-* the menu changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-configVisible: function(p_sType, p_aArgs, p_oMenu) {
-
- if(this.cfg.getProperty("position") == "dynamic") {
-
- YAHOO.widget.Menu.superclass.configVisible.call(
- this,
- p_sType,
- p_aArgs,
- p_oMenu
- );
-
- }
- else {
-
- var bVisible = p_aArgs[0];
- var sDisplay = Dom.getStyle(this.element, "display");
-
- if(bVisible) {
-
- if(sDisplay != "block") {
- this.beforeShowEvent.fire();
- Dom.setStyle(this.element, "display", "block");
- this.showEvent.fire();
- }
-
- }
- else {
-
- if(sDisplay == "block") {
- this.beforeHideEvent.fire();
- Dom.setStyle(this.element, "display", "none");
- this.hideEvent.fire();
- }
-
- }
-
- }
-
-},
-
-/**
-* @method configPosition
-* @description Event handler for when the "position" configuration property
-* of the menu changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-configPosition: function(p_sType, p_aArgs, p_oMenu) {
-
- var sCSSPosition = p_aArgs[0] == "static" ? "static" : "absolute";
- var oCfg = this.cfg;
-
- Dom.setStyle(this.element, "position", sCSSPosition);
-
- if(sCSSPosition == "static") {
-
- /*
- Remove the iframe for statically positioned menus since it will
- intercept mouse events.
- */
-
- oCfg.setProperty("iframe", false);
-
- // Statically positioned menus are visible by default
-
- Dom.setStyle(this.element, "display", "block");
-
- oCfg.setProperty("visible", true);
-
- }
- else {
-
- /*
- Even though the "visible" property is queued to
- "false" by default, we need to set the "visibility" property to
- "hidden" since Overlay's "configVisible" implementation checks the
- element's "visibility" style property before deciding whether
- or not to show an Overlay instance.
- */
-
- Dom.setStyle(this.element, "visibility", "hidden");
-
- }
-
- if(sCSSPosition == "absolute") {
-
- var nZIndex = oCfg.getProperty("zindex");
-
- if(!nZIndex || nZIndex === 0) {
-
- nZIndex = this.parent ?
- (this.parent.parent.cfg.getProperty("zindex") + 1) : 1;
-
- oCfg.setProperty("zindex", nZIndex);
-
- }
-
- }
-
-},
-
-/**
-* @method configIframe
-* @description Event handler for when the "iframe" configuration property of
-* the menu changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-configIframe: function(p_sType, p_aArgs, p_oMenu) {
-
- if(this.cfg.getProperty("position") == "dynamic") {
-
- YAHOO.widget.Menu.superclass.configIframe.call(
- this,
- p_sType,
- p_aArgs,
- p_oMenu
- );
-
- }
-
-},
-
-/**
-* @method configHideDelay
-* @description Event handler for when the "hidedelay" configuration property
-* of the menu changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-configHideDelay: function(p_sType, p_aArgs, p_oMenu) {
-
- var nHideDelay = p_aArgs[0];
- var oMouseOutEvent = this.mouseOutEvent;
- var oMouseOverEvent = this.mouseOverEvent;
- var oKeyDownEvent = this.keyDownEvent;
-
- if(nHideDelay > 0) {
-
- /*
- Only assign event handlers once. This way the user change
- the value for the hidedelay as many times as they want.
- */
-
- if(!this._hideDelayEventHandlersAssigned) {
-
- oMouseOutEvent.subscribe(this._execHideDelay, true);
- oMouseOverEvent.subscribe(this._cancelHideDelay, this, true);
- oKeyDownEvent.subscribe(this._cancelHideDelay, this, true);
-
- this._hideDelayEventHandlersAssigned = true;
-
- }
-
- }
- else {
-
- oMouseOutEvent.unsubscribe(this._execHideDelay, this);
- oMouseOverEvent.unsubscribe(this._cancelHideDelay, this);
- oKeyDownEvent.unsubscribe(this._cancelHideDelay, this);
-
- this._hideDelayEventHandlersAssigned = false;
-
- }
-
-},
-
-/**
-* @method configContainer
-* @description Event handler for when the "container" configuration property
-of the menu changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
-* fired the event.
-*/
-configContainer: function(p_sType, p_aArgs, p_oMenu) {
-
- var oElement = p_aArgs[0];
-
- if(typeof oElement == 'string') {
-
- this.cfg.setProperty(
- "container",
- document.getElementById(oElement),
- true
- );
-
- }
-
-},
-
-// Public methods
-
-/**
-* Event handler called when the resize monitor element's "resize" evet is fired.
-*/
-onDomResize: function(e, obj) {
-
- if(!this._handleResize) {
-
- this._handleResize = true;
- return;
-
- }
-
- var oConfig = this.cfg;
-
- if(oConfig.getProperty("position") == "dynamic") {
-
- oConfig.setProperty("width", (this._getOffsetWidth() + "px"));
-
- }
-
- YAHOO.widget.Menu.superclass.onDomResize.call(this, e, obj);
-
-},
-
-/**
-* @method initEvents
-* @description Initializes the custom events for the menu.
-*/
-initEvents: function() {
-
- YAHOO.widget.Menu.superclass.initEvents.call(this);
-
- // Create custom events
-
- var CustomEvent = YAHOO.util.CustomEvent;
-
- this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);
- this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);
- this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);
- this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);
- this.clickEvent = new CustomEvent("clickEvent", this);
- this.keyPressEvent = new CustomEvent("keyPressEvent", this);
- this.keyDownEvent = new CustomEvent("keyDownEvent", this);
- this.keyUpEvent = new CustomEvent("keyUpEvent", this);
- this.itemAddedEvent = new CustomEvent("itemAddedEvent", this);
- this.itemRemovedEvent = new CustomEvent("itemRemovedEvent", this);
-
-},
-
-/**
-* @method getRoot
-* @description Finds the menu's root menu.
-*/
-getRoot: function() {
-
- var oItem = this.parent;
-
- if(oItem) {
-
- var oParentMenu = oItem.parent;
-
- return oParentMenu ? oParentMenu.getRoot() : this;
-
- }
- else {
-
- return this;
-
- }
-
-},
-
-/**
-* @method toString
-* @description Returns a string representing the menu.
-* @return {String}
-*/
-toString: function() {
-
- return ("Menu " + this.id);
-
-},
-
-/**
-* @method setItemGroupTitle
-* @description Sets the title of a group of menu items.
-* @param {String} p_sGroupTitle String specifying the title of the group.
-* @param {Number} p_nGroupIndex Optional. Number specifying the group to which
-* the title belongs.
-*/
-setItemGroupTitle: function(p_sGroupTitle, p_nGroupIndex) {
-
- if(typeof p_sGroupTitle == "string" && p_sGroupTitle.length > 0) {
-
- var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;
- var oTitle = this._aGroupTitleElements[nGroupIndex];
-
- if(oTitle) {
-
- oTitle.innerHTML = p_sGroupTitle;
-
- }
- else {
-
- oTitle = document.createElement(this.GROUP_TITLE_TAG_NAME);
-
- oTitle.innerHTML = p_sGroupTitle;
-
- this._aGroupTitleElements[nGroupIndex] = oTitle;
-
- }
-
- var i = this._aGroupTitleElements.length - 1;
- var nFirstIndex;
-
- do {
-
- if(this._aGroupTitleElements[i]) {
-
- Dom.removeClass(this._aGroupTitleElements[i], "first-of-type");
-
- nFirstIndex = i;
-
- }
-
- }
- while(i--);
-
- if(nFirstIndex !== null) {
-
- Dom.addClass(
- this._aGroupTitleElements[nFirstIndex],
- "first-of-type"
- );
-
- }
-
- }
-
-},
-
-/**
-* @method addItem
-* @description Appends an item to the menu.
-* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
-* instance to be added to the menu.
-* @param {String} p_oItem String specifying the text of the item to be added
-* to the menu.
-* @param {Object} p_oItem Object literal containing a set of menu item
-* configuration properties.
-* @param {Number} p_nGroupIndex Optional. Number indicating the group to
-* which the item belongs.
-* @return {YAHOO.widget.MenuItem}
-*/
-addItem: function(p_oItem, p_nGroupIndex) {
-
- if(p_oItem) {
-
- return this._addItemToGroup(p_nGroupIndex, p_oItem);
-
- }
-
-},
-
-/**
-* @method addItems
-* @description Adds an array of items to the menu.
-* @param {Array} p_aItems Array of items to be added to the menu. The array
-* can contain strings specifying the text for each item to be created, object
-* literals specifying each of the menu item configuration properties,
-* or MenuItem instances.
-* @param {Number} p_nGroupIndex Optional. Number specifying the group to
-* which the items belongs.
-* @return {Array}
-*/
-addItems: function(p_aItems, p_nGroupIndex) {
-
- function isArray(p_oValue) {
-
- return (typeof p_oValue == "object" && p_oValue.constructor == Array);
-
- }
-
- if(isArray(p_aItems)) {
-
- var nItems = p_aItems.length;
- var aItems = [];
- var oItem;
-
- for(var i=0; i<div> element
-* (and accompanying child nodes) from the document.
-*/
-destroy: function() {
-
- // Remove Custom Event listeners
-
- this.mouseOverEvent.unsubscribeAll();
- this.mouseOutEvent.unsubscribeAll();
- this.mouseDownEvent.unsubscribeAll();
- this.mouseUpEvent.unsubscribeAll();
- this.clickEvent.unsubscribeAll();
- this.keyPressEvent.unsubscribeAll();
- this.keyDownEvent.unsubscribeAll();
- this.keyUpEvent.unsubscribeAll();
-
- var nItemGroups = this._aItemGroups.length;
- var nItems;
- var oItemGroup;
- var oItem;
- var i;
- var n;
-
- // Remove all items
-
- if(nItemGroups > 0) {
-
- i = nItemGroups - 1;
-
- do {
-
- oItemGroup = this._aItemGroups[i];
-
- if(oItemGroup) {
-
- nItems = oItemGroup.length;
-
- if(nItems > 0) {
-
- n = nItems - 1;
-
- do {
-
- oItem = this._aItemGroups[i][n];
-
- if(oItem) {
-
- oItem.destroy();
- }
-
- }
- while(n--);
-
- }
-
- }
-
- }
- while(i--);
-
- }
-
- // Continue with the superclass implementation of this method
-
- YAHOO.widget.Menu.superclass.destroy.call(this);
-
-
-},
-
-/**
-* @method setInitialFocus
-* @description Sets focus to the menu's first enabled item.
-*/
-setInitialFocus: function() {
-
- var oItem = this._getFirstEnabledItem();
-
- if(oItem) {
-
- oItem.focus();
- }
-
-},
-
-/**
-* @method setInitialSelection
-* @description Sets the "selected" configuration property of the menu's first
-* enabled item to "true."
-*/
-setInitialSelection: function() {
-
- var oItem = this._getFirstEnabledItem();
-
- if(oItem) {
-
- oItem.cfg.setProperty("selected", true);
- }
-
-},
-
-/**
-* @method clearActiveItem
-* @description Sets the "selected" configuration property of the menu's active
-* item to "false" and hides the item's submenu.
-* @param {Boolean} p_bBlur Boolean indicating if the menu's active item
-* should be blurred.
-*/
-clearActiveItem: function(p_bBlur) {
-
- if(this.cfg.getProperty("showdelay") > 0) {
-
- this._cancelShowDelay();
-
- }
-
- var oActiveItem = this.activeItem;
-
- if(oActiveItem) {
-
- var oConfig = oActiveItem.cfg;
-
- oConfig.setProperty("selected", false);
-
- var oSubmenu = oConfig.getProperty("submenu");
-
- if(oSubmenu) {
-
- oSubmenu.hide();
-
- }
-
- if(p_bBlur) {
-
- oActiveItem.blur();
-
- }
-
- }
-
-},
-
-/**
-* @description Initializes the class's configurable properties which can be
-* changed using the menu's Config object ("cfg").
-* @method initDefaultConfig
-*/
-initDefaultConfig: function() {
-
- YAHOO.widget.Menu.superclass.initDefaultConfig.call(this);
-
- var oConfig = this.cfg;
-
- // Add configuration properties
-
- /*
- Change the default value for the "visible" configuration
- property to "false" by re-adding the property.
- */
-
- /**
- * @config visible
- * @description Boolean indicating whether or not the menu is visible. If
- * the menu's "position" configuration property is set to "dynamic" (the
- * default), this property toggles the menu's <div>
- * element's "visibility" style property between "visible" (true) or
- * "hidden" (false). If the menu's "position" configuration property is
- * set to "static" this property toggles the menu's
- * <div> element's "display" style property
- * between "block" (true) or "none" (false).
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "visible",
- {
- value:false,
- handler:this.configVisible,
- validator:this.cfg.checkBoolean
- }
- );
-
- /*
- Change the default value for the "constraintoviewport" configuration
- property to "true" by re-adding the property.
- */
-
- /**
- * @config constraintoviewport
- * @description Boolean indicating if the menu will try to remain inside
- * the boundaries of the size of viewport.
- * @default true
- * @type Boolean
- */
- oConfig.addProperty(
- "constraintoviewport",
- {
- value:true,
- handler:this.configConstrainToViewport,
- validator:this.cfg.checkBoolean,
- supercedes:["iframe","x","y","xy"]
- }
- );
-
- /**
- * @config position
- * @description String indicating how a menu should be positioned on the
- * screen. Possible values are "static" and "dynamic." Static menus are
- * visible by default and reside in the normal flow of the document
- * (CSS position: static). Dynamic menus are hidden by default, reside
- * out of the normal flow of the document (CSS position: absolute), and
- * can overlay other elements on the screen.
- * @default dynamic
- * @type String
- */
- oConfig.addProperty(
- "position",
- {
- value: "dynamic",
- handler: this.configPosition,
- validator: this._checkPosition,
- supercedes: ["visible"]
- }
- );
-
- /**
- * @config submenualignment
- * @description Array defining how submenus should be aligned to their
- * parent menu item. The format is: [itemCorner, submenuCorner]. By default
- * a submenu's top left corner is aligned to its parent menu item's top
- * right corner.
- * @default ["tl","tr"]
- * @type Array
- */
- oConfig.addProperty("submenualignment", { value: ["tl","tr"] } );
-
- /**
- * @config autosubmenudisplay
- * @description Boolean indicating if submenus are automatically made
- * visible when the user mouses over the menu's items.
- * @default true
- * @type Boolean
- */
- oConfig.addProperty(
- "autosubmenudisplay",
- {
- value: true,
- validator: oConfig.checkBoolean
- }
- );
-
- /**
- * @config showdelay
- * @description Number indicating the time (in milliseconds) that should
- * expire before a submenu is made visible when the user mouses over
- * the menu's items.
- * @default 0
- * @type Number
- */
- oConfig.addProperty(
- "showdelay",
- {
- value: 0,
- validator: oConfig.checkNumber
- }
- );
-
- /**
- * @config hidedelay
- * @description Number indicating the time (in milliseconds) that should
- * expire before the menu is hidden.
- * @default 0
- * @type Number
- */
- oConfig.addProperty(
- "hidedelay",
- {
- value: 0,
- validator: oConfig.checkNumber,
- handler: this.configHideDelay,
- suppressEvent: true
- }
- );
-
- /**
- * @config clicktohide
- * @description Boolean indicating if the menu will automatically be
- * hidden if the user clicks outside of it.
- * @default true
- * @type Boolean
- */
- oConfig.addProperty(
- "clicktohide",
- {
- value: true,
- validator: oConfig.checkBoolean
- }
- );
-
- /**
- * @config container
- * @description HTML element reference or string specifying the id
- * attribute of the HTML element that the menu's markup should be rendered into.
- * @type HTMLElement |String
- * @default document.body
- */
- this.cfg.addProperty(
- "container",
- { value:document.body, handler:this.configContainer }
- );
-
-}
-
-}); // END YAHOO.extend
-
-})();
-
-/**
-* The base class for all menuing containers.
-*
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the menu module.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source for the
-* menu module.
-* @param {HTMLDivElement } p_oElement Object
-* specifying the <div> element of the menu module.
-* @param {HTMLSelectElement } p_oElement Object
-* specifying the <select> element to be used as the data
-* source for the menu module.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu module. See configuration class documentation for
-* more details.
-* @class MenuModule
-* @constructor
-* @extends YAHOO.widget.Overlay
-* @deprecated As of version 0.12, all MenuModule functionality has been
-* implemented directly in YAHOO.widget.Menu, making YAHOO.widget.Menu the base
-* class for all menuing containers.
-*/
-YAHOO.widget.MenuModule = YAHOO.widget.Menu;
-
-(function() {
-
-var Dom = YAHOO.util.Dom;
-var Module = YAHOO.widget.Module;
-var Menu = YAHOO.widget.Menu;
-
-/**
-* Creates an item for a menu.
-*
-* @param {String} p_oObject String specifying the text of the menu item.
-* @param {HTMLLIElement } p_oObject Object specifying
-* the <li> element of the menu item.
-* @param {HTMLOptGroupElement } p_oObject Object
-* specifying the <optgroup> element of the menu item.
-* @param {HTMLOptionElement } p_oObject Object
-* specifying the <option> element of the menu item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu item. See configuration class documentation
-* for more details.
-* @class MenuItem
-* @constructor
-*/
-YAHOO.widget.MenuItem = function(p_oObject, p_oConfig) {
-
- if(p_oObject) {
-
- if(p_oConfig) {
-
- this.parent = p_oConfig.parent;
- this.value = p_oConfig.value;
-
- }
-
- this.init(p_oObject, p_oConfig);
-
- }
-
-};
-
-YAHOO.widget.MenuItem.prototype = {
-
- // Constants
-
- /**
- * @property SUBMENU_INDICATOR_IMAGE_PATH
- * @description String representing the path to the image to be used for the
- * menu item's submenu arrow indicator.
- * @default "nt/ic/ut/alt1/menuarorght8_nrm_1.gif"
- * @final
- * @type String
- */
- SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarorght8_nrm_1.gif",
-
- /**
- * @property SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
- * @description String representing the path to the image to be used for the
- * submenu arrow indicator when the menu item is selected.
- * @default "nt/ic/ut/alt1/menuarorght8_hov_1.gif"
- * @final
- * @type String
- */
- SELECTED_SUBMENU_INDICATOR_IMAGE_PATH:
- "nt/ic/ut/alt1/menuarorght8_hov_1.gif",
-
- /**
- * @property DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
- * @description String representing the path to the image to be used for the
- * submenu arrow indicator when the menu item is disabled.
- * @default "nt/ic/ut/alt1/menuarorght8_dim_1.gif"
- * @final
- * @type String
- */
- DISABLED_SUBMENU_INDICATOR_IMAGE_PATH:
- "nt/ic/ut/alt1/menuarorght8_dim_1.gif",
-
- /**
- * @property COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT
- * @description String representing the alt text for the image to be used
- * for the submenu arrow indicator.
- * @default "Collapsed. Click to expand."
- * @final
- * @type String
- */
- COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT: "Collapsed. Click to expand.",
-
- /**
- * @property EXPANDED_SUBMENU_INDICATOR_ALT_TEXT
- * @description String representing the alt text for the image to be used
- * for the submenu arrow indicator when the submenu is visible.
- * @default "Expanded. Click to collapse."
- * @final
- * @type String
- */
- EXPANDED_SUBMENU_INDICATOR_ALT_TEXT: "Expanded. Click to collapse.",
-
- /**
- * @property DISABLED_SUBMENU_INDICATOR_ALT_TEXT
- * @description String representing the alt text for the image to be used
- * for the submenu arrow indicator when the menu item is disabled.
- * @default "Disabled."
- * @final
- * @type String
- */
- DISABLED_SUBMENU_INDICATOR_ALT_TEXT: "Disabled.",
-
- /**
- * @property CHECKED_IMAGE_PATH
- * @description String representing the path to the image to be used for
- * the checked state.
- * @default "nt/ic/ut/bsc/menuchk8_nrm_1.gif"
- * @final
- * @type String
- */
- CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_nrm_1.gif",
-
-
- /**
- * @property SELECTED_CHECKED_IMAGE_PATH
- * @description String representing the path to the image to be used for
- * the selected checked state.
- * @default "nt/ic/ut/bsc/menuchk8_hov_1.gif"
- * @final
- * @type String
- */
- SELECTED_CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_hov_1.gif",
-
-
- /**
- * @property DISABLED_CHECKED_IMAGE_PATH
- * @description String representing the path to the image to be used for
- * the disabled checked state.
- * @default "nt/ic/ut/bsc/menuchk8_dim_1.gif"
- * @final
- * @type String
- */
- DISABLED_CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_dim_1.gif",
-
-
- /**
- * @property CHECKED_IMAGE_ALT_TEXT
- * @description String representing the alt text for the image to be used
- * for the checked image.
- * @default "Checked."
- * @final
- * @type String
- */
- CHECKED_IMAGE_ALT_TEXT: "Checked.",
-
-
- /**
- * @property DISABLED_CHECKED_IMAGE_ALT_TEXT
- * @description String representing the alt text for the image to be used
- * for the checked image when the item is disabled.
- * @default "Checked. (Item disabled.)"
- * @final
- * @type String
- */
- DISABLED_CHECKED_IMAGE_ALT_TEXT: "Checked. (Item disabled.)",
-
- /**
- * @property CSS_CLASS_NAME
- * @description String representing the CSS class(es) to be applied to the
- * <li> element of the menu item.
- * @default "yuimenuitem"
- * @final
- * @type String
- */
- CSS_CLASS_NAME: "yuimenuitem",
-
- /**
- * @property SUBMENU_TYPE
- * @description Object representing the type of menu to instantiate and
- * add when parsing the child nodes of the menu item's source HTML element.
- * @final
- * @type YAHOO.widget.Menu
- */
- SUBMENU_TYPE: null,
-
- /**
- * @property IMG_ROOT
- * @description String representing the prefix path to use for
- * non-secure images.
- * @default "http://us.i1.yimg.com/us.yimg.com/i/"
- * @type String
- */
- IMG_ROOT: "http://us.i1.yimg.com/us.yimg.com/i/",
-
-
- /**
- * @property IMG_ROOT_SSL
- * @description String representing the prefix path to use for securely
- * served images.
- * @default "https://a248.e.akamai.net/sec.yimg.com/i/"
- * @type String
- */
- IMG_ROOT_SSL: "https://a248.e.akamai.net/sec.yimg.com/i/",
-
- // Private member variables
-
- /**
- * @property _oAnchor
- * @description Object reference to the menu item's
- * <a> element.
- * @default null
- * @private
- * @type HTMLAnchorElement
- */
- _oAnchor: null,
-
-
- /**
- * @property _oText
- * @description Object reference to the menu item's text node.
- * @default null
- * @private
- * @type TextNode
- */
- _oText: null,
-
-
- /**
- * @property _oHelpTextEM
- * @description Object reference to the menu item's help text
- * <em> element.
- * @default null
- * @private
- * @type HTMLElement
- */
- _oHelpTextEM: null,
-
-
- /**
- * @property _oSubmenu
- * @description Object reference to the menu item's submenu.
- * @default null
- * @private
- * @type YAHOO.widget.Menu
- */
- _oSubmenu: null,
-
- /**
- * @property _checkImage
- * @description Object reference to the menu item's checkmark image.
- * @default null
- * @private
- * @type HTMLImageElement
- */
- _checkImage: null,
-
- // Public properties
-
- /**
- * @property constructor
- * @description Object reference to the menu item's constructor function.
- * @default YAHOO.widget.MenuItem
- * @type YAHOO.widget.MenuItem
- */
- constructor: YAHOO.widget.MenuItem,
-
- /**
- * @property imageRoot
- * @description String representing the root path for all of the menu
- * item's images.
- * @type String
- */
- imageRoot: null,
-
- /**
- * @property isSecure
- * @description Boolean representing whether or not the current browsing
- * context is secure (HTTPS).
- * @type Boolean
- */
- isSecure: Module.prototype.isSecure,
-
- /**
- * @property index
- * @description Number indicating the ordinal position of the menu item in
- * its group.
- * @default null
- * @type Number
- */
- index: null,
-
- /**
- * @property groupIndex
- * @description Number indicating the index of the group to which the menu
- * item belongs.
- * @default null
- * @type Number
- */
- groupIndex: null,
-
- /**
- * @property parent
- * @description Object reference to the menu item's parent menu.
- * @default null
- * @type YAHOO.widget.Menu
- */
- parent: null,
-
- /**
- * @property element
- * @description Object reference to the menu item's
- * <li> element.
- * @default HTMLLIElement
- * @type HTMLLIElement
- */
- element: null,
-
- /**
- * @property srcElement
- * @description Object reference to the HTML element (either
- * <li>, <optgroup> or
- * <option>) used create the menu item.
- * @default HTMLLIElement |HTMLOptGroupElement |HTMLOptionElement
- * @type HTMLLIElement |
- * HTMLOptGroupElement |HTMLOptionElement
- */
- srcElement: null,
-
- /**
- * @property value
- * @description Object reference to the menu item's value.
- * @default null
- * @type Object
- */
- value: null,
-
- /**
- * @property submenuIndicator
- * @description Object reference to the <img> element
- * used to create the submenu indicator for the menu item.
- * @default HTMLImageElement
- * @type HTMLImageElement
- */
- submenuIndicator: null,
-
- /**
- * @property browser
- * @description String representing the browser.
- * @type String
- */
- browser: Module.prototype.browser,
-
- // Events
-
- /**
- * @event destroyEvent
- * @description Fires when the menu item's <li>
- * element is removed from its parent <ul> element.
- * @type YAHOO.util.CustomEvent
- */
- destroyEvent: null,
-
- /**
- * @event mouseOverEvent
- * @description Fires when the mouse has entered the menu item. Passes
- * back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- mouseOverEvent: null,
-
- /**
- * @event mouseOutEvent
- * @description Fires when the mouse has left the menu item. Passes back
- * the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- mouseOutEvent: null,
-
- /**
- * @event mouseDownEvent
- * @description Fires when the user mouses down on the menu item. Passes
- * back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- mouseDownEvent: null,
-
- /**
- * @event mouseUpEvent
- * @description Fires when the user releases a mouse button while the mouse
- * is over the menu item. Passes back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- mouseUpEvent: null,
-
- /**
- * @event clickEvent
- * @description Fires when the user clicks the on the menu item. Passes
- * back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- clickEvent: null,
-
- /**
- * @event keyPressEvent
- * @description Fires when the user presses an alphanumeric key when the
- * menu item has focus. Passes back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- keyPressEvent: null,
-
- /**
- * @event keyDownEvent
- * @description Fires when the user presses a key when the menu item has
- * focus. Passes back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- keyDownEvent: null,
-
- /**
- * @event keyUpEvent
- * @description Fires when the user releases a key when the menu item has
- * focus. Passes back the DOM Event object as an argument.
- * @type YAHOO.util.CustomEvent
- */
- keyUpEvent: null,
-
- /**
- * @event focusEvent
- * @description Fires when the menu item receives focus.
- * @type YAHOO.util.CustomEvent
- */
- focusEvent: null,
-
- /**
- * @event blurEvent
- * @description Fires when the menu item loses the input focus.
- * @type YAHOO.util.CustomEvent
- */
- blurEvent: null,
-
- /**
- * @method init
- * @description The MenuItem class's initialization method. This method is
- * automatically called by the constructor, and sets up all DOM references
- * for pre-existing markup, and creates required markup if it is not
- * already present.
- * @param {String} p_oObject String specifying the text of the menu item.
- * @param {HTMLLIElement } p_oObject Object specifying
- * the <li> element of the menu item.
- * @param {HTMLOptGroupElement } p_oObject Object
- * specifying the <optgroup> element of the menu item.
- * @param {HTMLOptionElement } p_oObject Object
- * specifying the <option> element of the menu item.
- * @param {Object} p_oConfig Optional. Object literal specifying the
- * configuration for the menu item. See configuration class documentation
- * for more details.
- */
- init: function(p_oObject, p_oConfig) {
-
- this.imageRoot = (this.isSecure) ? this.IMG_ROOT_SSL : this.IMG_ROOT;
-
- if(!this.SUBMENU_TYPE) {
-
- this.SUBMENU_TYPE = Menu;
-
- }
-
- // Create the config object
-
- this.cfg = new YAHOO.util.Config(this);
-
- this.initDefaultConfig();
-
- var oConfig = this.cfg;
-
- if(this._checkString(p_oObject)) {
-
- this._createRootNodeStructure();
-
- oConfig.setProperty("text", p_oObject);
-
- }
- else if(this._checkDOMNode(p_oObject)) {
-
- switch(p_oObject.tagName.toUpperCase()) {
-
- case "OPTION":
-
- this._createRootNodeStructure();
-
- oConfig.setProperty("text", p_oObject.text);
-
- this.srcElement = p_oObject;
-
- break;
-
- case "OPTGROUP":
-
- this._createRootNodeStructure();
-
- oConfig.setProperty("text", p_oObject.label);
-
- this.srcElement = p_oObject;
-
- this._initSubTree();
-
- break;
-
- case "LI":
-
- // Get the anchor node (if it exists)
-
- var oAnchor = this._getFirstElement(p_oObject, "A");
- var sURL = "#";
- var sTarget = null;
- var sText = null;
-
- // Capture the "text" and/or the "URL"
-
- if(oAnchor) {
-
- sURL = oAnchor.getAttribute("href");
- sTarget = oAnchor.getAttribute("target");
-
- if(oAnchor.innerText) {
-
- sText = oAnchor.innerText;
-
- }
- else {
-
- var oRange = oAnchor.ownerDocument.createRange();
-
- oRange.selectNodeContents(oAnchor);
-
- sText = oRange.toString();
-
- }
-
- }
- else {
-
- var oText = p_oObject.firstChild;
-
- sText = oText.nodeValue;
-
- oAnchor = document.createElement("a");
-
- oAnchor.setAttribute("href", sURL);
-
- p_oObject.replaceChild(oAnchor, oText);
-
- oAnchor.appendChild(oText);
-
- }
-
- this.srcElement = p_oObject;
- this.element = p_oObject;
- this._oAnchor = oAnchor;
-
-
- // Check if emphasis has been applied to the MenuItem
-
- var oEmphasisNode = this._getFirstElement(oAnchor);
- var bEmphasis = false;
- var bStrongEmphasis = false;
-
- if(oEmphasisNode) {
-
- // Set a reference to the text node
-
- this._oText = oEmphasisNode.firstChild;
-
- switch(oEmphasisNode.tagName.toUpperCase()) {
-
- case "EM":
-
- bEmphasis = true;
-
- break;
-
- case "STRONG":
-
- bStrongEmphasis = true;
-
- break;
-
- }
-
- }
- else {
-
- // Set a reference to the text node
-
- this._oText = oAnchor.firstChild;
-
- }
-
- /*
- Set these properties silently to sync up the
- configuration object without making changes to the
- element's DOM
- */
-
- oConfig.setProperty("text", sText, true);
- oConfig.setProperty("url", sURL, true);
- oConfig.setProperty("target", sTarget, true);
- oConfig.setProperty("emphasis", bEmphasis, true);
- oConfig.setProperty(
- "strongemphasis",
- bStrongEmphasis,
- true
- );
-
- this._initSubTree();
-
- break;
-
- }
-
- }
-
- if(this.element) {
-
- Dom.addClass(this.element, this.CSS_CLASS_NAME);
-
- // Create custom events
-
- var CustomEvent = YAHOO.util.CustomEvent;
-
- this.destroyEvent = new CustomEvent("destroyEvent", this);
- this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);
- this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);
- this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);
- this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);
- this.clickEvent = new CustomEvent("clickEvent", this);
- this.keyPressEvent = new CustomEvent("keyPressEvent", this);
- this.keyDownEvent = new CustomEvent("keyDownEvent", this);
- this.keyUpEvent = new CustomEvent("keyUpEvent", this);
- this.focusEvent = new CustomEvent("focusEvent", this);
- this.blurEvent = new CustomEvent("blurEvent", this);
-
- if(p_oConfig) {
-
- oConfig.applyConfig(p_oConfig);
-
- }
-
- oConfig.fireQueue();
-
- }
-
- },
-
- // Private methods
-
- /**
- * @method _getFirstElement
- * @description Returns an HTML element's first HTML element node.
- * @private
- * @param {HTMLElement } p_oElement Object
- * reference specifying the element to be evaluated.
- * @param {String} p_sTagName Optional. String specifying the tagname of
- * the element to be retrieved.
- * @return {HTMLElement }
- */
- _getFirstElement: function(p_oElement, p_sTagName) {
-
- var oElement;
-
- if(p_oElement.firstChild && p_oElement.firstChild.nodeType == 1) {
-
- oElement = p_oElement.firstChild;
-
- }
- else if(
- p_oElement.firstChild &&
- p_oElement.firstChild.nextSibling &&
- p_oElement.firstChild.nextSibling.nodeType == 1
- ) {
-
- oElement = p_oElement.firstChild.nextSibling;
-
- }
-
- if(p_sTagName) {
-
- return (oElement && oElement.tagName.toUpperCase() == p_sTagName) ?
- oElement : false;
-
- }
-
- return oElement;
-
- },
-
- /**
- * @method _checkString
- * @description Determines if an object is a string.
- * @private
- * @param {Object} p_oObject Object to be evaluated.
- * @return {Boolean}
- */
- _checkString: function(p_oObject) {
-
- return (typeof p_oObject == "string");
-
- },
-
- /**
- * @method _checkDOMNode
- * @description Determines if an object is an HTML element.
- * @private
- * @param {Object} p_oObject Object to be evaluated.
- * @return {Boolean}
- */
- _checkDOMNode: function(p_oObject) {
-
- return (p_oObject && p_oObject.tagName);
-
- },
-
- /**
- * @method _createRootNodeStructure
- * @description Creates the core DOM structure for the menu item.
- * @private
- */
- _createRootNodeStructure: function () {
-
- this.element = document.createElement("li");
-
- this._oText = document.createTextNode("");
-
- this._oAnchor = document.createElement("a");
- this._oAnchor.appendChild(this._oText);
-
- this.cfg.refireEvent("url");
-
- this.element.appendChild(this._oAnchor);
-
- },
-
- /**
- * @method _initSubTree
- * @description Iterates the source element's childNodes collection and uses
- * the child nodes to instantiate other menus.
- * @private
- */
- _initSubTree: function() {
-
- var oSrcEl = this.srcElement;
- var oConfig = this.cfg;
-
- if(oSrcEl.childNodes.length > 0) {
-
- if(
- this.parent.lazyLoad &&
- this.parent.srcElement &&
- this.parent.srcElement.tagName.toUpperCase() == "SELECT"
- ) {
-
- oConfig.setProperty(
- "submenu",
- { id: Dom.generateId(), itemdata: oSrcEl.childNodes }
- );
-
- }
- else {
-
- var oNode = oSrcEl.firstChild;
- var aOptions = [];
-
- do {
-
- if(oNode && oNode.tagName) {
-
- switch(oNode.tagName.toUpperCase()) {
-
- case "DIV":
-
- oConfig.setProperty("submenu", oNode);
-
- break;
-
- case "OPTION":
-
- aOptions[aOptions.length] = oNode;
-
- break;
-
- }
-
- }
-
- }
- while((oNode = oNode.nextSibling));
-
-
- var nOptions = aOptions.length;
-
- if(nOptions > 0) {
-
- var oMenu = new this.SUBMENU_TYPE(Dom.generateId());
-
- oConfig.setProperty("submenu", oMenu);
-
- for(var n=0; n 0) {
-
- oAnchor.setAttribute("target", sTarget);
-
- }
- else {
-
- oAnchor.removeAttribute("target");
-
- }
-
- },
-
- /**
- * @method configEmphasis
- * @description Event handler for when the "emphasis" configuration property
- * of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configEmphasis: function(p_sType, p_aArgs, p_oItem) {
-
- var bEmphasis = p_aArgs[0];
- var oAnchor = this._oAnchor;
- var oText = this._oText;
- var oConfig = this.cfg;
- var oEM;
-
- if(bEmphasis && oConfig.getProperty("strongemphasis")) {
-
- oConfig.setProperty("strongemphasis", false);
-
- }
-
- if(oAnchor) {
-
- if(bEmphasis) {
-
- oEM = document.createElement("em");
- oEM.appendChild(oText);
-
- oAnchor.appendChild(oEM);
-
- }
- else {
-
- oEM = this._getFirstElement(oAnchor, "EM");
-
- oAnchor.removeChild(oEM);
- oAnchor.appendChild(oText);
-
- }
-
- }
-
- },
-
- /**
- * @method configStrongEmphasis
- * @description Event handler for when the "strongemphasis" configuration
- * property of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configStrongEmphasis: function(p_sType, p_aArgs, p_oItem) {
-
- var bStrongEmphasis = p_aArgs[0];
- var oAnchor = this._oAnchor;
- var oText = this._oText;
- var oConfig = this.cfg;
- var oStrong;
-
- if(bStrongEmphasis && oConfig.getProperty("emphasis")) {
-
- oConfig.setProperty("emphasis", false);
-
- }
-
- if(oAnchor) {
-
- if(bStrongEmphasis) {
-
- oStrong = document.createElement("strong");
- oStrong.appendChild(oText);
-
- oAnchor.appendChild(oStrong);
-
- }
- else {
-
- oStrong = this._getFirstElement(oAnchor, "STRONG");
-
- oAnchor.removeChild(oStrong);
- oAnchor.appendChild(oText);
-
- }
-
- }
-
- },
-
- /**
- * @method configChecked
- * @description Event handler for when the "checked" configuration property
- * of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configChecked: function(p_sType, p_aArgs, p_oItem) {
-
- var bChecked = p_aArgs[0];
- var oEl = this.element;
- var oConfig = this.cfg;
- var oImg;
-
-
- if(bChecked) {
-
- this._preloadImage(this.CHECKED_IMAGE_PATH);
- this._preloadImage(this.SELECTED_CHECKED_IMAGE_PATH);
- this._preloadImage(this.DISABLED_CHECKED_IMAGE_PATH);
-
- oImg = document.createElement("img");
- oImg.src = (this.imageRoot + this.CHECKED_IMAGE_PATH);
- oImg.alt = this.CHECKED_IMAGE_ALT_TEXT;
-
- var oSubmenu = this.cfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- oEl.insertBefore(oImg, oSubmenu.element);
-
- }
- else {
-
- oEl.appendChild(oImg);
-
- }
-
- Dom.addClass([oEl, oImg], "checked");
-
- this._checkImage = oImg;
-
- if(oConfig.getProperty("disabled")) {
-
- oConfig.refireEvent("disabled");
-
- }
-
- if(oConfig.getProperty("selected")) {
-
- oConfig.refireEvent("selected");
-
- }
-
- }
- else {
-
- oImg = this._checkImage;
-
- Dom.removeClass([oEl, oImg], "checked");
-
- if(oImg) {
-
- oEl.removeChild(oImg);
-
- }
-
- this._checkImage = null;
-
- }
-
- },
-
- /**
- * @method configDisabled
- * @description Event handler for when the "disabled" configuration property
- * of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configDisabled: function(p_sType, p_aArgs, p_oItem) {
-
- var bDisabled = p_aArgs[0];
- var oAnchor = this._oAnchor;
- var aNodes = [this.element, oAnchor];
- var oEM = this._oHelpTextEM;
- var oConfig = this.cfg;
- var oImg;
- var sImgSrc;
- var sImgAlt;
-
- if(oEM) {
-
- aNodes[2] = oEM;
-
- }
-
- if(this.cfg.getProperty("checked")) {
-
- sImgAlt = this.CHECKED_IMAGE_ALT_TEXT;
- sImgSrc = this.CHECKED_IMAGE_PATH;
- oImg = this._checkImage;
-
- if(bDisabled) {
-
- sImgAlt = this.DISABLED_CHECKED_IMAGE_ALT_TEXT;
- sImgSrc = this.DISABLED_CHECKED_IMAGE_PATH;
-
- }
-
- oImg.src = document.images[(this.imageRoot + sImgSrc)].src;
- oImg.alt = sImgAlt;
-
- }
-
- oImg = this.submenuIndicator;
-
- if(bDisabled) {
-
- if(oConfig.getProperty("selected")) {
-
- oConfig.setProperty("selected", false);
-
- }
-
- oAnchor.removeAttribute("href");
-
- Dom.addClass(aNodes, "disabled");
-
- sImgSrc = this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH;
- sImgAlt = this.DISABLED_SUBMENU_INDICATOR_ALT_TEXT;
-
- }
- else {
-
- oAnchor.setAttribute("href", oConfig.getProperty("url"));
-
- Dom.removeClass(aNodes, "disabled");
-
- sImgSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;
- sImgAlt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
-
- }
-
- if(oImg) {
-
- oImg.src = this.imageRoot + sImgSrc;
- oImg.alt = sImgAlt;
-
- }
-
- },
-
- /**
- * @method configSelected
- * @description Event handler for when the "selected" configuration property
- * of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configSelected: function(p_sType, p_aArgs, p_oItem) {
-
- if(!this.cfg.getProperty("disabled")) {
-
- var bSelected = p_aArgs[0];
- var oEM = this._oHelpTextEM;
- var aNodes = [this.element, this._oAnchor];
- var oImg = this.submenuIndicator;
- var sImgSrc;
-
- if(oEM) {
-
- aNodes[aNodes.length] = oEM;
-
- }
-
- if(oImg) {
-
- aNodes[aNodes.length] = oImg;
-
- }
-
-
- if(this.cfg.getProperty("checked")) {
-
- sImgSrc = this.imageRoot + (bSelected ?
- this.SELECTED_CHECKED_IMAGE_PATH : this.CHECKED_IMAGE_PATH);
-
- this._checkImage.src = document.images[sImgSrc].src;
-
- }
-
- if(bSelected) {
-
- Dom.addClass(aNodes, "selected");
- sImgSrc = this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH;
-
- }
- else {
-
- Dom.removeClass(aNodes, "selected");
- sImgSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;
-
- }
-
- if(oImg) {
-
- oImg.src = document.images[(this.imageRoot + sImgSrc)].src;
-
- }
-
- }
-
- },
-
- /**
- * @method configSubmenu
- * @description Event handler for when the "submenu" configuration property
- * of the menu item changes.
- * @param {String} p_sType String representing the name of the event that
- * was fired.
- * @param {Array} p_aArgs Array of arguments sent when the event was fired.
- * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
- * that fired the event.
- */
- configSubmenu: function(p_sType, p_aArgs, p_oItem) {
-
- var oEl = this.element;
- var oSubmenu = p_aArgs[0];
- var oImg = this.submenuIndicator;
- var oConfig = this.cfg;
- var aNodes = [this.element, this._oAnchor];
- var oMenu;
- var bLazyLoad = this.parent && this.parent.lazyLoad;
-
- if(oSubmenu) {
-
- if(oSubmenu instanceof Menu) {
-
- oMenu = oSubmenu;
- oMenu.parent = this;
- oMenu.lazyLoad = bLazyLoad;
-
- }
- else if(
- typeof oSubmenu == "object" &&
- oSubmenu.id &&
- !oSubmenu.nodeType
- ) {
-
- var sSubmenuId = oSubmenu.id;
- var oSubmenuConfig = oSubmenu;
-
- delete oSubmenu["id"];
-
- oSubmenuConfig.lazyload = bLazyLoad;
- oSubmenuConfig.parent = this;
-
- oMenu = new this.SUBMENU_TYPE(sSubmenuId, oSubmenuConfig);
-
- // Set the value of the property to the Menu instance
-
- this.cfg.setProperty("submenu", oMenu, true);
-
- }
- else {
-
- oMenu = new this.SUBMENU_TYPE(
- oSubmenu,
- { lazyload: bLazyLoad, parent: this }
- );
-
- // Set the value of the property to the Menu instance
-
- this.cfg.setProperty("submenu", oMenu, true);
-
- }
-
- if(oMenu) {
-
- this._oSubmenu = oMenu;
-
- if(!oImg) {
-
- this._preloadImage(this.SUBMENU_INDICATOR_IMAGE_PATH);
- this._preloadImage(
- this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
- );
-
- this._preloadImage(
- this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
- );
-
- oImg = document.createElement("img");
-
- oImg.src =
- (this.imageRoot + this.SUBMENU_INDICATOR_IMAGE_PATH);
-
- oImg.alt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
-
- oEl.appendChild(oImg);
-
- this.submenuIndicator = oImg;
-
- Dom.addClass(aNodes, "hassubmenu");
-
- if(oConfig.getProperty("disabled")) {
-
- oConfig.refireEvent("disabled");
-
- }
-
- if(oConfig.getProperty("selected")) {
-
- oConfig.refireEvent("selected");
-
- }
-
- }
-
- }
-
- }
- else {
-
- Dom.removeClass(aNodes, "hassubmenu");
-
- if(oImg) {
-
- oEl.removeChild(oImg);
-
- }
-
- if(this._oSubmenu) {
-
- this._oSubmenu.destroy();
-
- }
-
- }
-
- },
-
- // Public methods
-
- /**
- * @method initDefaultConfig
- * @description Initializes an item's configurable properties.
- */
- initDefaultConfig : function() {
-
- var oConfig = this.cfg;
- var CheckBoolean = oConfig.checkBoolean;
-
- // Define the config properties
-
- /**
- * @config text
- * @description String specifying the text label for the menu item.
- * When building a menu from existing HTML the value of this property
- * will be interpreted from the menu's markup.
- * @default ""
- * @type String
- */
- oConfig.addProperty(
- "text",
- {
- value: "",
- handler: this.configText,
- validator: this._checkString,
- suppressEvent: true
- }
- );
-
-
- /**
- * @config helptext
- * @description String specifying additional instructional text to
- * accompany the text for the nenu item.
- * @default null
- * @type String|
- * HTMLElement
- */
- oConfig.addProperty("helptext", { handler: this.configHelpText });
-
- /**
- * @config url
- * @description String specifying the URL for the menu item's anchor's
- * "href" attribute. When building a menu from existing HTML the value
- * of this property will be interpreted from the menu's markup.
- * @default "#"
- * @type String
- */
- oConfig.addProperty(
- "url",
- { value: "#", handler: this.configURL, suppressEvent: true }
- );
-
- /**
- * @config target
- * @description String specifying the value for the "target" attribute
- * of the menu item's anchor element. Specifying a target will
- * require the user to click directly on the menu item's anchor node in
- * order to cause the browser to navigate to the specified URL.
- * When building a menu from existing HTML the value of this property
- * will be interpreted from the menu's markup.
- * @default null
- * @type String
- */
- oConfig.addProperty(
- "target",
- { handler: this.configTarget, suppressEvent: true }
- );
-
- /**
- * @config emphasis
- * @description Boolean indicating if the text of the menu item will be
- * rendered with emphasis. When building a menu from existing HTML the
- * value of this property will be interpreted from the menu's markup.
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "emphasis",
- {
- value: false,
- handler: this.configEmphasis,
- validator: CheckBoolean,
- suppressEvent: true
- }
- );
-
- /**
- * @config strongemphasis
- * @description Boolean indicating if the text of the menu item will be
- * rendered with strong emphasis. When building a menu from existing
- * HTML the value of this property will be interpreted from the
- * menu's markup.
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "strongemphasis",
- {
- value: false,
- handler: this.configStrongEmphasis,
- validator: CheckBoolean,
- suppressEvent: true
- }
- );
-
- /**
- * @config checked
- * @description Boolean indicating if the menu item should be rendered
- * with a checkmark.
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "checked",
- {
- value: false,
- handler: this.configChecked,
- validator: this.cfg.checkBoolean,
- suppressEvent: true,
- supercedes:["disabled"]
- }
- );
-
- /**
- * @config disabled
- * @description Boolean indicating if the menu item should be disabled.
- * (Disabled menu items are dimmed and will not respond to user input
- * or fire events.)
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "disabled",
- {
- value: false,
- handler: this.configDisabled,
- validator: CheckBoolean,
- suppressEvent: true
- }
- );
-
- /**
- * @config selected
- * @description Boolean indicating if the menu item should
- * be highlighted.
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "selected",
- {
- value: false,
- handler: this.configSelected,
- validator: CheckBoolean,
- suppressEvent: true
- }
- );
-
- /**
- * @config submenu
- * @description Object specifying the submenu to be appended to the
- * menu item. The value can be one of the following: Object
- * specifying a Menu instance. Object literal specifying the
- * menu to be created. Format: { id: [menu id], itemdata:
- * [array of values for
- * items ] }. String specifying the id attribute
- * of the <div> element of the menu.
- * Object specifying the <div> element of the
- * menu.
- * @default null
- * @type Menu|String|Object|
- * HTMLElement
- */
- oConfig.addProperty("submenu", { handler: this.configSubmenu });
-
- },
-
- /**
- * @method getNextEnabledSibling
- * @description Finds the menu item's next enabled sibling.
- * @return YAHOO.widget.MenuItem
- */
- getNextEnabledSibling: function() {
-
- if(this.parent instanceof Menu) {
-
- var nGroupIndex = this.groupIndex;
-
- /**
- * Finds the next item in an array.
- * @private
- * @param {p_aArray} Array to search.
- * @param {p_nStartIndex} Number indicating the index to
- * start searching the array.
- * @return {Object}
- */
- var getNextArrayItem = function(p_aArray, p_nStartIndex) {
-
- return p_aArray[p_nStartIndex] ||
- getNextArrayItem(p_aArray, (p_nStartIndex+1));
-
- };
-
-
- var aItemGroups = this.parent.getItemGroups();
- var oNextItem;
-
-
- if(this.index < (aItemGroups[nGroupIndex].length - 1)) {
-
- oNextItem = getNextArrayItem(
- aItemGroups[nGroupIndex],
- (this.index+1)
- );
-
- }
- else {
-
- var nNextGroupIndex;
-
- if(nGroupIndex < (aItemGroups.length - 1)) {
-
- nNextGroupIndex = nGroupIndex + 1;
-
- }
- else {
-
- nNextGroupIndex = 0;
-
- }
-
- var aNextGroup = getNextArrayItem(aItemGroups, nNextGroupIndex);
-
- // Retrieve the first menu item in the next group
-
- oNextItem = getNextArrayItem(aNextGroup, 0);
-
- }
-
- return (
- oNextItem.cfg.getProperty("disabled") ||
- oNextItem.element.style.display == "none"
- ) ?
- oNextItem.getNextEnabledSibling() : oNextItem;
-
- }
-
- },
-
- /**
- * @method getPreviousEnabledSibling
- * @description Finds the menu item's previous enabled sibling.
- * @return {YAHOO.widget.MenuItem}
- */
- getPreviousEnabledSibling: function() {
-
- if(this.parent instanceof Menu) {
-
- var nGroupIndex = this.groupIndex;
-
- /**
- * Returns the previous item in an array
- * @private
- * @param {p_aArray} Array to search.
- * @param {p_nStartIndex} Number indicating the index to
- * start searching the array.
- * @return {Object}
- */
- var getPreviousArrayItem = function(p_aArray, p_nStartIndex) {
-
- return p_aArray[p_nStartIndex] ||
- getPreviousArrayItem(p_aArray, (p_nStartIndex-1));
-
- };
-
- /**
- * Get the index of the first item in an array
- * @private
- * @param {p_aArray} Array to search.
- * @param {p_nStartIndex} Number indicating the index to
- * start searching the array.
- * @return {Object}
- */
- var getFirstItemIndex = function(p_aArray, p_nStartIndex) {
-
- return p_aArray[p_nStartIndex] ?
- p_nStartIndex :
- getFirstItemIndex(p_aArray, (p_nStartIndex+1));
-
- };
-
- var aItemGroups = this.parent.getItemGroups();
- var oPreviousItem;
-
- if(
- this.index > getFirstItemIndex(aItemGroups[nGroupIndex], 0)
- ) {
-
- oPreviousItem =
- getPreviousArrayItem(
- aItemGroups[nGroupIndex],
- (this.index-1)
- );
-
- }
- else {
-
- var nPreviousGroupIndex;
-
- if(nGroupIndex > getFirstItemIndex(aItemGroups, 0)) {
-
- nPreviousGroupIndex = nGroupIndex - 1;
-
- }
- else {
-
- nPreviousGroupIndex = aItemGroups.length - 1;
-
- }
-
- var aPreviousGroup =
- getPreviousArrayItem(aItemGroups, nPreviousGroupIndex);
-
- oPreviousItem =
- getPreviousArrayItem(
- aPreviousGroup,
- (aPreviousGroup.length - 1)
- );
-
- }
-
- return (
- oPreviousItem.cfg.getProperty("disabled") ||
- oPreviousItem.element.style.display == "none"
- ) ?
- oPreviousItem.getPreviousEnabledSibling() : oPreviousItem;
-
- }
-
- },
-
- /**
- * @method focus
- * @description Causes the menu item to receive the focus and fires the
- * focus event.
- */
- focus: function() {
-
- var oParent = this.parent;
- var oAnchor = this._oAnchor;
- var oActiveItem = oParent.activeItem;
-
- if(
- !this.cfg.getProperty("disabled") &&
- oParent &&
- oParent.cfg.getProperty("visible") &&
- this.element.style.display != "none"
- ) {
-
- if(oActiveItem) {
-
- oActiveItem.blur();
-
- }
-
- try {
-
- oAnchor.focus();
-
- }
- catch(e) {
-
- }
-
- this.focusEvent.fire();
-
- }
-
- },
-
- /**
- * @method blur
- * @description Causes the menu item to lose focus and fires the
- * onblur event.
- */
- blur: function() {
-
- var oParent = this.parent;
-
- if(
- !this.cfg.getProperty("disabled") &&
- oParent &&
- Dom.getStyle(oParent.element, "visibility") == "visible"
- ) {
-
- this._oAnchor.blur();
-
- this.blurEvent.fire();
-
- }
-
- },
-
- /**
- * @method destroy
- * @description Removes the menu item's <li> element
- * from its parent <ul> element.
- */
- destroy: function() {
-
- var oEl = this.element;
-
- if(oEl) {
-
- // Remove CustomEvent listeners
-
- this.mouseOverEvent.unsubscribeAll();
- this.mouseOutEvent.unsubscribeAll();
- this.mouseDownEvent.unsubscribeAll();
- this.mouseUpEvent.unsubscribeAll();
- this.clickEvent.unsubscribeAll();
- this.keyPressEvent.unsubscribeAll();
- this.keyDownEvent.unsubscribeAll();
- this.keyUpEvent.unsubscribeAll();
- this.focusEvent.unsubscribeAll();
- this.blurEvent.unsubscribeAll();
- this.cfg.configChangedEvent.unsubscribeAll();
-
- // Remove the element from the parent node
-
- var oParentNode = oEl.parentNode;
-
- if(oParentNode) {
-
- oParentNode.removeChild(oEl);
-
- this.destroyEvent.fire();
-
- }
-
- this.destroyEvent.unsubscribeAll();
-
- }
-
- },
-
- /**
- * @method toString
- * @description Returns a string representing the menu item.
- * @return {String}
- */
- toString: function() {
-
- return ("MenuItem: " + this.cfg.getProperty("text"));
-
- }
-
-};
-
-})();
-
-/**
-* Creates an item for a menu module.
-*
-* @param {String} p_oObject String specifying the text of the menu module item.
-* @param {HTMLLIElement } p_oObject Object specifying the
-* <li> element of the menu module item.
-* @param {HTMLOptGroupElement } p_oObject Object specifying
-* the <optgroup> element of the menu module item.
-* @param {HTMLOptionElement } p_oObject Object specifying the
-* <option> element of the menu module item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu module item. See configuration class documentation
-* for more details.
-* @class MenuModuleItem
-* @constructor
-* @deprecated As of version 0.12, all MenuModuleItem functionality has been
-* implemented directly in YAHOO.widget.MenuItem, making YAHOO.widget.MenuItem
-* the base class for all menu items.
-*/
-YAHOO.widget.MenuModuleItem = YAHOO.widget.MenuItem;
-
-/**
-* Creates a list of options or commands which are made visible in response to
-* an HTML element's "contextmenu" event ("mousedown" for Opera).
-*
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the context menu.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source for the
-* context menu.
-* @param {HTMLDivElement } p_oElement Object specifying the
-* <div> element of the context menu.
-* @param {HTMLSelectElement } p_oElement Object specifying
-* the <select> element to be used as the data source for
-* the context menu.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the context menu. See configuration class documentation
-* for more details.
-* @class ContextMenu
-* @constructor
-* @extends YAHOO.widget.Menu
-* @namespace YAHOO.widget
-*/
-YAHOO.widget.ContextMenu = function(p_oElement, p_oConfig) {
-
- YAHOO.widget.ContextMenu.superclass.constructor.call(
- this,
- p_oElement,
- p_oConfig
- );
-
-};
-
-YAHOO.extend(YAHOO.widget.ContextMenu, YAHOO.widget.Menu, {
-
-// Private properties
-
-/**
-* @property _oTrigger
-* @description Object reference to the current value of the "trigger"
-* configuration property.
-* @default null
-* @private
-* @type String|HTMLElement |Array
-*/
-_oTrigger: null,
-
-// Public properties
-
-/**
-* @property contextEventTarget
-* @description Object reference for the HTML element that was the target of the
-* "contextmenu" DOM event ("mousedown" for Opera) that triggered the display of
-* the context menu.
-* @default null
-* @type HTMLElement
-*/
-contextEventTarget: null,
-
-/**
-* @method init
-* @description The ContextMenu class's initialization method. This method is
-* automatically called by the constructor, and sets up all DOM references for
-* pre-existing markup, and creates required markup if it is not already present.
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the context menu.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source for
-* the context menu.
-* @param {HTMLDivElement } p_oElement Object specifying the
-* <div> element of the context menu.
-* @param {HTMLSelectElement } p_oElement Object specifying
-* the <select> element to be used as the data source for
-* the context menu.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the context menu. See configuration class documentation
-* for more details.
-*/
-init: function(p_oElement, p_oConfig) {
-
- if(!this.ITEM_TYPE) {
-
- this.ITEM_TYPE = YAHOO.widget.ContextMenuItem;
-
- }
-
- // Call the init of the superclass (YAHOO.widget.Menu)
-
- YAHOO.widget.ContextMenu.superclass.init.call(this, p_oElement);
-
- this.beforeInitEvent.fire(YAHOO.widget.ContextMenu);
-
- if(p_oConfig) {
-
- this.cfg.applyConfig(p_oConfig, true);
-
- }
-
-
- this.initEvent.fire(YAHOO.widget.ContextMenu);
-
-},
-
-// Private methods
-
-/**
-* @method _removeEventHandlers
-* @description Removes all of the DOM event handlers from the HTML element(s)
-* whose "context menu" event ("click" for Opera) trigger the display of
-* the context menu.
-* @private
-*/
-_removeEventHandlers: function() {
-
- var Event = YAHOO.util.Event;
- var oTrigger = this._oTrigger;
- var bOpera = (this.browser == "opera");
-
- // Remove the event handlers from the trigger(s)
-
- Event.removeListener(
- oTrigger,
- (bOpera ? "mousedown" : "contextmenu"),
- this._onTriggerContextMenu
- );
-
- if(bOpera) {
-
- Event.removeListener(oTrigger, "click", this._onTriggerClick);
-
- }
-
-},
-
-// Private event handlers
-
-/**
-* @method _onTriggerClick
-* @description "click" event handler for the HTML element(s) identified as the
-* "trigger" for the context menu. Used to cancel default behaviors in Opera.
-* @private
-* @param {Event} p_oEvent Object representing the DOM event object passed back
-* by the event utility (YAHOO.util.Event).
-* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
-* menu that is handling the event.
-*/
-_onTriggerClick: function(p_oEvent, p_oMenu) {
-
- if(p_oEvent.ctrlKey) {
-
- YAHOO.util.Event.stopEvent(p_oEvent);
-
- }
-
-},
-
-/**
-* @method _onTriggerContextMenu
-* @description "contextmenu" event handler ("mousedown" for Opera) for the HTML
-* element(s) that trigger the display of the context menu.
-* @private
-* @param {Event} p_oEvent Object representing the DOM event object passed back
-* by the event utility (YAHOO.util.Event).
-* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
-* menu that is handling the event.
-*/
-_onTriggerContextMenu: function(p_oEvent, p_oMenu) {
-
- // Hide any other ContextMenu instances that might be visible
-
- YAHOO.widget.MenuManager.hideVisible();
-
- var Event = YAHOO.util.Event;
- var oConfig = this.cfg;
-
- if(p_oEvent.type == "mousedown" && !p_oEvent.ctrlKey) {
-
- return;
-
- }
-
- this.contextEventTarget = Event.getTarget(p_oEvent);
-
- // Position and display the context menu
-
- var nX = Event.getPageX(p_oEvent);
- var nY = Event.getPageY(p_oEvent);
-
- oConfig.applyConfig( { xy:[nX, nY], visible:true } );
- oConfig.fireQueue();
-
- /*
- Prevent the browser's default context menu from appearing and
- stop the propagation of the "contextmenu" event so that
- other ContextMenu instances are not displayed.
- */
-
- Event.stopEvent(p_oEvent);
-
-},
-
-// Public methods
-
-/**
-* @method toString
-* @description Returns a string representing the context menu.
-* @return {String}
-*/
-toString: function() {
-
- return ("ContextMenu " + this.id);
-
-},
-
-/**
-* @method initDefaultConfig
-* @description Initializes the class's configurable properties which can be
-* changed using the context menu's Config object ("cfg").
-*/
-initDefaultConfig: function() {
-
- YAHOO.widget.ContextMenu.superclass.initDefaultConfig.call(this);
-
- /**
- * @config trigger
- * @description The HTML element(s) whose "contextmenu" event ("mousedown"
- * for Opera) trigger the display of the context menu. Can be a string
- * representing the id attribute of the HTML element, an object reference
- * for the HTML element, or an array of strings or HTML element references.
- * @default null
- * @type String|HTMLElement |Array
- */
- this.cfg.addProperty("trigger", { handler: this.configTrigger });
-
-},
-
-/**
-* @method destroy
-* @description Removes the context menu's <div> element
-* (and accompanying child nodes) from the document.
-*/
-destroy: function() {
-
- // Remove the DOM event handlers from the current trigger(s)
-
- this._removeEventHandlers();
-
-
- // Continue with the superclass implementation of this method
-
- YAHOO.widget.ContextMenu.superclass.destroy.call(this);
-
-},
-
-// Public event handlers for configuration properties
-
-/**
-* @method configTrigger
-* @description Event handler for when the value of the "trigger" configuration
-* property changes.
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
-* menu that fired the event.
-*/
-configTrigger: function(p_sType, p_aArgs, p_oMenu) {
-
- var Event = YAHOO.util.Event;
- var oTrigger = p_aArgs[0];
-
- if(oTrigger) {
-
- /*
- If there is a current "trigger" - remove the event handlers
- from that element(s) before assigning new ones
- */
-
- if(this._oTrigger) {
-
- this._removeEventHandlers();
-
- }
-
- this._oTrigger = oTrigger;
-
- /*
- Listen for the "mousedown" event in Opera b/c it does not
- support the "contextmenu" event
- */
-
- var bOpera = (this.browser == "opera");
-
- Event.addListener(
- oTrigger,
- (bOpera ? "mousedown" : "contextmenu"),
- this._onTriggerContextMenu,
- this,
- true
- );
-
- /*
- Assign a "click" event handler to the trigger element(s) for
- Opera to prevent default browser behaviors.
- */
-
- if(bOpera) {
-
- Event.addListener(
- oTrigger,
- "click",
- this._onTriggerClick,
- this,
- true
- );
-
- }
-
- }
- else {
-
- this._removeEventHandlers();
-
- }
-
-}
-
-}); // END YAHOO.extend
-
-/**
-* Creates an item for a context menu.
-*
-* @param {String} p_oObject String specifying the text of the context menu item.
-* @param {HTMLLIElement } p_oObject Object specifying the
-* <li> element of the context menu item.
-* @param {HTMLOptGroupElement } p_oObject Object
-* specifying the <optgroup> element of the context
-* menu item.
-* @param {HTMLOptionElement } p_oObject Object specifying
-* the <option> element of the context menu item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the context menu item. See configuration class
-* documentation for more details.
-* @class ContextMenuItem
-* @constructor
-* @extends YAHOO.widget.MenuItem
-*/
-YAHOO.widget.ContextMenuItem = function(p_oObject, p_oConfig) {
-
- YAHOO.widget.ContextMenuItem.superclass.constructor.call(
- this,
- p_oObject,
- p_oConfig
- );
-
-};
-
-YAHOO.extend(YAHOO.widget.ContextMenuItem, YAHOO.widget.MenuItem, {
-
-/**
-* @method init
-* @description The ContextMenuItem class's initialization method. This method
-* is automatically called by the constructor, and sets up all DOM references
-* for pre-existing markup, and creates required markup if it is not
-* already present.
-* @param {String} p_oObject String specifying the text of the context menu item.
-* @param {HTMLLIElement } p_oObject Object specifying the
-* <li> element of the context menu item.
-* @param {HTMLOptGroupElement } p_oObject Object
-* specifying the <optgroup> element of the context
-* menu item.
-* @param {HTMLOptionElement } p_oObject Object specifying
-* the <option> element of the context menu item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the context menu item. See configuration class
-* documentation for more details.
-*/
-init: function(p_oObject, p_oConfig) {
-
- if(!this.SUBMENU_TYPE) {
-
- this.SUBMENU_TYPE = YAHOO.widget.ContextMenu;
-
- }
-
- /*
- Call the init of the superclass (YAHOO.widget.MenuItem)
- Note: We don't pass the user config in here yet
- because we only want it executed once, at the lowest
- subclass level.
- */
-
- YAHOO.widget.ContextMenuItem.superclass.init.call(this, p_oObject);
-
- var oConfig = this.cfg;
-
- if(p_oConfig) {
-
- oConfig.applyConfig(p_oConfig, true);
-
- }
-
- oConfig.fireQueue();
-
-},
-
-// Public methods
-
-/**
-* @method toString
-* @description Returns a string representing the context menu item.
-* @return {String}
-*/
-toString: function() {
-
- return ("MenuBarItem: " + this.cfg.getProperty("text"));
-
-}
-
-}); // END YAHOO.extend
-
-/**
-* Horizontal collection of items, each of which can contain a submenu.
-*
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the menu bar.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source for the
-* menu bar.
-* @param {HTMLDivElement } p_oElement Object specifying
-* the <div> element of the menu bar.
-* @param {HTMLSelectElement } p_oElement Object
-* specifying the <select> element to be used as the data
-* source for the menu bar.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu bar. See configuration class documentation for
-* more details.
-* @class Menubar
-* @constructor
-* @extends YAHOO.widget.Menu
-* @namespace YAHOO.widget
-*/
-YAHOO.widget.MenuBar = function(p_oElement, p_oConfig) {
-
- YAHOO.widget.MenuBar.superclass.constructor.call(
- this,
- p_oElement,
- p_oConfig
- );
-
-};
-
-YAHOO.extend(YAHOO.widget.MenuBar, YAHOO.widget.Menu, {
-
-/**
-* @method init
-* @description The MenuBar class's initialization method. This method is
-* automatically called by the constructor, and sets up all DOM references for
-* pre-existing markup, and creates required markup if it is not already present.
-* @param {String} p_oElement String specifying the id attribute of the
-* <div> element of the menu bar.
-* @param {String} p_oElement String specifying the id attribute of the
-* <select> element to be used as the data source for the
-* menu bar.
-* @param {HTMLDivElement } p_oElement Object specifying
-* the <div> element of the menu bar.
-* @param {HTMLSelectElement } p_oElement Object
-* specifying the <select> element to be used as the data
-* source for the menu bar.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu bar. See configuration class documentation for
-* more details.
-*/
-init: function(p_oElement, p_oConfig) {
-
- if(!this.ITEM_TYPE) {
-
- this.ITEM_TYPE = YAHOO.widget.MenuBarItem;
-
- }
-
- // Call the init of the superclass (YAHOO.widget.Menu)
-
- YAHOO.widget.MenuBar.superclass.init.call(this, p_oElement);
-
- this.beforeInitEvent.fire(YAHOO.widget.MenuBar);
-
- if(p_oConfig) {
-
- this.cfg.applyConfig(p_oConfig, true);
-
- }
-
- this.initEvent.fire(YAHOO.widget.MenuBar);
-
-},
-
-// Constants
-
-/**
-* @property CSS_CLASS_NAME
-* @description String representing the CSS class(es) to be applied to the menu
-* bar's <div> element.
-* @default "yuimenubar"
-* @final
-* @type String
-*/
-CSS_CLASS_NAME: "yuimenubar",
-
-// Protected event handlers
-
-/**
-* @method _onKeyDown
-* @description "keydown" Custom Event handler for the menu bar.
-* @private
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.MenuBar} p_oMenuBar Object representing the menu bar
-* that fired the event.
-*/
-_onKeyDown: function(p_sType, p_aArgs, p_oMenuBar) {
-
- var Event = YAHOO.util.Event;
- var oEvent = p_aArgs[0];
- var oItem = p_aArgs[1];
- var oItemCfg = oItem.cfg;
- var oSubmenu;
-
- switch(oEvent.keyCode) {
-
- case 27: // Esc key
-
- if(this.cfg.getProperty("position") == "dynamic") {
-
- this.hide();
-
- if(this.parent) {
-
- this.parent.focus();
-
- }
-
- }
- else if(this.activeItem) {
-
- oSubmenu = this.activeItem.cfg.getProperty("submenu");
-
- if(oSubmenu && oSubmenu.cfg.getProperty("visible")) {
-
- oSubmenu.hide();
- this.activeItem.focus();
-
- }
- else {
-
- this.activeItem.cfg.setProperty("selected", false);
- this.activeItem.blur();
-
- }
-
- }
-
-
- Event.preventDefault(oEvent);
-
- break;
-
- case 37: // Left arrow
- case 39: // Right arrow
-
- if(
- oItem == this.activeItem &&
- !oItemCfg.getProperty("selected")
- ) {
-
- oItemCfg.setProperty("selected", true);
-
- }
- else {
-
- var oNextItem = (oEvent.keyCode == 37) ?
- oItem.getPreviousEnabledSibling() :
- oItem.getNextEnabledSibling();
-
- if(oNextItem) {
-
- this.clearActiveItem();
-
- oNextItem.cfg.setProperty("selected", true);
-
- if(this.cfg.getProperty("autosubmenudisplay")) {
-
- oSubmenu = oNextItem.cfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- oSubmenu.show();
- oSubmenu.activeItem.blur();
- oSubmenu.activeItem = null;
-
- }
-
- }
-
- oNextItem.focus();
-
- }
-
- }
-
- Event.preventDefault(oEvent);
-
- break;
-
- case 40: // Down arrow
-
- if(this.activeItem != oItem) {
-
- this.clearActiveItem();
-
- oItemCfg.setProperty("selected", true);
- oItem.focus();
-
- }
-
- oSubmenu = oItemCfg.getProperty("submenu");
-
- if(oSubmenu) {
-
- if(oSubmenu.cfg.getProperty("visible")) {
-
- oSubmenu.setInitialSelection();
- oSubmenu.setInitialFocus();
-
- }
- else {
-
- oSubmenu.show();
-
- }
-
- }
-
- Event.preventDefault(oEvent);
-
- break;
-
- }
-
-},
-
-/**
-* @method _onClick
-* @description "click" event handler for the menu bar.
-* @protected
-* @param {String} p_sType String representing the name of the event that
-* was fired.
-* @param {Array} p_aArgs Array of arguments sent when the event was fired.
-* @param {YAHOO.widget.MenuBar} p_oMenuBar Object representing the menu bar
-* that fired the event.
-*/
-_onClick: function(p_sType, p_aArgs, p_oMenuBar) {
-
- YAHOO.widget.MenuBar.superclass._onClick.call(
- this,
- p_sType,
- p_aArgs,
- p_oMenuBar
- );
-
- var oItem = p_aArgs[1];
-
- if(oItem) {
-
- var Event = YAHOO.util.Event;
- var Dom = YAHOO.util.Dom;
-
- var oEvent = p_aArgs[0];
- var oTarget = Event.getTarget(oEvent);
-
- var oActiveItem = this.activeItem;
- var oConfig = this.cfg;
-
- // Hide any other submenus that might be visible
-
- if(oActiveItem && oActiveItem != oItem) {
-
- this.clearActiveItem();
-
- }
-
-
- // Select and focus the current item
-
- oItem.cfg.setProperty("selected", true);
- oItem.focus();
-
-
- // Show the submenu for the item
-
- var oSubmenu = oItem.cfg.getProperty("submenu");
-
- if(oSubmenu && oTarget != oItem.submenuIndicator) {
-
- if(oSubmenu.cfg.getProperty("visible")) {
-
- oSubmenu.hide();
-
- }
- else {
-
- oSubmenu.show();
-
- }
-
- }
-
- }
-
-},
-
-// Public methods
-
-/**
-* @method toString
-* @description Returns a string representing the menu bar.
-* @return {String}
-*/
-toString: function() {
-
- return ("MenuBar " + this.id);
-
-},
-
-/**
-* @description Initializes the class's configurable properties which can be
-* changed using the menu bar's Config object ("cfg").
-* @method initDefaultConfig
-*/
-initDefaultConfig: function() {
-
- YAHOO.widget.MenuBar.superclass.initDefaultConfig.call(this);
-
- var oConfig = this.cfg;
-
- // Add configuration properties
-
- /*
- Set the default value for the "position" configuration property
- to "static" by re-adding the property.
- */
-
- /**
- * @config position
- * @description String indicating how a menu bar should be positioned on the
- * screen. Possible values are "static" and "dynamic." Static menu bars
- * are visible by default and reside in the normal flow of the document
- * (CSS position: static). Dynamic menu bars are hidden by default, reside
- * out of the normal flow of the document (CSS position: absolute), and can
- * overlay other elements on the screen.
- * @default static
- * @type String
- */
- oConfig.addProperty(
- "position",
- {
- value: "static",
- handler: this.configPosition,
- validator: this._checkPosition,
- supercedes: ["visible"]
- }
- );
-
- /*
- Set the default value for the "submenualignment" configuration property
- to ["tl","bl"] by re-adding the property.
- */
-
- /**
- * @config submenualignment
- * @description Array defining how submenus should be aligned to their
- * parent menu bar item. The format is: [itemCorner, submenuCorner].
- * @default ["tl","bl"]
- * @type Array
- */
- oConfig.addProperty("submenualignment", { value: ["tl","bl"] } );
-
- /*
- Change the default value for the "autosubmenudisplay" configuration
- property to "false" by re-adding the property.
- */
-
- /**
- * @config autosubmenudisplay
- * @description Boolean indicating if submenus are automatically made
- * visible when the user mouses over the menu bar's items.
- * @default false
- * @type Boolean
- */
- oConfig.addProperty(
- "autosubmenudisplay",
- { value: false, validator: oConfig.checkBoolean }
- );
-
-}
-
-}); // END YAHOO.extend
-
-/**
-* Creates an item for a menu bar.
-*
-* @param {String} p_oObject String specifying the text of the menu bar item.
-* @param {HTMLLIElement } p_oObject Object specifying the
-* <li> element of the menu bar item.
-* @param {HTMLOptGroupElement } p_oObject Object
-* specifying the <optgroup> element of the menu bar item.
-* @param {HTMLOptionElement } p_oObject Object specifying
-* the <option> element of the menu bar item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu bar item. See configuration class documentation
-* for more details.
-* @class MenuBarItem
-* @constructor
-* @extends YAHOO.widget.MenuItem
-*/
-YAHOO.widget.MenuBarItem = function(p_oObject, p_oConfig) {
-
- YAHOO.widget.MenuBarItem.superclass.constructor.call(
- this,
- p_oObject,
- p_oConfig
- );
-
-};
-
-YAHOO.extend(YAHOO.widget.MenuBarItem, YAHOO.widget.MenuItem, {
-
-/**
-* @method init
-* @description The MenuBarItem class's initialization method. This method is
-* automatically called by the constructor, and sets up all DOM references for
-* pre-existing markup, and creates required markup if it is not already present.
-* @param {String} p_oObject String specifying the text of the menu bar item.
-* @param {HTMLLIElement } p_oObject Object specifying the
-* <li> element of the menu bar item.
-* @param {HTMLOptGroupElement } p_oObject Object
-* specifying the <optgroup> element of the menu bar item.
-* @param {HTMLOptionElement } p_oObject Object specifying
-* the <option> element of the menu bar item.
-* @param {Object} p_oConfig Optional. Object literal specifying the
-* configuration for the menu bar item. See configuration class documentation
-* for more details.
-*/
-init: function(p_oObject, p_oConfig) {
-
- if(!this.SUBMENU_TYPE) {
-
- this.SUBMENU_TYPE = YAHOO.widget.Menu;
-
- }
-
- /*
- Call the init of the superclass (YAHOO.widget.MenuItem)
- Note: We don't pass the user config in here yet
- because we only want it executed once, at the lowest
- subclass level.
- */
-
- YAHOO.widget.MenuBarItem.superclass.init.call(this, p_oObject);
-
- var oConfig = this.cfg;
-
- if(p_oConfig) {
-
- oConfig.applyConfig(p_oConfig, true);
-
- }
-
- oConfig.fireQueue();
-
-},
-
-// Constants
-
-/**
-* @property CSS_CLASS_NAME
-* @description String representing the CSS class(es) to be applied to the
-* <li> element of the menu bar item.
-* @default "yuimenubaritem"
-* @final
-* @type String
-*/
-CSS_CLASS_NAME: "yuimenubaritem",
-
-/**
-* @property SUBMENU_INDICATOR_IMAGE_PATH
-* @description String representing the path to the image to be used for the
-* menu bar item's submenu arrow indicator.
-* @default "nt/ic/ut/alt1/menuarodwn8_nrm_1.gif"
-* @final
-* @type String
-*/
-SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_nrm_1.gif",
-
-/**
-* @property SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
-* @description String representing the path to the image to be used for the
-* submenu arrow indicator when the menu bar item is selected.
-* @default "nt/ic/ut/alt1/menuarodwn8_hov_1.gif"
-* @final
-* @type String
-*/
-SELECTED_SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_hov_1.gif",
-
-/**
-* @property DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
-* @description String representing the path to the image to be used for the
-* submenu arrow indicator when the menu bar item is disabled.
-* @default "nt/ic/ut/alt1/menuarodwn8_dim_1.gif"
-* @final
-* @type String
-*/
-DISABLED_SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_dim_1.gif",
-
-// Public methods
-
-/**
-* @method toString
-* @description Returns a string representing the menu bar item.
-* @return {String}
-*/
-toString: function() {
-
- return ("MenuBarItem: " + this.cfg.getProperty("text"));
-
-}
-
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.com/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+* @module menu
+* @description The Menu Library features a collection of widgets that make
+* it easy to add menus to your website or web application. With the Menu
+* Library you can create website fly-out menus, customized context menus, or
+* application-style menu bars with just a small amount of scripting.
+*
+* Screen-reader accessibility.
+* Keyboard and mouse navigation.
+* A rich event model that provides access to all of a menu's
+* interesting moments.
+* Support for
+* Progressive
+* Enhancement ; Menus can be created from simple,
+* semantic markup on the page or purely through JavaScript.
+*
+* @title Menu Library
+* @namespace YAHOO.widget
+* @requires Event, Dom, Container
+*/
+(function() {
+
+var Dom = YAHOO.util.Dom;
+var Event = YAHOO.util.Event;
+
+/**
+* Singleton that manages a collection of all menus and menu items. Listens for
+* DOM events at the document level and dispatches the events to the
+* corresponding menu or menu item.
+*
+* @namespace YAHOO.widget
+* @class MenuManager
+* @static
+*/
+YAHOO.widget.MenuManager = new function() {
+
+ // Private member variables
+
+ // Flag indicating if the DOM event handlers have been attached
+
+ var m_bInitializedEventHandlers = false;
+
+ // Collection of menus
+
+ var m_oMenus = {};
+
+
+ // Collection of menu items
+
+ var m_oItems = {};
+
+ // Collection of visible menus
+
+ var m_oVisibleMenus = {};
+
+ // Logger
+
+
+ // Private methods
+
+ /**
+ * Adds an item to the collection of known menu items.
+ * @private
+ * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem
+ * instance to be added.
+ */
+ var addItem = function(p_oItem) {
+
+ var sYUIId = Dom.generateId();
+
+ if(p_oItem && m_oItems[sYUIId] != p_oItem) {
+
+ p_oItem.element.setAttribute("yuiid", sYUIId);
+
+ m_oItems[sYUIId] = p_oItem;
+
+ p_oItem.destroyEvent.subscribe(onItemDestroy, p_oItem);
+
+
+ }
+
+ };
+
+ /**
+ * Removes an item from the collection of known menu items.
+ * @private
+ * @param {YAHOO.widget.MenuItem} p_oItem Object specifying the MenuItem
+ * instance to be removed.
+ */
+ var removeItem = function(p_oItem) {
+
+ var sYUIId = p_oItem.element.getAttribute("yuiid");
+
+ if(sYUIId && m_oItems[sYUIId]) {
+
+ delete m_oItems[sYUIId];
+
+
+ }
+
+ };
+
+ /**
+ * Finds the root DIV node of a menu or the root LI node of a menu item.
+ * @private
+ * @param {HTMLElement } p_oElement Object specifying
+ * an HTML element.
+ */
+ var getMenuRootElement = function(p_oElement) {
+
+ var oParentNode;
+
+ if(p_oElement && p_oElement.tagName) {
+
+ switch(p_oElement.tagName.toUpperCase()) {
+
+ case "DIV":
+
+ oParentNode = p_oElement.parentNode;
+
+ // Check if the DIV is the inner "body" node of a menu
+
+ if(
+ Dom.hasClass(p_oElement, "bd") &&
+ oParentNode &&
+ oParentNode.tagName &&
+ oParentNode.tagName.toUpperCase() == "DIV"
+ ) {
+
+ return oParentNode;
+
+ }
+ else {
+
+ return p_oElement;
+
+ }
+
+ break;
+
+ case "LI":
+
+ return p_oElement;
+
+ default:
+
+ oParentNode = p_oElement.parentNode;
+
+ if(oParentNode) {
+
+ return getMenuRootElement(oParentNode);
+
+ }
+
+ break;
+
+ }
+
+ }
+
+ };
+
+ // Private event handlers
+
+ /**
+ * Generic, global event handler for all of a menu's DOM-based
+ * events. This listens for events against the document object. If the
+ * target of a given event is a member of a menu or menu item's DOM, the
+ * instance's corresponding Custom Event is fired.
+ * @private
+ * @param {Event} p_oEvent Object representing the DOM event object passed
+ * back by the event utility (YAHOO.util.Event).
+ */
+ var onDOMEvent = function(p_oEvent) {
+
+ // Get the target node of the DOM event
+
+ var oTarget = Event.getTarget(p_oEvent);
+
+ // See if the target of the event was a menu, or a menu item
+
+ var oElement = getMenuRootElement(oTarget);
+
+ var oMenuItem;
+ var oMenu;
+
+ if(oElement) {
+
+ var sTagName = oElement.tagName.toUpperCase();
+
+ if(sTagName == "LI") {
+
+ var sYUIId = oElement.getAttribute("yuiid");
+
+ if(sYUIId) {
+
+ oMenuItem = m_oItems[sYUIId];
+ oMenu = oMenuItem.parent;
+
+ }
+
+ }
+ else if(sTagName == "DIV") {
+
+ if(oElement.id) {
+
+ oMenu = m_oMenus[oElement.id];
+
+ }
+
+ }
+
+ }
+
+ if(oMenu) {
+
+ // Map of DOM event names to CustomEvent names
+
+ var oEventTypes = {
+ "click": "clickEvent",
+ "mousedown": "mouseDownEvent",
+ "mouseup": "mouseUpEvent",
+ "mouseover": "mouseOverEvent",
+ "mouseout": "mouseOutEvent",
+ "keydown": "keyDownEvent",
+ "keyup": "keyUpEvent",
+ "keypress": "keyPressEvent"
+ };
+
+ var sCustomEventType = oEventTypes[p_oEvent.type];
+
+ // Fire the Custom Even that corresponds the current DOM event
+
+ if(oMenuItem && !oMenuItem.cfg.getProperty("disabled")) {
+
+ oMenuItem[sCustomEventType].fire(p_oEvent);
+
+ }
+
+ oMenu[sCustomEventType].fire(p_oEvent, oMenuItem);
+
+ }
+ else if(p_oEvent.type == "mousedown") {
+
+ /*
+ If the target of the event wasn't a menu, hide all
+ dynamically positioned menus
+ */
+
+ var oActiveItem;
+
+ for(var i in m_oMenus) {
+
+ if(m_oMenus.hasOwnProperty(i)) {
+
+ oMenu = m_oMenus[i];
+
+ if(
+ oMenu.cfg.getProperty("clicktohide") &&
+ oMenu.cfg.getProperty("position") == "dynamic"
+ ) {
+
+ oMenu.hide();
+
+ }
+ else {
+
+ oMenu.clearActiveItem(true);
+
+ }
+
+ }
+
+ }
+
+ }
+
+ };
+
+ /**
+ * "destroy" event handler for a menu.
+ * @private
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+ * fired the event.
+ */
+ var onMenuDestroy = function(p_sType, p_aArgs, p_oMenu) {
+
+ this.removeMenu(p_oMenu);
+
+ };
+
+ /**
+ * "destroy" event handler for a MenuItem instance.
+ * @private
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ var onItemDestroy = function(p_sType, p_aArgs, p_oItem) {
+
+ var sYUIId = p_oItem.element.getAttribute("yuiid");
+
+ if(sYUIId) {
+
+ delete m_oItems[sYUIId];
+
+ }
+
+ };
+
+ /**
+ * Event handler for when the "visible" configuration property
+ * of a Menu instance changes.
+ * @private
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+ * fired the event.
+ */
+ var onMenuVisibleConfigChange = function(p_sType, p_aArgs, p_oMenu) {
+
+ var bVisible = p_aArgs[0];
+
+ if(bVisible) {
+
+ m_oVisibleMenus[p_oMenu.id] = p_oMenu;
+
+
+ }
+ else if(m_oVisibleMenus[p_oMenu.id]) {
+
+ delete m_oVisibleMenus[p_oMenu.id];
+
+
+ }
+
+ };
+
+ /**
+ * "itemadded" event handler for a Menu instance.
+ * @private
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ */
+ var onItemAdded = function(p_sType, p_aArgs) {
+
+ addItem(p_aArgs[0]);
+
+ };
+
+
+ /**
+ * "itemremoved" event handler for a Menu instance.
+ * @private
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ */
+ var onItemRemoved = function(p_sType, p_aArgs) {
+
+ removeItem(p_aArgs[0]);
+
+ };
+
+ // Privileged methods
+
+ /**
+ * @method addMenu
+ * @description Adds a menu to the collection of known menus.
+ * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance
+ * to be added.
+ */
+ this.addMenu = function(p_oMenu) {
+
+ if(p_oMenu && p_oMenu.id && !m_oMenus[p_oMenu.id]) {
+
+ m_oMenus[p_oMenu.id] = p_oMenu;
+
+
+ if(!m_bInitializedEventHandlers) {
+
+ var oDoc = document;
+
+ Event.addListener(oDoc, "mouseover", onDOMEvent, this, true);
+ Event.addListener(oDoc, "mouseout", onDOMEvent, this, true);
+ Event.addListener(oDoc, "mousedown", onDOMEvent, this, true);
+ Event.addListener(oDoc, "mouseup", onDOMEvent, this, true);
+ Event.addListener(oDoc, "click", onDOMEvent, this, true);
+ Event.addListener(oDoc, "keydown", onDOMEvent, this, true);
+ Event.addListener(oDoc, "keyup", onDOMEvent, this, true);
+ Event.addListener(oDoc, "keypress", onDOMEvent, this, true);
+
+ m_bInitializedEventHandlers = true;
+
+
+ }
+
+ p_oMenu.destroyEvent.subscribe(onMenuDestroy, p_oMenu, this);
+
+ p_oMenu.cfg.subscribeToConfigEvent(
+ "visible",
+ onMenuVisibleConfigChange,
+ p_oMenu
+ );
+
+ p_oMenu.itemAddedEvent.subscribe(onItemAdded);
+ p_oMenu.itemRemovedEvent.subscribe(onItemRemoved);
+
+
+ }
+
+ };
+
+ /**
+ * @method removeMenu
+ * @description Removes a menu from the collection of known menus.
+ * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu instance
+ * to be removed.
+ */
+ this.removeMenu = function(p_oMenu) {
+
+ if(p_oMenu && m_oMenus[p_oMenu.id]) {
+
+ delete m_oMenus[p_oMenu.id];
+
+
+ }
+
+ };
+
+ /**
+ * @method hideVisible
+ * @description Hides all visible, dynamically positioned menus.
+ */
+ this.hideVisible = function() {
+
+ var oMenu;
+
+ for(var i in m_oVisibleMenus) {
+
+ if(m_oVisibleMenus.hasOwnProperty(i)) {
+
+ oMenu = m_oVisibleMenus[i];
+
+ if(oMenu.cfg.getProperty("position") == "dynamic") {
+
+ oMenu.hide();
+
+ }
+
+ }
+
+ }
+
+ };
+
+ /**
+ * @method getMenus
+ * @description Returns an array of all menus registered with the
+ * menu manger.
+ * @return {Array}
+ */
+ this.getMenus = function() {
+
+ return m_oMenus;
+
+ };
+
+ /**
+ * @method getMenu
+ * @description Returns a menu with the specified id.
+ * @param {String} p_sId String specifying the id of the menu to
+ * be retrieved.
+ * @return {YAHOO.widget.Menu}
+ */
+ this.getMenu = function(p_sId) {
+
+ if(m_oMenus[p_sId]) {
+
+ return m_oMenus[p_sId];
+
+ }
+
+ };
+
+
+ /**
+ * @method toString
+ * @description Returns a string representing the menu manager.
+ * @return {String}
+ */
+ this.toString = function() {
+
+ return ("MenuManager");
+
+ };
+
+};
+
+})();
+
+(function() {
+
+var Dom = YAHOO.util.Dom;
+var Event = YAHOO.util.Event;
+
+/**
+* The Menu class creates a container that holds a vertical list representing
+* a set of options or commands. Menu is the base class for all
+* menu containers.
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the menu.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source
+* for the menu.
+* @param {HTMLDivElement } p_oElement Object
+* specifying the <div> element of the menu.
+* @param {HTMLSelectElement } p_oElement
+* Object specifying the <select> element to be used as
+* the data source for the menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu. See configuration class documentation for
+* more details.
+* @namespace YAHOO.widget
+* @class Menu
+* @constructor
+* @extends YAHOO.widget.Overlay
+*/
+YAHOO.widget.Menu = function(p_oElement, p_oConfig) {
+
+ if(p_oConfig) {
+
+ this.parent = p_oConfig.parent;
+
+ this.lazyLoad = p_oConfig.lazyLoad || p_oConfig.lazyload;
+
+ this.itemData = p_oConfig.itemData || p_oConfig.itemdata;
+
+ }
+
+ YAHOO.widget.Menu.superclass.constructor.call(
+ this,
+ p_oElement,
+ p_oConfig
+ );
+
+};
+
+YAHOO.extend(YAHOO.widget.Menu, YAHOO.widget.Overlay, {
+
+// Constants
+
+/**
+* @property CSS_CLASS_NAME
+* @description String representing the CSS class(es) to be applied to the
+* menu's <div> element.
+* @default "yuimenu"
+* @final
+* @type String
+*/
+CSS_CLASS_NAME: "yuimenu",
+
+/**
+* @property ITEM_TYPE
+* @description Object representing the type of menu item to instantiate and
+* add when parsing the child nodes (either <li> element,
+* <optgroup> element or <option>)
+* of the menu's source HTML element.
+* @default YAHOO.widget.MenuItem
+* @final
+* @type YAHOO.widget.MenuItem
+*/
+ITEM_TYPE: null,
+
+/**
+* @property GROUP_TITLE_TAG_NAME
+* @description String representing the tagname of the HTML element used to
+* title the menu's item groups.
+* @default H6
+* @final
+* @type String
+*/
+GROUP_TITLE_TAG_NAME: "h6",
+
+// Private properties
+
+/**
+* @property _nHideDelayId
+* @description Number representing the time-out setting used to cancel the
+* hiding of a menu.
+* @default null
+* @private
+* @type Number
+*/
+_nHideDelayId: null,
+
+/**
+* @property _nShowDelayId
+* @description Number representing the time-out setting used to cancel the
+* showing of a menu.
+* @default null
+* @private
+* @type Number
+*/
+_nShowDelayId: null,
+
+/**
+* @property _hideDelayEventHandlersAssigned
+* @description Boolean indicating if the "mouseover" and "mouseout" event
+* handlers used for hiding the menu via a call to "window.setTimeout" have
+* already been assigned.
+* @default false
+* @private
+* @type Boolean
+*/
+_hideDelayEventHandlersAssigned: false,
+
+/**
+* @property _bHandledMouseOverEvent
+* @description Boolean indicating the current state of the menu's
+* "mouseover" event.
+* @default false
+* @private
+* @type Boolean
+*/
+_bHandledMouseOverEvent: false,
+
+/**
+* @property _bHandledMouseOutEvent
+* @description Boolean indicating the current state of the menu's
+* "mouseout" event.
+* @default false
+* @private
+* @type Boolean
+*/
+_bHandledMouseOutEvent: false,
+
+/**
+* @property _aGroupTitleElements
+* @description Array of HTML element used to title groups of menu items.
+* @default []
+* @private
+* @type Array
+*/
+_aGroupTitleElements: null,
+
+/**
+* @property _aItemGroups
+* @description Array of menu items.
+* @default []
+* @private
+* @type Array
+*/
+_aItemGroups: null,
+
+/**
+* @property _aListElements
+* @description Array of <ul> elements, each of which is
+* the parent node for each item's <li> element.
+* @default []
+* @private
+* @type Array
+*/
+_aListElements: null,
+
+// Public properties
+
+/**
+* @property lazyLoad
+* @description Boolean indicating if the menu's "lazy load" feature is
+* enabled. If set to "true," initialization and rendering of the menu's
+* items will be deferred until the first time it is made visible. This
+* property should be set via the constructor using the configuration
+* object literal.
+* @default false
+* @type Boolean
+*/
+lazyLoad: false,
+
+/**
+* @property itemData
+* @description Array of items to be added to the menu. The array can contain
+* strings representing the text for each item to be created, object literals
+* representing the menu item configuration properties, or MenuItem instances.
+* This property should be set via the constructor using the configuration
+* object literal.
+* @default null
+* @type Array
+*/
+itemData: null,
+
+/**
+* @property activeItem
+* @description Object reference to the item in the menu that has focus.
+* @default null
+* @type YAHOO.widget.MenuItem
+*/
+activeItem: null,
+
+/**
+* @property parent
+* @description Object reference to the menu's parent menu or menu item.
+* This property can be set via the constructor using the configuration
+* object literal.
+* @default null
+* @type YAHOO.widget.MenuItem
+*/
+parent: null,
+
+/**
+* @property srcElement
+* @description Object reference to the HTML element (either
+* <select> or <div>) used to
+* create the menu.
+* @default null
+* @type HTMLSelectElement |HTMLDivElement
+*/
+srcElement: null,
+
+// Events
+
+/**
+* @event mouseOverEvent
+* @description Fires when the mouse has entered the menu. Passes back
+* the DOM Event object as an argument.
+*/
+mouseOverEvent: null,
+
+/**
+* @event mouseOutEvent
+* @description Fires when the mouse has left the menu. Passes back the DOM
+* Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+mouseOutEvent: null,
+
+/**
+* @event mouseDownEvent
+* @description Fires when the user mouses down on the menu. Passes back the
+* DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+mouseDownEvent: null,
+
+/**
+* @event mouseUpEvent
+* @description Fires when the user releases a mouse button while the mouse is
+* over the menu. Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+mouseUpEvent: null,
+
+/**
+* @event clickEvent
+* @description Fires when the user clicks the on the menu. Passes back the
+* DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+clickEvent: null,
+
+/**
+* @event keyPressEvent
+* @description Fires when the user presses an alphanumeric key when one of the
+* menu's items has focus. Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+keyPressEvent: null,
+
+/**
+* @event keyDownEvent
+* @description Fires when the user presses a key when one of the menu's items
+* has focus. Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+keyDownEvent: null,
+
+/**
+* @event keyUpEvent
+* @description Fires when the user releases a key when one of the menu's items
+* has focus. Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+keyUpEvent: null,
+
+/**
+* @event itemAddedEvent
+* @description Fires when an item is added to the menu.
+* @type YAHOO.util.CustomEvent
+*/
+itemAddedEvent: null,
+
+/**
+* @event itemRemovedEvent
+* @description Fires when an item is removed to the menu.
+* @type YAHOO.util.CustomEvent
+*/
+itemRemovedEvent: null,
+
+/**
+* @method init
+* @description The Menu class's initialization method. This method is
+* automatically called by the constructor, and sets up all DOM references
+* for pre-existing markup, and creates required markup if it is not
+* already present.
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the menu.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source
+* for the menu.
+* @param {HTMLDivElement } p_oElement Object
+* specifying the <div> element of the menu.
+* @param {HTMLSelectElement } p_oElement
+* Object specifying the <select> element to be used as
+* the data source for the menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu. See configuration class documentation for
+* more details.
+*/
+init: function(p_oElement, p_oConfig) {
+
+ this._aItemGroups = [];
+ this._aListElements = [];
+ this._aGroupTitleElements = [];
+
+ if(!this.ITEM_TYPE) {
+
+ this.ITEM_TYPE = YAHOO.widget.MenuItem;
+
+ }
+
+ var oElement;
+
+ if(typeof p_oElement == "string") {
+
+ oElement = document.getElementById(p_oElement);
+
+ }
+ else if(p_oElement.tagName) {
+
+ oElement = p_oElement;
+
+ }
+
+ if(oElement && oElement.tagName) {
+
+ switch(oElement.tagName.toUpperCase()) {
+
+ case "DIV":
+
+ this.srcElement = oElement;
+
+ if(!oElement.id) {
+
+ oElement.setAttribute("id", Dom.generateId());
+
+ }
+
+ /*
+ Note: we don't pass the user config in here yet
+ because we only want it executed once, at the lowest
+ subclass level.
+ */
+
+ YAHOO.widget.Menu.superclass.init.call(this, oElement);
+
+ this.beforeInitEvent.fire(YAHOO.widget.Menu);
+
+
+ break;
+
+ case "SELECT":
+
+ this.srcElement = oElement;
+
+
+ /*
+ The source element is not something that we can use
+ outright, so we need to create a new Overlay
+
+ Note: we don't pass the user config in here yet
+ because we only want it executed once, at the lowest
+ subclass level.
+ */
+
+ YAHOO.widget.Menu.superclass.init.call(this, Dom.generateId());
+
+ this.beforeInitEvent.fire(YAHOO.widget.Menu);
+
+ break;
+
+ }
+
+ }
+ else {
+
+ /*
+ Note: we don't pass the user config in here yet
+ because we only want it executed once, at the lowest
+ subclass level.
+ */
+
+ YAHOO.widget.Menu.superclass.init.call(this, p_oElement);
+
+ this.beforeInitEvent.fire(YAHOO.widget.Menu);
+
+ }
+
+ if(this.element) {
+
+ var oEl = this.element;
+
+ Dom.addClass(oEl, this.CSS_CLASS_NAME);
+
+ // Subscribe to Custom Events
+
+ this.initEvent.subscribe(this._onInit, this, true);
+ this.beforeRenderEvent.subscribe(this._onBeforeRender, this, true);
+ this.renderEvent.subscribe(this._onRender, this, true);
+ this.beforeShowEvent.subscribe(this._onBeforeShow, this, true);
+ this.showEvent.subscribe(this._onShow, this, true);
+ this.beforeHideEvent.subscribe(this._onBeforeHide, this, true);
+ this.mouseOverEvent.subscribe(this._onMouseOver, this, true);
+ this.mouseOutEvent.subscribe(this._onMouseOut, this, true);
+ this.clickEvent.subscribe(this._onClick, this, true);
+ this.keyDownEvent.subscribe(this._onKeyDown, this, true);
+
+ if(p_oConfig) {
+
+ this.cfg.applyConfig(p_oConfig, true);
+
+ }
+
+ // Register the Menu instance with the MenuManager
+
+ YAHOO.widget.MenuManager.addMenu(this);
+
+
+ this.initEvent.fire(YAHOO.widget.Menu);
+
+ }
+
+},
+
+// Private methods
+
+/**
+* @method _initSubTree
+* @description Iterates the childNodes of the source element to find nodes
+* used to instantiate menu and menu items.
+* @private
+*/
+_initSubTree: function() {
+
+ var oNode;
+
+ if(this.srcElement.tagName == "DIV") {
+
+ /*
+ Populate the collection of item groups and item
+ group titles
+ */
+
+ oNode = this.body.firstChild;
+
+ var nGroup = 0;
+ var sGroupTitleTagName = this.GROUP_TITLE_TAG_NAME.toUpperCase();
+
+ do {
+
+ if(oNode && oNode.tagName) {
+
+ switch(oNode.tagName.toUpperCase()) {
+
+ case sGroupTitleTagName:
+
+ this._aGroupTitleElements[nGroup] = oNode;
+
+ break;
+
+ case "UL":
+
+ this._aListElements[nGroup] = oNode;
+ this._aItemGroups[nGroup] = [];
+ nGroup++;
+
+ break;
+
+ }
+
+ }
+
+ }
+ while((oNode = oNode.nextSibling));
+
+ /*
+ Apply the "first-of-type" class to the first UL to mimic
+ the "first-of-type" CSS3 psuedo class.
+ */
+
+ if(this._aListElements[0]) {
+
+ Dom.addClass(this._aListElements[0], "first-of-type");
+
+ }
+
+ }
+
+ oNode = null;
+
+ if(this.srcElement.tagName) {
+
+ switch(this.srcElement.tagName.toUpperCase()) {
+
+ case "DIV":
+
+ if(this._aListElements.length > 0) {
+
+
+ var i = this._aListElements.length - 1;
+
+ do {
+
+ oNode = this._aListElements[i].firstChild;
+
+
+ do {
+
+ if(oNode && oNode.tagName) {
+
+ switch(oNode.tagName.toUpperCase()) {
+
+ case "LI":
+
+
+ this.addItem(
+ new this.ITEM_TYPE(
+ oNode,
+ { parent: this }
+ ),
+ i
+ );
+
+ break;
+
+ }
+
+ }
+
+ }
+ while((oNode = oNode.nextSibling));
+
+ }
+ while(i--);
+
+ }
+
+ break;
+
+ case "SELECT":
+
+
+ oNode = this.srcElement.firstChild;
+
+ do {
+
+ if(oNode && oNode.tagName) {
+
+ switch(oNode.tagName.toUpperCase()) {
+
+ case "OPTGROUP":
+ case "OPTION":
+
+
+ this.addItem(
+ new this.ITEM_TYPE(
+ oNode,
+ { parent: this }
+ )
+ );
+
+ break;
+
+ }
+
+ }
+
+ }
+ while((oNode = oNode.nextSibling));
+
+ break;
+
+ }
+
+ }
+
+},
+
+/**
+* @method _getFirstEnabledItem
+* @description Returns the first enabled item in the menu.
+* @return {YAHOO.widget.MenuItem}
+* @private
+*/
+_getFirstEnabledItem: function() {
+
+ var nGroups = this._aItemGroups.length;
+ var oItem;
+ var aItemGroup;
+
+ for(var i=0; i= aGroup.length);
+
+ if(aGroup[p_nItemIndex]) {
+
+ aGroup.splice(p_nItemIndex, 0, oItem);
+
+ }
+ else {
+
+ aGroup[p_nItemIndex] = oItem;
+
+ }
+
+ oGroupItem = aGroup[p_nItemIndex];
+
+ if(oGroupItem) {
+
+ if(
+ bAppend &&
+ (
+ !oGroupItem.element.parentNode ||
+ oGroupItem.element.parentNode.nodeType == 11
+ )
+ ) {
+
+ this._aListElements[nGroupIndex].appendChild(
+ oGroupItem.element
+ );
+
+ }
+ else {
+
+
+ /**
+ * Returns the next sibling of an item in an array.
+ * @private
+ * @param {p_aArray} Array to search.
+ * @param {p_nStartIndex} Number indicating the index to
+ * start searching the array.
+ * @return {Object}
+ */
+ var getNextItemSibling =
+
+ function(p_aArray, p_nStartIndex) {
+
+ return (
+ p_aArray[p_nStartIndex] ||
+ getNextItemSibling(
+ p_aArray,
+ (p_nStartIndex+1)
+ )
+ );
+
+ };
+
+
+ var oNextItemSibling =
+ getNextItemSibling(aGroup, (p_nItemIndex+1));
+
+ if(
+ oNextItemSibling &&
+ (
+ !oGroupItem.element.parentNode ||
+ oGroupItem.element.parentNode.nodeType == 11
+ )
+ ) {
+
+ this._aListElements[nGroupIndex].insertBefore(
+ oGroupItem.element,
+ oNextItemSibling.element
+ );
+
+ }
+
+ }
+
+
+ oGroupItem.parent = this;
+
+ this._subscribeToItemEvents(oGroupItem);
+
+ this._configureSubmenu(oGroupItem);
+
+ this._updateItemProperties(nGroupIndex);
+
+
+ this.itemAddedEvent.fire(oGroupItem);
+
+ return oGroupItem;
+
+ }
+
+ }
+ else {
+
+ var nItemIndex = aGroup.length;
+
+ aGroup[nItemIndex] = oItem;
+
+ oGroupItem = aGroup[nItemIndex];
+
+
+ if(oGroupItem) {
+
+ if(
+ !Dom.isAncestor(
+ this._aListElements[nGroupIndex],
+ oGroupItem.element
+ )
+ ) {
+
+ this._aListElements[nGroupIndex].appendChild(
+ oGroupItem.element
+ );
+
+ }
+
+ oGroupItem.element.setAttribute("groupindex", nGroupIndex);
+ oGroupItem.element.setAttribute("index", nItemIndex);
+
+ oGroupItem.parent = this;
+
+ oGroupItem.index = nItemIndex;
+ oGroupItem.groupIndex = nGroupIndex;
+
+ this._subscribeToItemEvents(oGroupItem);
+
+ this._configureSubmenu(oGroupItem);
+
+ if(nItemIndex === 0) {
+
+ Dom.addClass(oGroupItem.element, "first-of-type");
+
+ }
+
+
+
+ this.itemAddedEvent.fire(oGroupItem);
+
+ return oGroupItem;
+
+ }
+
+ }
+
+ }
+
+},
+
+/**
+* @method _removeItemFromGroupByIndex
+* @description Removes a menu item from a group by index. Returns the menu
+* item that was removed.
+* @private
+* @param {Number} p_nGroupIndex Number indicating the group to which the menu
+* item belongs.
+* @param {Number} p_nItemIndex Number indicating the index of the menu item
+* to be removed.
+* @return {YAHOO.widget.MenuItem}
+*/
+_removeItemFromGroupByIndex: function(p_nGroupIndex, p_nItemIndex) {
+
+ var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;
+ var aGroup = this._getItemGroup(nGroupIndex);
+
+ if(aGroup) {
+
+ var aArray = aGroup.splice(p_nItemIndex, 1);
+ var oItem = aArray[0];
+
+ if(oItem) {
+
+ // Update the index and className properties of each member
+
+ this._updateItemProperties(nGroupIndex);
+
+ if(aGroup.length === 0) {
+
+ // Remove the UL
+
+ var oUL = this._aListElements[nGroupIndex];
+
+ if(this.body && oUL) {
+
+ this.body.removeChild(oUL);
+
+ }
+
+ // Remove the group from the array of items
+
+ this._aItemGroups.splice(nGroupIndex, 1);
+
+
+ // Remove the UL from the array of ULs
+
+ this._aListElements.splice(nGroupIndex, 1);
+
+
+ /*
+ Assign the "first-of-type" class to the new first UL
+ in the collection
+ */
+
+ oUL = this._aListElements[0];
+
+ if(oUL) {
+
+ Dom.addClass(oUL, "first-of-type");
+
+ }
+
+ }
+
+
+ this.itemRemovedEvent.fire(oItem);
+
+ // Return a reference to the item that was removed
+
+ return oItem;
+
+ }
+
+ }
+
+},
+
+/**
+* @method _removeItemFromGroupByValue
+* @description Removes a menu item from a group by reference. Returns the
+* menu item that was removed.
+* @private
+* @param {Number} p_nGroupIndex Number indicating the group to which the
+* menu item belongs.
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
+* instance to be removed.
+* @return {YAHOO.widget.MenuItem}
+*/
+_removeItemFromGroupByValue: function(p_nGroupIndex, p_oItem) {
+
+ var aGroup = this._getItemGroup(p_nGroupIndex);
+
+ if(aGroup) {
+
+ var nItems = aGroup.length;
+ var nItemIndex = -1;
+
+ if(nItems > 0) {
+
+ var i = nItems-1;
+
+ do {
+
+ if(aGroup[i] == p_oItem) {
+
+ nItemIndex = i;
+ break;
+
+ }
+
+ }
+ while(i--);
+
+ if(nItemIndex > -1) {
+
+ return this._removeItemFromGroupByIndex(
+ p_nGroupIndex,
+ nItemIndex
+ );
+
+ }
+
+ }
+
+ }
+
+},
+
+/**
+* @method _updateItemProperties
+* @description Updates the "index," "groupindex," and "className" properties
+* of the menu items in the specified group.
+* @private
+* @param {Number} p_nGroupIndex Number indicating the group of items to update.
+*/
+_updateItemProperties: function(p_nGroupIndex) {
+
+ var aGroup = this._getItemGroup(p_nGroupIndex);
+ var nItems = aGroup.length;
+
+ if(nItems > 0) {
+
+ var i = nItems - 1;
+ var oItem;
+ var oLI;
+
+ // Update the index and className properties of each member
+
+ do {
+
+ oItem = aGroup[i];
+
+ if(oItem) {
+
+ oLI = oItem.element;
+
+ oItem.index = i;
+ oItem.groupIndex = p_nGroupIndex;
+
+ oLI.setAttribute("groupindex", p_nGroupIndex);
+ oLI.setAttribute("index", i);
+
+ Dom.removeClass(oLI, "first-of-type");
+
+ }
+
+ }
+ while(i--);
+
+ if(oLI) {
+
+ Dom.addClass(oLI, "first-of-type");
+
+ }
+
+ }
+
+},
+
+/**
+* @method _createItemGroup
+* @description Creates a new menu item group (array) and its associated
+* <ul> element. Returns an aray of menu item groups.
+* @private
+* @param {Number} p_nIndex Number indicating the group to create.
+* @return {Array}
+*/
+_createItemGroup: function(p_nIndex) {
+
+ if(!this._aItemGroups[p_nIndex]) {
+
+ this._aItemGroups[p_nIndex] = [];
+
+ var oUL = document.createElement("ul");
+
+ this._aListElements[p_nIndex] = oUL;
+
+ return this._aItemGroups[p_nIndex];
+
+ }
+
+},
+
+/**
+* @method _getItemGroup
+* @description Returns the menu item group at the specified index.
+* @private
+* @param {Number} p_nIndex Number indicating the index of the menu item group
+* to be retrieved.
+* @return {Array}
+*/
+_getItemGroup: function(p_nIndex) {
+
+ var nIndex = ((typeof p_nIndex == "number") ? p_nIndex : 0);
+
+ return this._aItemGroups[nIndex];
+
+},
+
+/**
+* @method _configureSubmenu
+* @description Subscribes the menu item's submenu to its parent menu's events.
+* @private
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
+* instance with the submenu to be configured.
+*/
+_configureSubmenu: function(p_oItem) {
+
+ var oSubmenu = p_oItem.cfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ /*
+ Listen for configuration changes to the parent menu
+ so they they can be applied to the submenu.
+ */
+
+ this.cfg.configChangedEvent.subscribe(
+ this._onParentMenuConfigChange,
+ oSubmenu,
+ true
+ );
+
+ this.renderEvent.subscribe(
+ this._onParentMenuRender,
+ oSubmenu,
+ true
+ );
+
+ oSubmenu.beforeShowEvent.subscribe(
+ this._onSubmenuBeforeShow,
+ oSubmenu,
+ true
+ );
+
+ oSubmenu.showEvent.subscribe(
+ this._onSubmenuShow,
+ oSubmenu,
+ true
+ );
+
+ oSubmenu.hideEvent.subscribe(
+ this._onSubmenuHide,
+ oSubmenu,
+ true
+ );
+
+ }
+
+},
+
+/**
+* @method _subscribeToItemEvents
+* @description Subscribes a menu to a menu item's event.
+* @private
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
+* instance whose events should be subscribed to.
+*/
+_subscribeToItemEvents: function(p_oItem) {
+
+ p_oItem.focusEvent.subscribe(this._onMenuItemFocus, p_oItem, this);
+
+ p_oItem.blurEvent.subscribe(this._onMenuItemBlur, this, true);
+
+ p_oItem.cfg.configChangedEvent.subscribe(
+ this._onMenuItemConfigChange,
+ p_oItem,
+ this
+ );
+
+},
+
+/**
+* @method _getOffsetWidth
+* @description Returns the offset width of the menu's
+* <div> element.
+* @private
+*/
+_getOffsetWidth: function() {
+
+ var oClone = this.element.cloneNode(true);
+
+ Dom.setStyle(oClone, "width", "");
+
+ document.body.appendChild(oClone);
+
+ var sWidth = oClone.offsetWidth;
+
+ document.body.removeChild(oClone);
+
+ return sWidth;
+
+},
+
+/**
+* @method _cancelHideDelay
+* @description Cancels the call to "hideMenu."
+* @private
+*/
+_cancelHideDelay: function() {
+
+ var oRoot = this.getRoot();
+
+ if(oRoot._nHideDelayId) {
+
+ window.clearTimeout(oRoot._nHideDelayId);
+
+ }
+
+},
+
+/**
+* @method _execHideDelay
+* @description Hides the menu after the number of milliseconds specified by
+* the "hidedelay" configuration property.
+* @private
+*/
+_execHideDelay: function() {
+
+ this._cancelHideDelay();
+
+ var oRoot = this.getRoot();
+ var me = this;
+
+ var hideMenu = function() {
+
+ if(oRoot.activeItem) {
+
+ oRoot.clearActiveItem();
+
+ }
+
+ if(oRoot == me && me.cfg.getProperty("position") == "dynamic") {
+
+ me.hide();
+
+ }
+
+ };
+
+ oRoot._nHideDelayId =
+ window.setTimeout(hideMenu, oRoot.cfg.getProperty("hidedelay"));
+
+},
+
+/**
+* @method _cancelShowDelay
+* @description Cancels the call to the "showMenu."
+* @private
+*/
+_cancelShowDelay: function() {
+
+ var oRoot = this.getRoot();
+
+ if(oRoot._nShowDelayId) {
+
+ window.clearTimeout(oRoot._nShowDelayId);
+
+ }
+
+},
+
+/**
+* @method _execShowDelay
+* @description Shows the menu after the number of milliseconds specified by
+* the "showdelay" configuration property have ellapsed.
+* @private
+* @param {YAHOO.widget.Menu} p_oMenu Object specifying the menu that should
+* be made visible.
+*/
+_execShowDelay: function(p_oMenu) {
+
+ this._cancelShowDelay();
+
+ var oRoot = this.getRoot();
+
+ var showMenu = function() {
+
+ p_oMenu.show();
+
+ };
+
+ oRoot._nShowDelayId =
+ window.setTimeout(showMenu, oRoot.cfg.getProperty("showdelay"));
+
+},
+
+// Protected methods
+
+/**
+* @method _onMouseOver
+* @description "mouseover" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onMouseOver: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oEvent = p_aArgs[0];
+ var oItem = p_aArgs[1];
+ var oTarget = Event.getTarget(oEvent);
+
+ if(
+ !this._bHandledMouseOverEvent &&
+ (oTarget == this.element || Dom.isAncestor(this.element, oTarget))
+ ) {
+
+ // MENU MOUSEOVER LOGIC HERE
+
+ this.clearActiveItem();
+
+ this._bHandledMouseOverEvent = true;
+ this._bHandledMouseOutEvent = false;
+
+ }
+
+ if(
+ oItem && !oItem.handledMouseOverEvent &&
+ (oTarget == oItem.element || Dom.isAncestor(oItem.element, oTarget))
+ ) {
+
+ var oItemCfg = oItem.cfg;
+
+ // Select and focus the current menu item
+
+ oItemCfg.setProperty("selected", true);
+ oItem.focus();
+
+ if(this.cfg.getProperty("autosubmenudisplay")) {
+
+ // Show the submenu this menu item
+
+ var oSubmenu = oItemCfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ if(this.cfg.getProperty("showdelay") > 0) {
+
+ this._execShowDelay(oSubmenu);
+
+ }
+ else {
+
+ oSubmenu.show();
+
+ }
+
+ }
+
+ }
+
+ oItem.handledMouseOverEvent = true;
+ oItem.handledMouseOutEvent = false;
+
+ }
+
+},
+
+/**
+* @method _onMouseOut
+* @description "mouseout" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onMouseOut: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oEvent = p_aArgs[0];
+ var oItem = p_aArgs[1];
+ var oRelatedTarget = Event.getRelatedTarget(oEvent);
+ var bMovingToSubmenu = false;
+
+ if(oItem) {
+
+ var oItemCfg = oItem.cfg;
+ var oSubmenu = oItemCfg.getProperty("submenu");
+
+ if(
+ oSubmenu &&
+ (
+ oRelatedTarget == oSubmenu.element ||
+ Dom.isAncestor(oSubmenu.element, oRelatedTarget)
+ )
+ ) {
+
+ bMovingToSubmenu = true;
+
+ }
+
+ if(
+ !oItem.handledMouseOutEvent &&
+ (
+ (
+ oRelatedTarget != oItem.element &&
+ !Dom.isAncestor(oItem.element, oRelatedTarget)
+ ) || bMovingToSubmenu
+ )
+ ) {
+
+ if(this.cfg.getProperty("showdelay") > 0) {
+
+ this._cancelShowDelay();
+
+ }
+
+ if(!bMovingToSubmenu) {
+
+ oItemCfg.setProperty("selected", false);
+
+ }
+
+ if(this.cfg.getProperty("autosubmenudisplay")) {
+
+ if(oSubmenu) {
+
+ if(
+ !(
+ oRelatedTarget == oSubmenu.element ||
+ YAHOO.util.Dom.isAncestor(
+ oSubmenu.element,
+ oRelatedTarget
+ )
+ )
+ ) {
+
+ oSubmenu.hide();
+
+ }
+
+ }
+
+ }
+
+ oItem.handledMouseOutEvent = true;
+ oItem.handledMouseOverEvent = false;
+
+ }
+
+ }
+
+ if(
+ !this._bHandledMouseOutEvent &&
+ (
+ (
+ oRelatedTarget != this.element &&
+ !Dom.isAncestor(this.element, oRelatedTarget)
+ )
+ || bMovingToSubmenu
+ )
+ ) {
+
+ this._bHandledMouseOutEvent = true;
+ this._bHandledMouseOverEvent = false;
+
+ }
+
+},
+
+/**
+* @method _onClick
+* @description "click" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onClick: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oEvent = p_aArgs[0];
+ var oItem = p_aArgs[1];
+ var oTarget = Event.getTarget(oEvent);
+
+ if(oItem) {
+
+ var oItemCfg = oItem.cfg;
+ var oSubmenu = oItemCfg.getProperty("submenu");
+
+ /*
+ ACCESSIBILITY FEATURE FOR SCREEN READERS:
+ Expand/collapse the submenu when the user clicks
+ on the submenu indicator image.
+ */
+
+ if(oTarget == oItem.submenuIndicator && oSubmenu) {
+
+ if(oSubmenu.cfg.getProperty("visible")) {
+
+ oSubmenu.hide();
+
+ }
+ else {
+
+ this.clearActiveItem();
+
+ this.activeItem = oItem;
+
+ oItem.cfg.setProperty("selected", true);
+
+ oSubmenu.show();
+
+ }
+
+ }
+ else {
+
+ var sURL = oItemCfg.getProperty("url");
+ var bCurrentPageURL = (sURL.substr((sURL.length-1),1) == "#");
+ var sTarget = oItemCfg.getProperty("target");
+ var bHasTarget = (sTarget && sTarget.length > 0);
+
+ /*
+ Prevent the browser from following links
+ equal to "#"
+ */
+
+ if(
+ oTarget.tagName.toUpperCase() == "A" &&
+ bCurrentPageURL && !bHasTarget
+ ) {
+
+ Event.preventDefault(oEvent);
+
+ }
+
+ if(
+ oTarget.tagName.toUpperCase() != "A" &&
+ !bCurrentPageURL && !bHasTarget
+ ) {
+
+ /*
+ Follow the URL of the item regardless of
+ whether or not the user clicked specifically
+ on the anchor element.
+ */
+
+ document.location = sURL;
+
+ }
+
+ /*
+ If the item doesn't navigate to a URL and it doesn't have
+ a submenu, then collapse the menu tree.
+ */
+
+ if(bCurrentPageURL && !oSubmenu) {
+
+ var oRoot = this.getRoot();
+
+ if(oRoot.cfg.getProperty("position") == "static") {
+
+ oRoot.clearActiveItem();
+
+ }
+ else {
+
+ oRoot.hide();
+
+ }
+
+ }
+
+ }
+
+ }
+
+},
+
+/**
+* @method _onKeyDown
+* @description "keydown" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onKeyDown: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oEvent = p_aArgs[0];
+ var oItem = p_aArgs[1];
+ var oSubmenu;
+
+ if(oItem) {
+
+ var oItemCfg = oItem.cfg;
+ var oParentItem = this.parent;
+ var oRoot;
+ var oNextItem;
+
+ switch(oEvent.keyCode) {
+
+ case 38: // Up arrow
+ case 40: // Down arrow
+
+ if(
+ oItem == this.activeItem &&
+ !oItemCfg.getProperty("selected")
+ ) {
+
+ oItemCfg.setProperty("selected", true);
+
+ }
+ else {
+
+ oNextItem = (oEvent.keyCode == 38) ?
+ oItem.getPreviousEnabledSibling() :
+ oItem.getNextEnabledSibling();
+
+ if(oNextItem) {
+
+ this.clearActiveItem();
+
+ oNextItem.cfg.setProperty("selected", true);
+ oNextItem.focus();
+
+ }
+
+ }
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+
+ case 39: // Right arrow
+
+ oSubmenu = oItemCfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ if(!oItemCfg.getProperty("selected")) {
+
+ oItemCfg.setProperty("selected", true);
+
+ }
+
+ oSubmenu.show();
+
+ oSubmenu.setInitialSelection();
+
+ }
+ else {
+
+ oRoot = this.getRoot();
+
+ if(oRoot instanceof YAHOO.widget.MenuBar) {
+
+ oNextItem = oRoot.activeItem.getNextEnabledSibling();
+
+ if(oNextItem) {
+
+ oRoot.clearActiveItem();
+
+ oNextItem.cfg.setProperty("selected", true);
+
+ oSubmenu = oNextItem.cfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ oSubmenu.show();
+
+ }
+
+ oNextItem.focus();
+
+ }
+
+ }
+
+ }
+
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+
+ case 37: // Left arrow
+
+ if(oParentItem) {
+
+ var oParentMenu = oParentItem.parent;
+
+ if(oParentMenu instanceof YAHOO.widget.MenuBar) {
+
+ oNextItem =
+ oParentMenu.activeItem.getPreviousEnabledSibling();
+
+ if(oNextItem) {
+
+ oParentMenu.clearActiveItem();
+
+ oNextItem.cfg.setProperty("selected", true);
+
+ oSubmenu = oNextItem.cfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ oSubmenu.show();
+
+ }
+
+ oNextItem.focus();
+
+ }
+
+ }
+ else {
+
+ this.hide();
+
+ oParentItem.focus();
+
+ }
+
+ }
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+ }
+
+ }
+
+ if(oEvent.keyCode == 27) { // Esc key
+
+ if(this.cfg.getProperty("position") == "dynamic") {
+
+ this.hide();
+
+ if(this.parent) {
+
+ this.parent.focus();
+
+ }
+
+ }
+ else if(this.activeItem) {
+
+ oSubmenu = this.activeItem.cfg.getProperty("submenu");
+
+ if(oSubmenu && oSubmenu.cfg.getProperty("visible")) {
+
+ oSubmenu.hide();
+ this.activeItem.focus();
+
+ }
+ else {
+
+ this.activeItem.cfg.setProperty("selected", false);
+ this.activeItem.blur();
+
+ }
+
+ }
+
+ Event.preventDefault(oEvent);
+
+ }
+
+},
+
+// Private methods
+
+/**
+* @method _onInit
+* @description "init" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onInit: function(p_sType, p_aArgs, p_oMenu) {
+
+ if(
+ (
+ (this.parent && !this.lazyLoad) ||
+ (!this.parent && this.cfg.getProperty("position") == "static") ||
+ (
+ !this.parent &&
+ !this.lazyLoad &&
+ this.cfg.getProperty("position") == "dynamic"
+ )
+ ) &&
+ this.getItemGroups().length === 0
+ ) {
+
+ if(this.srcElement) {
+
+ this._initSubTree();
+
+ }
+
+ if(this.itemData) {
+
+ this.addItems(this.itemData);
+
+ }
+
+ }
+ else if(this.lazyLoad) {
+
+ this.cfg.fireQueue();
+
+ }
+
+},
+
+/**
+* @method _onBeforeRender
+* @description "beforerender" event handler for the menu. Appends all of the
+* <ul>, <li> and their accompanying
+* title elements to the body element of the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onBeforeRender: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oConfig = this.cfg;
+ var oEl = this.element;
+ var nListElements = this._aListElements.length;
+
+ if(nListElements > 0) {
+
+ var i = 0;
+ var bFirstList = true;
+ var oUL;
+ var oGroupTitle;
+
+ do {
+
+ oUL = this._aListElements[i];
+
+ if(oUL) {
+
+ if(bFirstList) {
+
+ Dom.addClass(oUL, "first-of-type");
+ bFirstList = false;
+
+ }
+
+ if(!Dom.isAncestor(oEl, oUL)) {
+
+ this.appendToBody(oUL);
+
+ }
+
+ oGroupTitle = this._aGroupTitleElements[i];
+
+ if(oGroupTitle) {
+
+ if(!Dom.isAncestor(oEl, oGroupTitle)) {
+
+ oUL.parentNode.insertBefore(oGroupTitle, oUL);
+
+ }
+
+ Dom.addClass(oUL, "hastitle");
+
+ }
+
+ }
+
+ i++;
+
+ }
+ while(i < nListElements);
+
+ }
+
+},
+
+/**
+* @method _onRender
+* @description "render" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onRender: function(p_sType, p_aArgs, p_oMenu) {
+
+ if(this.cfg.getProperty("position") == "dynamic") {
+
+ var sWidth =
+ this.element.parentNode.tagName.toUpperCase() == "BODY" ?
+ this.element.offsetWidth : this._getOffsetWidth();
+
+ this.cfg.setProperty("width", (sWidth + "px"));
+
+ }
+
+},
+
+/**
+* @method _onBeforeShow
+* @description "beforeshow" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+_onBeforeShow: function(p_sType, p_aArgs, p_oMenu) {
+
+ if(this.lazyLoad && this.getItemGroups().length === 0) {
+
+ if(this.srcElement) {
+
+ this._initSubTree();
+
+ }
+
+ if(this.itemData) {
+
+ if(
+ this.parent && this.parent.parent &&
+ this.parent.parent.srcElement &&
+ this.parent.parent.srcElement.tagName.toUpperCase() == "SELECT"
+ ) {
+
+ var nOptions = this.itemData.length;
+
+ for(var n=0; n 0) {
+
+ oConfig.showdelay = nShowDelay;
+
+ }
+
+ var nHideDelay = oParentMenu.cfg.getProperty("hidedelay");
+
+ if(nHideDelay > 0) {
+
+ oConfig.hidedelay = nHideDelay;
+
+ }
+
+ /*
+ Only sync the "iframe" configuration property if the parent
+ menu's "position" configuration is the same.
+ */
+
+ if(
+ this.cfg.getProperty("position") ==
+ oParentMenu.cfg.getProperty("position")
+ ) {
+
+ oConfig.iframe = oParentMenu.cfg.getProperty("iframe");
+
+ }
+
+
+ p_oSubmenu.cfg.applyConfig(oConfig);
+
+ if(!this.lazyLoad) {
+
+ if(Dom.inDocument(this.element)) {
+
+ this.render();
+
+ }
+ else {
+
+ this.render(this.parent.element);
+
+ }
+
+ }
+
+},
+
+/**
+* @method _onSubmenuBeforeShow
+* @description "beforeshow" event handler for a submenu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
+* subscribed to the event.
+*/
+_onSubmenuBeforeShow: function(p_sType, p_aArgs, p_oSubmenu) {
+
+ var oParent = this.parent;
+ var aAlignment = oParent.parent.cfg.getProperty("submenualignment");
+
+ this.cfg.setProperty(
+ "context",
+ [oParent.element, aAlignment[0], aAlignment[1]]
+ );
+
+ oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;
+
+},
+
+/**
+* @method _onSubmenuShow
+* @description "show" event handler for a submenu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
+* subscribed to the event.
+*/
+_onSubmenuShow: function(p_sType, p_aArgs, p_oSubmenu) {
+
+ var oParent = this.parent;
+
+ oParent.submenuIndicator.alt = oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;
+
+},
+
+/**
+* @method _onSubmenuHide
+* @description "hide" Custom Event handler for a submenu.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that
+* subscribed to the event.
+*/
+_onSubmenuHide: function(p_sType, p_aArgs, p_oSubmenu) {
+
+ var oParent = this.parent;
+
+ oParent.submenuIndicator.alt = oParent.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
+
+},
+
+/**
+* @method _onMenuItemFocus
+* @description "focus" event handler for the menu's items.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+* that fired the event.
+*/
+_onMenuItemFocus: function(p_sType, p_aArgs, p_oItem) {
+
+ this.activeItem = p_oItem;
+
+},
+
+/**
+* @method _onMenuItemBlur
+* @description "blur" event handler for the menu's items.
+* @private
+* @param {String} p_sType String representing the name of the event
+* that was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onMenuItemBlur: function(p_sType, p_aArgs) {
+
+ this.activeItem = null;
+
+},
+
+/**
+* @method _onMenuItemConfigChange
+* @description "configchange" event handler for the menu's items.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+* that fired the event.
+*/
+_onMenuItemConfigChange: function(p_sType, p_aArgs, p_oItem) {
+
+ var sProperty = p_aArgs[0][0];
+
+ switch(sProperty) {
+
+ case "submenu":
+
+ var oSubmenu = p_aArgs[0][1];
+
+ if(oSubmenu) {
+
+ this._configureSubmenu(p_oItem);
+
+ }
+
+ break;
+
+ case "text":
+ case "helptext":
+
+ /*
+ A change to an item's "text" or "helptext"
+ configuration properties requires the width of the parent
+ menu to be recalculated.
+ */
+
+ if(this.element.style.width) {
+
+ var sWidth = this._getOffsetWidth() + "px";
+
+ Dom.setStyle(this.element, "width", sWidth);
+
+ }
+
+ break;
+
+ }
+
+},
+
+// Public event handlers for configuration properties
+
+/**
+* @method enforceConstraints
+* @description The default event handler executed when the moveEvent is fired,
+* if the "constraintoviewport" configuration property is set to true.
+* @param {String} type The name of the event that was fired.
+* @param {Array} args Collection of arguments sent when the
+* event was fired.
+* @param {Array} obj Array containing the current Menu instance
+* and the item that fired the event.
+*/
+enforceConstraints: function(type, args, obj) {
+
+ var oConfig = this.cfg;
+
+ var pos = args[0];
+
+ var x = pos[0];
+ var y = pos[1];
+
+ var bod = document.getElementsByTagName('body')[0];
+ var htm = document.getElementsByTagName('html')[0];
+
+ var bodyOverflow = Dom.getStyle(bod, "overflow");
+ var htmOverflow = Dom.getStyle(htm, "overflow");
+
+ var offsetHeight = this.element.offsetHeight;
+ var offsetWidth = this.element.offsetWidth;
+
+ var viewPortWidth = Dom.getClientWidth();
+ var viewPortHeight = Dom.getClientHeight();
+
+ var scrollX = window.scrollX || document.body.scrollLeft;
+ var scrollY = window.scrollY || document.body.scrollTop;
+
+ var topConstraint = scrollY + 10;
+ var leftConstraint = scrollX + 10;
+ var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;
+ var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;
+
+ var aContext = oConfig.getProperty("context");
+ var oContextElement = aContext ? aContext[0] : null;
+
+
+ if (x < 10) {
+
+ x = leftConstraint;
+
+ } else if ((x + offsetWidth) > viewPortWidth) {
+
+ if(
+ oContextElement &&
+ ((x - oContextElement.offsetWidth) > offsetWidth)
+ ) {
+
+ x = (x - (oContextElement.offsetWidth + offsetWidth));
+
+ }
+ else {
+
+ x = rightConstraint;
+
+ }
+
+ }
+
+ if (y < 10) {
+
+ y = topConstraint;
+
+ } else if (y > bottomConstraint) {
+
+ if(oContextElement && (y > offsetHeight)) {
+
+ y = ((y + oContextElement.offsetHeight) - offsetHeight);
+
+ }
+ else {
+
+ y = bottomConstraint;
+
+ }
+
+ }
+
+ oConfig.setProperty("x", x, true);
+ oConfig.setProperty("y", y, true);
+
+},
+
+/**
+* @method configVisible
+* @description Event handler for when the "visible" configuration property
+* the menu changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+configVisible: function(p_sType, p_aArgs, p_oMenu) {
+
+ if(this.cfg.getProperty("position") == "dynamic") {
+
+ YAHOO.widget.Menu.superclass.configVisible.call(
+ this,
+ p_sType,
+ p_aArgs,
+ p_oMenu
+ );
+
+ }
+ else {
+
+ var bVisible = p_aArgs[0];
+ var sDisplay = Dom.getStyle(this.element, "display");
+
+ if(bVisible) {
+
+ if(sDisplay != "block") {
+ this.beforeShowEvent.fire();
+ Dom.setStyle(this.element, "display", "block");
+ this.showEvent.fire();
+ }
+
+ }
+ else {
+
+ if(sDisplay == "block") {
+ this.beforeHideEvent.fire();
+ Dom.setStyle(this.element, "display", "none");
+ this.hideEvent.fire();
+ }
+
+ }
+
+ }
+
+},
+
+/**
+* @method configPosition
+* @description Event handler for when the "position" configuration property
+* of the menu changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+configPosition: function(p_sType, p_aArgs, p_oMenu) {
+
+ var sCSSPosition = p_aArgs[0] == "static" ? "static" : "absolute";
+ var oCfg = this.cfg;
+
+ Dom.setStyle(this.element, "position", sCSSPosition);
+
+ if(sCSSPosition == "static") {
+
+ /*
+ Remove the iframe for statically positioned menus since it will
+ intercept mouse events.
+ */
+
+ oCfg.setProperty("iframe", false);
+
+ // Statically positioned menus are visible by default
+
+ Dom.setStyle(this.element, "display", "block");
+
+ oCfg.setProperty("visible", true);
+
+ }
+ else {
+
+ /*
+ Even though the "visible" property is queued to
+ "false" by default, we need to set the "visibility" property to
+ "hidden" since Overlay's "configVisible" implementation checks the
+ element's "visibility" style property before deciding whether
+ or not to show an Overlay instance.
+ */
+
+ Dom.setStyle(this.element, "visibility", "hidden");
+
+ }
+
+ if(sCSSPosition == "absolute") {
+
+ var nZIndex = oCfg.getProperty("zindex");
+
+ if(!nZIndex || nZIndex === 0) {
+
+ nZIndex = this.parent ?
+ (this.parent.parent.cfg.getProperty("zindex") + 1) : 1;
+
+ oCfg.setProperty("zindex", nZIndex);
+
+ }
+
+ }
+
+},
+
+/**
+* @method configIframe
+* @description Event handler for when the "iframe" configuration property of
+* the menu changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+configIframe: function(p_sType, p_aArgs, p_oMenu) {
+
+ if(this.cfg.getProperty("position") == "dynamic") {
+
+ YAHOO.widget.Menu.superclass.configIframe.call(
+ this,
+ p_sType,
+ p_aArgs,
+ p_oMenu
+ );
+
+ }
+
+},
+
+/**
+* @method configHideDelay
+* @description Event handler for when the "hidedelay" configuration property
+* of the menu changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+configHideDelay: function(p_sType, p_aArgs, p_oMenu) {
+
+ var nHideDelay = p_aArgs[0];
+ var oMouseOutEvent = this.mouseOutEvent;
+ var oMouseOverEvent = this.mouseOverEvent;
+ var oKeyDownEvent = this.keyDownEvent;
+
+ if(nHideDelay > 0) {
+
+ /*
+ Only assign event handlers once. This way the user change
+ the value for the hidedelay as many times as they want.
+ */
+
+ if(!this._hideDelayEventHandlersAssigned) {
+
+ oMouseOutEvent.subscribe(this._execHideDelay, true);
+ oMouseOverEvent.subscribe(this._cancelHideDelay, this, true);
+ oKeyDownEvent.subscribe(this._cancelHideDelay, this, true);
+
+ this._hideDelayEventHandlersAssigned = true;
+
+ }
+
+ }
+ else {
+
+ oMouseOutEvent.unsubscribe(this._execHideDelay, this);
+ oMouseOverEvent.unsubscribe(this._cancelHideDelay, this);
+ oKeyDownEvent.unsubscribe(this._cancelHideDelay, this);
+
+ this._hideDelayEventHandlersAssigned = false;
+
+ }
+
+},
+
+/**
+* @method configContainer
+* @description Event handler for when the "container" configuration property
+of the menu changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that
+* fired the event.
+*/
+configContainer: function(p_sType, p_aArgs, p_oMenu) {
+
+ var oElement = p_aArgs[0];
+
+ if(typeof oElement == 'string') {
+
+ this.cfg.setProperty(
+ "container",
+ document.getElementById(oElement),
+ true
+ );
+
+ }
+
+},
+
+// Public methods
+
+/**
+* Event handler called when the resize monitor element's "resize" evet is fired.
+*/
+onDomResize: function(e, obj) {
+
+ if(!this._handleResize) {
+
+ this._handleResize = true;
+ return;
+
+ }
+
+ var oConfig = this.cfg;
+
+ if(oConfig.getProperty("position") == "dynamic") {
+
+ oConfig.setProperty("width", (this._getOffsetWidth() + "px"));
+
+ }
+
+ YAHOO.widget.Menu.superclass.onDomResize.call(this, e, obj);
+
+},
+
+/**
+* @method initEvents
+* @description Initializes the custom events for the menu.
+*/
+initEvents: function() {
+
+ YAHOO.widget.Menu.superclass.initEvents.call(this);
+
+ // Create custom events
+
+ var CustomEvent = YAHOO.util.CustomEvent;
+
+ this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);
+ this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);
+ this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);
+ this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);
+ this.clickEvent = new CustomEvent("clickEvent", this);
+ this.keyPressEvent = new CustomEvent("keyPressEvent", this);
+ this.keyDownEvent = new CustomEvent("keyDownEvent", this);
+ this.keyUpEvent = new CustomEvent("keyUpEvent", this);
+ this.itemAddedEvent = new CustomEvent("itemAddedEvent", this);
+ this.itemRemovedEvent = new CustomEvent("itemRemovedEvent", this);
+
+},
+
+/**
+* @method getRoot
+* @description Finds the menu's root menu.
+*/
+getRoot: function() {
+
+ var oItem = this.parent;
+
+ if(oItem) {
+
+ var oParentMenu = oItem.parent;
+
+ return oParentMenu ? oParentMenu.getRoot() : this;
+
+ }
+ else {
+
+ return this;
+
+ }
+
+},
+
+/**
+* @method toString
+* @description Returns a string representing the menu.
+* @return {String}
+*/
+toString: function() {
+
+ return ("Menu " + this.id);
+
+},
+
+/**
+* @method setItemGroupTitle
+* @description Sets the title of a group of menu items.
+* @param {String} p_sGroupTitle String specifying the title of the group.
+* @param {Number} p_nGroupIndex Optional. Number specifying the group to which
+* the title belongs.
+*/
+setItemGroupTitle: function(p_sGroupTitle, p_nGroupIndex) {
+
+ if(typeof p_sGroupTitle == "string" && p_sGroupTitle.length > 0) {
+
+ var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;
+ var oTitle = this._aGroupTitleElements[nGroupIndex];
+
+ if(oTitle) {
+
+ oTitle.innerHTML = p_sGroupTitle;
+
+ }
+ else {
+
+ oTitle = document.createElement(this.GROUP_TITLE_TAG_NAME);
+
+ oTitle.innerHTML = p_sGroupTitle;
+
+ this._aGroupTitleElements[nGroupIndex] = oTitle;
+
+ }
+
+ var i = this._aGroupTitleElements.length - 1;
+ var nFirstIndex;
+
+ do {
+
+ if(this._aGroupTitleElements[i]) {
+
+ Dom.removeClass(this._aGroupTitleElements[i], "first-of-type");
+
+ nFirstIndex = i;
+
+ }
+
+ }
+ while(i--);
+
+ if(nFirstIndex !== null) {
+
+ Dom.addClass(
+ this._aGroupTitleElements[nFirstIndex],
+ "first-of-type"
+ );
+
+ }
+
+ }
+
+},
+
+/**
+* @method addItem
+* @description Appends an item to the menu.
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem
+* instance to be added to the menu.
+* @param {String} p_oItem String specifying the text of the item to be added
+* to the menu.
+* @param {Object} p_oItem Object literal containing a set of menu item
+* configuration properties.
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to
+* which the item belongs.
+* @return {YAHOO.widget.MenuItem}
+*/
+addItem: function(p_oItem, p_nGroupIndex) {
+
+ if(p_oItem) {
+
+ return this._addItemToGroup(p_nGroupIndex, p_oItem);
+
+ }
+
+},
+
+/**
+* @method addItems
+* @description Adds an array of items to the menu.
+* @param {Array} p_aItems Array of items to be added to the menu. The array
+* can contain strings specifying the text for each item to be created, object
+* literals specifying each of the menu item configuration properties,
+* or MenuItem instances.
+* @param {Number} p_nGroupIndex Optional. Number specifying the group to
+* which the items belongs.
+* @return {Array}
+*/
+addItems: function(p_aItems, p_nGroupIndex) {
+
+ function isArray(p_oValue) {
+
+ return (typeof p_oValue == "object" && p_oValue.constructor == Array);
+
+ }
+
+ if(isArray(p_aItems)) {
+
+ var nItems = p_aItems.length;
+ var aItems = [];
+ var oItem;
+
+ for(var i=0; i<div> element
+* (and accompanying child nodes) from the document.
+*/
+destroy: function() {
+
+ // Remove Custom Event listeners
+
+ this.mouseOverEvent.unsubscribeAll();
+ this.mouseOutEvent.unsubscribeAll();
+ this.mouseDownEvent.unsubscribeAll();
+ this.mouseUpEvent.unsubscribeAll();
+ this.clickEvent.unsubscribeAll();
+ this.keyPressEvent.unsubscribeAll();
+ this.keyDownEvent.unsubscribeAll();
+ this.keyUpEvent.unsubscribeAll();
+
+ var nItemGroups = this._aItemGroups.length;
+ var nItems;
+ var oItemGroup;
+ var oItem;
+ var i;
+ var n;
+
+ // Remove all items
+
+ if(nItemGroups > 0) {
+
+ i = nItemGroups - 1;
+
+ do {
+
+ oItemGroup = this._aItemGroups[i];
+
+ if(oItemGroup) {
+
+ nItems = oItemGroup.length;
+
+ if(nItems > 0) {
+
+ n = nItems - 1;
+
+ do {
+
+ oItem = this._aItemGroups[i][n];
+
+ if(oItem) {
+
+ oItem.destroy();
+ }
+
+ }
+ while(n--);
+
+ }
+
+ }
+
+ }
+ while(i--);
+
+ }
+
+ // Continue with the superclass implementation of this method
+
+ YAHOO.widget.Menu.superclass.destroy.call(this);
+
+
+},
+
+/**
+* @method setInitialFocus
+* @description Sets focus to the menu's first enabled item.
+*/
+setInitialFocus: function() {
+
+ var oItem = this._getFirstEnabledItem();
+
+ if(oItem) {
+
+ oItem.focus();
+ }
+
+},
+
+/**
+* @method setInitialSelection
+* @description Sets the "selected" configuration property of the menu's first
+* enabled item to "true."
+*/
+setInitialSelection: function() {
+
+ var oItem = this._getFirstEnabledItem();
+
+ if(oItem) {
+
+ oItem.cfg.setProperty("selected", true);
+ }
+
+},
+
+/**
+* @method clearActiveItem
+* @description Sets the "selected" configuration property of the menu's active
+* item to "false" and hides the item's submenu.
+* @param {Boolean} p_bBlur Boolean indicating if the menu's active item
+* should be blurred.
+*/
+clearActiveItem: function(p_bBlur) {
+
+ if(this.cfg.getProperty("showdelay") > 0) {
+
+ this._cancelShowDelay();
+
+ }
+
+ var oActiveItem = this.activeItem;
+
+ if(oActiveItem) {
+
+ var oConfig = oActiveItem.cfg;
+
+ oConfig.setProperty("selected", false);
+
+ var oSubmenu = oConfig.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ oSubmenu.hide();
+
+ }
+
+ if(p_bBlur) {
+
+ oActiveItem.blur();
+
+ }
+
+ }
+
+},
+
+/**
+* @description Initializes the class's configurable properties which can be
+* changed using the menu's Config object ("cfg").
+* @method initDefaultConfig
+*/
+initDefaultConfig: function() {
+
+ YAHOO.widget.Menu.superclass.initDefaultConfig.call(this);
+
+ var oConfig = this.cfg;
+
+ // Add configuration properties
+
+ /*
+ Change the default value for the "visible" configuration
+ property to "false" by re-adding the property.
+ */
+
+ /**
+ * @config visible
+ * @description Boolean indicating whether or not the menu is visible. If
+ * the menu's "position" configuration property is set to "dynamic" (the
+ * default), this property toggles the menu's <div>
+ * element's "visibility" style property between "visible" (true) or
+ * "hidden" (false). If the menu's "position" configuration property is
+ * set to "static" this property toggles the menu's
+ * <div> element's "display" style property
+ * between "block" (true) or "none" (false).
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "visible",
+ {
+ value:false,
+ handler:this.configVisible,
+ validator:this.cfg.checkBoolean
+ }
+ );
+
+ /*
+ Change the default value for the "constraintoviewport" configuration
+ property to "true" by re-adding the property.
+ */
+
+ /**
+ * @config constraintoviewport
+ * @description Boolean indicating if the menu will try to remain inside
+ * the boundaries of the size of viewport.
+ * @default true
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "constraintoviewport",
+ {
+ value:true,
+ handler:this.configConstrainToViewport,
+ validator:this.cfg.checkBoolean,
+ supercedes:["iframe","x","y","xy"]
+ }
+ );
+
+ /**
+ * @config position
+ * @description String indicating how a menu should be positioned on the
+ * screen. Possible values are "static" and "dynamic." Static menus are
+ * visible by default and reside in the normal flow of the document
+ * (CSS position: static). Dynamic menus are hidden by default, reside
+ * out of the normal flow of the document (CSS position: absolute), and
+ * can overlay other elements on the screen.
+ * @default dynamic
+ * @type String
+ */
+ oConfig.addProperty(
+ "position",
+ {
+ value: "dynamic",
+ handler: this.configPosition,
+ validator: this._checkPosition,
+ supercedes: ["visible"]
+ }
+ );
+
+ /**
+ * @config submenualignment
+ * @description Array defining how submenus should be aligned to their
+ * parent menu item. The format is: [itemCorner, submenuCorner]. By default
+ * a submenu's top left corner is aligned to its parent menu item's top
+ * right corner.
+ * @default ["tl","tr"]
+ * @type Array
+ */
+ oConfig.addProperty("submenualignment", { value: ["tl","tr"] } );
+
+ /**
+ * @config autosubmenudisplay
+ * @description Boolean indicating if submenus are automatically made
+ * visible when the user mouses over the menu's items.
+ * @default true
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "autosubmenudisplay",
+ {
+ value: true,
+ validator: oConfig.checkBoolean
+ }
+ );
+
+ /**
+ * @config showdelay
+ * @description Number indicating the time (in milliseconds) that should
+ * expire before a submenu is made visible when the user mouses over
+ * the menu's items.
+ * @default 0
+ * @type Number
+ */
+ oConfig.addProperty(
+ "showdelay",
+ {
+ value: 0,
+ validator: oConfig.checkNumber
+ }
+ );
+
+ /**
+ * @config hidedelay
+ * @description Number indicating the time (in milliseconds) that should
+ * expire before the menu is hidden.
+ * @default 0
+ * @type Number
+ */
+ oConfig.addProperty(
+ "hidedelay",
+ {
+ value: 0,
+ validator: oConfig.checkNumber,
+ handler: this.configHideDelay,
+ suppressEvent: true
+ }
+ );
+
+ /**
+ * @config clicktohide
+ * @description Boolean indicating if the menu will automatically be
+ * hidden if the user clicks outside of it.
+ * @default true
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "clicktohide",
+ {
+ value: true,
+ validator: oConfig.checkBoolean
+ }
+ );
+
+ /**
+ * @config container
+ * @description HTML element reference or string specifying the id
+ * attribute of the HTML element that the menu's markup should be rendered into.
+ * @type HTMLElement |String
+ * @default document.body
+ */
+ this.cfg.addProperty(
+ "container",
+ { value:document.body, handler:this.configContainer }
+ );
+
+}
+
+}); // END YAHOO.extend
+
+})();
+
+/**
+* The base class for all menuing containers.
+*
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the menu module.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source for the
+* menu module.
+* @param {HTMLDivElement } p_oElement Object
+* specifying the <div> element of the menu module.
+* @param {HTMLSelectElement } p_oElement Object
+* specifying the <select> element to be used as the data
+* source for the menu module.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu module. See configuration class documentation for
+* more details.
+* @class MenuModule
+* @constructor
+* @extends YAHOO.widget.Overlay
+* @deprecated As of version 0.12, all MenuModule functionality has been
+* implemented directly in YAHOO.widget.Menu, making YAHOO.widget.Menu the base
+* class for all menuing containers.
+*/
+YAHOO.widget.MenuModule = YAHOO.widget.Menu;
+
+(function() {
+
+var Dom = YAHOO.util.Dom;
+var Module = YAHOO.widget.Module;
+var Menu = YAHOO.widget.Menu;
+
+/**
+* Creates an item for a menu.
+*
+* @param {String} p_oObject String specifying the text of the menu item.
+* @param {HTMLLIElement } p_oObject Object specifying
+* the <li> element of the menu item.
+* @param {HTMLOptGroupElement } p_oObject Object
+* specifying the <optgroup> element of the menu item.
+* @param {HTMLOptionElement } p_oObject Object
+* specifying the <option> element of the menu item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu item. See configuration class documentation
+* for more details.
+* @class MenuItem
+* @constructor
+*/
+YAHOO.widget.MenuItem = function(p_oObject, p_oConfig) {
+
+ if(p_oObject) {
+
+ if(p_oConfig) {
+
+ this.parent = p_oConfig.parent;
+ this.value = p_oConfig.value;
+
+ }
+
+ this.init(p_oObject, p_oConfig);
+
+ }
+
+};
+
+YAHOO.widget.MenuItem.prototype = {
+
+ // Constants
+
+ /**
+ * @property SUBMENU_INDICATOR_IMAGE_PATH
+ * @description String representing the path to the image to be used for the
+ * menu item's submenu arrow indicator.
+ * @default "nt/ic/ut/alt1/menuarorght8_nrm_1.gif"
+ * @final
+ * @type String
+ */
+ SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarorght8_nrm_1.gif",
+
+ /**
+ * @property SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
+ * @description String representing the path to the image to be used for the
+ * submenu arrow indicator when the menu item is selected.
+ * @default "nt/ic/ut/alt1/menuarorght8_hov_1.gif"
+ * @final
+ * @type String
+ */
+ SELECTED_SUBMENU_INDICATOR_IMAGE_PATH:
+ "nt/ic/ut/alt1/menuarorght8_hov_1.gif",
+
+ /**
+ * @property DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
+ * @description String representing the path to the image to be used for the
+ * submenu arrow indicator when the menu item is disabled.
+ * @default "nt/ic/ut/alt1/menuarorght8_dim_1.gif"
+ * @final
+ * @type String
+ */
+ DISABLED_SUBMENU_INDICATOR_IMAGE_PATH:
+ "nt/ic/ut/alt1/menuarorght8_dim_1.gif",
+
+ /**
+ * @property COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT
+ * @description String representing the alt text for the image to be used
+ * for the submenu arrow indicator.
+ * @default "Collapsed. Click to expand."
+ * @final
+ * @type String
+ */
+ COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT: "Collapsed. Click to expand.",
+
+ /**
+ * @property EXPANDED_SUBMENU_INDICATOR_ALT_TEXT
+ * @description String representing the alt text for the image to be used
+ * for the submenu arrow indicator when the submenu is visible.
+ * @default "Expanded. Click to collapse."
+ * @final
+ * @type String
+ */
+ EXPANDED_SUBMENU_INDICATOR_ALT_TEXT: "Expanded. Click to collapse.",
+
+ /**
+ * @property DISABLED_SUBMENU_INDICATOR_ALT_TEXT
+ * @description String representing the alt text for the image to be used
+ * for the submenu arrow indicator when the menu item is disabled.
+ * @default "Disabled."
+ * @final
+ * @type String
+ */
+ DISABLED_SUBMENU_INDICATOR_ALT_TEXT: "Disabled.",
+
+ /**
+ * @property CHECKED_IMAGE_PATH
+ * @description String representing the path to the image to be used for
+ * the checked state.
+ * @default "nt/ic/ut/bsc/menuchk8_nrm_1.gif"
+ * @final
+ * @type String
+ */
+ CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_nrm_1.gif",
+
+
+ /**
+ * @property SELECTED_CHECKED_IMAGE_PATH
+ * @description String representing the path to the image to be used for
+ * the selected checked state.
+ * @default "nt/ic/ut/bsc/menuchk8_hov_1.gif"
+ * @final
+ * @type String
+ */
+ SELECTED_CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_hov_1.gif",
+
+
+ /**
+ * @property DISABLED_CHECKED_IMAGE_PATH
+ * @description String representing the path to the image to be used for
+ * the disabled checked state.
+ * @default "nt/ic/ut/bsc/menuchk8_dim_1.gif"
+ * @final
+ * @type String
+ */
+ DISABLED_CHECKED_IMAGE_PATH: "nt/ic/ut/bsc/menuchk8_dim_1.gif",
+
+
+ /**
+ * @property CHECKED_IMAGE_ALT_TEXT
+ * @description String representing the alt text for the image to be used
+ * for the checked image.
+ * @default "Checked."
+ * @final
+ * @type String
+ */
+ CHECKED_IMAGE_ALT_TEXT: "Checked.",
+
+
+ /**
+ * @property DISABLED_CHECKED_IMAGE_ALT_TEXT
+ * @description String representing the alt text for the image to be used
+ * for the checked image when the item is disabled.
+ * @default "Checked. (Item disabled.)"
+ * @final
+ * @type String
+ */
+ DISABLED_CHECKED_IMAGE_ALT_TEXT: "Checked. (Item disabled.)",
+
+ /**
+ * @property CSS_CLASS_NAME
+ * @description String representing the CSS class(es) to be applied to the
+ * <li> element of the menu item.
+ * @default "yuimenuitem"
+ * @final
+ * @type String
+ */
+ CSS_CLASS_NAME: "yuimenuitem",
+
+ /**
+ * @property SUBMENU_TYPE
+ * @description Object representing the type of menu to instantiate and
+ * add when parsing the child nodes of the menu item's source HTML element.
+ * @final
+ * @type YAHOO.widget.Menu
+ */
+ SUBMENU_TYPE: null,
+
+ /**
+ * @property IMG_ROOT
+ * @description String representing the prefix path to use for
+ * non-secure images.
+ * @default "http://us.i1.yimg.com/us.yimg.com/i/"
+ * @type String
+ */
+ IMG_ROOT: "http://us.i1.yimg.com/us.yimg.com/i/",
+
+
+ /**
+ * @property IMG_ROOT_SSL
+ * @description String representing the prefix path to use for securely
+ * served images.
+ * @default "https://a248.e.akamai.net/sec.yimg.com/i/"
+ * @type String
+ */
+ IMG_ROOT_SSL: "https://a248.e.akamai.net/sec.yimg.com/i/",
+
+ // Private member variables
+
+ /**
+ * @property _oAnchor
+ * @description Object reference to the menu item's
+ * <a> element.
+ * @default null
+ * @private
+ * @type HTMLAnchorElement
+ */
+ _oAnchor: null,
+
+
+ /**
+ * @property _oText
+ * @description Object reference to the menu item's text node.
+ * @default null
+ * @private
+ * @type TextNode
+ */
+ _oText: null,
+
+
+ /**
+ * @property _oHelpTextEM
+ * @description Object reference to the menu item's help text
+ * <em> element.
+ * @default null
+ * @private
+ * @type HTMLElement
+ */
+ _oHelpTextEM: null,
+
+
+ /**
+ * @property _oSubmenu
+ * @description Object reference to the menu item's submenu.
+ * @default null
+ * @private
+ * @type YAHOO.widget.Menu
+ */
+ _oSubmenu: null,
+
+ /**
+ * @property _checkImage
+ * @description Object reference to the menu item's checkmark image.
+ * @default null
+ * @private
+ * @type HTMLImageElement
+ */
+ _checkImage: null,
+
+ // Public properties
+
+ /**
+ * @property constructor
+ * @description Object reference to the menu item's constructor function.
+ * @default YAHOO.widget.MenuItem
+ * @type YAHOO.widget.MenuItem
+ */
+ constructor: YAHOO.widget.MenuItem,
+
+ /**
+ * @property imageRoot
+ * @description String representing the root path for all of the menu
+ * item's images.
+ * @type String
+ */
+ imageRoot: null,
+
+ /**
+ * @property isSecure
+ * @description Boolean representing whether or not the current browsing
+ * context is secure (HTTPS).
+ * @type Boolean
+ */
+ isSecure: Module.prototype.isSecure,
+
+ /**
+ * @property index
+ * @description Number indicating the ordinal position of the menu item in
+ * its group.
+ * @default null
+ * @type Number
+ */
+ index: null,
+
+ /**
+ * @property groupIndex
+ * @description Number indicating the index of the group to which the menu
+ * item belongs.
+ * @default null
+ * @type Number
+ */
+ groupIndex: null,
+
+ /**
+ * @property parent
+ * @description Object reference to the menu item's parent menu.
+ * @default null
+ * @type YAHOO.widget.Menu
+ */
+ parent: null,
+
+ /**
+ * @property element
+ * @description Object reference to the menu item's
+ * <li> element.
+ * @default HTMLLIElement
+ * @type HTMLLIElement
+ */
+ element: null,
+
+ /**
+ * @property srcElement
+ * @description Object reference to the HTML element (either
+ * <li>, <optgroup> or
+ * <option>) used create the menu item.
+ * @default HTMLLIElement |HTMLOptGroupElement |HTMLOptionElement
+ * @type HTMLLIElement |
+ * HTMLOptGroupElement |HTMLOptionElement
+ */
+ srcElement: null,
+
+ /**
+ * @property value
+ * @description Object reference to the menu item's value.
+ * @default null
+ * @type Object
+ */
+ value: null,
+
+ /**
+ * @property submenuIndicator
+ * @description Object reference to the <img> element
+ * used to create the submenu indicator for the menu item.
+ * @default HTMLImageElement
+ * @type HTMLImageElement
+ */
+ submenuIndicator: null,
+
+ /**
+ * @property browser
+ * @description String representing the browser.
+ * @type String
+ */
+ browser: Module.prototype.browser,
+
+ // Events
+
+ /**
+ * @event destroyEvent
+ * @description Fires when the menu item's <li>
+ * element is removed from its parent <ul> element.
+ * @type YAHOO.util.CustomEvent
+ */
+ destroyEvent: null,
+
+ /**
+ * @event mouseOverEvent
+ * @description Fires when the mouse has entered the menu item. Passes
+ * back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ mouseOverEvent: null,
+
+ /**
+ * @event mouseOutEvent
+ * @description Fires when the mouse has left the menu item. Passes back
+ * the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ mouseOutEvent: null,
+
+ /**
+ * @event mouseDownEvent
+ * @description Fires when the user mouses down on the menu item. Passes
+ * back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ mouseDownEvent: null,
+
+ /**
+ * @event mouseUpEvent
+ * @description Fires when the user releases a mouse button while the mouse
+ * is over the menu item. Passes back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ mouseUpEvent: null,
+
+ /**
+ * @event clickEvent
+ * @description Fires when the user clicks the on the menu item. Passes
+ * back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ clickEvent: null,
+
+ /**
+ * @event keyPressEvent
+ * @description Fires when the user presses an alphanumeric key when the
+ * menu item has focus. Passes back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ keyPressEvent: null,
+
+ /**
+ * @event keyDownEvent
+ * @description Fires when the user presses a key when the menu item has
+ * focus. Passes back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ keyDownEvent: null,
+
+ /**
+ * @event keyUpEvent
+ * @description Fires when the user releases a key when the menu item has
+ * focus. Passes back the DOM Event object as an argument.
+ * @type YAHOO.util.CustomEvent
+ */
+ keyUpEvent: null,
+
+ /**
+ * @event focusEvent
+ * @description Fires when the menu item receives focus.
+ * @type YAHOO.util.CustomEvent
+ */
+ focusEvent: null,
+
+ /**
+ * @event blurEvent
+ * @description Fires when the menu item loses the input focus.
+ * @type YAHOO.util.CustomEvent
+ */
+ blurEvent: null,
+
+ /**
+ * @method init
+ * @description The MenuItem class's initialization method. This method is
+ * automatically called by the constructor, and sets up all DOM references
+ * for pre-existing markup, and creates required markup if it is not
+ * already present.
+ * @param {String} p_oObject String specifying the text of the menu item.
+ * @param {HTMLLIElement } p_oObject Object specifying
+ * the <li> element of the menu item.
+ * @param {HTMLOptGroupElement } p_oObject Object
+ * specifying the <optgroup> element of the menu item.
+ * @param {HTMLOptionElement } p_oObject Object
+ * specifying the <option> element of the menu item.
+ * @param {Object} p_oConfig Optional. Object literal specifying the
+ * configuration for the menu item. See configuration class documentation
+ * for more details.
+ */
+ init: function(p_oObject, p_oConfig) {
+
+ this.imageRoot = (this.isSecure) ? this.IMG_ROOT_SSL : this.IMG_ROOT;
+
+ if(!this.SUBMENU_TYPE) {
+
+ this.SUBMENU_TYPE = Menu;
+
+ }
+
+ // Create the config object
+
+ this.cfg = new YAHOO.util.Config(this);
+
+ this.initDefaultConfig();
+
+ var oConfig = this.cfg;
+
+ if(this._checkString(p_oObject)) {
+
+ this._createRootNodeStructure();
+
+ oConfig.setProperty("text", p_oObject);
+
+ }
+ else if(this._checkDOMNode(p_oObject)) {
+
+ switch(p_oObject.tagName.toUpperCase()) {
+
+ case "OPTION":
+
+ this._createRootNodeStructure();
+
+ oConfig.setProperty("text", p_oObject.text);
+
+ this.srcElement = p_oObject;
+
+ break;
+
+ case "OPTGROUP":
+
+ this._createRootNodeStructure();
+
+ oConfig.setProperty("text", p_oObject.label);
+
+ this.srcElement = p_oObject;
+
+ this._initSubTree();
+
+ break;
+
+ case "LI":
+
+ // Get the anchor node (if it exists)
+
+ var oAnchor = this._getFirstElement(p_oObject, "A");
+ var sURL = "#";
+ var sTarget = null;
+ var sText = null;
+
+ // Capture the "text" and/or the "URL"
+
+ if(oAnchor) {
+
+ sURL = oAnchor.getAttribute("href");
+ sTarget = oAnchor.getAttribute("target");
+
+ if(oAnchor.innerText) {
+
+ sText = oAnchor.innerText;
+
+ }
+ else {
+
+ var oRange = oAnchor.ownerDocument.createRange();
+
+ oRange.selectNodeContents(oAnchor);
+
+ sText = oRange.toString();
+
+ }
+
+ }
+ else {
+
+ var oText = p_oObject.firstChild;
+
+ sText = oText.nodeValue;
+
+ oAnchor = document.createElement("a");
+
+ oAnchor.setAttribute("href", sURL);
+
+ p_oObject.replaceChild(oAnchor, oText);
+
+ oAnchor.appendChild(oText);
+
+ }
+
+ this.srcElement = p_oObject;
+ this.element = p_oObject;
+ this._oAnchor = oAnchor;
+
+
+ // Check if emphasis has been applied to the MenuItem
+
+ var oEmphasisNode = this._getFirstElement(oAnchor);
+ var bEmphasis = false;
+ var bStrongEmphasis = false;
+
+ if(oEmphasisNode) {
+
+ // Set a reference to the text node
+
+ this._oText = oEmphasisNode.firstChild;
+
+ switch(oEmphasisNode.tagName.toUpperCase()) {
+
+ case "EM":
+
+ bEmphasis = true;
+
+ break;
+
+ case "STRONG":
+
+ bStrongEmphasis = true;
+
+ break;
+
+ }
+
+ }
+ else {
+
+ // Set a reference to the text node
+
+ this._oText = oAnchor.firstChild;
+
+ }
+
+ /*
+ Set these properties silently to sync up the
+ configuration object without making changes to the
+ element's DOM
+ */
+
+ oConfig.setProperty("text", sText, true);
+ oConfig.setProperty("url", sURL, true);
+ oConfig.setProperty("target", sTarget, true);
+ oConfig.setProperty("emphasis", bEmphasis, true);
+ oConfig.setProperty(
+ "strongemphasis",
+ bStrongEmphasis,
+ true
+ );
+
+ this._initSubTree();
+
+ break;
+
+ }
+
+ }
+
+ if(this.element) {
+
+ Dom.addClass(this.element, this.CSS_CLASS_NAME);
+
+ // Create custom events
+
+ var CustomEvent = YAHOO.util.CustomEvent;
+
+ this.destroyEvent = new CustomEvent("destroyEvent", this);
+ this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);
+ this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);
+ this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);
+ this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);
+ this.clickEvent = new CustomEvent("clickEvent", this);
+ this.keyPressEvent = new CustomEvent("keyPressEvent", this);
+ this.keyDownEvent = new CustomEvent("keyDownEvent", this);
+ this.keyUpEvent = new CustomEvent("keyUpEvent", this);
+ this.focusEvent = new CustomEvent("focusEvent", this);
+ this.blurEvent = new CustomEvent("blurEvent", this);
+
+ if(p_oConfig) {
+
+ oConfig.applyConfig(p_oConfig);
+
+ }
+
+ oConfig.fireQueue();
+
+ }
+
+ },
+
+ // Private methods
+
+ /**
+ * @method _getFirstElement
+ * @description Returns an HTML element's first HTML element node.
+ * @private
+ * @param {HTMLElement } p_oElement Object
+ * reference specifying the element to be evaluated.
+ * @param {String} p_sTagName Optional. String specifying the tagname of
+ * the element to be retrieved.
+ * @return {HTMLElement }
+ */
+ _getFirstElement: function(p_oElement, p_sTagName) {
+
+ var oElement;
+
+ if(p_oElement.firstChild && p_oElement.firstChild.nodeType == 1) {
+
+ oElement = p_oElement.firstChild;
+
+ }
+ else if(
+ p_oElement.firstChild &&
+ p_oElement.firstChild.nextSibling &&
+ p_oElement.firstChild.nextSibling.nodeType == 1
+ ) {
+
+ oElement = p_oElement.firstChild.nextSibling;
+
+ }
+
+ if(p_sTagName) {
+
+ return (oElement && oElement.tagName.toUpperCase() == p_sTagName) ?
+ oElement : false;
+
+ }
+
+ return oElement;
+
+ },
+
+ /**
+ * @method _checkString
+ * @description Determines if an object is a string.
+ * @private
+ * @param {Object} p_oObject Object to be evaluated.
+ * @return {Boolean}
+ */
+ _checkString: function(p_oObject) {
+
+ return (typeof p_oObject == "string");
+
+ },
+
+ /**
+ * @method _checkDOMNode
+ * @description Determines if an object is an HTML element.
+ * @private
+ * @param {Object} p_oObject Object to be evaluated.
+ * @return {Boolean}
+ */
+ _checkDOMNode: function(p_oObject) {
+
+ return (p_oObject && p_oObject.tagName);
+
+ },
+
+ /**
+ * @method _createRootNodeStructure
+ * @description Creates the core DOM structure for the menu item.
+ * @private
+ */
+ _createRootNodeStructure: function () {
+
+ this.element = document.createElement("li");
+
+ this._oText = document.createTextNode("");
+
+ this._oAnchor = document.createElement("a");
+ this._oAnchor.appendChild(this._oText);
+
+ this.cfg.refireEvent("url");
+
+ this.element.appendChild(this._oAnchor);
+
+ },
+
+ /**
+ * @method _initSubTree
+ * @description Iterates the source element's childNodes collection and uses
+ * the child nodes to instantiate other menus.
+ * @private
+ */
+ _initSubTree: function() {
+
+ var oSrcEl = this.srcElement;
+ var oConfig = this.cfg;
+
+ if(oSrcEl.childNodes.length > 0) {
+
+ if(
+ this.parent.lazyLoad &&
+ this.parent.srcElement &&
+ this.parent.srcElement.tagName.toUpperCase() == "SELECT"
+ ) {
+
+ oConfig.setProperty(
+ "submenu",
+ { id: Dom.generateId(), itemdata: oSrcEl.childNodes }
+ );
+
+ }
+ else {
+
+ var oNode = oSrcEl.firstChild;
+ var aOptions = [];
+
+ do {
+
+ if(oNode && oNode.tagName) {
+
+ switch(oNode.tagName.toUpperCase()) {
+
+ case "DIV":
+
+ oConfig.setProperty("submenu", oNode);
+
+ break;
+
+ case "OPTION":
+
+ aOptions[aOptions.length] = oNode;
+
+ break;
+
+ }
+
+ }
+
+ }
+ while((oNode = oNode.nextSibling));
+
+
+ var nOptions = aOptions.length;
+
+ if(nOptions > 0) {
+
+ var oMenu = new this.SUBMENU_TYPE(Dom.generateId());
+
+ oConfig.setProperty("submenu", oMenu);
+
+ for(var n=0; n 0) {
+
+ oAnchor.setAttribute("target", sTarget);
+
+ }
+ else {
+
+ oAnchor.removeAttribute("target");
+
+ }
+
+ },
+
+ /**
+ * @method configEmphasis
+ * @description Event handler for when the "emphasis" configuration property
+ * of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configEmphasis: function(p_sType, p_aArgs, p_oItem) {
+
+ var bEmphasis = p_aArgs[0];
+ var oAnchor = this._oAnchor;
+ var oText = this._oText;
+ var oConfig = this.cfg;
+ var oEM;
+
+ if(bEmphasis && oConfig.getProperty("strongemphasis")) {
+
+ oConfig.setProperty("strongemphasis", false);
+
+ }
+
+ if(oAnchor) {
+
+ if(bEmphasis) {
+
+ oEM = document.createElement("em");
+ oEM.appendChild(oText);
+
+ oAnchor.appendChild(oEM);
+
+ }
+ else {
+
+ oEM = this._getFirstElement(oAnchor, "EM");
+
+ oAnchor.removeChild(oEM);
+ oAnchor.appendChild(oText);
+
+ }
+
+ }
+
+ },
+
+ /**
+ * @method configStrongEmphasis
+ * @description Event handler for when the "strongemphasis" configuration
+ * property of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configStrongEmphasis: function(p_sType, p_aArgs, p_oItem) {
+
+ var bStrongEmphasis = p_aArgs[0];
+ var oAnchor = this._oAnchor;
+ var oText = this._oText;
+ var oConfig = this.cfg;
+ var oStrong;
+
+ if(bStrongEmphasis && oConfig.getProperty("emphasis")) {
+
+ oConfig.setProperty("emphasis", false);
+
+ }
+
+ if(oAnchor) {
+
+ if(bStrongEmphasis) {
+
+ oStrong = document.createElement("strong");
+ oStrong.appendChild(oText);
+
+ oAnchor.appendChild(oStrong);
+
+ }
+ else {
+
+ oStrong = this._getFirstElement(oAnchor, "STRONG");
+
+ oAnchor.removeChild(oStrong);
+ oAnchor.appendChild(oText);
+
+ }
+
+ }
+
+ },
+
+ /**
+ * @method configChecked
+ * @description Event handler for when the "checked" configuration property
+ * of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configChecked: function(p_sType, p_aArgs, p_oItem) {
+
+ var bChecked = p_aArgs[0];
+ var oEl = this.element;
+ var oConfig = this.cfg;
+ var oImg;
+
+
+ if(bChecked) {
+
+ this._preloadImage(this.CHECKED_IMAGE_PATH);
+ this._preloadImage(this.SELECTED_CHECKED_IMAGE_PATH);
+ this._preloadImage(this.DISABLED_CHECKED_IMAGE_PATH);
+
+ oImg = document.createElement("img");
+ oImg.src = (this.imageRoot + this.CHECKED_IMAGE_PATH);
+ oImg.alt = this.CHECKED_IMAGE_ALT_TEXT;
+
+ var oSubmenu = this.cfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ oEl.insertBefore(oImg, oSubmenu.element);
+
+ }
+ else {
+
+ oEl.appendChild(oImg);
+
+ }
+
+ Dom.addClass([oEl, oImg], "checked");
+
+ this._checkImage = oImg;
+
+ if(oConfig.getProperty("disabled")) {
+
+ oConfig.refireEvent("disabled");
+
+ }
+
+ if(oConfig.getProperty("selected")) {
+
+ oConfig.refireEvent("selected");
+
+ }
+
+ }
+ else {
+
+ oImg = this._checkImage;
+
+ Dom.removeClass([oEl, oImg], "checked");
+
+ if(oImg) {
+
+ oEl.removeChild(oImg);
+
+ }
+
+ this._checkImage = null;
+
+ }
+
+ },
+
+ /**
+ * @method configDisabled
+ * @description Event handler for when the "disabled" configuration property
+ * of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configDisabled: function(p_sType, p_aArgs, p_oItem) {
+
+ var bDisabled = p_aArgs[0];
+ var oAnchor = this._oAnchor;
+ var aNodes = [this.element, oAnchor];
+ var oEM = this._oHelpTextEM;
+ var oConfig = this.cfg;
+ var oImg;
+ var sImgSrc;
+ var sImgAlt;
+
+ if(oEM) {
+
+ aNodes[2] = oEM;
+
+ }
+
+ if(this.cfg.getProperty("checked")) {
+
+ sImgAlt = this.CHECKED_IMAGE_ALT_TEXT;
+ sImgSrc = this.CHECKED_IMAGE_PATH;
+ oImg = this._checkImage;
+
+ if(bDisabled) {
+
+ sImgAlt = this.DISABLED_CHECKED_IMAGE_ALT_TEXT;
+ sImgSrc = this.DISABLED_CHECKED_IMAGE_PATH;
+
+ }
+
+ oImg.src = document.images[(this.imageRoot + sImgSrc)].src;
+ oImg.alt = sImgAlt;
+
+ }
+
+ oImg = this.submenuIndicator;
+
+ if(bDisabled) {
+
+ if(oConfig.getProperty("selected")) {
+
+ oConfig.setProperty("selected", false);
+
+ }
+
+ oAnchor.removeAttribute("href");
+
+ Dom.addClass(aNodes, "disabled");
+
+ sImgSrc = this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH;
+ sImgAlt = this.DISABLED_SUBMENU_INDICATOR_ALT_TEXT;
+
+ }
+ else {
+
+ oAnchor.setAttribute("href", oConfig.getProperty("url"));
+
+ Dom.removeClass(aNodes, "disabled");
+
+ sImgSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;
+ sImgAlt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
+
+ }
+
+ if(oImg) {
+
+ oImg.src = this.imageRoot + sImgSrc;
+ oImg.alt = sImgAlt;
+
+ }
+
+ },
+
+ /**
+ * @method configSelected
+ * @description Event handler for when the "selected" configuration property
+ * of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configSelected: function(p_sType, p_aArgs, p_oItem) {
+
+ if(!this.cfg.getProperty("disabled")) {
+
+ var bSelected = p_aArgs[0];
+ var oEM = this._oHelpTextEM;
+ var aNodes = [this.element, this._oAnchor];
+ var oImg = this.submenuIndicator;
+ var sImgSrc;
+
+ if(oEM) {
+
+ aNodes[aNodes.length] = oEM;
+
+ }
+
+ if(oImg) {
+
+ aNodes[aNodes.length] = oImg;
+
+ }
+
+
+ if(this.cfg.getProperty("checked")) {
+
+ sImgSrc = this.imageRoot + (bSelected ?
+ this.SELECTED_CHECKED_IMAGE_PATH : this.CHECKED_IMAGE_PATH);
+
+ this._checkImage.src = document.images[sImgSrc].src;
+
+ }
+
+ if(bSelected) {
+
+ Dom.addClass(aNodes, "selected");
+ sImgSrc = this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH;
+
+ }
+ else {
+
+ Dom.removeClass(aNodes, "selected");
+ sImgSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;
+
+ }
+
+ if(oImg) {
+
+ oImg.src = document.images[(this.imageRoot + sImgSrc)].src;
+
+ }
+
+ }
+
+ },
+
+ /**
+ * @method configSubmenu
+ * @description Event handler for when the "submenu" configuration property
+ * of the menu item changes.
+ * @param {String} p_sType String representing the name of the event that
+ * was fired.
+ * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+ * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+ * that fired the event.
+ */
+ configSubmenu: function(p_sType, p_aArgs, p_oItem) {
+
+ var oEl = this.element;
+ var oSubmenu = p_aArgs[0];
+ var oImg = this.submenuIndicator;
+ var oConfig = this.cfg;
+ var aNodes = [this.element, this._oAnchor];
+ var oMenu;
+ var bLazyLoad = this.parent && this.parent.lazyLoad;
+
+ if(oSubmenu) {
+
+ if(oSubmenu instanceof Menu) {
+
+ oMenu = oSubmenu;
+ oMenu.parent = this;
+ oMenu.lazyLoad = bLazyLoad;
+
+ }
+ else if(
+ typeof oSubmenu == "object" &&
+ oSubmenu.id &&
+ !oSubmenu.nodeType
+ ) {
+
+ var sSubmenuId = oSubmenu.id;
+ var oSubmenuConfig = oSubmenu;
+
+ delete oSubmenu["id"];
+
+ oSubmenuConfig.lazyload = bLazyLoad;
+ oSubmenuConfig.parent = this;
+
+ oMenu = new this.SUBMENU_TYPE(sSubmenuId, oSubmenuConfig);
+
+ // Set the value of the property to the Menu instance
+
+ this.cfg.setProperty("submenu", oMenu, true);
+
+ }
+ else {
+
+ oMenu = new this.SUBMENU_TYPE(
+ oSubmenu,
+ { lazyload: bLazyLoad, parent: this }
+ );
+
+ // Set the value of the property to the Menu instance
+
+ this.cfg.setProperty("submenu", oMenu, true);
+
+ }
+
+ if(oMenu) {
+
+ this._oSubmenu = oMenu;
+
+ if(!oImg) {
+
+ this._preloadImage(this.SUBMENU_INDICATOR_IMAGE_PATH);
+ this._preloadImage(
+ this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
+ );
+
+ this._preloadImage(
+ this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
+ );
+
+ oImg = document.createElement("img");
+
+ oImg.src =
+ (this.imageRoot + this.SUBMENU_INDICATOR_IMAGE_PATH);
+
+ oImg.alt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;
+
+ oEl.appendChild(oImg);
+
+ this.submenuIndicator = oImg;
+
+ Dom.addClass(aNodes, "hassubmenu");
+
+ if(oConfig.getProperty("disabled")) {
+
+ oConfig.refireEvent("disabled");
+
+ }
+
+ if(oConfig.getProperty("selected")) {
+
+ oConfig.refireEvent("selected");
+
+ }
+
+ }
+
+ }
+
+ }
+ else {
+
+ Dom.removeClass(aNodes, "hassubmenu");
+
+ if(oImg) {
+
+ oEl.removeChild(oImg);
+
+ }
+
+ if(this._oSubmenu) {
+
+ this._oSubmenu.destroy();
+
+ }
+
+ }
+
+ },
+
+ // Public methods
+
+ /**
+ * @method initDefaultConfig
+ * @description Initializes an item's configurable properties.
+ */
+ initDefaultConfig : function() {
+
+ var oConfig = this.cfg;
+ var CheckBoolean = oConfig.checkBoolean;
+
+ // Define the config properties
+
+ /**
+ * @config text
+ * @description String specifying the text label for the menu item.
+ * When building a menu from existing HTML the value of this property
+ * will be interpreted from the menu's markup.
+ * @default ""
+ * @type String
+ */
+ oConfig.addProperty(
+ "text",
+ {
+ value: "",
+ handler: this.configText,
+ validator: this._checkString,
+ suppressEvent: true
+ }
+ );
+
+
+ /**
+ * @config helptext
+ * @description String specifying additional instructional text to
+ * accompany the text for the nenu item.
+ * @default null
+ * @type String|
+ * HTMLElement
+ */
+ oConfig.addProperty("helptext", { handler: this.configHelpText });
+
+ /**
+ * @config url
+ * @description String specifying the URL for the menu item's anchor's
+ * "href" attribute. When building a menu from existing HTML the value
+ * of this property will be interpreted from the menu's markup.
+ * @default "#"
+ * @type String
+ */
+ oConfig.addProperty(
+ "url",
+ { value: "#", handler: this.configURL, suppressEvent: true }
+ );
+
+ /**
+ * @config target
+ * @description String specifying the value for the "target" attribute
+ * of the menu item's anchor element. Specifying a target will
+ * require the user to click directly on the menu item's anchor node in
+ * order to cause the browser to navigate to the specified URL.
+ * When building a menu from existing HTML the value of this property
+ * will be interpreted from the menu's markup.
+ * @default null
+ * @type String
+ */
+ oConfig.addProperty(
+ "target",
+ { handler: this.configTarget, suppressEvent: true }
+ );
+
+ /**
+ * @config emphasis
+ * @description Boolean indicating if the text of the menu item will be
+ * rendered with emphasis. When building a menu from existing HTML the
+ * value of this property will be interpreted from the menu's markup.
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "emphasis",
+ {
+ value: false,
+ handler: this.configEmphasis,
+ validator: CheckBoolean,
+ suppressEvent: true
+ }
+ );
+
+ /**
+ * @config strongemphasis
+ * @description Boolean indicating if the text of the menu item will be
+ * rendered with strong emphasis. When building a menu from existing
+ * HTML the value of this property will be interpreted from the
+ * menu's markup.
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "strongemphasis",
+ {
+ value: false,
+ handler: this.configStrongEmphasis,
+ validator: CheckBoolean,
+ suppressEvent: true
+ }
+ );
+
+ /**
+ * @config checked
+ * @description Boolean indicating if the menu item should be rendered
+ * with a checkmark.
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "checked",
+ {
+ value: false,
+ handler: this.configChecked,
+ validator: this.cfg.checkBoolean,
+ suppressEvent: true,
+ supercedes:["disabled"]
+ }
+ );
+
+ /**
+ * @config disabled
+ * @description Boolean indicating if the menu item should be disabled.
+ * (Disabled menu items are dimmed and will not respond to user input
+ * or fire events.)
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "disabled",
+ {
+ value: false,
+ handler: this.configDisabled,
+ validator: CheckBoolean,
+ suppressEvent: true
+ }
+ );
+
+ /**
+ * @config selected
+ * @description Boolean indicating if the menu item should
+ * be highlighted.
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "selected",
+ {
+ value: false,
+ handler: this.configSelected,
+ validator: CheckBoolean,
+ suppressEvent: true
+ }
+ );
+
+ /**
+ * @config submenu
+ * @description Object specifying the submenu to be appended to the
+ * menu item. The value can be one of the following: Object
+ * specifying a Menu instance. Object literal specifying the
+ * menu to be created. Format: { id: [menu id], itemdata:
+ * [array of values for
+ * items ] }. String specifying the id attribute
+ * of the <div> element of the menu.
+ * Object specifying the <div> element of the
+ * menu.
+ * @default null
+ * @type Menu|String|Object|
+ * HTMLElement
+ */
+ oConfig.addProperty("submenu", { handler: this.configSubmenu });
+
+ },
+
+ /**
+ * @method getNextEnabledSibling
+ * @description Finds the menu item's next enabled sibling.
+ * @return YAHOO.widget.MenuItem
+ */
+ getNextEnabledSibling: function() {
+
+ if(this.parent instanceof Menu) {
+
+ var nGroupIndex = this.groupIndex;
+
+ /**
+ * Finds the next item in an array.
+ * @private
+ * @param {p_aArray} Array to search.
+ * @param {p_nStartIndex} Number indicating the index to
+ * start searching the array.
+ * @return {Object}
+ */
+ var getNextArrayItem = function(p_aArray, p_nStartIndex) {
+
+ return p_aArray[p_nStartIndex] ||
+ getNextArrayItem(p_aArray, (p_nStartIndex+1));
+
+ };
+
+
+ var aItemGroups = this.parent.getItemGroups();
+ var oNextItem;
+
+
+ if(this.index < (aItemGroups[nGroupIndex].length - 1)) {
+
+ oNextItem = getNextArrayItem(
+ aItemGroups[nGroupIndex],
+ (this.index+1)
+ );
+
+ }
+ else {
+
+ var nNextGroupIndex;
+
+ if(nGroupIndex < (aItemGroups.length - 1)) {
+
+ nNextGroupIndex = nGroupIndex + 1;
+
+ }
+ else {
+
+ nNextGroupIndex = 0;
+
+ }
+
+ var aNextGroup = getNextArrayItem(aItemGroups, nNextGroupIndex);
+
+ // Retrieve the first menu item in the next group
+
+ oNextItem = getNextArrayItem(aNextGroup, 0);
+
+ }
+
+ return (
+ oNextItem.cfg.getProperty("disabled") ||
+ oNextItem.element.style.display == "none"
+ ) ?
+ oNextItem.getNextEnabledSibling() : oNextItem;
+
+ }
+
+ },
+
+ /**
+ * @method getPreviousEnabledSibling
+ * @description Finds the menu item's previous enabled sibling.
+ * @return {YAHOO.widget.MenuItem}
+ */
+ getPreviousEnabledSibling: function() {
+
+ if(this.parent instanceof Menu) {
+
+ var nGroupIndex = this.groupIndex;
+
+ /**
+ * Returns the previous item in an array
+ * @private
+ * @param {p_aArray} Array to search.
+ * @param {p_nStartIndex} Number indicating the index to
+ * start searching the array.
+ * @return {Object}
+ */
+ var getPreviousArrayItem = function(p_aArray, p_nStartIndex) {
+
+ return p_aArray[p_nStartIndex] ||
+ getPreviousArrayItem(p_aArray, (p_nStartIndex-1));
+
+ };
+
+ /**
+ * Get the index of the first item in an array
+ * @private
+ * @param {p_aArray} Array to search.
+ * @param {p_nStartIndex} Number indicating the index to
+ * start searching the array.
+ * @return {Object}
+ */
+ var getFirstItemIndex = function(p_aArray, p_nStartIndex) {
+
+ return p_aArray[p_nStartIndex] ?
+ p_nStartIndex :
+ getFirstItemIndex(p_aArray, (p_nStartIndex+1));
+
+ };
+
+ var aItemGroups = this.parent.getItemGroups();
+ var oPreviousItem;
+
+ if(
+ this.index > getFirstItemIndex(aItemGroups[nGroupIndex], 0)
+ ) {
+
+ oPreviousItem =
+ getPreviousArrayItem(
+ aItemGroups[nGroupIndex],
+ (this.index-1)
+ );
+
+ }
+ else {
+
+ var nPreviousGroupIndex;
+
+ if(nGroupIndex > getFirstItemIndex(aItemGroups, 0)) {
+
+ nPreviousGroupIndex = nGroupIndex - 1;
+
+ }
+ else {
+
+ nPreviousGroupIndex = aItemGroups.length - 1;
+
+ }
+
+ var aPreviousGroup =
+ getPreviousArrayItem(aItemGroups, nPreviousGroupIndex);
+
+ oPreviousItem =
+ getPreviousArrayItem(
+ aPreviousGroup,
+ (aPreviousGroup.length - 1)
+ );
+
+ }
+
+ return (
+ oPreviousItem.cfg.getProperty("disabled") ||
+ oPreviousItem.element.style.display == "none"
+ ) ?
+ oPreviousItem.getPreviousEnabledSibling() : oPreviousItem;
+
+ }
+
+ },
+
+ /**
+ * @method focus
+ * @description Causes the menu item to receive the focus and fires the
+ * focus event.
+ */
+ focus: function() {
+
+ var oParent = this.parent;
+ var oAnchor = this._oAnchor;
+ var oActiveItem = oParent.activeItem;
+
+ if(
+ !this.cfg.getProperty("disabled") &&
+ oParent &&
+ oParent.cfg.getProperty("visible") &&
+ this.element.style.display != "none"
+ ) {
+
+ if(oActiveItem) {
+
+ oActiveItem.blur();
+
+ }
+
+ try {
+
+ oAnchor.focus();
+
+ }
+ catch(e) {
+
+ }
+
+ this.focusEvent.fire();
+
+ }
+
+ },
+
+ /**
+ * @method blur
+ * @description Causes the menu item to lose focus and fires the
+ * onblur event.
+ */
+ blur: function() {
+
+ var oParent = this.parent;
+
+ if(
+ !this.cfg.getProperty("disabled") &&
+ oParent &&
+ Dom.getStyle(oParent.element, "visibility") == "visible"
+ ) {
+
+ this._oAnchor.blur();
+
+ this.blurEvent.fire();
+
+ }
+
+ },
+
+ /**
+ * @method destroy
+ * @description Removes the menu item's <li> element
+ * from its parent <ul> element.
+ */
+ destroy: function() {
+
+ var oEl = this.element;
+
+ if(oEl) {
+
+ // Remove CustomEvent listeners
+
+ this.mouseOverEvent.unsubscribeAll();
+ this.mouseOutEvent.unsubscribeAll();
+ this.mouseDownEvent.unsubscribeAll();
+ this.mouseUpEvent.unsubscribeAll();
+ this.clickEvent.unsubscribeAll();
+ this.keyPressEvent.unsubscribeAll();
+ this.keyDownEvent.unsubscribeAll();
+ this.keyUpEvent.unsubscribeAll();
+ this.focusEvent.unsubscribeAll();
+ this.blurEvent.unsubscribeAll();
+ this.cfg.configChangedEvent.unsubscribeAll();
+
+ // Remove the element from the parent node
+
+ var oParentNode = oEl.parentNode;
+
+ if(oParentNode) {
+
+ oParentNode.removeChild(oEl);
+
+ this.destroyEvent.fire();
+
+ }
+
+ this.destroyEvent.unsubscribeAll();
+
+ }
+
+ },
+
+ /**
+ * @method toString
+ * @description Returns a string representing the menu item.
+ * @return {String}
+ */
+ toString: function() {
+
+ return ("MenuItem: " + this.cfg.getProperty("text"));
+
+ }
+
+};
+
+})();
+
+/**
+* Creates an item for a menu module.
+*
+* @param {String} p_oObject String specifying the text of the menu module item.
+* @param {HTMLLIElement } p_oObject Object specifying the
+* <li> element of the menu module item.
+* @param {HTMLOptGroupElement } p_oObject Object specifying
+* the <optgroup> element of the menu module item.
+* @param {HTMLOptionElement } p_oObject Object specifying the
+* <option> element of the menu module item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu module item. See configuration class documentation
+* for more details.
+* @class MenuModuleItem
+* @constructor
+* @deprecated As of version 0.12, all MenuModuleItem functionality has been
+* implemented directly in YAHOO.widget.MenuItem, making YAHOO.widget.MenuItem
+* the base class for all menu items.
+*/
+YAHOO.widget.MenuModuleItem = YAHOO.widget.MenuItem;
+
+/**
+* Creates a list of options or commands which are made visible in response to
+* an HTML element's "contextmenu" event ("mousedown" for Opera).
+*
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the context menu.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source for the
+* context menu.
+* @param {HTMLDivElement } p_oElement Object specifying the
+* <div> element of the context menu.
+* @param {HTMLSelectElement } p_oElement Object specifying
+* the <select> element to be used as the data source for
+* the context menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the context menu. See configuration class documentation
+* for more details.
+* @class ContextMenu
+* @constructor
+* @extends YAHOO.widget.Menu
+* @namespace YAHOO.widget
+*/
+YAHOO.widget.ContextMenu = function(p_oElement, p_oConfig) {
+
+ YAHOO.widget.ContextMenu.superclass.constructor.call(
+ this,
+ p_oElement,
+ p_oConfig
+ );
+
+};
+
+YAHOO.extend(YAHOO.widget.ContextMenu, YAHOO.widget.Menu, {
+
+// Private properties
+
+/**
+* @property _oTrigger
+* @description Object reference to the current value of the "trigger"
+* configuration property.
+* @default null
+* @private
+* @type String|HTMLElement |Array
+*/
+_oTrigger: null,
+
+// Public properties
+
+/**
+* @property contextEventTarget
+* @description Object reference for the HTML element that was the target of the
+* "contextmenu" DOM event ("mousedown" for Opera) that triggered the display of
+* the context menu.
+* @default null
+* @type HTMLElement
+*/
+contextEventTarget: null,
+
+/**
+* @method init
+* @description The ContextMenu class's initialization method. This method is
+* automatically called by the constructor, and sets up all DOM references for
+* pre-existing markup, and creates required markup if it is not already present.
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the context menu.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source for
+* the context menu.
+* @param {HTMLDivElement } p_oElement Object specifying the
+* <div> element of the context menu.
+* @param {HTMLSelectElement } p_oElement Object specifying
+* the <select> element to be used as the data source for
+* the context menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the context menu. See configuration class documentation
+* for more details.
+*/
+init: function(p_oElement, p_oConfig) {
+
+ if(!this.ITEM_TYPE) {
+
+ this.ITEM_TYPE = YAHOO.widget.ContextMenuItem;
+
+ }
+
+ // Call the init of the superclass (YAHOO.widget.Menu)
+
+ YAHOO.widget.ContextMenu.superclass.init.call(this, p_oElement);
+
+ this.beforeInitEvent.fire(YAHOO.widget.ContextMenu);
+
+ if(p_oConfig) {
+
+ this.cfg.applyConfig(p_oConfig, true);
+
+ }
+
+
+ this.initEvent.fire(YAHOO.widget.ContextMenu);
+
+},
+
+// Private methods
+
+/**
+* @method _removeEventHandlers
+* @description Removes all of the DOM event handlers from the HTML element(s)
+* whose "context menu" event ("click" for Opera) trigger the display of
+* the context menu.
+* @private
+*/
+_removeEventHandlers: function() {
+
+ var Event = YAHOO.util.Event;
+ var oTrigger = this._oTrigger;
+ var bOpera = (this.browser == "opera");
+
+ // Remove the event handlers from the trigger(s)
+
+ Event.removeListener(
+ oTrigger,
+ (bOpera ? "mousedown" : "contextmenu"),
+ this._onTriggerContextMenu
+ );
+
+ if(bOpera) {
+
+ Event.removeListener(oTrigger, "click", this._onTriggerClick);
+
+ }
+
+},
+
+// Private event handlers
+
+/**
+* @method _onTriggerClick
+* @description "click" event handler for the HTML element(s) identified as the
+* "trigger" for the context menu. Used to cancel default behaviors in Opera.
+* @private
+* @param {Event} p_oEvent Object representing the DOM event object passed back
+* by the event utility (YAHOO.util.Event).
+* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
+* menu that is handling the event.
+*/
+_onTriggerClick: function(p_oEvent, p_oMenu) {
+
+ if(p_oEvent.ctrlKey) {
+
+ YAHOO.util.Event.stopEvent(p_oEvent);
+
+ }
+
+},
+
+/**
+* @method _onTriggerContextMenu
+* @description "contextmenu" event handler ("mousedown" for Opera) for the HTML
+* element(s) that trigger the display of the context menu.
+* @private
+* @param {Event} p_oEvent Object representing the DOM event object passed back
+* by the event utility (YAHOO.util.Event).
+* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
+* menu that is handling the event.
+*/
+_onTriggerContextMenu: function(p_oEvent, p_oMenu) {
+
+ // Hide any other ContextMenu instances that might be visible
+
+ YAHOO.widget.MenuManager.hideVisible();
+
+ var Event = YAHOO.util.Event;
+ var oConfig = this.cfg;
+
+ if(p_oEvent.type == "mousedown" && !p_oEvent.ctrlKey) {
+
+ return;
+
+ }
+
+ this.contextEventTarget = Event.getTarget(p_oEvent);
+
+ // Position and display the context menu
+
+ var nX = Event.getPageX(p_oEvent);
+ var nY = Event.getPageY(p_oEvent);
+
+ oConfig.applyConfig( { xy:[nX, nY], visible:true } );
+ oConfig.fireQueue();
+
+ /*
+ Prevent the browser's default context menu from appearing and
+ stop the propagation of the "contextmenu" event so that
+ other ContextMenu instances are not displayed.
+ */
+
+ Event.stopEvent(p_oEvent);
+
+},
+
+// Public methods
+
+/**
+* @method toString
+* @description Returns a string representing the context menu.
+* @return {String}
+*/
+toString: function() {
+
+ return ("ContextMenu " + this.id);
+
+},
+
+/**
+* @method initDefaultConfig
+* @description Initializes the class's configurable properties which can be
+* changed using the context menu's Config object ("cfg").
+*/
+initDefaultConfig: function() {
+
+ YAHOO.widget.ContextMenu.superclass.initDefaultConfig.call(this);
+
+ /**
+ * @config trigger
+ * @description The HTML element(s) whose "contextmenu" event ("mousedown"
+ * for Opera) trigger the display of the context menu. Can be a string
+ * representing the id attribute of the HTML element, an object reference
+ * for the HTML element, or an array of strings or HTML element references.
+ * @default null
+ * @type String|HTMLElement |Array
+ */
+ this.cfg.addProperty("trigger", { handler: this.configTrigger });
+
+},
+
+/**
+* @method destroy
+* @description Removes the context menu's <div> element
+* (and accompanying child nodes) from the document.
+*/
+destroy: function() {
+
+ // Remove the DOM event handlers from the current trigger(s)
+
+ this._removeEventHandlers();
+
+
+ // Continue with the superclass implementation of this method
+
+ YAHOO.widget.ContextMenu.superclass.destroy.call(this);
+
+},
+
+// Public event handlers for configuration properties
+
+/**
+* @method configTrigger
+* @description Event handler for when the value of the "trigger" configuration
+* property changes.
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context
+* menu that fired the event.
+*/
+configTrigger: function(p_sType, p_aArgs, p_oMenu) {
+
+ var Event = YAHOO.util.Event;
+ var oTrigger = p_aArgs[0];
+
+ if(oTrigger) {
+
+ /*
+ If there is a current "trigger" - remove the event handlers
+ from that element(s) before assigning new ones
+ */
+
+ if(this._oTrigger) {
+
+ this._removeEventHandlers();
+
+ }
+
+ this._oTrigger = oTrigger;
+
+ /*
+ Listen for the "mousedown" event in Opera b/c it does not
+ support the "contextmenu" event
+ */
+
+ var bOpera = (this.browser == "opera");
+
+ Event.addListener(
+ oTrigger,
+ (bOpera ? "mousedown" : "contextmenu"),
+ this._onTriggerContextMenu,
+ this,
+ true
+ );
+
+ /*
+ Assign a "click" event handler to the trigger element(s) for
+ Opera to prevent default browser behaviors.
+ */
+
+ if(bOpera) {
+
+ Event.addListener(
+ oTrigger,
+ "click",
+ this._onTriggerClick,
+ this,
+ true
+ );
+
+ }
+
+ }
+ else {
+
+ this._removeEventHandlers();
+
+ }
+
+}
+
+}); // END YAHOO.extend
+
+/**
+* Creates an item for a context menu.
+*
+* @param {String} p_oObject String specifying the text of the context menu item.
+* @param {HTMLLIElement } p_oObject Object specifying the
+* <li> element of the context menu item.
+* @param {HTMLOptGroupElement } p_oObject Object
+* specifying the <optgroup> element of the context
+* menu item.
+* @param {HTMLOptionElement } p_oObject Object specifying
+* the <option> element of the context menu item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the context menu item. See configuration class
+* documentation for more details.
+* @class ContextMenuItem
+* @constructor
+* @extends YAHOO.widget.MenuItem
+*/
+YAHOO.widget.ContextMenuItem = function(p_oObject, p_oConfig) {
+
+ YAHOO.widget.ContextMenuItem.superclass.constructor.call(
+ this,
+ p_oObject,
+ p_oConfig
+ );
+
+};
+
+YAHOO.extend(YAHOO.widget.ContextMenuItem, YAHOO.widget.MenuItem, {
+
+/**
+* @method init
+* @description The ContextMenuItem class's initialization method. This method
+* is automatically called by the constructor, and sets up all DOM references
+* for pre-existing markup, and creates required markup if it is not
+* already present.
+* @param {String} p_oObject String specifying the text of the context menu item.
+* @param {HTMLLIElement } p_oObject Object specifying the
+* <li> element of the context menu item.
+* @param {HTMLOptGroupElement } p_oObject Object
+* specifying the <optgroup> element of the context
+* menu item.
+* @param {HTMLOptionElement } p_oObject Object specifying
+* the <option> element of the context menu item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the context menu item. See configuration class
+* documentation for more details.
+*/
+init: function(p_oObject, p_oConfig) {
+
+ if(!this.SUBMENU_TYPE) {
+
+ this.SUBMENU_TYPE = YAHOO.widget.ContextMenu;
+
+ }
+
+ /*
+ Call the init of the superclass (YAHOO.widget.MenuItem)
+ Note: We don't pass the user config in here yet
+ because we only want it executed once, at the lowest
+ subclass level.
+ */
+
+ YAHOO.widget.ContextMenuItem.superclass.init.call(this, p_oObject);
+
+ var oConfig = this.cfg;
+
+ if(p_oConfig) {
+
+ oConfig.applyConfig(p_oConfig, true);
+
+ }
+
+ oConfig.fireQueue();
+
+},
+
+// Public methods
+
+/**
+* @method toString
+* @description Returns a string representing the context menu item.
+* @return {String}
+*/
+toString: function() {
+
+ return ("MenuBarItem: " + this.cfg.getProperty("text"));
+
+}
+
+}); // END YAHOO.extend
+
+/**
+* Horizontal collection of items, each of which can contain a submenu.
+*
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the menu bar.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source for the
+* menu bar.
+* @param {HTMLDivElement } p_oElement Object specifying
+* the <div> element of the menu bar.
+* @param {HTMLSelectElement } p_oElement Object
+* specifying the <select> element to be used as the data
+* source for the menu bar.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu bar. See configuration class documentation for
+* more details.
+* @class Menubar
+* @constructor
+* @extends YAHOO.widget.Menu
+* @namespace YAHOO.widget
+*/
+YAHOO.widget.MenuBar = function(p_oElement, p_oConfig) {
+
+ YAHOO.widget.MenuBar.superclass.constructor.call(
+ this,
+ p_oElement,
+ p_oConfig
+ );
+
+};
+
+YAHOO.extend(YAHOO.widget.MenuBar, YAHOO.widget.Menu, {
+
+/**
+* @method init
+* @description The MenuBar class's initialization method. This method is
+* automatically called by the constructor, and sets up all DOM references for
+* pre-existing markup, and creates required markup if it is not already present.
+* @param {String} p_oElement String specifying the id attribute of the
+* <div> element of the menu bar.
+* @param {String} p_oElement String specifying the id attribute of the
+* <select> element to be used as the data source for the
+* menu bar.
+* @param {HTMLDivElement } p_oElement Object specifying
+* the <div> element of the menu bar.
+* @param {HTMLSelectElement } p_oElement Object
+* specifying the <select> element to be used as the data
+* source for the menu bar.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu bar. See configuration class documentation for
+* more details.
+*/
+init: function(p_oElement, p_oConfig) {
+
+ if(!this.ITEM_TYPE) {
+
+ this.ITEM_TYPE = YAHOO.widget.MenuBarItem;
+
+ }
+
+ // Call the init of the superclass (YAHOO.widget.Menu)
+
+ YAHOO.widget.MenuBar.superclass.init.call(this, p_oElement);
+
+ this.beforeInitEvent.fire(YAHOO.widget.MenuBar);
+
+ if(p_oConfig) {
+
+ this.cfg.applyConfig(p_oConfig, true);
+
+ }
+
+ this.initEvent.fire(YAHOO.widget.MenuBar);
+
+},
+
+// Constants
+
+/**
+* @property CSS_CLASS_NAME
+* @description String representing the CSS class(es) to be applied to the menu
+* bar's <div> element.
+* @default "yuimenubar"
+* @final
+* @type String
+*/
+CSS_CLASS_NAME: "yuimenubar",
+
+// Protected event handlers
+
+/**
+* @method _onKeyDown
+* @description "keydown" Custom Event handler for the menu bar.
+* @private
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.MenuBar} p_oMenuBar Object representing the menu bar
+* that fired the event.
+*/
+_onKeyDown: function(p_sType, p_aArgs, p_oMenuBar) {
+
+ var Event = YAHOO.util.Event;
+ var oEvent = p_aArgs[0];
+ var oItem = p_aArgs[1];
+ var oItemCfg = oItem.cfg;
+ var oSubmenu;
+
+ switch(oEvent.keyCode) {
+
+ case 27: // Esc key
+
+ if(this.cfg.getProperty("position") == "dynamic") {
+
+ this.hide();
+
+ if(this.parent) {
+
+ this.parent.focus();
+
+ }
+
+ }
+ else if(this.activeItem) {
+
+ oSubmenu = this.activeItem.cfg.getProperty("submenu");
+
+ if(oSubmenu && oSubmenu.cfg.getProperty("visible")) {
+
+ oSubmenu.hide();
+ this.activeItem.focus();
+
+ }
+ else {
+
+ this.activeItem.cfg.setProperty("selected", false);
+ this.activeItem.blur();
+
+ }
+
+ }
+
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+ case 37: // Left arrow
+ case 39: // Right arrow
+
+ if(
+ oItem == this.activeItem &&
+ !oItemCfg.getProperty("selected")
+ ) {
+
+ oItemCfg.setProperty("selected", true);
+
+ }
+ else {
+
+ var oNextItem = (oEvent.keyCode == 37) ?
+ oItem.getPreviousEnabledSibling() :
+ oItem.getNextEnabledSibling();
+
+ if(oNextItem) {
+
+ this.clearActiveItem();
+
+ oNextItem.cfg.setProperty("selected", true);
+
+ if(this.cfg.getProperty("autosubmenudisplay")) {
+
+ oSubmenu = oNextItem.cfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ oSubmenu.show();
+ oSubmenu.activeItem.blur();
+ oSubmenu.activeItem = null;
+
+ }
+
+ }
+
+ oNextItem.focus();
+
+ }
+
+ }
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+ case 40: // Down arrow
+
+ if(this.activeItem != oItem) {
+
+ this.clearActiveItem();
+
+ oItemCfg.setProperty("selected", true);
+ oItem.focus();
+
+ }
+
+ oSubmenu = oItemCfg.getProperty("submenu");
+
+ if(oSubmenu) {
+
+ if(oSubmenu.cfg.getProperty("visible")) {
+
+ oSubmenu.setInitialSelection();
+ oSubmenu.setInitialFocus();
+
+ }
+ else {
+
+ oSubmenu.show();
+
+ }
+
+ }
+
+ Event.preventDefault(oEvent);
+
+ break;
+
+ }
+
+},
+
+/**
+* @method _onClick
+* @description "click" event handler for the menu bar.
+* @protected
+* @param {String} p_sType String representing the name of the event that
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.MenuBar} p_oMenuBar Object representing the menu bar
+* that fired the event.
+*/
+_onClick: function(p_sType, p_aArgs, p_oMenuBar) {
+
+ YAHOO.widget.MenuBar.superclass._onClick.call(
+ this,
+ p_sType,
+ p_aArgs,
+ p_oMenuBar
+ );
+
+ var oItem = p_aArgs[1];
+
+ if(oItem) {
+
+ var Event = YAHOO.util.Event;
+ var Dom = YAHOO.util.Dom;
+
+ var oEvent = p_aArgs[0];
+ var oTarget = Event.getTarget(oEvent);
+
+ var oActiveItem = this.activeItem;
+ var oConfig = this.cfg;
+
+ // Hide any other submenus that might be visible
+
+ if(oActiveItem && oActiveItem != oItem) {
+
+ this.clearActiveItem();
+
+ }
+
+
+ // Select and focus the current item
+
+ oItem.cfg.setProperty("selected", true);
+ oItem.focus();
+
+
+ // Show the submenu for the item
+
+ var oSubmenu = oItem.cfg.getProperty("submenu");
+
+ if(oSubmenu && oTarget != oItem.submenuIndicator) {
+
+ if(oSubmenu.cfg.getProperty("visible")) {
+
+ oSubmenu.hide();
+
+ }
+ else {
+
+ oSubmenu.show();
+
+ }
+
+ }
+
+ }
+
+},
+
+// Public methods
+
+/**
+* @method toString
+* @description Returns a string representing the menu bar.
+* @return {String}
+*/
+toString: function() {
+
+ return ("MenuBar " + this.id);
+
+},
+
+/**
+* @description Initializes the class's configurable properties which can be
+* changed using the menu bar's Config object ("cfg").
+* @method initDefaultConfig
+*/
+initDefaultConfig: function() {
+
+ YAHOO.widget.MenuBar.superclass.initDefaultConfig.call(this);
+
+ var oConfig = this.cfg;
+
+ // Add configuration properties
+
+ /*
+ Set the default value for the "position" configuration property
+ to "static" by re-adding the property.
+ */
+
+ /**
+ * @config position
+ * @description String indicating how a menu bar should be positioned on the
+ * screen. Possible values are "static" and "dynamic." Static menu bars
+ * are visible by default and reside in the normal flow of the document
+ * (CSS position: static). Dynamic menu bars are hidden by default, reside
+ * out of the normal flow of the document (CSS position: absolute), and can
+ * overlay other elements on the screen.
+ * @default static
+ * @type String
+ */
+ oConfig.addProperty(
+ "position",
+ {
+ value: "static",
+ handler: this.configPosition,
+ validator: this._checkPosition,
+ supercedes: ["visible"]
+ }
+ );
+
+ /*
+ Set the default value for the "submenualignment" configuration property
+ to ["tl","bl"] by re-adding the property.
+ */
+
+ /**
+ * @config submenualignment
+ * @description Array defining how submenus should be aligned to their
+ * parent menu bar item. The format is: [itemCorner, submenuCorner].
+ * @default ["tl","bl"]
+ * @type Array
+ */
+ oConfig.addProperty("submenualignment", { value: ["tl","bl"] } );
+
+ /*
+ Change the default value for the "autosubmenudisplay" configuration
+ property to "false" by re-adding the property.
+ */
+
+ /**
+ * @config autosubmenudisplay
+ * @description Boolean indicating if submenus are automatically made
+ * visible when the user mouses over the menu bar's items.
+ * @default false
+ * @type Boolean
+ */
+ oConfig.addProperty(
+ "autosubmenudisplay",
+ { value: false, validator: oConfig.checkBoolean }
+ );
+
+}
+
+}); // END YAHOO.extend
+
+/**
+* Creates an item for a menu bar.
+*
+* @param {String} p_oObject String specifying the text of the menu bar item.
+* @param {HTMLLIElement } p_oObject Object specifying the
+* <li> element of the menu bar item.
+* @param {HTMLOptGroupElement } p_oObject Object
+* specifying the <optgroup> element of the menu bar item.
+* @param {HTMLOptionElement } p_oObject Object specifying
+* the <option> element of the menu bar item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu bar item. See configuration class documentation
+* for more details.
+* @class MenuBarItem
+* @constructor
+* @extends YAHOO.widget.MenuItem
+*/
+YAHOO.widget.MenuBarItem = function(p_oObject, p_oConfig) {
+
+ YAHOO.widget.MenuBarItem.superclass.constructor.call(
+ this,
+ p_oObject,
+ p_oConfig
+ );
+
+};
+
+YAHOO.extend(YAHOO.widget.MenuBarItem, YAHOO.widget.MenuItem, {
+
+/**
+* @method init
+* @description The MenuBarItem class's initialization method. This method is
+* automatically called by the constructor, and sets up all DOM references for
+* pre-existing markup, and creates required markup if it is not already present.
+* @param {String} p_oObject String specifying the text of the menu bar item.
+* @param {HTMLLIElement } p_oObject Object specifying the
+* <li> element of the menu bar item.
+* @param {HTMLOptGroupElement } p_oObject Object
+* specifying the <optgroup> element of the menu bar item.
+* @param {HTMLOptionElement } p_oObject Object specifying
+* the <option> element of the menu bar item.
+* @param {Object} p_oConfig Optional. Object literal specifying the
+* configuration for the menu bar item. See configuration class documentation
+* for more details.
+*/
+init: function(p_oObject, p_oConfig) {
+
+ if(!this.SUBMENU_TYPE) {
+
+ this.SUBMENU_TYPE = YAHOO.widget.Menu;
+
+ }
+
+ /*
+ Call the init of the superclass (YAHOO.widget.MenuItem)
+ Note: We don't pass the user config in here yet
+ because we only want it executed once, at the lowest
+ subclass level.
+ */
+
+ YAHOO.widget.MenuBarItem.superclass.init.call(this, p_oObject);
+
+ var oConfig = this.cfg;
+
+ if(p_oConfig) {
+
+ oConfig.applyConfig(p_oConfig, true);
+
+ }
+
+ oConfig.fireQueue();
+
+},
+
+// Constants
+
+/**
+* @property CSS_CLASS_NAME
+* @description String representing the CSS class(es) to be applied to the
+* <li> element of the menu bar item.
+* @default "yuimenubaritem"
+* @final
+* @type String
+*/
+CSS_CLASS_NAME: "yuimenubaritem",
+
+/**
+* @property SUBMENU_INDICATOR_IMAGE_PATH
+* @description String representing the path to the image to be used for the
+* menu bar item's submenu arrow indicator.
+* @default "nt/ic/ut/alt1/menuarodwn8_nrm_1.gif"
+* @final
+* @type String
+*/
+SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_nrm_1.gif",
+
+/**
+* @property SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
+* @description String representing the path to the image to be used for the
+* submenu arrow indicator when the menu bar item is selected.
+* @default "nt/ic/ut/alt1/menuarodwn8_hov_1.gif"
+* @final
+* @type String
+*/
+SELECTED_SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_hov_1.gif",
+
+/**
+* @property DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
+* @description String representing the path to the image to be used for the
+* submenu arrow indicator when the menu bar item is disabled.
+* @default "nt/ic/ut/alt1/menuarodwn8_dim_1.gif"
+* @final
+* @type String
+*/
+DISABLED_SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarodwn8_dim_1.gif",
+
+// Public methods
+
+/**
+* @method toString
+* @description Returns a string representing the menu bar item.
+* @return {String}
+*/
+toString: function() {
+
+ return ("MenuBarItem: " + this.cfg.getProperty("text"));
+
+}
+
}); // END YAHOO.extend
\ No newline at end of file
diff --git a/thirdpartyjs/yui/reset-fonts-grids/README b/thirdpartyjs/yui/reset-fonts-grids/README
index d8e7eeb..af70695 100644
--- a/thirdpartyjs/yui/reset-fonts-grids/README
+++ b/thirdpartyjs/yui/reset-fonts-grids/README
@@ -1,8 +1,8 @@
-YUI Library - Reset+Fonts+Grids (RFG) - Release Notes
-
-Version 0.12.0
-
- * Initial release.
-
- * This file is a convenience file containing an in-order
+YUI Library - Reset+Fonts+Grids (RFG) - Release Notes
+
+Version 0.12.0
+
+ * Initial release.
+
+ * This file is a convenience file containing an in-order
concatenation of Reset, Fonts, and Grids.
\ No newline at end of file
diff --git a/thirdpartyjs/yui/reset-fonts-grids/reset-fonts-grids-min.css b/thirdpartyjs/yui/reset-fonts-grids/reset-fonts-grids-min.css
index bf76e56..3ea97ae 100644
--- a/thirdpartyjs/yui/reset-fonts-grids/reset-fonts-grids-min.css
+++ b/thirdpartyjs/yui/reset-fonts-grids/reset-fonts-grids-min.css
@@ -1,4 +1,4 @@
-/*Copyright (c) 2006,Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.0 */
-/*reset.css*/body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;}
-/*fonts.css*/body{font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;}
+/*Copyright (c) 2006,Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.12.0 */
+/*reset.css*/body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;}
+/*fonts.css*/body{font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;}
/*grids.css*/body{text-align:center;}#ft{clear:both;}#doc,#doc2,#doc3,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7{margin:auto;text-align:left;width:57.69em;*width:56.3em;min-width:750px;}#doc2{width:73.074em;*width:71.313em;min-width:950px;}#doc3{margin:auto 10px;width:auto;}.yui-b{position:relative;}.yui-b{_position:static;}#yui-main .yui-b{position:static;}#yui-main{width:100%;}.yui-t1 #yui-main,.yui-t2 #yui-main,.yui-t3 #yui-main{float:right;margin-left:-25em;}.yui-t4 #yui-main,.yui-t5 #yui-main,.yui-t6 #yui-main{float:left;margin-right:-25em;}.yui-t1 .yui-b{float:left;width:12.3207em;*width:12.0106em;}.yui-t1 #yui-main .yui-b{margin-left:13.3207em;*margin-left:13.0106em;}.yui-t2 .yui-b{float:left;width:13.8456em;*width:13.512em;}.yui-t2 #yui-main .yui-b{margin-left:14.8456em;*margin-left:14.512em;}.yui-t3 .yui-b{float:left;width:23.0759em;*width:22.52em;}.yui-t3 #yui-main .yui-b{margin-left:24.0759em;*margin-left:23.52em;}.yui-t4 .yui-b{float:right;width:13.8456em;*width:13.512em;}.yui-t4 #yui-main .yui-b{margin-right:14.8456em;*margin-right:14.512em;}.yui-t5 .yui-b{float:right;width:18.4608em;*width:18.016em;}.yui-t5 #yui-main .yui-b{margin-right:19.4608em;*margin-right:19.016em;}.yui-t6 .yui-b{float:right;width:23.0759em;*width:22.52em;}.yui-t6 #yui-main .yui-b{margin-right:24.0759em;*margin-right:23.52em;}.yui-t7 #yui-main .yui-b{display:block;margin:0 0 1em 0;}#yui-main .yui-b{float:none;width:auto;}.yui-g .yui-u,.yui-g .yui-g,.yui-gc .yui-u,.yui-gc .yui-g .yui-u,.yui-ge .yui-u,.yui-gf .yui-u{float:right;display:inline;}.yui-g div.first,.yui-gc div.first,.yui-gc div.first div.first,.yui-gd div.first,.yui-ge div.first,.yui-gf div.first{float:left;}.yui-g .yui-u,.yui-g .yui-g{width:49.1%;}.yui-g .yui-g .yui-u,.yui-gc .yui-g .yui-u{width:48.1%;}.yui-gb .yui-u,.yui-gc .yui-u,.yui-gd .yui-u{float:left;margin-left:2%;*margin-left:1.895%;width:32%;}.yui-gb div.first,.yui-gc div.first,.yui-gd div.first{margin-left:0;}.yui-gc div.first,.yui-gd .yui-u{width:66%;}.yui-gd div.first{width:32%;}.yui-ge .yui-u{width:24%;}.yui-ge div.first,.yui-gf .yui-u{width:74.2%;}.yui-gf div.first{width:24%;}.yui-ge div.first{width:74.2%;}#bd:after,.yui-g:after,.yui-gb:after,.yui-gc:after,.yui-gd:after,.yui-ge:after,.yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#bd,.yui-g,.yui-gb,.yui-gc,.yui-gd,.yui-ge,.yui-gf{zoom:1;}
\ No newline at end of file
diff --git a/thirdpartyjs/yui/reset-fonts-grids/reset-fonts-grids.css b/thirdpartyjs/yui/reset-fonts-grids/reset-fonts-grids.css
index 507ed66..8cd7377 100644
--- a/thirdpartyjs/yui/reset-fonts-grids/reset-fonts-grids.css
+++ b/thirdpartyjs/yui/reset-fonts-grids/reset-fonts-grids.css
@@ -1,174 +1,174 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-/*=============*/
-/* reset.css */
-/*=============*/
-
-body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}
-table{border-collapse:collapse;border-spacing:0;}
-fieldset,img{border:0;}
-address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}
-ol,ul {list-style:none;}
-caption,th {text-align:left;}
-h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}
-q:before,q:after{content:'';}
-abbr,acronym {border:0;}
-
-/*=============*/
-/* fonts.css */
-/*=============*/
-
-/**
- * 84.5% for !IE, keywords for IE to preserve user font-size adjustment
- * Percents could work for IE, but for backCompat purposes, we are using keywords.
- * x-small is for IE6/7 quirks mode.
- *
- */
-body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
-table {font-size:inherit;font:100%;}
-/**
- * 99% for safari; 100% is too large
- */
-select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}
-/**
- * Bump up !IE to get to 13px equivalent
- */
-pre, code {font:115% monospace;*font-size:100%;}
-/**
- * Default line-height based on font-size rather than "computed-value"
- * see: http://www.w3.org/TR/CSS21/visudet.html#line-height
- */
-body * {line-height:1.22em;}
-
-/*=============*/
-/* grids.css */
-/*=============*/
-
-/* for all templates and grids */
-body{text-align:center;}
-#ft{clear:both;}
-/**/
-/* 750 centered, and backward compatibility */
-#doc,#doc2,#doc3,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7 {
- margin:auto;text-align:left;
- width:57.69em;*width:56.3em;min-width:750px;}
-/* 950 centered */
-#doc2 {
- width:73.074em;*width:71.313em;min-width:950px;}
-/* 100% with 10px viewport side matting */
-#doc3 {
- margin:auto 10px; /* not for structure, but so content doesn't bleed to edge */
- width:auto;}
-
-/* below required for all fluid grids; adjust widths and margins above accordingly */
-
- /* to preserve source-order independence for Gecko */
- .yui-b{position:relative;}
- .yui-b{_position:static;} /* for IE < 7 */
- #yui-main .yui-b{position:static;}
-
-#yui-main {width:100%;}
-.yui-t1 #yui-main,
-.yui-t2 #yui-main,
-.yui-t3 #yui-main{float:right;margin-left:-25em;/* IE: preserve layout at narrow widths */}
-
-.yui-t4 #yui-main,
-.yui-t5 #yui-main,
-.yui-t6 #yui-main{float:left;margin-right:-25em;/* IE: preserve layout at narrow widths */}
-
-.yui-t1 .yui-b {
- float:left;
- width:12.3207em;*width:12.0106em;}
-.yui-t1 #yui-main .yui-b{
- margin-left:13.3207em;*margin-left:13.0106em;
-}
-
-.yui-t2 .yui-b {
- float:left;
- width:13.8456em;*width:13.512em;}
-.yui-t2 #yui-main .yui-b {
- margin-left:14.8456em;*margin-left:14.512em;
-}
-
-.yui-t3 .yui-b {
- float:left;
- width:23.0759em;*width:22.52em;}
-.yui-t3 #yui-main .yui-b {
- margin-left:24.0759em;*margin-left:23.52em;
-}
-
-.yui-t4 .yui-b {
- float:right;
- width:13.8456em;*width:13.512em;}
-.yui-t4 #yui-main .yui-b {
- margin-right:14.8456em;*margin-right:14.512em;
-}
-
-.yui-t5 .yui-b {
- float:right;
- width:18.4608em;*width:18.016em;}
-.yui-t5 #yui-main .yui-b {
- margin-right:19.4608em;*margin-right:19.016em;
-}
-
-.yui-t6 .yui-b {
- float:right;
- width:23.0759em;*width:22.52em;}
-.yui-t6 #yui-main .yui-b {
- margin-right:24.0759em;*margin-right:23.52em;
-}
-
-.yui-t7 #yui-main .yui-b {
- display:block;margin:0 0 1em 0;
-}
-#yui-main .yui-b {float:none;width:auto;}
-/* GRIDS (not TEMPLATES) */
-.yui-g .yui-u,
-.yui-g .yui-g,
-.yui-gc .yui-u,
-.yui-gc .yui-g .yui-u,
-.yui-ge .yui-u,
-.yui-gf .yui-u{float:right;display:inline;}
-.yui-g div.first,
-.yui-gc div.first,
-.yui-gc div.first div.first,
-.yui-gd div.first,
-.yui-ge div.first,
-.yui-gf div.first{float:left;}
-.yui-g .yui-u,
-.yui-g .yui-g{width:49.1%;}
-.yui-g .yui-g .yui-u,
-.yui-gc .yui-g .yui-u {width:48.1%;}
-.yui-gb .yui-u,
-.yui-gc .yui-u,
-.yui-gd .yui-u{float:left;margin-left:2%;*margin-left:1.895%;width:32%;}
-.yui-gb div.first,
-.yui-gc div.first,
-.yui-gd div.first{margin-left:0;}
-.yui-gc div.first,
-.yui-gd .yui-u{width:66%;}
-.yui-gd div.first{width:32%;}
-.yui-ge .yui-u{width:24%;}
-.yui-ge div.first,
-.yui-gf .yui-u{width:74.2%;}
-.yui-gf div.first{width:24%;}
-.yui-ge div.first{width:74.2%;}
-#bd:after,
-.yui-g:after,
-.yui-gb:after,
-.yui-gc:after,
-.yui-gd:after,
-.yui-ge:after,
-.yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
-#bd,
-.yui-g,
-.yui-gb,
-.yui-gc,
-.yui-gd,
-.yui-ge,
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/*=============*/
+/* reset.css */
+/*=============*/
+
+body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}
+table{border-collapse:collapse;border-spacing:0;}
+fieldset,img{border:0;}
+address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}
+ol,ul {list-style:none;}
+caption,th {text-align:left;}
+h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}
+q:before,q:after{content:'';}
+abbr,acronym {border:0;}
+
+/*=============*/
+/* fonts.css */
+/*=============*/
+
+/**
+ * 84.5% for !IE, keywords for IE to preserve user font-size adjustment
+ * Percents could work for IE, but for backCompat purposes, we are using keywords.
+ * x-small is for IE6/7 quirks mode.
+ *
+ */
+body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
+table {font-size:inherit;font:100%;}
+/**
+ * 99% for safari; 100% is too large
+ */
+select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}
+/**
+ * Bump up !IE to get to 13px equivalent
+ */
+pre, code {font:115% monospace;*font-size:100%;}
+/**
+ * Default line-height based on font-size rather than "computed-value"
+ * see: http://www.w3.org/TR/CSS21/visudet.html#line-height
+ */
+body * {line-height:1.22em;}
+
+/*=============*/
+/* grids.css */
+/*=============*/
+
+/* for all templates and grids */
+body{text-align:center;}
+#ft{clear:both;}
+/**/
+/* 750 centered, and backward compatibility */
+#doc,#doc2,#doc3,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7 {
+ margin:auto;text-align:left;
+ width:57.69em;*width:56.3em;min-width:750px;}
+/* 950 centered */
+#doc2 {
+ width:73.074em;*width:71.313em;min-width:950px;}
+/* 100% with 10px viewport side matting */
+#doc3 {
+ margin:auto 10px; /* not for structure, but so content doesn't bleed to edge */
+ width:auto;}
+
+/* below required for all fluid grids; adjust widths and margins above accordingly */
+
+ /* to preserve source-order independence for Gecko */
+ .yui-b{position:relative;}
+ .yui-b{_position:static;} /* for IE < 7 */
+ #yui-main .yui-b{position:static;}
+
+#yui-main {width:100%;}
+.yui-t1 #yui-main,
+.yui-t2 #yui-main,
+.yui-t3 #yui-main{float:right;margin-left:-25em;/* IE: preserve layout at narrow widths */}
+
+.yui-t4 #yui-main,
+.yui-t5 #yui-main,
+.yui-t6 #yui-main{float:left;margin-right:-25em;/* IE: preserve layout at narrow widths */}
+
+.yui-t1 .yui-b {
+ float:left;
+ width:12.3207em;*width:12.0106em;}
+.yui-t1 #yui-main .yui-b{
+ margin-left:13.3207em;*margin-left:13.0106em;
+}
+
+.yui-t2 .yui-b {
+ float:left;
+ width:13.8456em;*width:13.512em;}
+.yui-t2 #yui-main .yui-b {
+ margin-left:14.8456em;*margin-left:14.512em;
+}
+
+.yui-t3 .yui-b {
+ float:left;
+ width:23.0759em;*width:22.52em;}
+.yui-t3 #yui-main .yui-b {
+ margin-left:24.0759em;*margin-left:23.52em;
+}
+
+.yui-t4 .yui-b {
+ float:right;
+ width:13.8456em;*width:13.512em;}
+.yui-t4 #yui-main .yui-b {
+ margin-right:14.8456em;*margin-right:14.512em;
+}
+
+.yui-t5 .yui-b {
+ float:right;
+ width:18.4608em;*width:18.016em;}
+.yui-t5 #yui-main .yui-b {
+ margin-right:19.4608em;*margin-right:19.016em;
+}
+
+.yui-t6 .yui-b {
+ float:right;
+ width:23.0759em;*width:22.52em;}
+.yui-t6 #yui-main .yui-b {
+ margin-right:24.0759em;*margin-right:23.52em;
+}
+
+.yui-t7 #yui-main .yui-b {
+ display:block;margin:0 0 1em 0;
+}
+#yui-main .yui-b {float:none;width:auto;}
+/* GRIDS (not TEMPLATES) */
+.yui-g .yui-u,
+.yui-g .yui-g,
+.yui-gc .yui-u,
+.yui-gc .yui-g .yui-u,
+.yui-ge .yui-u,
+.yui-gf .yui-u{float:right;display:inline;}
+.yui-g div.first,
+.yui-gc div.first,
+.yui-gc div.first div.first,
+.yui-gd div.first,
+.yui-ge div.first,
+.yui-gf div.first{float:left;}
+.yui-g .yui-u,
+.yui-g .yui-g{width:49.1%;}
+.yui-g .yui-g .yui-u,
+.yui-gc .yui-g .yui-u {width:48.1%;}
+.yui-gb .yui-u,
+.yui-gc .yui-u,
+.yui-gd .yui-u{float:left;margin-left:2%;*margin-left:1.895%;width:32%;}
+.yui-gb div.first,
+.yui-gc div.first,
+.yui-gd div.first{margin-left:0;}
+.yui-gc div.first,
+.yui-gd .yui-u{width:66%;}
+.yui-gd div.first{width:32%;}
+.yui-ge .yui-u{width:24%;}
+.yui-ge div.first,
+.yui-gf .yui-u{width:74.2%;}
+.yui-gf div.first{width:24%;}
+.yui-ge div.first{width:74.2%;}
+#bd:after,
+.yui-g:after,
+.yui-gb:after,
+.yui-gc:after,
+.yui-gd:after,
+.yui-ge:after,
+.yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
+#bd,
+.yui-g,
+.yui-gb,
+.yui-gc,
+.yui-gd,
+.yui-ge,
.yui-gf{zoom:1;}
\ No newline at end of file
diff --git a/thirdpartyjs/yui/reset/README b/thirdpartyjs/yui/reset/README
index 990e8cc..437cae3 100644
--- a/thirdpartyjs/yui/reset/README
+++ b/thirdpartyjs/yui/reset/README
@@ -1,17 +1,17 @@
-YUI Library - Reset - Release Notes
-
-Version 0.12.0
-
- * Added: h1,h2,h3,h4,h5,h6{font-weight:normal;}
-
- * Added: abbr,acronym {border:0;}
-
- * Added: textarea {padding:0;margin:0;}
-
-Version 0.11.0
-
- * No changes.
-
-Version 0.10.0
-
+YUI Library - Reset - Release Notes
+
+Version 0.12.0
+
+ * Added: h1,h2,h3,h4,h5,h6{font-weight:normal;}
+
+ * Added: abbr,acronym {border:0;}
+
+ * Added: textarea {padding:0;margin:0;}
+
+Version 0.11.0
+
+ * No changes.
+
+Version 0.10.0
+
* Initial release.
\ No newline at end of file
diff --git a/thirdpartyjs/yui/reset/reset.css b/thirdpartyjs/yui/reset/reset.css
index c488811..f884211 100644
--- a/thirdpartyjs/yui/reset/reset.css
+++ b/thirdpartyjs/yui/reset/reset.css
@@ -1,15 +1,15 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}
-table{border-collapse:collapse;border-spacing:0;}
-fieldset,img{border:0;}
-address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}
-ol,ul {list-style:none;}
-caption,th {text-align:left;}
-h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}
-q:before,q:after{content:'';}
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}
+table{border-collapse:collapse;border-spacing:0;}
+fieldset,img{border:0;}
+address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}
+ol,ul {list-style:none;}
+caption,th {text-align:left;}
+h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}
+q:before,q:after{content:'';}
abbr,acronym {border:0;}
\ No newline at end of file
diff --git a/thirdpartyjs/yui/slider/README b/thirdpartyjs/yui/slider/README
index dc317b4..521f4c8 100644
--- a/thirdpartyjs/yui/slider/README
+++ b/thirdpartyjs/yui/slider/README
@@ -1,54 +1,54 @@
-Slider - Release Notes
-
-0.12.0
-
- * Added "slideStart", "slideEnd", and "change" custom events. The abstract
- methods these will eventually replace still work.
-
- * The default animation duration is 0.2 seconds (reduced from 0.4 seconds),
- and is configurable via the animationDuration property.
-
- * Keyboard navigation is now built in. The background needs a tabindex for
- keyboard nav to work. Keyboard nav can be disabled by setting enableKeys
- to false. The number of pixels the slider moves when the arrow keys
- are pressed is controlled by keyIncrement, and defaults to 20. Note,
- Safari support limited to background element types that support focus
- in that browser. http://bugs.webkit.org/show_bug.cgi?id=7138
-
- * Fixed broken doctype in examples/index.html
-
- * Catching an unhandled script exception in FF that could occur when
- attempting to focus the slider background while a text field without
- autocomplete="false" has focus
-
-0.11.3
-
- * No change
-
-0.11.0
-
- * When the thumb is clicked and dragged, the click position delta is properly
- applied.
-
- * The slider background can be disabled by setting backgroundEnabled to false.
-
- * Added SliderThumb->clearTicks
-
- * Incorporated updated drag and drop performance improvements
-
-0.10.0
-
- * Drag and drop's autoscroll feature is now turned off by default
- in the slider.
-
- * The slider no longer sets its initial value upon initialization
-
- * RGB slider example fixed for IE7.
-
- * Updated to work with the onAvailable feature in Drag and Drop.
-
- * Updated the basic slider example page to make the control more
- accessible to non-FF1.5 browsers.
-
- * Split the examples into separate pages
-
+Slider - Release Notes
+
+0.12.0
+
+ * Added "slideStart", "slideEnd", and "change" custom events. The abstract
+ methods these will eventually replace still work.
+
+ * The default animation duration is 0.2 seconds (reduced from 0.4 seconds),
+ and is configurable via the animationDuration property.
+
+ * Keyboard navigation is now built in. The background needs a tabindex for
+ keyboard nav to work. Keyboard nav can be disabled by setting enableKeys
+ to false. The number of pixels the slider moves when the arrow keys
+ are pressed is controlled by keyIncrement, and defaults to 20. Note,
+ Safari support limited to background element types that support focus
+ in that browser. http://bugs.webkit.org/show_bug.cgi?id=7138
+
+ * Fixed broken doctype in examples/index.html
+
+ * Catching an unhandled script exception in FF that could occur when
+ attempting to focus the slider background while a text field without
+ autocomplete="false" has focus
+
+0.11.3
+
+ * No change
+
+0.11.0
+
+ * When the thumb is clicked and dragged, the click position delta is properly
+ applied.
+
+ * The slider background can be disabled by setting backgroundEnabled to false.
+
+ * Added SliderThumb->clearTicks
+
+ * Incorporated updated drag and drop performance improvements
+
+0.10.0
+
+ * Drag and drop's autoscroll feature is now turned off by default
+ in the slider.
+
+ * The slider no longer sets its initial value upon initialization
+
+ * RGB slider example fixed for IE7.
+
+ * Updated to work with the onAvailable feature in Drag and Drop.
+
+ * Updated the basic slider example page to make the control more
+ accessible to non-FF1.5 browsers.
+
+ * Split the examples into separate pages
+
diff --git a/thirdpartyjs/yui/slider/slider-debug.js b/thirdpartyjs/yui/slider/slider-debug.js
index af921ee..aa1f337 100644
--- a/thirdpartyjs/yui/slider/slider-debug.js
+++ b/thirdpartyjs/yui/slider/slider-debug.js
@@ -1,1152 +1,1152 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-/**
- * The Slider component is a UI control that enables the user to adjust
- * values in a finite range along one or two axes. Typically, the Slider
- * control is used in a web application as a rich, visual replacement
- * for an input box that takes a number as input. The Slider control can
- * also easily accommodate a second dimension, providing x,y output for
- * a selection point chosen from a rectangular region.
- *
- * @module slider
- * @title Slider Widget
- * @namespace YAHOO.widget
- * @requires yahoo,dom,dragdrop,event
- * @optional animation
- */
-
-/**
- * A DragDrop implementation that can be used as a background for a
- * slider. It takes a reference to the thumb instance
- * so it can delegate some of the events to it. The goal is to make the
- * thumb jump to the location on the background when the background is
- * clicked.
- *
- * @class Slider
- * @extends YAHOO.util.DragDrop
- * @constructor
- * @param {String} id The id of the element linked to this instance
- * @param {String} sGroup The group of related DragDrop items
- * @param {String} sType The type of slider (horiz, vert, region)
- */
-YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) {
- if (sElementId) {
-
- /**
- * The type of the slider (horiz, vert, region)
- * @property type
- * @type string
- */
- this.type = sType;
-
- this.init(sElementId, sGroup, true);
-
- //this.removeInvalidHandleType("A");
-
- this.logger = new YAHOO.widget.LogWriter(this.toString());
-
- var self = this;
-
- /**
- * Event the fires when the value of the control changes. If
- * the control is animated the event will fire every point
- * along the way.
- * @event change
- * @param {int} new
- * @param {int} firstOffset the number of pixels the thumb has moved
- * from its start position. Normal horizontal and vertical sliders will only
- * have the firstOffset. Regions will have both, the first is the horizontal
- * offset, the second the vertical.
- * @param {int} secondOffset the y offset for region sliders
- */
- this.createEvent("change", this);
-
- /**
- * Event that fires at the end of a slider thumb move.
- * @event slideStart
- */
- this.createEvent("slideStart", this);
-
- /**
- * Event that fires at the end of a slider thumb move
- * @event slideEnd
- */
- this.createEvent("slideEnd", this);
-
- /**
- * A YAHOO.widget.SliderThumb instance that we will use to
- * reposition the thumb when the background is clicked
- * @property thumb
- * @type YAHOO.widget.SliderThumb
- */
- this.thumb = oThumb;
-
- // add handler for the handle onchange event
- oThumb.onChange = function() {
- self.handleThumbChange();
- };
-
- /**
- * Overrides the isTarget property in YAHOO.util.DragDrop
- * @property isTarget
- * @private
- */
- this.isTarget = false;
-
- /**
- * Flag that determines if the thumb will animate when moved
- * @property animate
- * @type boolean
- */
- this.animate = YAHOO.widget.Slider.ANIM_AVAIL;
-
- /**
- * Set to false to disable a background click thumb move
- * @property backgroundEnabled
- * @type boolean
- */
- this.backgroundEnabled = true;
-
- /**
- * Adjustment factor for tick animation, the more ticks, the
- * faster the animation (by default)
- * @property tickPause
- * @type int
- */
- this.tickPause = 40;
-
- /**
- * Enables the arrow, home and end keys, defaults to true.
- * @property enableKeys
- * @type boolean
- */
- this.enableKeys = true;
-
- /**
- * Specifies the number of pixels the arrow keys will move the slider.
- * Default is 25.
- * @property keyIncrement
- * @type int
- */
- this.keyIncrement = 20;
-
- /**
- * moveComplete is set to true when the slider has moved to its final
- * destination. For animated slider, this value can be checked in
- * the onChange handler to make it possible to execute logic only
- * when the move is complete rather than at all points along the way.
- *
- * @property moveComplete
- * @type Boolean
- */
- this.moveComplete = true;
-
- /**
- * If animation is configured, specifies the length of the animation
- * in seconds.
- * @property animationDuration
- * @type int
- * @default 0.2
- */
- this.animationDuration = 0.2;
-
- if (oThumb._isHoriz && oThumb.xTicks && oThumb.xTicks.length) {
- this.tickPause = Math.round(360 / oThumb.xTicks.length);
- } else if (oThumb.yTicks && oThumb.yTicks.length) {
- this.tickPause = Math.round(360 / oThumb.yTicks.length);
- }
-
- this.logger.log("tickPause: " + this.tickPause);
-
- // delegate thumb methods
- oThumb.onMouseDown = function () { return self.focus(); };
- //oThumb.b4MouseDown = function () { return self.b4MouseDown(); };
- // oThumb.lock = function() { self.lock(); };
- // oThumb.unlock = function() { self.unlock(); };
- oThumb.onMouseUp = function() { self.thumbMouseUp(); };
- oThumb.onDrag = function() { self.fireEvents(); };
- oThumb.onAvailable = function() { return self.setStartSliderState(); };
- }
-};
-
-/**
- * Factory method for creating a horizontal slider
- * @method YAHOO.widget.Slider.getHorizSlider
- * @static
- * @param {String} sBGElId the id of the slider's background element
- * @param {String} sHandleElId the id of the thumb element
- * @param {int} iLeft the number of pixels the element can move left
- * @param {int} iRight the number of pixels the element can move right
- * @param {int} iTickSize optional parameter for specifying that the element
- * should move a certain number pixels at a time.
- * @return {Slider} a horizontal slider control
- */
-YAHOO.widget.Slider.getHorizSlider =
- function (sBGElId, sHandleElId, iLeft, iRight, iTickSize) {
- return new YAHOO.widget.Slider(sBGElId, sBGElId,
- new YAHOO.widget.SliderThumb(sHandleElId, sBGElId,
- iLeft, iRight, 0, 0, iTickSize), "horiz");
-};
-
-/**
- * Factory method for creating a vertical slider
- * @method YAHOO.widget.Slider.getVertSlider
- * @static
- * @param {String} sBGElId the id of the slider's background element
- * @param {String} sHandleElId the id of the thumb element
- * @param {int} iUp the number of pixels the element can move up
- * @param {int} iDown the number of pixels the element can move down
- * @param {int} iTickSize optional parameter for specifying that the element
- * should move a certain number pixels at a time.
- * @return {Slider} a vertical slider control
- */
-YAHOO.widget.Slider.getVertSlider =
- function (sBGElId, sHandleElId, iUp, iDown, iTickSize) {
- return new YAHOO.widget.Slider(sBGElId, sBGElId,
- new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0,
- iUp, iDown, iTickSize), "vert");
-};
-
-/**
- * Factory method for creating a slider region like the one in the color
- * picker example
- * @method YAHOO.widget.Slider.getSliderRegion
- * @static
- * @param {String} sBGElId the id of the slider's background element
- * @param {String} sHandleElId the id of the thumb element
- * @param {int} iLeft the number of pixels the element can move left
- * @param {int} iRight the number of pixels the element can move right
- * @param {int} iUp the number of pixels the element can move up
- * @param {int} iDown the number of pixels the element can move down
- * @param {int} iTickSize optional parameter for specifying that the element
- * should move a certain number pixels at a time.
- * @return {Slider} a slider region control
- */
-YAHOO.widget.Slider.getSliderRegion =
- function (sBGElId, sHandleElId, iLeft, iRight, iUp, iDown, iTickSize) {
- return new YAHOO.widget.Slider(sBGElId, sBGElId,
- new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, iLeft, iRight,
- iUp, iDown, iTickSize), "region");
-};
-
-/**
- * By default, animation is available if the animation library is detected.
- * @property YAHOO.widget.Slider.ANIM_AVAIL
- * @static
- * @type boolean
- */
-YAHOO.widget.Slider.ANIM_AVAIL = true;
-
-YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, {
-
- onAvailable: function() {
- var Event = YAHOO.util.Event;
- Event.on(this.id, "keydown", this.handleKeyDown, this, true);
- Event.on(this.id, "keypress", this.handleKeyPress, this, true);
- },
-
- handleKeyPress: function(e) {
- if (this.enableKeys) {
- var Event = YAHOO.util.Event;
- var kc = Event.getCharCode(e);
- switch (kc) {
- case 0x25: // left
- case 0x26: // up
- case 0x27: // right
- case 0x28: // down
- case 0x24: // home
- case 0x23: // end
- Event.preventDefault(e);
- break;
- default:
- }
- }
- },
-
- handleKeyDown: function(e) {
- if (this.enableKeys) {
- var Event = YAHOO.util.Event;
-
- var kc = Event.getCharCode(e), t=this.thumb;
- var h=this.getXValue(),v=this.getYValue();
-
- var horiz = false;
- var changeValue = true;
- switch (kc) {
-
- // left
- case 0x25: h -= this.keyIncrement; break;
-
- // up
- case 0x26: v -= this.keyIncrement; break;
-
- // right
- case 0x27: h += this.keyIncrement; break;
-
- // down
- case 0x28: v += this.keyIncrement; break;
-
- // home
- case 0x24: h = t.leftConstraint;
- v = t.topConstraint;
- break;
-
- // end
- case 0x23: h = t.rightConstraint;
- v = t.bottomConstraint;
- break;
-
- default: changeValue = false;
- }
-
- if (changeValue) {
- if (t._isRegion) {
- this.setRegionValue(h, v, true);
- } else {
- var newVal = (t._isHoriz) ? h : v;
- this.setValue(newVal, true);
- }
- Event.stopEvent(e);
- }
-
- }
- },
-
- /**
- * Initialization that sets up the value offsets once the elements are ready
- * @method setSliderStartState
- */
- setStartSliderState: function() {
-
- this.logger.log("Fixing state");
-
- this.setThumbCenterPoint();
-
- /**
- * The basline position of the background element, used
- * to determine if the background has moved since the last
- * operation.
- * @property baselinePos
- * @type [int, int]
- */
- this.baselinePos = YAHOO.util.Dom.getXY(this.getEl());
-
- this.thumb.startOffset = this.thumb.getOffsetFromParent(this.baselinePos);
-
- if (this.thumb._isRegion) {
- if (this.deferredSetRegionValue) {
- this.setRegionValue.apply(this, this.deferredSetRegionValue, true);
- this.deferredSetRegionValue = null;
- } else {
- this.setRegionValue(0, 0, true);
- }
- } else {
- if (this.deferredSetValue) {
- this.setValue.apply(this, this.deferredSetValue, true);
- this.deferredSetValue = null;
- } else {
- this.setValue(0, true, true);
- }
- }
- },
-
- /**
- * When the thumb is available, we cache the centerpoint of the element so
- * we can position the element correctly when the background is clicked
- * @method setThumbCenterPoint
- */
- setThumbCenterPoint: function() {
-
- var el = this.thumb.getEl();
-
- if (el) {
- /**
- * The center of the slider element is stored so we can position
- * place it in the correct position when the background is clicked
- * @property thumbCenterPoint
- * @type {"x": int, "y": int}
- */
- this.thumbCenterPoint = {
- x: parseInt(el.offsetWidth/2, 10),
- y: parseInt(el.offsetHeight/2, 10)
- };
- }
-
- },
-
- /**
- * Locks the slider, overrides YAHOO.util.DragDrop
- * @method lock
- */
- lock: function() {
- this.logger.log("locking");
- this.thumb.lock();
- this.locked = true;
- },
-
- /**
- * Unlocks the slider, overrides YAHOO.util.DragDrop
- * @method unlock
- */
- unlock: function() {
- this.logger.log("unlocking");
- this.thumb.unlock();
- this.locked = false;
- },
-
- /**
- * Handles mouseup event on the slider background
- * @method thumbMouseUp
- * @private
- */
- thumbMouseUp: function() {
- this.logger.log("bg mouseup");
- if (!this.isLocked() && !this.moveComplete) {
- this.endMove();
- }
-
- },
-
- /**
- * Returns a reference to this slider's thumb
- * @method getThumb
- * @return {SliderThumb} this slider's thumb
- */
- getThumb: function() {
- return this.thumb;
- },
-
- /**
- * Try to focus the element when clicked so we can add
- * accessibility features
- * @method focus
- * @private
- */
- focus: function() {
- this.logger.log("focus");
-
- // Focus the background element if possible
- var el = this.getEl();
-
- if (el.focus) {
- try {
- el.focus();
- } catch(e) {
- // Prevent permission denied unhandled exception in FF that can
- // happen when setting focus while another element is handling
- // the blur. @TODO this is still writing to the error log
- // (unhandled error) in FF1.5 with strict error checking on.
- }
- }
-
- this.verifyOffset();
-
- if (this.isLocked()) {
- return false;
- } else {
- this.onSlideStart();
- return true;
- }
- },
-
- /**
- * Event that fires when the value of the slider has changed
- * @method onChange
- * @param {int} firstOffset the number of pixels the thumb has moved
- * from its start position. Normal horizontal and vertical sliders will only
- * have the firstOffset. Regions will have both, the first is the horizontal
- * offset, the second the vertical.
- * @param {int} secondOffset the y offset for region sliders
- * @deprecated use instance.subscribe("change") instead
- */
- onChange: function (firstOffset, secondOffset) {
- /* override me */
- this.logger.log("onChange: " + firstOffset + ", " + secondOffset);
- },
-
- /**
- * Event that fires when the at the beginning of the slider thumb move
- * @method onSlideStart
- * @deprecated use instance.subscribe("slideStart") instead
- */
- onSlideStart: function () {
- /* override me */
- this.logger.log("onSlideStart");
- },
-
- /**
- * Event that fires at the end of a slider thumb move
- * @method onSliderEnd
- * @deprecated use instance.subscribe("slideEnd") instead
- */
- onSlideEnd: function () {
- /* override me */
- this.logger.log("onSlideEnd");
- },
-
- /**
- * Returns the slider's thumb offset from the start position
- * @method getValue
- * @return {int} the current value
- */
- getValue: function () {
- return this.thumb.getValue();
- },
-
- /**
- * Returns the slider's thumb X offset from the start position
- * @method getXValue
- * @return {int} the current horizontal offset
- */
- getXValue: function () {
- return this.thumb.getXValue();
- },
-
- /**
- * Returns the slider's thumb Y offset from the start position
- * @method getYValue
- * @return {int} the current vertical offset
- */
- getYValue: function () {
- return this.thumb.getYValue();
- },
-
- /**
- * Internal handler for the slider thumb's onChange event
- * @method handleThumbChange
- * @private
- */
- handleThumbChange: function () {
- var t = this.thumb;
- if (t._isRegion) {
- t.onChange(t.getXValue(), t.getYValue());
- this.fireEvent("change", { x: t.getXValue(), y: t.getYValue() } );
- } else {
- t.onChange(t.getValue());
- this.fireEvent("change", t.getValue());
- }
-
- },
-
- /**
- * Provides a way to set the value of the slider in code.
- * @method setValue
- * @param {int} newOffset the number of pixels the thumb should be
- * positioned away from the initial start point
- * @param {boolean} skipAnim set to true to disable the animation
- * for this move action (but not others).
- * @param {boolean} force ignore the locked setting and set value anyway
- * @return {boolean} true if the move was performed, false if it failed
- */
- setValue: function(newOffset, skipAnim, force) {
- this.logger.log("setValue " + newOffset);
-
- if (!this.thumb.available) {
- this.logger.log("defer setValue until after onAvailble");
- this.deferredSetValue = arguments;
- return false;
- }
-
- if (this.isLocked() && !force) {
- this.logger.log("Can't set the value, the control is locked");
- return false;
- }
-
- if ( isNaN(newOffset) ) {
- this.logger.log("setValue, Illegal argument: " + newOffset);
- return false;
- }
-
- var t = this.thumb;
- var newX, newY;
- this.verifyOffset();
- if (t._isRegion) {
- return false;
- } else if (t._isHoriz) {
- this.onSlideStart();
- // this.fireEvent("slideStart");
- newX = t.initPageX + newOffset + this.thumbCenterPoint.x;
- this.moveThumb(newX, t.initPageY, skipAnim);
- } else {
- this.onSlideStart();
- // this.fireEvent("slideStart");
- newY = t.initPageY + newOffset + this.thumbCenterPoint.y;
- this.moveThumb(t.initPageX, newY, skipAnim);
- }
-
- return true;
- },
-
- /**
- * Provides a way to set the value of the region slider in code.
- * @method setRegionValue
- * @param {int} newOffset the number of pixels the thumb should be
- * positioned away from the initial start point (x axis for region)
- * @param {int} newOffset2 the number of pixels the thumb should be
- * positioned away from the initial start point (y axis for region)
- * @param {boolean} skipAnim set to true to disable the animation
- * for this move action (but not others).
- * @param {boolean} force ignore the locked setting and set value anyway
- * @return {boolean} true if the move was performed, false if it failed
- */
- setRegionValue: function(newOffset, newOffset2, skipAnim) {
-
- if (!this.thumb.available) {
- this.logger.log("defer setRegionValue until after onAvailble");
- this.deferredSetRegionValue = arguments;
- return false;
- }
-
- if (this.isLocked() && !force) {
- this.logger.log("Can't set the value, the control is locked");
- return false;
- }
-
- if ( isNaN(newOffset) ) {
- this.logger.log("setRegionValue, Illegal argument: " + newOffset);
- return false;
- }
-
- var t = this.thumb;
- if (t._isRegion) {
- this.onSlideStart();
- var newX = t.initPageX + newOffset + this.thumbCenterPoint.x;
- var newY = t.initPageY + newOffset2 + this.thumbCenterPoint.y;
- this.moveThumb(newX, newY, skipAnim);
- return true;
- }
-
- return false;
-
- },
-
- /**
- * Checks the background position element position. If it has moved from the
- * baseline position, the constraints for the thumb are reset
- * @method verifyOffset
- * @return {boolean} True if the offset is the same as the baseline.
- */
- verifyOffset: function() {
-
- var newPos = YAHOO.util.Dom.getXY(this.getEl());
- this.logger.log("newPos: " + newPos);
-
- if (newPos[0] != this.baselinePos[0] || newPos[1] != this.baselinePos[1]) {
- this.logger.log("background moved, resetting constraints");
- this.thumb.resetConstraints();
- this.baselinePos = newPos;
- return false;
- }
-
- return true;
- },
-
- /**
- * Move the associated slider moved to a timeout to try to get around the
- * mousedown stealing moz does when I move the slider element between the
- * cursor and the background during the mouseup event
- * @method moveThumb
- * @param {int} x the X coordinate of the click
- * @param {int} y the Y coordinate of the click
- * @param {boolean} skipAnim don't animate if the move happend onDrag
- * @private
- */
- moveThumb: function(x, y, skipAnim) {
-
- // this.logger.log("move thumb", "warn");
-
- var t = this.thumb;
- var self = this;
-
- if (!t.available) {
- this.logger.log("thumb is not available yet, aborting move");
- return;
- }
-
- this.logger.log("move thumb, x: " + x + ", y: " + y);
-
- // this.verifyOffset();
-
- t.setDelta(this.thumbCenterPoint.x, this.thumbCenterPoint.y);
-
- var _p = t.getTargetCoord(x, y);
- var p = [_p.x, _p.y];
-
-
- this.fireEvent("slideStart");
-
- if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && t._graduated && !skipAnim) {
- this.logger.log("graduated");
- // this.thumb._animating = true;
- this.lock();
-
- setTimeout( function() { self.moveOneTick(p); }, this.tickPause );
-
- } else if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && !skipAnim) {
- this.logger.log("animating to " + p);
-
- // this.thumb._animating = true;
- this.lock();
-
- var oAnim = new YAHOO.util.Motion(
- t.id, { points: { to: p } },
- this.animationDuration,
- YAHOO.util.Easing.easeOut );
-
- oAnim.onComplete.subscribe( function() { self.endMove(); } );
- oAnim.animate();
- } else {
- t.setDragElPos(x, y);
- // this.fireEvents();
- this.endMove();
- }
- },
-
- /**
- * Move the slider one tick mark towards its final coordinate. Used
- * for the animation when tick marks are defined
- * @method moveOneTick
- * @param {int[]} the destination coordinate
- * @private
- */
- moveOneTick: function(finalCoord) {
-
- var t = this.thumb;
- var curCoord = YAHOO.util.Dom.getXY(t.getEl());
- var tmp;
-
- // var thresh = Math.min(t.tickSize + (Math.floor(t.tickSize/2)), 10);
- // var thresh = 10;
- // var thresh = t.tickSize + (Math.floor(t.tickSize/2));
-
- var nextCoord = null;
-
- if (t._isRegion) {
- nextCoord = this._getNextX(curCoord, finalCoord);
- var tmpX = (nextCoord) ? nextCoord[0] : curCoord[0];
- nextCoord = this._getNextY([tmpX, curCoord[1]], finalCoord);
-
- } else if (t._isHoriz) {
- nextCoord = this._getNextX(curCoord, finalCoord);
- } else {
- nextCoord = this._getNextY(curCoord, finalCoord);
- }
-
- this.logger.log("moveOneTick: " +
- " finalCoord: " + finalCoord +
- " curCoord: " + curCoord +
- " nextCoord: " + nextCoord);
-
- if (nextCoord) {
-
- // move to the next coord
- // YAHOO.util.Dom.setXY(t.getEl(), nextCoord);
-
- // var el = t.getEl();
- // YAHOO.util.Dom.setStyle(el, "left", (nextCoord[0] + this.thumb.deltaSetXY[0]) + "px");
- // YAHOO.util.Dom.setStyle(el, "top", (nextCoord[1] + this.thumb.deltaSetXY[1]) + "px");
-
- this.thumb.alignElWithMouse(t.getEl(), nextCoord[0], nextCoord[1]);
-
- // check if we are in the final position, if not make a recursive call
- if (!(nextCoord[0] == finalCoord[0] && nextCoord[1] == finalCoord[1])) {
- var self = this;
- setTimeout(function() { self.moveOneTick(finalCoord); },
- this.tickPause);
- } else {
- this.endMove();
- }
- } else {
- this.endMove();
- }
-
- //this.tickPause = Math.round(this.tickPause/2);
- },
-
- /**
- * Returns the next X tick value based on the current coord and the target coord.
- * @method _getNextX
- * @private
- */
- _getNextX: function(curCoord, finalCoord) {
- this.logger.log("getNextX: " + curCoord + ", " + finalCoord);
- var t = this.thumb;
- var thresh;
- var tmp = [];
- var nextCoord = null;
- if (curCoord[0] > finalCoord[0]) {
- thresh = t.tickSize - this.thumbCenterPoint.x;
- tmp = t.getTargetCoord( curCoord[0] - thresh, curCoord[1] );
- nextCoord = [tmp.x, tmp.y];
- } else if (curCoord[0] < finalCoord[0]) {
- thresh = t.tickSize + this.thumbCenterPoint.x;
- tmp = t.getTargetCoord( curCoord[0] + thresh, curCoord[1] );
- nextCoord = [tmp.x, tmp.y];
- } else {
- // equal, do nothing
- }
-
- return nextCoord;
- },
-
- /**
- * Returns the next Y tick value based on the current coord and the target coord.
- * @method _getNextY
- * @private
- */
- _getNextY: function(curCoord, finalCoord) {
- var t = this.thumb;
- var thresh;
- var tmp = [];
- var nextCoord = null;
-
- if (curCoord[1] > finalCoord[1]) {
- thresh = t.tickSize - this.thumbCenterPoint.y;
- tmp = t.getTargetCoord( curCoord[0], curCoord[1] - thresh );
- nextCoord = [tmp.x, tmp.y];
- } else if (curCoord[1] < finalCoord[1]) {
- thresh = t.tickSize + this.thumbCenterPoint.y;
- tmp = t.getTargetCoord( curCoord[0], curCoord[1] + thresh );
- nextCoord = [tmp.x, tmp.y];
- } else {
- // equal, do nothing
- }
-
- return nextCoord;
- },
-
- /**
- * Resets the constraints before moving the thumb.
- * @method b4MouseDown
- * @private
- */
- b4MouseDown: function(e) {
- this.thumb.autoOffset();
- this.thumb.resetConstraints();
- },
-
-
- /**
- * Handles the mousedown event for the slider background
- * @method onMouseDown
- * @private
- */
- onMouseDown: function(e) {
- // this.resetConstraints(true);
- // this.thumb.resetConstraints(true);
-
- if (! this.isLocked() && this.backgroundEnabled) {
- var x = YAHOO.util.Event.getPageX(e);
- var y = YAHOO.util.Event.getPageY(e);
- this.logger.log("bg mousedown: " + x + "," + y);
-
- this.focus();
- this.moveThumb(x, y);
- }
-
- },
-
- /**
- * Handles the onDrag event for the slider background
- * @method onDrag
- * @private
- */
- onDrag: function(e) {
- if (! this.isLocked()) {
- var x = YAHOO.util.Event.getPageX(e);
- var y = YAHOO.util.Event.getPageY(e);
- this.moveThumb(x, y, true);
- }
- },
-
- /**
- * Fired when the slider movement ends
- * @method endMove
- * @private
- */
- endMove: function () {
- // this._animating = false;
- this.unlock();
- this.moveComplete = true;
- this.fireEvents();
- },
-
- /**
- * Fires the change event if the value has been changed. Ignored if we are in
- * the middle of an animation as the event will fire when the animation is
- * complete
- * @method fireEvents
- * @private
- */
- fireEvents: function () {
-
- var t = this.thumb;
- // this.logger.log("FireEvents: " + t._isRegion);
-
- t.cachePosition();
-
- if (! this.isLocked()) {
- if (t._isRegion) {
- this.logger.log("region");
- var newX = t.getXValue();
- var newY = t.getYValue();
-
- if (newX != this.previousX || newY != this.previousY) {
- // this.logger.log("Firing onchange");
- this.onChange(newX, newY);
- this.fireEvent("change", { x: newX, y: newY });
- }
-
- this.previousX = newX;
- this.previousY = newY;
-
- } else {
- var newVal = t.getValue();
- if (newVal != this.previousVal) {
- this.logger.log("Firing onchange: " + newVal);
- this.onChange( newVal );
- this.fireEvent("change", newVal);
- }
- this.previousVal = newVal;
- }
-
- if (this.moveComplete) {
- this.onSlideEnd();
- this.fireEvent("slideEnd");
- this.moveComplete = false;
- }
-
- }
- },
-
- /**
- * Slider toString
- * @method toString
- * @return {string} string representation of the instance
- */
- toString: function () {
- return ("Slider (" + this.type +") " + this.id);
- }
-
-});
-
-YAHOO.augment(YAHOO.widget.Slider, YAHOO.util.EventProvider);
-
-/**
- * A drag and drop implementation to be used as the thumb of a slider.
- * @class SliderThumb
- * @extends YAHOO.util.DD
- * @constructor
- * @param {String} id the id of the slider html element
- * @param {String} sGroup the group of related DragDrop items
- * @param {int} iLeft the number of pixels the element can move left
- * @param {int} iRight the number of pixels the element can move right
- * @param {int} iUp the number of pixels the element can move up
- * @param {int} iDown the number of pixels the element can move down
- * @param {int} iTickSize optional parameter for specifying that the element
- * should move a certain number pixels at a time.
- */
-YAHOO.widget.SliderThumb = function(id, sGroup, iLeft, iRight, iUp, iDown, iTickSize) {
-
- if (id) {
- this.init(id, sGroup);
-
- /**
- * The id of the thumbs parent HTML element (the slider background
- * element).
- * @property parentElId
- * @type string
- */
- this.parentElId = sGroup;
- }
-
-
- //this.removeInvalidHandleType("A");
-
- this.logger = new YAHOO.widget.LogWriter(this.toString());
-
- /**
- * Overrides the isTarget property in YAHOO.util.DragDrop
- * @property isTarget
- * @private
- */
- this.isTarget = false;
-
- /**
- * The tick size for this slider
- * @property tickSize
- * @type int
- * @private
- */
- this.tickSize = iTickSize;
-
- /**
- * Informs the drag and drop util that the offsets should remain when
- * resetting the constraints. This preserves the slider value when
- * the constraints are reset
- * @property maintainOffset
- * @type boolean
- * @private
- */
- this.maintainOffset = true;
-
- this.initSlider(iLeft, iRight, iUp, iDown, iTickSize);
-
- /**
- * Turns off the autoscroll feature in drag and drop
- * @property scroll
- * @private
- */
- this.scroll = false;
-
-};
-
-YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, {
-
- /**
- * The (X and Y) difference between the thumb location and its parent
- * (the slider background) when the control is instantiated.
- * @property startOffset
- * @type [int, int]
- */
- startOffset: null,
-
- /**
- * Flag used to figure out if this is a horizontal or vertical slider
- * @property _isHoriz
- * @type boolean
- * @private
- */
- _isHoriz: false,
-
- /**
- * Cache the last value so we can check for change
- * @property _prevVal
- * @type int
- * @private
- */
- _prevVal: 0,
-
- /**
- * The slider is _graduated if there is a tick interval defined
- * @property _graduated
- * @type boolean
- * @private
- */
- _graduated: false,
-
- /**
- * Returns the difference between the location of the thumb and its parent.
- * @method getOffsetFromParent
- * @param {[int, int]} parentPos Optionally accepts the position of the parent
- * @type [int, int]
- */
- getOffsetFromParent: function(parentPos) {
- var myPos = YAHOO.util.Dom.getXY(this.getEl());
- var ppos = parentPos || YAHOO.util.Dom.getXY(this.parentElId);
-
- return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ];
- },
-
- /**
- * Set up the slider, must be called in the constructor of all subclasses
- * @method initSlider
- * @param {int} iLeft the number of pixels the element can move left
- * @param {int} iRight the number of pixels the element can move right
- * @param {int} iUp the number of pixels the element can move up
- * @param {int} iDown the number of pixels the element can move down
- * @param {int} iTickSize the width of the tick interval.
- */
- initSlider: function (iLeft, iRight, iUp, iDown, iTickSize) {
-
- this.setXConstraint(iLeft, iRight, iTickSize);
- this.setYConstraint(iUp, iDown, iTickSize);
-
- if (iTickSize && iTickSize > 1) {
- this._graduated = true;
- }
-
- this._isHoriz = (iLeft || iRight);
- this._isVert = (iUp || iDown);
- this._isRegion = (this._isHoriz && this._isVert);
-
- },
-
- /**
- * Clear's the slider's ticks
- * @method clearTicks
- */
- clearTicks: function () {
- YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);
- this._graduated = false;
- },
-
- /**
- * Gets the current offset from the element's start position in
- * pixels.
- * @method getValue
- * @return {int} the number of pixels (positive or negative) the
- * slider has moved from the start position.
- */
- getValue: function () {
- if (!this.available) { return 0; }
- var val = (this._isHoriz) ? this.getXValue() : this.getYValue();
- this.logger.log("getVal: " + val);
- return val;
- },
-
- /**
- * Gets the current X offset from the element's start position in
- * pixels.
- * @method getXValue
- * @return {int} the number of pixels (positive or negative) the
- * slider has moved horizontally from the start position.
- */
- getXValue: function () {
- if (!this.available) { return 0; }
- var newOffset = this.getOffsetFromParent();
- return (newOffset[0] - this.startOffset[0]);
- },
-
- /**
- * Gets the current Y offset from the element's start position in
- * pixels.
- * @method getYValue
- * @return {int} the number of pixels (positive or negative) the
- * slider has moved vertically from the start position.
- */
- getYValue: function () {
- if (!this.available) { return 0; }
- var newOffset = this.getOffsetFromParent();
- return (newOffset[1] - this.startOffset[1]);
- },
-
- /**
- * Thumb toString
- * @method toString
- * @return {string} string representation of the instance
- */
- toString: function () {
- return "SliderThumb " + this.id;
- },
-
- /**
- * The onchange event for the handle/thumb is delegated to the YAHOO.widget.Slider
- * instance it belongs to.
- * @method onChange
- * @private
- */
- onChange: function (x, y) {
- }
-
-});
-
-if ("undefined" == typeof YAHOO.util.Anim) {
- YAHOO.widget.Slider.ANIM_AVAIL = false;
-}
-
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+ * The Slider component is a UI control that enables the user to adjust
+ * values in a finite range along one or two axes. Typically, the Slider
+ * control is used in a web application as a rich, visual replacement
+ * for an input box that takes a number as input. The Slider control can
+ * also easily accommodate a second dimension, providing x,y output for
+ * a selection point chosen from a rectangular region.
+ *
+ * @module slider
+ * @title Slider Widget
+ * @namespace YAHOO.widget
+ * @requires yahoo,dom,dragdrop,event
+ * @optional animation
+ */
+
+/**
+ * A DragDrop implementation that can be used as a background for a
+ * slider. It takes a reference to the thumb instance
+ * so it can delegate some of the events to it. The goal is to make the
+ * thumb jump to the location on the background when the background is
+ * clicked.
+ *
+ * @class Slider
+ * @extends YAHOO.util.DragDrop
+ * @constructor
+ * @param {String} id The id of the element linked to this instance
+ * @param {String} sGroup The group of related DragDrop items
+ * @param {String} sType The type of slider (horiz, vert, region)
+ */
+YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) {
+ if (sElementId) {
+
+ /**
+ * The type of the slider (horiz, vert, region)
+ * @property type
+ * @type string
+ */
+ this.type = sType;
+
+ this.init(sElementId, sGroup, true);
+
+ //this.removeInvalidHandleType("A");
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+
+ var self = this;
+
+ /**
+ * Event the fires when the value of the control changes. If
+ * the control is animated the event will fire every point
+ * along the way.
+ * @event change
+ * @param {int} new
+ * @param {int} firstOffset the number of pixels the thumb has moved
+ * from its start position. Normal horizontal and vertical sliders will only
+ * have the firstOffset. Regions will have both, the first is the horizontal
+ * offset, the second the vertical.
+ * @param {int} secondOffset the y offset for region sliders
+ */
+ this.createEvent("change", this);
+
+ /**
+ * Event that fires at the end of a slider thumb move.
+ * @event slideStart
+ */
+ this.createEvent("slideStart", this);
+
+ /**
+ * Event that fires at the end of a slider thumb move
+ * @event slideEnd
+ */
+ this.createEvent("slideEnd", this);
+
+ /**
+ * A YAHOO.widget.SliderThumb instance that we will use to
+ * reposition the thumb when the background is clicked
+ * @property thumb
+ * @type YAHOO.widget.SliderThumb
+ */
+ this.thumb = oThumb;
+
+ // add handler for the handle onchange event
+ oThumb.onChange = function() {
+ self.handleThumbChange();
+ };
+
+ /**
+ * Overrides the isTarget property in YAHOO.util.DragDrop
+ * @property isTarget
+ * @private
+ */
+ this.isTarget = false;
+
+ /**
+ * Flag that determines if the thumb will animate when moved
+ * @property animate
+ * @type boolean
+ */
+ this.animate = YAHOO.widget.Slider.ANIM_AVAIL;
+
+ /**
+ * Set to false to disable a background click thumb move
+ * @property backgroundEnabled
+ * @type boolean
+ */
+ this.backgroundEnabled = true;
+
+ /**
+ * Adjustment factor for tick animation, the more ticks, the
+ * faster the animation (by default)
+ * @property tickPause
+ * @type int
+ */
+ this.tickPause = 40;
+
+ /**
+ * Enables the arrow, home and end keys, defaults to true.
+ * @property enableKeys
+ * @type boolean
+ */
+ this.enableKeys = true;
+
+ /**
+ * Specifies the number of pixels the arrow keys will move the slider.
+ * Default is 25.
+ * @property keyIncrement
+ * @type int
+ */
+ this.keyIncrement = 20;
+
+ /**
+ * moveComplete is set to true when the slider has moved to its final
+ * destination. For animated slider, this value can be checked in
+ * the onChange handler to make it possible to execute logic only
+ * when the move is complete rather than at all points along the way.
+ *
+ * @property moveComplete
+ * @type Boolean
+ */
+ this.moveComplete = true;
+
+ /**
+ * If animation is configured, specifies the length of the animation
+ * in seconds.
+ * @property animationDuration
+ * @type int
+ * @default 0.2
+ */
+ this.animationDuration = 0.2;
+
+ if (oThumb._isHoriz && oThumb.xTicks && oThumb.xTicks.length) {
+ this.tickPause = Math.round(360 / oThumb.xTicks.length);
+ } else if (oThumb.yTicks && oThumb.yTicks.length) {
+ this.tickPause = Math.round(360 / oThumb.yTicks.length);
+ }
+
+ this.logger.log("tickPause: " + this.tickPause);
+
+ // delegate thumb methods
+ oThumb.onMouseDown = function () { return self.focus(); };
+ //oThumb.b4MouseDown = function () { return self.b4MouseDown(); };
+ // oThumb.lock = function() { self.lock(); };
+ // oThumb.unlock = function() { self.unlock(); };
+ oThumb.onMouseUp = function() { self.thumbMouseUp(); };
+ oThumb.onDrag = function() { self.fireEvents(); };
+ oThumb.onAvailable = function() { return self.setStartSliderState(); };
+ }
+};
+
+/**
+ * Factory method for creating a horizontal slider
+ * @method YAHOO.widget.Slider.getHorizSlider
+ * @static
+ * @param {String} sBGElId the id of the slider's background element
+ * @param {String} sHandleElId the id of the thumb element
+ * @param {int} iLeft the number of pixels the element can move left
+ * @param {int} iRight the number of pixels the element can move right
+ * @param {int} iTickSize optional parameter for specifying that the element
+ * should move a certain number pixels at a time.
+ * @return {Slider} a horizontal slider control
+ */
+YAHOO.widget.Slider.getHorizSlider =
+ function (sBGElId, sHandleElId, iLeft, iRight, iTickSize) {
+ return new YAHOO.widget.Slider(sBGElId, sBGElId,
+ new YAHOO.widget.SliderThumb(sHandleElId, sBGElId,
+ iLeft, iRight, 0, 0, iTickSize), "horiz");
+};
+
+/**
+ * Factory method for creating a vertical slider
+ * @method YAHOO.widget.Slider.getVertSlider
+ * @static
+ * @param {String} sBGElId the id of the slider's background element
+ * @param {String} sHandleElId the id of the thumb element
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize optional parameter for specifying that the element
+ * should move a certain number pixels at a time.
+ * @return {Slider} a vertical slider control
+ */
+YAHOO.widget.Slider.getVertSlider =
+ function (sBGElId, sHandleElId, iUp, iDown, iTickSize) {
+ return new YAHOO.widget.Slider(sBGElId, sBGElId,
+ new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0,
+ iUp, iDown, iTickSize), "vert");
+};
+
+/**
+ * Factory method for creating a slider region like the one in the color
+ * picker example
+ * @method YAHOO.widget.Slider.getSliderRegion
+ * @static
+ * @param {String} sBGElId the id of the slider's background element
+ * @param {String} sHandleElId the id of the thumb element
+ * @param {int} iLeft the number of pixels the element can move left
+ * @param {int} iRight the number of pixels the element can move right
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize optional parameter for specifying that the element
+ * should move a certain number pixels at a time.
+ * @return {Slider} a slider region control
+ */
+YAHOO.widget.Slider.getSliderRegion =
+ function (sBGElId, sHandleElId, iLeft, iRight, iUp, iDown, iTickSize) {
+ return new YAHOO.widget.Slider(sBGElId, sBGElId,
+ new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, iLeft, iRight,
+ iUp, iDown, iTickSize), "region");
+};
+
+/**
+ * By default, animation is available if the animation library is detected.
+ * @property YAHOO.widget.Slider.ANIM_AVAIL
+ * @static
+ * @type boolean
+ */
+YAHOO.widget.Slider.ANIM_AVAIL = true;
+
+YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, {
+
+ onAvailable: function() {
+ var Event = YAHOO.util.Event;
+ Event.on(this.id, "keydown", this.handleKeyDown, this, true);
+ Event.on(this.id, "keypress", this.handleKeyPress, this, true);
+ },
+
+ handleKeyPress: function(e) {
+ if (this.enableKeys) {
+ var Event = YAHOO.util.Event;
+ var kc = Event.getCharCode(e);
+ switch (kc) {
+ case 0x25: // left
+ case 0x26: // up
+ case 0x27: // right
+ case 0x28: // down
+ case 0x24: // home
+ case 0x23: // end
+ Event.preventDefault(e);
+ break;
+ default:
+ }
+ }
+ },
+
+ handleKeyDown: function(e) {
+ if (this.enableKeys) {
+ var Event = YAHOO.util.Event;
+
+ var kc = Event.getCharCode(e), t=this.thumb;
+ var h=this.getXValue(),v=this.getYValue();
+
+ var horiz = false;
+ var changeValue = true;
+ switch (kc) {
+
+ // left
+ case 0x25: h -= this.keyIncrement; break;
+
+ // up
+ case 0x26: v -= this.keyIncrement; break;
+
+ // right
+ case 0x27: h += this.keyIncrement; break;
+
+ // down
+ case 0x28: v += this.keyIncrement; break;
+
+ // home
+ case 0x24: h = t.leftConstraint;
+ v = t.topConstraint;
+ break;
+
+ // end
+ case 0x23: h = t.rightConstraint;
+ v = t.bottomConstraint;
+ break;
+
+ default: changeValue = false;
+ }
+
+ if (changeValue) {
+ if (t._isRegion) {
+ this.setRegionValue(h, v, true);
+ } else {
+ var newVal = (t._isHoriz) ? h : v;
+ this.setValue(newVal, true);
+ }
+ Event.stopEvent(e);
+ }
+
+ }
+ },
+
+ /**
+ * Initialization that sets up the value offsets once the elements are ready
+ * @method setSliderStartState
+ */
+ setStartSliderState: function() {
+
+ this.logger.log("Fixing state");
+
+ this.setThumbCenterPoint();
+
+ /**
+ * The basline position of the background element, used
+ * to determine if the background has moved since the last
+ * operation.
+ * @property baselinePos
+ * @type [int, int]
+ */
+ this.baselinePos = YAHOO.util.Dom.getXY(this.getEl());
+
+ this.thumb.startOffset = this.thumb.getOffsetFromParent(this.baselinePos);
+
+ if (this.thumb._isRegion) {
+ if (this.deferredSetRegionValue) {
+ this.setRegionValue.apply(this, this.deferredSetRegionValue, true);
+ this.deferredSetRegionValue = null;
+ } else {
+ this.setRegionValue(0, 0, true);
+ }
+ } else {
+ if (this.deferredSetValue) {
+ this.setValue.apply(this, this.deferredSetValue, true);
+ this.deferredSetValue = null;
+ } else {
+ this.setValue(0, true, true);
+ }
+ }
+ },
+
+ /**
+ * When the thumb is available, we cache the centerpoint of the element so
+ * we can position the element correctly when the background is clicked
+ * @method setThumbCenterPoint
+ */
+ setThumbCenterPoint: function() {
+
+ var el = this.thumb.getEl();
+
+ if (el) {
+ /**
+ * The center of the slider element is stored so we can position
+ * place it in the correct position when the background is clicked
+ * @property thumbCenterPoint
+ * @type {"x": int, "y": int}
+ */
+ this.thumbCenterPoint = {
+ x: parseInt(el.offsetWidth/2, 10),
+ y: parseInt(el.offsetHeight/2, 10)
+ };
+ }
+
+ },
+
+ /**
+ * Locks the slider, overrides YAHOO.util.DragDrop
+ * @method lock
+ */
+ lock: function() {
+ this.logger.log("locking");
+ this.thumb.lock();
+ this.locked = true;
+ },
+
+ /**
+ * Unlocks the slider, overrides YAHOO.util.DragDrop
+ * @method unlock
+ */
+ unlock: function() {
+ this.logger.log("unlocking");
+ this.thumb.unlock();
+ this.locked = false;
+ },
+
+ /**
+ * Handles mouseup event on the slider background
+ * @method thumbMouseUp
+ * @private
+ */
+ thumbMouseUp: function() {
+ this.logger.log("bg mouseup");
+ if (!this.isLocked() && !this.moveComplete) {
+ this.endMove();
+ }
+
+ },
+
+ /**
+ * Returns a reference to this slider's thumb
+ * @method getThumb
+ * @return {SliderThumb} this slider's thumb
+ */
+ getThumb: function() {
+ return this.thumb;
+ },
+
+ /**
+ * Try to focus the element when clicked so we can add
+ * accessibility features
+ * @method focus
+ * @private
+ */
+ focus: function() {
+ this.logger.log("focus");
+
+ // Focus the background element if possible
+ var el = this.getEl();
+
+ if (el.focus) {
+ try {
+ el.focus();
+ } catch(e) {
+ // Prevent permission denied unhandled exception in FF that can
+ // happen when setting focus while another element is handling
+ // the blur. @TODO this is still writing to the error log
+ // (unhandled error) in FF1.5 with strict error checking on.
+ }
+ }
+
+ this.verifyOffset();
+
+ if (this.isLocked()) {
+ return false;
+ } else {
+ this.onSlideStart();
+ return true;
+ }
+ },
+
+ /**
+ * Event that fires when the value of the slider has changed
+ * @method onChange
+ * @param {int} firstOffset the number of pixels the thumb has moved
+ * from its start position. Normal horizontal and vertical sliders will only
+ * have the firstOffset. Regions will have both, the first is the horizontal
+ * offset, the second the vertical.
+ * @param {int} secondOffset the y offset for region sliders
+ * @deprecated use instance.subscribe("change") instead
+ */
+ onChange: function (firstOffset, secondOffset) {
+ /* override me */
+ this.logger.log("onChange: " + firstOffset + ", " + secondOffset);
+ },
+
+ /**
+ * Event that fires when the at the beginning of the slider thumb move
+ * @method onSlideStart
+ * @deprecated use instance.subscribe("slideStart") instead
+ */
+ onSlideStart: function () {
+ /* override me */
+ this.logger.log("onSlideStart");
+ },
+
+ /**
+ * Event that fires at the end of a slider thumb move
+ * @method onSliderEnd
+ * @deprecated use instance.subscribe("slideEnd") instead
+ */
+ onSlideEnd: function () {
+ /* override me */
+ this.logger.log("onSlideEnd");
+ },
+
+ /**
+ * Returns the slider's thumb offset from the start position
+ * @method getValue
+ * @return {int} the current value
+ */
+ getValue: function () {
+ return this.thumb.getValue();
+ },
+
+ /**
+ * Returns the slider's thumb X offset from the start position
+ * @method getXValue
+ * @return {int} the current horizontal offset
+ */
+ getXValue: function () {
+ return this.thumb.getXValue();
+ },
+
+ /**
+ * Returns the slider's thumb Y offset from the start position
+ * @method getYValue
+ * @return {int} the current vertical offset
+ */
+ getYValue: function () {
+ return this.thumb.getYValue();
+ },
+
+ /**
+ * Internal handler for the slider thumb's onChange event
+ * @method handleThumbChange
+ * @private
+ */
+ handleThumbChange: function () {
+ var t = this.thumb;
+ if (t._isRegion) {
+ t.onChange(t.getXValue(), t.getYValue());
+ this.fireEvent("change", { x: t.getXValue(), y: t.getYValue() } );
+ } else {
+ t.onChange(t.getValue());
+ this.fireEvent("change", t.getValue());
+ }
+
+ },
+
+ /**
+ * Provides a way to set the value of the slider in code.
+ * @method setValue
+ * @param {int} newOffset the number of pixels the thumb should be
+ * positioned away from the initial start point
+ * @param {boolean} skipAnim set to true to disable the animation
+ * for this move action (but not others).
+ * @param {boolean} force ignore the locked setting and set value anyway
+ * @return {boolean} true if the move was performed, false if it failed
+ */
+ setValue: function(newOffset, skipAnim, force) {
+ this.logger.log("setValue " + newOffset);
+
+ if (!this.thumb.available) {
+ this.logger.log("defer setValue until after onAvailble");
+ this.deferredSetValue = arguments;
+ return false;
+ }
+
+ if (this.isLocked() && !force) {
+ this.logger.log("Can't set the value, the control is locked");
+ return false;
+ }
+
+ if ( isNaN(newOffset) ) {
+ this.logger.log("setValue, Illegal argument: " + newOffset);
+ return false;
+ }
+
+ var t = this.thumb;
+ var newX, newY;
+ this.verifyOffset();
+ if (t._isRegion) {
+ return false;
+ } else if (t._isHoriz) {
+ this.onSlideStart();
+ // this.fireEvent("slideStart");
+ newX = t.initPageX + newOffset + this.thumbCenterPoint.x;
+ this.moveThumb(newX, t.initPageY, skipAnim);
+ } else {
+ this.onSlideStart();
+ // this.fireEvent("slideStart");
+ newY = t.initPageY + newOffset + this.thumbCenterPoint.y;
+ this.moveThumb(t.initPageX, newY, skipAnim);
+ }
+
+ return true;
+ },
+
+ /**
+ * Provides a way to set the value of the region slider in code.
+ * @method setRegionValue
+ * @param {int} newOffset the number of pixels the thumb should be
+ * positioned away from the initial start point (x axis for region)
+ * @param {int} newOffset2 the number of pixels the thumb should be
+ * positioned away from the initial start point (y axis for region)
+ * @param {boolean} skipAnim set to true to disable the animation
+ * for this move action (but not others).
+ * @param {boolean} force ignore the locked setting and set value anyway
+ * @return {boolean} true if the move was performed, false if it failed
+ */
+ setRegionValue: function(newOffset, newOffset2, skipAnim) {
+
+ if (!this.thumb.available) {
+ this.logger.log("defer setRegionValue until after onAvailble");
+ this.deferredSetRegionValue = arguments;
+ return false;
+ }
+
+ if (this.isLocked() && !force) {
+ this.logger.log("Can't set the value, the control is locked");
+ return false;
+ }
+
+ if ( isNaN(newOffset) ) {
+ this.logger.log("setRegionValue, Illegal argument: " + newOffset);
+ return false;
+ }
+
+ var t = this.thumb;
+ if (t._isRegion) {
+ this.onSlideStart();
+ var newX = t.initPageX + newOffset + this.thumbCenterPoint.x;
+ var newY = t.initPageY + newOffset2 + this.thumbCenterPoint.y;
+ this.moveThumb(newX, newY, skipAnim);
+ return true;
+ }
+
+ return false;
+
+ },
+
+ /**
+ * Checks the background position element position. If it has moved from the
+ * baseline position, the constraints for the thumb are reset
+ * @method verifyOffset
+ * @return {boolean} True if the offset is the same as the baseline.
+ */
+ verifyOffset: function() {
+
+ var newPos = YAHOO.util.Dom.getXY(this.getEl());
+ this.logger.log("newPos: " + newPos);
+
+ if (newPos[0] != this.baselinePos[0] || newPos[1] != this.baselinePos[1]) {
+ this.logger.log("background moved, resetting constraints");
+ this.thumb.resetConstraints();
+ this.baselinePos = newPos;
+ return false;
+ }
+
+ return true;
+ },
+
+ /**
+ * Move the associated slider moved to a timeout to try to get around the
+ * mousedown stealing moz does when I move the slider element between the
+ * cursor and the background during the mouseup event
+ * @method moveThumb
+ * @param {int} x the X coordinate of the click
+ * @param {int} y the Y coordinate of the click
+ * @param {boolean} skipAnim don't animate if the move happend onDrag
+ * @private
+ */
+ moveThumb: function(x, y, skipAnim) {
+
+ // this.logger.log("move thumb", "warn");
+
+ var t = this.thumb;
+ var self = this;
+
+ if (!t.available) {
+ this.logger.log("thumb is not available yet, aborting move");
+ return;
+ }
+
+ this.logger.log("move thumb, x: " + x + ", y: " + y);
+
+ // this.verifyOffset();
+
+ t.setDelta(this.thumbCenterPoint.x, this.thumbCenterPoint.y);
+
+ var _p = t.getTargetCoord(x, y);
+ var p = [_p.x, _p.y];
+
+
+ this.fireEvent("slideStart");
+
+ if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && t._graduated && !skipAnim) {
+ this.logger.log("graduated");
+ // this.thumb._animating = true;
+ this.lock();
+
+ setTimeout( function() { self.moveOneTick(p); }, this.tickPause );
+
+ } else if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && !skipAnim) {
+ this.logger.log("animating to " + p);
+
+ // this.thumb._animating = true;
+ this.lock();
+
+ var oAnim = new YAHOO.util.Motion(
+ t.id, { points: { to: p } },
+ this.animationDuration,
+ YAHOO.util.Easing.easeOut );
+
+ oAnim.onComplete.subscribe( function() { self.endMove(); } );
+ oAnim.animate();
+ } else {
+ t.setDragElPos(x, y);
+ // this.fireEvents();
+ this.endMove();
+ }
+ },
+
+ /**
+ * Move the slider one tick mark towards its final coordinate. Used
+ * for the animation when tick marks are defined
+ * @method moveOneTick
+ * @param {int[]} the destination coordinate
+ * @private
+ */
+ moveOneTick: function(finalCoord) {
+
+ var t = this.thumb;
+ var curCoord = YAHOO.util.Dom.getXY(t.getEl());
+ var tmp;
+
+ // var thresh = Math.min(t.tickSize + (Math.floor(t.tickSize/2)), 10);
+ // var thresh = 10;
+ // var thresh = t.tickSize + (Math.floor(t.tickSize/2));
+
+ var nextCoord = null;
+
+ if (t._isRegion) {
+ nextCoord = this._getNextX(curCoord, finalCoord);
+ var tmpX = (nextCoord) ? nextCoord[0] : curCoord[0];
+ nextCoord = this._getNextY([tmpX, curCoord[1]], finalCoord);
+
+ } else if (t._isHoriz) {
+ nextCoord = this._getNextX(curCoord, finalCoord);
+ } else {
+ nextCoord = this._getNextY(curCoord, finalCoord);
+ }
+
+ this.logger.log("moveOneTick: " +
+ " finalCoord: " + finalCoord +
+ " curCoord: " + curCoord +
+ " nextCoord: " + nextCoord);
+
+ if (nextCoord) {
+
+ // move to the next coord
+ // YAHOO.util.Dom.setXY(t.getEl(), nextCoord);
+
+ // var el = t.getEl();
+ // YAHOO.util.Dom.setStyle(el, "left", (nextCoord[0] + this.thumb.deltaSetXY[0]) + "px");
+ // YAHOO.util.Dom.setStyle(el, "top", (nextCoord[1] + this.thumb.deltaSetXY[1]) + "px");
+
+ this.thumb.alignElWithMouse(t.getEl(), nextCoord[0], nextCoord[1]);
+
+ // check if we are in the final position, if not make a recursive call
+ if (!(nextCoord[0] == finalCoord[0] && nextCoord[1] == finalCoord[1])) {
+ var self = this;
+ setTimeout(function() { self.moveOneTick(finalCoord); },
+ this.tickPause);
+ } else {
+ this.endMove();
+ }
+ } else {
+ this.endMove();
+ }
+
+ //this.tickPause = Math.round(this.tickPause/2);
+ },
+
+ /**
+ * Returns the next X tick value based on the current coord and the target coord.
+ * @method _getNextX
+ * @private
+ */
+ _getNextX: function(curCoord, finalCoord) {
+ this.logger.log("getNextX: " + curCoord + ", " + finalCoord);
+ var t = this.thumb;
+ var thresh;
+ var tmp = [];
+ var nextCoord = null;
+ if (curCoord[0] > finalCoord[0]) {
+ thresh = t.tickSize - this.thumbCenterPoint.x;
+ tmp = t.getTargetCoord( curCoord[0] - thresh, curCoord[1] );
+ nextCoord = [tmp.x, tmp.y];
+ } else if (curCoord[0] < finalCoord[0]) {
+ thresh = t.tickSize + this.thumbCenterPoint.x;
+ tmp = t.getTargetCoord( curCoord[0] + thresh, curCoord[1] );
+ nextCoord = [tmp.x, tmp.y];
+ } else {
+ // equal, do nothing
+ }
+
+ return nextCoord;
+ },
+
+ /**
+ * Returns the next Y tick value based on the current coord and the target coord.
+ * @method _getNextY
+ * @private
+ */
+ _getNextY: function(curCoord, finalCoord) {
+ var t = this.thumb;
+ var thresh;
+ var tmp = [];
+ var nextCoord = null;
+
+ if (curCoord[1] > finalCoord[1]) {
+ thresh = t.tickSize - this.thumbCenterPoint.y;
+ tmp = t.getTargetCoord( curCoord[0], curCoord[1] - thresh );
+ nextCoord = [tmp.x, tmp.y];
+ } else if (curCoord[1] < finalCoord[1]) {
+ thresh = t.tickSize + this.thumbCenterPoint.y;
+ tmp = t.getTargetCoord( curCoord[0], curCoord[1] + thresh );
+ nextCoord = [tmp.x, tmp.y];
+ } else {
+ // equal, do nothing
+ }
+
+ return nextCoord;
+ },
+
+ /**
+ * Resets the constraints before moving the thumb.
+ * @method b4MouseDown
+ * @private
+ */
+ b4MouseDown: function(e) {
+ this.thumb.autoOffset();
+ this.thumb.resetConstraints();
+ },
+
+
+ /**
+ * Handles the mousedown event for the slider background
+ * @method onMouseDown
+ * @private
+ */
+ onMouseDown: function(e) {
+ // this.resetConstraints(true);
+ // this.thumb.resetConstraints(true);
+
+ if (! this.isLocked() && this.backgroundEnabled) {
+ var x = YAHOO.util.Event.getPageX(e);
+ var y = YAHOO.util.Event.getPageY(e);
+ this.logger.log("bg mousedown: " + x + "," + y);
+
+ this.focus();
+ this.moveThumb(x, y);
+ }
+
+ },
+
+ /**
+ * Handles the onDrag event for the slider background
+ * @method onDrag
+ * @private
+ */
+ onDrag: function(e) {
+ if (! this.isLocked()) {
+ var x = YAHOO.util.Event.getPageX(e);
+ var y = YAHOO.util.Event.getPageY(e);
+ this.moveThumb(x, y, true);
+ }
+ },
+
+ /**
+ * Fired when the slider movement ends
+ * @method endMove
+ * @private
+ */
+ endMove: function () {
+ // this._animating = false;
+ this.unlock();
+ this.moveComplete = true;
+ this.fireEvents();
+ },
+
+ /**
+ * Fires the change event if the value has been changed. Ignored if we are in
+ * the middle of an animation as the event will fire when the animation is
+ * complete
+ * @method fireEvents
+ * @private
+ */
+ fireEvents: function () {
+
+ var t = this.thumb;
+ // this.logger.log("FireEvents: " + t._isRegion);
+
+ t.cachePosition();
+
+ if (! this.isLocked()) {
+ if (t._isRegion) {
+ this.logger.log("region");
+ var newX = t.getXValue();
+ var newY = t.getYValue();
+
+ if (newX != this.previousX || newY != this.previousY) {
+ // this.logger.log("Firing onchange");
+ this.onChange(newX, newY);
+ this.fireEvent("change", { x: newX, y: newY });
+ }
+
+ this.previousX = newX;
+ this.previousY = newY;
+
+ } else {
+ var newVal = t.getValue();
+ if (newVal != this.previousVal) {
+ this.logger.log("Firing onchange: " + newVal);
+ this.onChange( newVal );
+ this.fireEvent("change", newVal);
+ }
+ this.previousVal = newVal;
+ }
+
+ if (this.moveComplete) {
+ this.onSlideEnd();
+ this.fireEvent("slideEnd");
+ this.moveComplete = false;
+ }
+
+ }
+ },
+
+ /**
+ * Slider toString
+ * @method toString
+ * @return {string} string representation of the instance
+ */
+ toString: function () {
+ return ("Slider (" + this.type +") " + this.id);
+ }
+
+});
+
+YAHOO.augment(YAHOO.widget.Slider, YAHOO.util.EventProvider);
+
+/**
+ * A drag and drop implementation to be used as the thumb of a slider.
+ * @class SliderThumb
+ * @extends YAHOO.util.DD
+ * @constructor
+ * @param {String} id the id of the slider html element
+ * @param {String} sGroup the group of related DragDrop items
+ * @param {int} iLeft the number of pixels the element can move left
+ * @param {int} iRight the number of pixels the element can move right
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize optional parameter for specifying that the element
+ * should move a certain number pixels at a time.
+ */
+YAHOO.widget.SliderThumb = function(id, sGroup, iLeft, iRight, iUp, iDown, iTickSize) {
+
+ if (id) {
+ this.init(id, sGroup);
+
+ /**
+ * The id of the thumbs parent HTML element (the slider background
+ * element).
+ * @property parentElId
+ * @type string
+ */
+ this.parentElId = sGroup;
+ }
+
+
+ //this.removeInvalidHandleType("A");
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+
+ /**
+ * Overrides the isTarget property in YAHOO.util.DragDrop
+ * @property isTarget
+ * @private
+ */
+ this.isTarget = false;
+
+ /**
+ * The tick size for this slider
+ * @property tickSize
+ * @type int
+ * @private
+ */
+ this.tickSize = iTickSize;
+
+ /**
+ * Informs the drag and drop util that the offsets should remain when
+ * resetting the constraints. This preserves the slider value when
+ * the constraints are reset
+ * @property maintainOffset
+ * @type boolean
+ * @private
+ */
+ this.maintainOffset = true;
+
+ this.initSlider(iLeft, iRight, iUp, iDown, iTickSize);
+
+ /**
+ * Turns off the autoscroll feature in drag and drop
+ * @property scroll
+ * @private
+ */
+ this.scroll = false;
+
+};
+
+YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, {
+
+ /**
+ * The (X and Y) difference between the thumb location and its parent
+ * (the slider background) when the control is instantiated.
+ * @property startOffset
+ * @type [int, int]
+ */
+ startOffset: null,
+
+ /**
+ * Flag used to figure out if this is a horizontal or vertical slider
+ * @property _isHoriz
+ * @type boolean
+ * @private
+ */
+ _isHoriz: false,
+
+ /**
+ * Cache the last value so we can check for change
+ * @property _prevVal
+ * @type int
+ * @private
+ */
+ _prevVal: 0,
+
+ /**
+ * The slider is _graduated if there is a tick interval defined
+ * @property _graduated
+ * @type boolean
+ * @private
+ */
+ _graduated: false,
+
+ /**
+ * Returns the difference between the location of the thumb and its parent.
+ * @method getOffsetFromParent
+ * @param {[int, int]} parentPos Optionally accepts the position of the parent
+ * @type [int, int]
+ */
+ getOffsetFromParent: function(parentPos) {
+ var myPos = YAHOO.util.Dom.getXY(this.getEl());
+ var ppos = parentPos || YAHOO.util.Dom.getXY(this.parentElId);
+
+ return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ];
+ },
+
+ /**
+ * Set up the slider, must be called in the constructor of all subclasses
+ * @method initSlider
+ * @param {int} iLeft the number of pixels the element can move left
+ * @param {int} iRight the number of pixels the element can move right
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize the width of the tick interval.
+ */
+ initSlider: function (iLeft, iRight, iUp, iDown, iTickSize) {
+
+ this.setXConstraint(iLeft, iRight, iTickSize);
+ this.setYConstraint(iUp, iDown, iTickSize);
+
+ if (iTickSize && iTickSize > 1) {
+ this._graduated = true;
+ }
+
+ this._isHoriz = (iLeft || iRight);
+ this._isVert = (iUp || iDown);
+ this._isRegion = (this._isHoriz && this._isVert);
+
+ },
+
+ /**
+ * Clear's the slider's ticks
+ * @method clearTicks
+ */
+ clearTicks: function () {
+ YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);
+ this._graduated = false;
+ },
+
+ /**
+ * Gets the current offset from the element's start position in
+ * pixels.
+ * @method getValue
+ * @return {int} the number of pixels (positive or negative) the
+ * slider has moved from the start position.
+ */
+ getValue: function () {
+ if (!this.available) { return 0; }
+ var val = (this._isHoriz) ? this.getXValue() : this.getYValue();
+ this.logger.log("getVal: " + val);
+ return val;
+ },
+
+ /**
+ * Gets the current X offset from the element's start position in
+ * pixels.
+ * @method getXValue
+ * @return {int} the number of pixels (positive or negative) the
+ * slider has moved horizontally from the start position.
+ */
+ getXValue: function () {
+ if (!this.available) { return 0; }
+ var newOffset = this.getOffsetFromParent();
+ return (newOffset[0] - this.startOffset[0]);
+ },
+
+ /**
+ * Gets the current Y offset from the element's start position in
+ * pixels.
+ * @method getYValue
+ * @return {int} the number of pixels (positive or negative) the
+ * slider has moved vertically from the start position.
+ */
+ getYValue: function () {
+ if (!this.available) { return 0; }
+ var newOffset = this.getOffsetFromParent();
+ return (newOffset[1] - this.startOffset[1]);
+ },
+
+ /**
+ * Thumb toString
+ * @method toString
+ * @return {string} string representation of the instance
+ */
+ toString: function () {
+ return "SliderThumb " + this.id;
+ },
+
+ /**
+ * The onchange event for the handle/thumb is delegated to the YAHOO.widget.Slider
+ * instance it belongs to.
+ * @method onChange
+ * @private
+ */
+ onChange: function (x, y) {
+ }
+
+});
+
+if ("undefined" == typeof YAHOO.util.Anim) {
+ YAHOO.widget.Slider.ANIM_AVAIL = false;
+}
+
diff --git a/thirdpartyjs/yui/slider/slider.js b/thirdpartyjs/yui/slider/slider.js
index 8d3cd62..444ceb5 100644
--- a/thirdpartyjs/yui/slider/slider.js
+++ b/thirdpartyjs/yui/slider/slider.js
@@ -1,1113 +1,1113 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-/**
- * The Slider component is a UI control that enables the user to adjust
- * values in a finite range along one or two axes. Typically, the Slider
- * control is used in a web application as a rich, visual replacement
- * for an input box that takes a number as input. The Slider control can
- * also easily accommodate a second dimension, providing x,y output for
- * a selection point chosen from a rectangular region.
- *
- * @module slider
- * @title Slider Widget
- * @namespace YAHOO.widget
- * @requires yahoo,dom,dragdrop,event
- * @optional animation
- */
-
-/**
- * A DragDrop implementation that can be used as a background for a
- * slider. It takes a reference to the thumb instance
- * so it can delegate some of the events to it. The goal is to make the
- * thumb jump to the location on the background when the background is
- * clicked.
- *
- * @class Slider
- * @extends YAHOO.util.DragDrop
- * @constructor
- * @param {String} id The id of the element linked to this instance
- * @param {String} sGroup The group of related DragDrop items
- * @param {String} sType The type of slider (horiz, vert, region)
- */
-YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) {
- if (sElementId) {
-
- /**
- * The type of the slider (horiz, vert, region)
- * @property type
- * @type string
- */
- this.type = sType;
-
- this.init(sElementId, sGroup, true);
-
- //this.removeInvalidHandleType("A");
-
-
- var self = this;
-
- /**
- * Event the fires when the value of the control changes. If
- * the control is animated the event will fire every point
- * along the way.
- * @event change
- * @param {int} new
- * @param {int} firstOffset the number of pixels the thumb has moved
- * from its start position. Normal horizontal and vertical sliders will only
- * have the firstOffset. Regions will have both, the first is the horizontal
- * offset, the second the vertical.
- * @param {int} secondOffset the y offset for region sliders
- */
- this.createEvent("change", this);
-
- /**
- * Event that fires at the end of a slider thumb move.
- * @event slideStart
- */
- this.createEvent("slideStart", this);
-
- /**
- * Event that fires at the end of a slider thumb move
- * @event slideEnd
- */
- this.createEvent("slideEnd", this);
-
- /**
- * A YAHOO.widget.SliderThumb instance that we will use to
- * reposition the thumb when the background is clicked
- * @property thumb
- * @type YAHOO.widget.SliderThumb
- */
- this.thumb = oThumb;
-
- // add handler for the handle onchange event
- oThumb.onChange = function() {
- self.handleThumbChange();
- };
-
- /**
- * Overrides the isTarget property in YAHOO.util.DragDrop
- * @property isTarget
- * @private
- */
- this.isTarget = false;
-
- /**
- * Flag that determines if the thumb will animate when moved
- * @property animate
- * @type boolean
- */
- this.animate = YAHOO.widget.Slider.ANIM_AVAIL;
-
- /**
- * Set to false to disable a background click thumb move
- * @property backgroundEnabled
- * @type boolean
- */
- this.backgroundEnabled = true;
-
- /**
- * Adjustment factor for tick animation, the more ticks, the
- * faster the animation (by default)
- * @property tickPause
- * @type int
- */
- this.tickPause = 40;
-
- /**
- * Enables the arrow, home and end keys, defaults to true.
- * @property enableKeys
- * @type boolean
- */
- this.enableKeys = true;
-
- /**
- * Specifies the number of pixels the arrow keys will move the slider.
- * Default is 25.
- * @property keyIncrement
- * @type int
- */
- this.keyIncrement = 20;
-
- /**
- * moveComplete is set to true when the slider has moved to its final
- * destination. For animated slider, this value can be checked in
- * the onChange handler to make it possible to execute logic only
- * when the move is complete rather than at all points along the way.
- *
- * @property moveComplete
- * @type Boolean
- */
- this.moveComplete = true;
-
- /**
- * If animation is configured, specifies the length of the animation
- * in seconds.
- * @property animationDuration
- * @type int
- * @default 0.2
- */
- this.animationDuration = 0.2;
-
- if (oThumb._isHoriz && oThumb.xTicks && oThumb.xTicks.length) {
- this.tickPause = Math.round(360 / oThumb.xTicks.length);
- } else if (oThumb.yTicks && oThumb.yTicks.length) {
- this.tickPause = Math.round(360 / oThumb.yTicks.length);
- }
-
-
- // delegate thumb methods
- oThumb.onMouseDown = function () { return self.focus(); };
- //oThumb.b4MouseDown = function () { return self.b4MouseDown(); };
- // oThumb.lock = function() { self.lock(); };
- // oThumb.unlock = function() { self.unlock(); };
- oThumb.onMouseUp = function() { self.thumbMouseUp(); };
- oThumb.onDrag = function() { self.fireEvents(); };
- oThumb.onAvailable = function() { return self.setStartSliderState(); };
- }
-};
-
-/**
- * Factory method for creating a horizontal slider
- * @method YAHOO.widget.Slider.getHorizSlider
- * @static
- * @param {String} sBGElId the id of the slider's background element
- * @param {String} sHandleElId the id of the thumb element
- * @param {int} iLeft the number of pixels the element can move left
- * @param {int} iRight the number of pixels the element can move right
- * @param {int} iTickSize optional parameter for specifying that the element
- * should move a certain number pixels at a time.
- * @return {Slider} a horizontal slider control
- */
-YAHOO.widget.Slider.getHorizSlider =
- function (sBGElId, sHandleElId, iLeft, iRight, iTickSize) {
- return new YAHOO.widget.Slider(sBGElId, sBGElId,
- new YAHOO.widget.SliderThumb(sHandleElId, sBGElId,
- iLeft, iRight, 0, 0, iTickSize), "horiz");
-};
-
-/**
- * Factory method for creating a vertical slider
- * @method YAHOO.widget.Slider.getVertSlider
- * @static
- * @param {String} sBGElId the id of the slider's background element
- * @param {String} sHandleElId the id of the thumb element
- * @param {int} iUp the number of pixels the element can move up
- * @param {int} iDown the number of pixels the element can move down
- * @param {int} iTickSize optional parameter for specifying that the element
- * should move a certain number pixels at a time.
- * @return {Slider} a vertical slider control
- */
-YAHOO.widget.Slider.getVertSlider =
- function (sBGElId, sHandleElId, iUp, iDown, iTickSize) {
- return new YAHOO.widget.Slider(sBGElId, sBGElId,
- new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0,
- iUp, iDown, iTickSize), "vert");
-};
-
-/**
- * Factory method for creating a slider region like the one in the color
- * picker example
- * @method YAHOO.widget.Slider.getSliderRegion
- * @static
- * @param {String} sBGElId the id of the slider's background element
- * @param {String} sHandleElId the id of the thumb element
- * @param {int} iLeft the number of pixels the element can move left
- * @param {int} iRight the number of pixels the element can move right
- * @param {int} iUp the number of pixels the element can move up
- * @param {int} iDown the number of pixels the element can move down
- * @param {int} iTickSize optional parameter for specifying that the element
- * should move a certain number pixels at a time.
- * @return {Slider} a slider region control
- */
-YAHOO.widget.Slider.getSliderRegion =
- function (sBGElId, sHandleElId, iLeft, iRight, iUp, iDown, iTickSize) {
- return new YAHOO.widget.Slider(sBGElId, sBGElId,
- new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, iLeft, iRight,
- iUp, iDown, iTickSize), "region");
-};
-
-/**
- * By default, animation is available if the animation library is detected.
- * @property YAHOO.widget.Slider.ANIM_AVAIL
- * @static
- * @type boolean
- */
-YAHOO.widget.Slider.ANIM_AVAIL = true;
-
-YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, {
-
- onAvailable: function() {
- var Event = YAHOO.util.Event;
- Event.on(this.id, "keydown", this.handleKeyDown, this, true);
- Event.on(this.id, "keypress", this.handleKeyPress, this, true);
- },
-
- handleKeyPress: function(e) {
- if (this.enableKeys) {
- var Event = YAHOO.util.Event;
- var kc = Event.getCharCode(e);
- switch (kc) {
- case 0x25: // left
- case 0x26: // up
- case 0x27: // right
- case 0x28: // down
- case 0x24: // home
- case 0x23: // end
- Event.preventDefault(e);
- break;
- default:
- }
- }
- },
-
- handleKeyDown: function(e) {
- if (this.enableKeys) {
- var Event = YAHOO.util.Event;
-
- var kc = Event.getCharCode(e), t=this.thumb;
- var h=this.getXValue(),v=this.getYValue();
-
- var horiz = false;
- var changeValue = true;
- switch (kc) {
-
- // left
- case 0x25: h -= this.keyIncrement; break;
-
- // up
- case 0x26: v -= this.keyIncrement; break;
-
- // right
- case 0x27: h += this.keyIncrement; break;
-
- // down
- case 0x28: v += this.keyIncrement; break;
-
- // home
- case 0x24: h = t.leftConstraint;
- v = t.topConstraint;
- break;
-
- // end
- case 0x23: h = t.rightConstraint;
- v = t.bottomConstraint;
- break;
-
- default: changeValue = false;
- }
-
- if (changeValue) {
- if (t._isRegion) {
- this.setRegionValue(h, v, true);
- } else {
- var newVal = (t._isHoriz) ? h : v;
- this.setValue(newVal, true);
- }
- Event.stopEvent(e);
- }
-
- }
- },
-
- /**
- * Initialization that sets up the value offsets once the elements are ready
- * @method setSliderStartState
- */
- setStartSliderState: function() {
-
-
- this.setThumbCenterPoint();
-
- /**
- * The basline position of the background element, used
- * to determine if the background has moved since the last
- * operation.
- * @property baselinePos
- * @type [int, int]
- */
- this.baselinePos = YAHOO.util.Dom.getXY(this.getEl());
-
- this.thumb.startOffset = this.thumb.getOffsetFromParent(this.baselinePos);
-
- if (this.thumb._isRegion) {
- if (this.deferredSetRegionValue) {
- this.setRegionValue.apply(this, this.deferredSetRegionValue, true);
- this.deferredSetRegionValue = null;
- } else {
- this.setRegionValue(0, 0, true);
- }
- } else {
- if (this.deferredSetValue) {
- this.setValue.apply(this, this.deferredSetValue, true);
- this.deferredSetValue = null;
- } else {
- this.setValue(0, true, true);
- }
- }
- },
-
- /**
- * When the thumb is available, we cache the centerpoint of the element so
- * we can position the element correctly when the background is clicked
- * @method setThumbCenterPoint
- */
- setThumbCenterPoint: function() {
-
- var el = this.thumb.getEl();
-
- if (el) {
- /**
- * The center of the slider element is stored so we can position
- * place it in the correct position when the background is clicked
- * @property thumbCenterPoint
- * @type {"x": int, "y": int}
- */
- this.thumbCenterPoint = {
- x: parseInt(el.offsetWidth/2, 10),
- y: parseInt(el.offsetHeight/2, 10)
- };
- }
-
- },
-
- /**
- * Locks the slider, overrides YAHOO.util.DragDrop
- * @method lock
- */
- lock: function() {
- this.thumb.lock();
- this.locked = true;
- },
-
- /**
- * Unlocks the slider, overrides YAHOO.util.DragDrop
- * @method unlock
- */
- unlock: function() {
- this.thumb.unlock();
- this.locked = false;
- },
-
- /**
- * Handles mouseup event on the slider background
- * @method thumbMouseUp
- * @private
- */
- thumbMouseUp: function() {
- if (!this.isLocked() && !this.moveComplete) {
- this.endMove();
- }
-
- },
-
- /**
- * Returns a reference to this slider's thumb
- * @method getThumb
- * @return {SliderThumb} this slider's thumb
- */
- getThumb: function() {
- return this.thumb;
- },
-
- /**
- * Try to focus the element when clicked so we can add
- * accessibility features
- * @method focus
- * @private
- */
- focus: function() {
-
- // Focus the background element if possible
- var el = this.getEl();
-
- if (el.focus) {
- try {
- el.focus();
- } catch(e) {
- // Prevent permission denied unhandled exception in FF that can
- // happen when setting focus while another element is handling
- // the blur. @TODO this is still writing to the error log
- // (unhandled error) in FF1.5 with strict error checking on.
- }
- }
-
- this.verifyOffset();
-
- if (this.isLocked()) {
- return false;
- } else {
- this.onSlideStart();
- return true;
- }
- },
-
- /**
- * Event that fires when the value of the slider has changed
- * @method onChange
- * @param {int} firstOffset the number of pixels the thumb has moved
- * from its start position. Normal horizontal and vertical sliders will only
- * have the firstOffset. Regions will have both, the first is the horizontal
- * offset, the second the vertical.
- * @param {int} secondOffset the y offset for region sliders
- * @deprecated use instance.subscribe("change") instead
- */
- onChange: function (firstOffset, secondOffset) {
- /* override me */
- },
-
- /**
- * Event that fires when the at the beginning of the slider thumb move
- * @method onSlideStart
- * @deprecated use instance.subscribe("slideStart") instead
- */
- onSlideStart: function () {
- /* override me */
- },
-
- /**
- * Event that fires at the end of a slider thumb move
- * @method onSliderEnd
- * @deprecated use instance.subscribe("slideEnd") instead
- */
- onSlideEnd: function () {
- /* override me */
- },
-
- /**
- * Returns the slider's thumb offset from the start position
- * @method getValue
- * @return {int} the current value
- */
- getValue: function () {
- return this.thumb.getValue();
- },
-
- /**
- * Returns the slider's thumb X offset from the start position
- * @method getXValue
- * @return {int} the current horizontal offset
- */
- getXValue: function () {
- return this.thumb.getXValue();
- },
-
- /**
- * Returns the slider's thumb Y offset from the start position
- * @method getYValue
- * @return {int} the current vertical offset
- */
- getYValue: function () {
- return this.thumb.getYValue();
- },
-
- /**
- * Internal handler for the slider thumb's onChange event
- * @method handleThumbChange
- * @private
- */
- handleThumbChange: function () {
- var t = this.thumb;
- if (t._isRegion) {
- t.onChange(t.getXValue(), t.getYValue());
- this.fireEvent("change", { x: t.getXValue(), y: t.getYValue() } );
- } else {
- t.onChange(t.getValue());
- this.fireEvent("change", t.getValue());
- }
-
- },
-
- /**
- * Provides a way to set the value of the slider in code.
- * @method setValue
- * @param {int} newOffset the number of pixels the thumb should be
- * positioned away from the initial start point
- * @param {boolean} skipAnim set to true to disable the animation
- * for this move action (but not others).
- * @param {boolean} force ignore the locked setting and set value anyway
- * @return {boolean} true if the move was performed, false if it failed
- */
- setValue: function(newOffset, skipAnim, force) {
-
- if (!this.thumb.available) {
- this.deferredSetValue = arguments;
- return false;
- }
-
- if (this.isLocked() && !force) {
- return false;
- }
-
- if ( isNaN(newOffset) ) {
- return false;
- }
-
- var t = this.thumb;
- var newX, newY;
- this.verifyOffset();
- if (t._isRegion) {
- return false;
- } else if (t._isHoriz) {
- this.onSlideStart();
- // this.fireEvent("slideStart");
- newX = t.initPageX + newOffset + this.thumbCenterPoint.x;
- this.moveThumb(newX, t.initPageY, skipAnim);
- } else {
- this.onSlideStart();
- // this.fireEvent("slideStart");
- newY = t.initPageY + newOffset + this.thumbCenterPoint.y;
- this.moveThumb(t.initPageX, newY, skipAnim);
- }
-
- return true;
- },
-
- /**
- * Provides a way to set the value of the region slider in code.
- * @method setRegionValue
- * @param {int} newOffset the number of pixels the thumb should be
- * positioned away from the initial start point (x axis for region)
- * @param {int} newOffset2 the number of pixels the thumb should be
- * positioned away from the initial start point (y axis for region)
- * @param {boolean} skipAnim set to true to disable the animation
- * for this move action (but not others).
- * @param {boolean} force ignore the locked setting and set value anyway
- * @return {boolean} true if the move was performed, false if it failed
- */
- setRegionValue: function(newOffset, newOffset2, skipAnim) {
-
- if (!this.thumb.available) {
- this.deferredSetRegionValue = arguments;
- return false;
- }
-
- if (this.isLocked() && !force) {
- return false;
- }
-
- if ( isNaN(newOffset) ) {
- return false;
- }
-
- var t = this.thumb;
- if (t._isRegion) {
- this.onSlideStart();
- var newX = t.initPageX + newOffset + this.thumbCenterPoint.x;
- var newY = t.initPageY + newOffset2 + this.thumbCenterPoint.y;
- this.moveThumb(newX, newY, skipAnim);
- return true;
- }
-
- return false;
-
- },
-
- /**
- * Checks the background position element position. If it has moved from the
- * baseline position, the constraints for the thumb are reset
- * @method verifyOffset
- * @return {boolean} True if the offset is the same as the baseline.
- */
- verifyOffset: function() {
-
- var newPos = YAHOO.util.Dom.getXY(this.getEl());
-
- if (newPos[0] != this.baselinePos[0] || newPos[1] != this.baselinePos[1]) {
- this.thumb.resetConstraints();
- this.baselinePos = newPos;
- return false;
- }
-
- return true;
- },
-
- /**
- * Move the associated slider moved to a timeout to try to get around the
- * mousedown stealing moz does when I move the slider element between the
- * cursor and the background during the mouseup event
- * @method moveThumb
- * @param {int} x the X coordinate of the click
- * @param {int} y the Y coordinate of the click
- * @param {boolean} skipAnim don't animate if the move happend onDrag
- * @private
- */
- moveThumb: function(x, y, skipAnim) {
-
-
- var t = this.thumb;
- var self = this;
-
- if (!t.available) {
- return;
- }
-
-
- // this.verifyOffset();
-
- t.setDelta(this.thumbCenterPoint.x, this.thumbCenterPoint.y);
-
- var _p = t.getTargetCoord(x, y);
- var p = [_p.x, _p.y];
-
- this.fireEvent("slideStart");
-
- if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && t._graduated && !skipAnim) {
- // this.thumb._animating = true;
- this.lock();
-
- setTimeout( function() { self.moveOneTick(p); }, this.tickPause );
-
- } else if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && !skipAnim) {
-
- // this.thumb._animating = true;
- this.lock();
-
- var oAnim = new YAHOO.util.Motion(
- t.id, { points: { to: p } },
- this.animationDuration,
- YAHOO.util.Easing.easeOut );
-
- oAnim.onComplete.subscribe( function() { self.endMove(); } );
- oAnim.animate();
- } else {
- t.setDragElPos(x, y);
- // this.fireEvents();
- this.endMove();
- }
- },
-
- /**
- * Move the slider one tick mark towards its final coordinate. Used
- * for the animation when tick marks are defined
- * @method moveOneTick
- * @param {int[]} the destination coordinate
- * @private
- */
- moveOneTick: function(finalCoord) {
-
- var t = this.thumb;
- var curCoord = YAHOO.util.Dom.getXY(t.getEl());
- var tmp;
-
- // var thresh = Math.min(t.tickSize + (Math.floor(t.tickSize/2)), 10);
- // var thresh = 10;
- // var thresh = t.tickSize + (Math.floor(t.tickSize/2));
-
- var nextCoord = null;
-
- if (t._isRegion) {
- nextCoord = this._getNextX(curCoord, finalCoord);
- var tmpX = (nextCoord) ? nextCoord[0] : curCoord[0];
- nextCoord = this._getNextY([tmpX, curCoord[1]], finalCoord);
-
- } else if (t._isHoriz) {
- nextCoord = this._getNextX(curCoord, finalCoord);
- } else {
- nextCoord = this._getNextY(curCoord, finalCoord);
- }
-
-
- if (nextCoord) {
-
- // move to the next coord
- // YAHOO.util.Dom.setXY(t.getEl(), nextCoord);
-
- // var el = t.getEl();
- // YAHOO.util.Dom.setStyle(el, "left", (nextCoord[0] + this.thumb.deltaSetXY[0]) + "px");
- // YAHOO.util.Dom.setStyle(el, "top", (nextCoord[1] + this.thumb.deltaSetXY[1]) + "px");
-
- this.thumb.alignElWithMouse(t.getEl(), nextCoord[0], nextCoord[1]);
-
- // check if we are in the final position, if not make a recursive call
- if (!(nextCoord[0] == finalCoord[0] && nextCoord[1] == finalCoord[1])) {
- var self = this;
- setTimeout(function() { self.moveOneTick(finalCoord); },
- this.tickPause);
- } else {
- this.endMove();
- }
- } else {
- this.endMove();
- }
-
- //this.tickPause = Math.round(this.tickPause/2);
- },
-
- /**
- * Returns the next X tick value based on the current coord and the target coord.
- * @method _getNextX
- * @private
- */
- _getNextX: function(curCoord, finalCoord) {
- var t = this.thumb;
- var thresh;
- var tmp = [];
- var nextCoord = null;
- if (curCoord[0] > finalCoord[0]) {
- thresh = t.tickSize - this.thumbCenterPoint.x;
- tmp = t.getTargetCoord( curCoord[0] - thresh, curCoord[1] );
- nextCoord = [tmp.x, tmp.y];
- } else if (curCoord[0] < finalCoord[0]) {
- thresh = t.tickSize + this.thumbCenterPoint.x;
- tmp = t.getTargetCoord( curCoord[0] + thresh, curCoord[1] );
- nextCoord = [tmp.x, tmp.y];
- } else {
- // equal, do nothing
- }
-
- return nextCoord;
- },
-
- /**
- * Returns the next Y tick value based on the current coord and the target coord.
- * @method _getNextY
- * @private
- */
- _getNextY: function(curCoord, finalCoord) {
- var t = this.thumb;
- var thresh;
- var tmp = [];
- var nextCoord = null;
-
- if (curCoord[1] > finalCoord[1]) {
- thresh = t.tickSize - this.thumbCenterPoint.y;
- tmp = t.getTargetCoord( curCoord[0], curCoord[1] - thresh );
- nextCoord = [tmp.x, tmp.y];
- } else if (curCoord[1] < finalCoord[1]) {
- thresh = t.tickSize + this.thumbCenterPoint.y;
- tmp = t.getTargetCoord( curCoord[0], curCoord[1] + thresh );
- nextCoord = [tmp.x, tmp.y];
- } else {
- // equal, do nothing
- }
-
- return nextCoord;
- },
-
- /**
- * Resets the constraints before moving the thumb.
- * @method b4MouseDown
- * @private
- */
- b4MouseDown: function(e) {
- this.thumb.autoOffset();
- this.thumb.resetConstraints();
- },
-
- /**
- * Handles the mousedown event for the slider background
- * @method onMouseDown
- * @private
- */
- onMouseDown: function(e) {
- // this.resetConstraints(true);
- // this.thumb.resetConstraints(true);
-
- if (! this.isLocked() && this.backgroundEnabled) {
- var x = YAHOO.util.Event.getPageX(e);
- var y = YAHOO.util.Event.getPageY(e);
-
- this.focus();
- this.moveThumb(x, y);
- }
-
- },
-
- /**
- * Handles the onDrag event for the slider background
- * @method onDrag
- * @private
- */
- onDrag: function(e) {
- if (! this.isLocked()) {
- var x = YAHOO.util.Event.getPageX(e);
- var y = YAHOO.util.Event.getPageY(e);
- this.moveThumb(x, y, true);
- }
- },
-
- /**
- * Fired when the slider movement ends
- * @method endMove
- * @private
- */
- endMove: function () {
- // this._animating = false;
- this.unlock();
- this.moveComplete = true;
- this.fireEvents();
- },
-
- /**
- * Fires the change event if the value has been changed. Ignored if we are in
- * the middle of an animation as the event will fire when the animation is
- * complete
- * @method fireEvents
- * @private
- */
- fireEvents: function () {
-
- var t = this.thumb;
-
- t.cachePosition();
-
- if (! this.isLocked()) {
- if (t._isRegion) {
- var newX = t.getXValue();
- var newY = t.getYValue();
-
- if (newX != this.previousX || newY != this.previousY) {
- this.onChange(newX, newY);
- this.fireEvent("change", { x: newX, y: newY });
- }
-
- this.previousX = newX;
- this.previousY = newY;
-
- } else {
- var newVal = t.getValue();
- if (newVal != this.previousVal) {
- this.onChange( newVal );
- this.fireEvent("change", newVal);
- }
- this.previousVal = newVal;
- }
-
- if (this.moveComplete) {
- this.onSlideEnd();
- this.fireEvent("slideEnd");
- this.moveComplete = false;
- }
-
- }
- },
-
- /**
- * Slider toString
- * @method toString
- * @return {string} string representation of the instance
- */
- toString: function () {
- return ("Slider (" + this.type +") " + this.id);
- }
-
-});
-
-YAHOO.augment(YAHOO.widget.Slider, YAHOO.util.EventProvider);
-
-/**
- * A drag and drop implementation to be used as the thumb of a slider.
- * @class SliderThumb
- * @extends YAHOO.util.DD
- * @constructor
- * @param {String} id the id of the slider html element
- * @param {String} sGroup the group of related DragDrop items
- * @param {int} iLeft the number of pixels the element can move left
- * @param {int} iRight the number of pixels the element can move right
- * @param {int} iUp the number of pixels the element can move up
- * @param {int} iDown the number of pixels the element can move down
- * @param {int} iTickSize optional parameter for specifying that the element
- * should move a certain number pixels at a time.
- */
-YAHOO.widget.SliderThumb = function(id, sGroup, iLeft, iRight, iUp, iDown, iTickSize) {
-
- if (id) {
- this.init(id, sGroup);
-
- /**
- * The id of the thumbs parent HTML element (the slider background
- * element).
- * @property parentElId
- * @type string
- */
- this.parentElId = sGroup;
- }
-
- //this.removeInvalidHandleType("A");
-
-
- /**
- * Overrides the isTarget property in YAHOO.util.DragDrop
- * @property isTarget
- * @private
- */
- this.isTarget = false;
-
- /**
- * The tick size for this slider
- * @property tickSize
- * @type int
- * @private
- */
- this.tickSize = iTickSize;
-
- /**
- * Informs the drag and drop util that the offsets should remain when
- * resetting the constraints. This preserves the slider value when
- * the constraints are reset
- * @property maintainOffset
- * @type boolean
- * @private
- */
- this.maintainOffset = true;
-
- this.initSlider(iLeft, iRight, iUp, iDown, iTickSize);
-
- /**
- * Turns off the autoscroll feature in drag and drop
- * @property scroll
- * @private
- */
- this.scroll = false;
-
-};
-
-YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, {
-
- /**
- * The (X and Y) difference between the thumb location and its parent
- * (the slider background) when the control is instantiated.
- * @property startOffset
- * @type [int, int]
- */
- startOffset: null,
-
- /**
- * Flag used to figure out if this is a horizontal or vertical slider
- * @property _isHoriz
- * @type boolean
- * @private
- */
- _isHoriz: false,
-
- /**
- * Cache the last value so we can check for change
- * @property _prevVal
- * @type int
- * @private
- */
- _prevVal: 0,
-
- /**
- * The slider is _graduated if there is a tick interval defined
- * @property _graduated
- * @type boolean
- * @private
- */
- _graduated: false,
-
- /**
- * Returns the difference between the location of the thumb and its parent.
- * @method getOffsetFromParent
- * @param {[int, int]} parentPos Optionally accepts the position of the parent
- * @type [int, int]
- */
- getOffsetFromParent: function(parentPos) {
- var myPos = YAHOO.util.Dom.getXY(this.getEl());
- var ppos = parentPos || YAHOO.util.Dom.getXY(this.parentElId);
-
- return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ];
- },
-
- /**
- * Set up the slider, must be called in the constructor of all subclasses
- * @method initSlider
- * @param {int} iLeft the number of pixels the element can move left
- * @param {int} iRight the number of pixels the element can move right
- * @param {int} iUp the number of pixels the element can move up
- * @param {int} iDown the number of pixels the element can move down
- * @param {int} iTickSize the width of the tick interval.
- */
- initSlider: function (iLeft, iRight, iUp, iDown, iTickSize) {
-
- this.setXConstraint(iLeft, iRight, iTickSize);
- this.setYConstraint(iUp, iDown, iTickSize);
-
- if (iTickSize && iTickSize > 1) {
- this._graduated = true;
- }
-
- this._isHoriz = (iLeft || iRight);
- this._isVert = (iUp || iDown);
- this._isRegion = (this._isHoriz && this._isVert);
-
- },
-
- /**
- * Clear's the slider's ticks
- * @method clearTicks
- */
- clearTicks: function () {
- YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);
- this._graduated = false;
- },
-
- /**
- * Gets the current offset from the element's start position in
- * pixels.
- * @method getValue
- * @return {int} the number of pixels (positive or negative) the
- * slider has moved from the start position.
- */
- getValue: function () {
- if (!this.available) { return 0; }
- var val = (this._isHoriz) ? this.getXValue() : this.getYValue();
- return val;
- },
-
- /**
- * Gets the current X offset from the element's start position in
- * pixels.
- * @method getXValue
- * @return {int} the number of pixels (positive or negative) the
- * slider has moved horizontally from the start position.
- */
- getXValue: function () {
- if (!this.available) { return 0; }
- var newOffset = this.getOffsetFromParent();
- return (newOffset[0] - this.startOffset[0]);
- },
-
- /**
- * Gets the current Y offset from the element's start position in
- * pixels.
- * @method getYValue
- * @return {int} the number of pixels (positive or negative) the
- * slider has moved vertically from the start position.
- */
- getYValue: function () {
- if (!this.available) { return 0; }
- var newOffset = this.getOffsetFromParent();
- return (newOffset[1] - this.startOffset[1]);
- },
-
- /**
- * Thumb toString
- * @method toString
- * @return {string} string representation of the instance
- */
- toString: function () {
- return "SliderThumb " + this.id;
- },
-
- /**
- * The onchange event for the handle/thumb is delegated to the YAHOO.widget.Slider
- * instance it belongs to.
- * @method onChange
- * @private
- */
- onChange: function (x, y) {
- }
-
-});
-
-if ("undefined" == typeof YAHOO.util.Anim) {
- YAHOO.widget.Slider.ANIM_AVAIL = false;
-}
-
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+ * The Slider component is a UI control that enables the user to adjust
+ * values in a finite range along one or two axes. Typically, the Slider
+ * control is used in a web application as a rich, visual replacement
+ * for an input box that takes a number as input. The Slider control can
+ * also easily accommodate a second dimension, providing x,y output for
+ * a selection point chosen from a rectangular region.
+ *
+ * @module slider
+ * @title Slider Widget
+ * @namespace YAHOO.widget
+ * @requires yahoo,dom,dragdrop,event
+ * @optional animation
+ */
+
+/**
+ * A DragDrop implementation that can be used as a background for a
+ * slider. It takes a reference to the thumb instance
+ * so it can delegate some of the events to it. The goal is to make the
+ * thumb jump to the location on the background when the background is
+ * clicked.
+ *
+ * @class Slider
+ * @extends YAHOO.util.DragDrop
+ * @constructor
+ * @param {String} id The id of the element linked to this instance
+ * @param {String} sGroup The group of related DragDrop items
+ * @param {String} sType The type of slider (horiz, vert, region)
+ */
+YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) {
+ if (sElementId) {
+
+ /**
+ * The type of the slider (horiz, vert, region)
+ * @property type
+ * @type string
+ */
+ this.type = sType;
+
+ this.init(sElementId, sGroup, true);
+
+ //this.removeInvalidHandleType("A");
+
+
+ var self = this;
+
+ /**
+ * Event the fires when the value of the control changes. If
+ * the control is animated the event will fire every point
+ * along the way.
+ * @event change
+ * @param {int} new
+ * @param {int} firstOffset the number of pixels the thumb has moved
+ * from its start position. Normal horizontal and vertical sliders will only
+ * have the firstOffset. Regions will have both, the first is the horizontal
+ * offset, the second the vertical.
+ * @param {int} secondOffset the y offset for region sliders
+ */
+ this.createEvent("change", this);
+
+ /**
+ * Event that fires at the end of a slider thumb move.
+ * @event slideStart
+ */
+ this.createEvent("slideStart", this);
+
+ /**
+ * Event that fires at the end of a slider thumb move
+ * @event slideEnd
+ */
+ this.createEvent("slideEnd", this);
+
+ /**
+ * A YAHOO.widget.SliderThumb instance that we will use to
+ * reposition the thumb when the background is clicked
+ * @property thumb
+ * @type YAHOO.widget.SliderThumb
+ */
+ this.thumb = oThumb;
+
+ // add handler for the handle onchange event
+ oThumb.onChange = function() {
+ self.handleThumbChange();
+ };
+
+ /**
+ * Overrides the isTarget property in YAHOO.util.DragDrop
+ * @property isTarget
+ * @private
+ */
+ this.isTarget = false;
+
+ /**
+ * Flag that determines if the thumb will animate when moved
+ * @property animate
+ * @type boolean
+ */
+ this.animate = YAHOO.widget.Slider.ANIM_AVAIL;
+
+ /**
+ * Set to false to disable a background click thumb move
+ * @property backgroundEnabled
+ * @type boolean
+ */
+ this.backgroundEnabled = true;
+
+ /**
+ * Adjustment factor for tick animation, the more ticks, the
+ * faster the animation (by default)
+ * @property tickPause
+ * @type int
+ */
+ this.tickPause = 40;
+
+ /**
+ * Enables the arrow, home and end keys, defaults to true.
+ * @property enableKeys
+ * @type boolean
+ */
+ this.enableKeys = true;
+
+ /**
+ * Specifies the number of pixels the arrow keys will move the slider.
+ * Default is 25.
+ * @property keyIncrement
+ * @type int
+ */
+ this.keyIncrement = 20;
+
+ /**
+ * moveComplete is set to true when the slider has moved to its final
+ * destination. For animated slider, this value can be checked in
+ * the onChange handler to make it possible to execute logic only
+ * when the move is complete rather than at all points along the way.
+ *
+ * @property moveComplete
+ * @type Boolean
+ */
+ this.moveComplete = true;
+
+ /**
+ * If animation is configured, specifies the length of the animation
+ * in seconds.
+ * @property animationDuration
+ * @type int
+ * @default 0.2
+ */
+ this.animationDuration = 0.2;
+
+ if (oThumb._isHoriz && oThumb.xTicks && oThumb.xTicks.length) {
+ this.tickPause = Math.round(360 / oThumb.xTicks.length);
+ } else if (oThumb.yTicks && oThumb.yTicks.length) {
+ this.tickPause = Math.round(360 / oThumb.yTicks.length);
+ }
+
+
+ // delegate thumb methods
+ oThumb.onMouseDown = function () { return self.focus(); };
+ //oThumb.b4MouseDown = function () { return self.b4MouseDown(); };
+ // oThumb.lock = function() { self.lock(); };
+ // oThumb.unlock = function() { self.unlock(); };
+ oThumb.onMouseUp = function() { self.thumbMouseUp(); };
+ oThumb.onDrag = function() { self.fireEvents(); };
+ oThumb.onAvailable = function() { return self.setStartSliderState(); };
+ }
+};
+
+/**
+ * Factory method for creating a horizontal slider
+ * @method YAHOO.widget.Slider.getHorizSlider
+ * @static
+ * @param {String} sBGElId the id of the slider's background element
+ * @param {String} sHandleElId the id of the thumb element
+ * @param {int} iLeft the number of pixels the element can move left
+ * @param {int} iRight the number of pixels the element can move right
+ * @param {int} iTickSize optional parameter for specifying that the element
+ * should move a certain number pixels at a time.
+ * @return {Slider} a horizontal slider control
+ */
+YAHOO.widget.Slider.getHorizSlider =
+ function (sBGElId, sHandleElId, iLeft, iRight, iTickSize) {
+ return new YAHOO.widget.Slider(sBGElId, sBGElId,
+ new YAHOO.widget.SliderThumb(sHandleElId, sBGElId,
+ iLeft, iRight, 0, 0, iTickSize), "horiz");
+};
+
+/**
+ * Factory method for creating a vertical slider
+ * @method YAHOO.widget.Slider.getVertSlider
+ * @static
+ * @param {String} sBGElId the id of the slider's background element
+ * @param {String} sHandleElId the id of the thumb element
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize optional parameter for specifying that the element
+ * should move a certain number pixels at a time.
+ * @return {Slider} a vertical slider control
+ */
+YAHOO.widget.Slider.getVertSlider =
+ function (sBGElId, sHandleElId, iUp, iDown, iTickSize) {
+ return new YAHOO.widget.Slider(sBGElId, sBGElId,
+ new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0,
+ iUp, iDown, iTickSize), "vert");
+};
+
+/**
+ * Factory method for creating a slider region like the one in the color
+ * picker example
+ * @method YAHOO.widget.Slider.getSliderRegion
+ * @static
+ * @param {String} sBGElId the id of the slider's background element
+ * @param {String} sHandleElId the id of the thumb element
+ * @param {int} iLeft the number of pixels the element can move left
+ * @param {int} iRight the number of pixels the element can move right
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize optional parameter for specifying that the element
+ * should move a certain number pixels at a time.
+ * @return {Slider} a slider region control
+ */
+YAHOO.widget.Slider.getSliderRegion =
+ function (sBGElId, sHandleElId, iLeft, iRight, iUp, iDown, iTickSize) {
+ return new YAHOO.widget.Slider(sBGElId, sBGElId,
+ new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, iLeft, iRight,
+ iUp, iDown, iTickSize), "region");
+};
+
+/**
+ * By default, animation is available if the animation library is detected.
+ * @property YAHOO.widget.Slider.ANIM_AVAIL
+ * @static
+ * @type boolean
+ */
+YAHOO.widget.Slider.ANIM_AVAIL = true;
+
+YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, {
+
+ onAvailable: function() {
+ var Event = YAHOO.util.Event;
+ Event.on(this.id, "keydown", this.handleKeyDown, this, true);
+ Event.on(this.id, "keypress", this.handleKeyPress, this, true);
+ },
+
+ handleKeyPress: function(e) {
+ if (this.enableKeys) {
+ var Event = YAHOO.util.Event;
+ var kc = Event.getCharCode(e);
+ switch (kc) {
+ case 0x25: // left
+ case 0x26: // up
+ case 0x27: // right
+ case 0x28: // down
+ case 0x24: // home
+ case 0x23: // end
+ Event.preventDefault(e);
+ break;
+ default:
+ }
+ }
+ },
+
+ handleKeyDown: function(e) {
+ if (this.enableKeys) {
+ var Event = YAHOO.util.Event;
+
+ var kc = Event.getCharCode(e), t=this.thumb;
+ var h=this.getXValue(),v=this.getYValue();
+
+ var horiz = false;
+ var changeValue = true;
+ switch (kc) {
+
+ // left
+ case 0x25: h -= this.keyIncrement; break;
+
+ // up
+ case 0x26: v -= this.keyIncrement; break;
+
+ // right
+ case 0x27: h += this.keyIncrement; break;
+
+ // down
+ case 0x28: v += this.keyIncrement; break;
+
+ // home
+ case 0x24: h = t.leftConstraint;
+ v = t.topConstraint;
+ break;
+
+ // end
+ case 0x23: h = t.rightConstraint;
+ v = t.bottomConstraint;
+ break;
+
+ default: changeValue = false;
+ }
+
+ if (changeValue) {
+ if (t._isRegion) {
+ this.setRegionValue(h, v, true);
+ } else {
+ var newVal = (t._isHoriz) ? h : v;
+ this.setValue(newVal, true);
+ }
+ Event.stopEvent(e);
+ }
+
+ }
+ },
+
+ /**
+ * Initialization that sets up the value offsets once the elements are ready
+ * @method setSliderStartState
+ */
+ setStartSliderState: function() {
+
+
+ this.setThumbCenterPoint();
+
+ /**
+ * The basline position of the background element, used
+ * to determine if the background has moved since the last
+ * operation.
+ * @property baselinePos
+ * @type [int, int]
+ */
+ this.baselinePos = YAHOO.util.Dom.getXY(this.getEl());
+
+ this.thumb.startOffset = this.thumb.getOffsetFromParent(this.baselinePos);
+
+ if (this.thumb._isRegion) {
+ if (this.deferredSetRegionValue) {
+ this.setRegionValue.apply(this, this.deferredSetRegionValue, true);
+ this.deferredSetRegionValue = null;
+ } else {
+ this.setRegionValue(0, 0, true);
+ }
+ } else {
+ if (this.deferredSetValue) {
+ this.setValue.apply(this, this.deferredSetValue, true);
+ this.deferredSetValue = null;
+ } else {
+ this.setValue(0, true, true);
+ }
+ }
+ },
+
+ /**
+ * When the thumb is available, we cache the centerpoint of the element so
+ * we can position the element correctly when the background is clicked
+ * @method setThumbCenterPoint
+ */
+ setThumbCenterPoint: function() {
+
+ var el = this.thumb.getEl();
+
+ if (el) {
+ /**
+ * The center of the slider element is stored so we can position
+ * place it in the correct position when the background is clicked
+ * @property thumbCenterPoint
+ * @type {"x": int, "y": int}
+ */
+ this.thumbCenterPoint = {
+ x: parseInt(el.offsetWidth/2, 10),
+ y: parseInt(el.offsetHeight/2, 10)
+ };
+ }
+
+ },
+
+ /**
+ * Locks the slider, overrides YAHOO.util.DragDrop
+ * @method lock
+ */
+ lock: function() {
+ this.thumb.lock();
+ this.locked = true;
+ },
+
+ /**
+ * Unlocks the slider, overrides YAHOO.util.DragDrop
+ * @method unlock
+ */
+ unlock: function() {
+ this.thumb.unlock();
+ this.locked = false;
+ },
+
+ /**
+ * Handles mouseup event on the slider background
+ * @method thumbMouseUp
+ * @private
+ */
+ thumbMouseUp: function() {
+ if (!this.isLocked() && !this.moveComplete) {
+ this.endMove();
+ }
+
+ },
+
+ /**
+ * Returns a reference to this slider's thumb
+ * @method getThumb
+ * @return {SliderThumb} this slider's thumb
+ */
+ getThumb: function() {
+ return this.thumb;
+ },
+
+ /**
+ * Try to focus the element when clicked so we can add
+ * accessibility features
+ * @method focus
+ * @private
+ */
+ focus: function() {
+
+ // Focus the background element if possible
+ var el = this.getEl();
+
+ if (el.focus) {
+ try {
+ el.focus();
+ } catch(e) {
+ // Prevent permission denied unhandled exception in FF that can
+ // happen when setting focus while another element is handling
+ // the blur. @TODO this is still writing to the error log
+ // (unhandled error) in FF1.5 with strict error checking on.
+ }
+ }
+
+ this.verifyOffset();
+
+ if (this.isLocked()) {
+ return false;
+ } else {
+ this.onSlideStart();
+ return true;
+ }
+ },
+
+ /**
+ * Event that fires when the value of the slider has changed
+ * @method onChange
+ * @param {int} firstOffset the number of pixels the thumb has moved
+ * from its start position. Normal horizontal and vertical sliders will only
+ * have the firstOffset. Regions will have both, the first is the horizontal
+ * offset, the second the vertical.
+ * @param {int} secondOffset the y offset for region sliders
+ * @deprecated use instance.subscribe("change") instead
+ */
+ onChange: function (firstOffset, secondOffset) {
+ /* override me */
+ },
+
+ /**
+ * Event that fires when the at the beginning of the slider thumb move
+ * @method onSlideStart
+ * @deprecated use instance.subscribe("slideStart") instead
+ */
+ onSlideStart: function () {
+ /* override me */
+ },
+
+ /**
+ * Event that fires at the end of a slider thumb move
+ * @method onSliderEnd
+ * @deprecated use instance.subscribe("slideEnd") instead
+ */
+ onSlideEnd: function () {
+ /* override me */
+ },
+
+ /**
+ * Returns the slider's thumb offset from the start position
+ * @method getValue
+ * @return {int} the current value
+ */
+ getValue: function () {
+ return this.thumb.getValue();
+ },
+
+ /**
+ * Returns the slider's thumb X offset from the start position
+ * @method getXValue
+ * @return {int} the current horizontal offset
+ */
+ getXValue: function () {
+ return this.thumb.getXValue();
+ },
+
+ /**
+ * Returns the slider's thumb Y offset from the start position
+ * @method getYValue
+ * @return {int} the current vertical offset
+ */
+ getYValue: function () {
+ return this.thumb.getYValue();
+ },
+
+ /**
+ * Internal handler for the slider thumb's onChange event
+ * @method handleThumbChange
+ * @private
+ */
+ handleThumbChange: function () {
+ var t = this.thumb;
+ if (t._isRegion) {
+ t.onChange(t.getXValue(), t.getYValue());
+ this.fireEvent("change", { x: t.getXValue(), y: t.getYValue() } );
+ } else {
+ t.onChange(t.getValue());
+ this.fireEvent("change", t.getValue());
+ }
+
+ },
+
+ /**
+ * Provides a way to set the value of the slider in code.
+ * @method setValue
+ * @param {int} newOffset the number of pixels the thumb should be
+ * positioned away from the initial start point
+ * @param {boolean} skipAnim set to true to disable the animation
+ * for this move action (but not others).
+ * @param {boolean} force ignore the locked setting and set value anyway
+ * @return {boolean} true if the move was performed, false if it failed
+ */
+ setValue: function(newOffset, skipAnim, force) {
+
+ if (!this.thumb.available) {
+ this.deferredSetValue = arguments;
+ return false;
+ }
+
+ if (this.isLocked() && !force) {
+ return false;
+ }
+
+ if ( isNaN(newOffset) ) {
+ return false;
+ }
+
+ var t = this.thumb;
+ var newX, newY;
+ this.verifyOffset();
+ if (t._isRegion) {
+ return false;
+ } else if (t._isHoriz) {
+ this.onSlideStart();
+ // this.fireEvent("slideStart");
+ newX = t.initPageX + newOffset + this.thumbCenterPoint.x;
+ this.moveThumb(newX, t.initPageY, skipAnim);
+ } else {
+ this.onSlideStart();
+ // this.fireEvent("slideStart");
+ newY = t.initPageY + newOffset + this.thumbCenterPoint.y;
+ this.moveThumb(t.initPageX, newY, skipAnim);
+ }
+
+ return true;
+ },
+
+ /**
+ * Provides a way to set the value of the region slider in code.
+ * @method setRegionValue
+ * @param {int} newOffset the number of pixels the thumb should be
+ * positioned away from the initial start point (x axis for region)
+ * @param {int} newOffset2 the number of pixels the thumb should be
+ * positioned away from the initial start point (y axis for region)
+ * @param {boolean} skipAnim set to true to disable the animation
+ * for this move action (but not others).
+ * @param {boolean} force ignore the locked setting and set value anyway
+ * @return {boolean} true if the move was performed, false if it failed
+ */
+ setRegionValue: function(newOffset, newOffset2, skipAnim) {
+
+ if (!this.thumb.available) {
+ this.deferredSetRegionValue = arguments;
+ return false;
+ }
+
+ if (this.isLocked() && !force) {
+ return false;
+ }
+
+ if ( isNaN(newOffset) ) {
+ return false;
+ }
+
+ var t = this.thumb;
+ if (t._isRegion) {
+ this.onSlideStart();
+ var newX = t.initPageX + newOffset + this.thumbCenterPoint.x;
+ var newY = t.initPageY + newOffset2 + this.thumbCenterPoint.y;
+ this.moveThumb(newX, newY, skipAnim);
+ return true;
+ }
+
+ return false;
+
+ },
+
+ /**
+ * Checks the background position element position. If it has moved from the
+ * baseline position, the constraints for the thumb are reset
+ * @method verifyOffset
+ * @return {boolean} True if the offset is the same as the baseline.
+ */
+ verifyOffset: function() {
+
+ var newPos = YAHOO.util.Dom.getXY(this.getEl());
+
+ if (newPos[0] != this.baselinePos[0] || newPos[1] != this.baselinePos[1]) {
+ this.thumb.resetConstraints();
+ this.baselinePos = newPos;
+ return false;
+ }
+
+ return true;
+ },
+
+ /**
+ * Move the associated slider moved to a timeout to try to get around the
+ * mousedown stealing moz does when I move the slider element between the
+ * cursor and the background during the mouseup event
+ * @method moveThumb
+ * @param {int} x the X coordinate of the click
+ * @param {int} y the Y coordinate of the click
+ * @param {boolean} skipAnim don't animate if the move happend onDrag
+ * @private
+ */
+ moveThumb: function(x, y, skipAnim) {
+
+
+ var t = this.thumb;
+ var self = this;
+
+ if (!t.available) {
+ return;
+ }
+
+
+ // this.verifyOffset();
+
+ t.setDelta(this.thumbCenterPoint.x, this.thumbCenterPoint.y);
+
+ var _p = t.getTargetCoord(x, y);
+ var p = [_p.x, _p.y];
+
+ this.fireEvent("slideStart");
+
+ if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && t._graduated && !skipAnim) {
+ // this.thumb._animating = true;
+ this.lock();
+
+ setTimeout( function() { self.moveOneTick(p); }, this.tickPause );
+
+ } else if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && !skipAnim) {
+
+ // this.thumb._animating = true;
+ this.lock();
+
+ var oAnim = new YAHOO.util.Motion(
+ t.id, { points: { to: p } },
+ this.animationDuration,
+ YAHOO.util.Easing.easeOut );
+
+ oAnim.onComplete.subscribe( function() { self.endMove(); } );
+ oAnim.animate();
+ } else {
+ t.setDragElPos(x, y);
+ // this.fireEvents();
+ this.endMove();
+ }
+ },
+
+ /**
+ * Move the slider one tick mark towards its final coordinate. Used
+ * for the animation when tick marks are defined
+ * @method moveOneTick
+ * @param {int[]} the destination coordinate
+ * @private
+ */
+ moveOneTick: function(finalCoord) {
+
+ var t = this.thumb;
+ var curCoord = YAHOO.util.Dom.getXY(t.getEl());
+ var tmp;
+
+ // var thresh = Math.min(t.tickSize + (Math.floor(t.tickSize/2)), 10);
+ // var thresh = 10;
+ // var thresh = t.tickSize + (Math.floor(t.tickSize/2));
+
+ var nextCoord = null;
+
+ if (t._isRegion) {
+ nextCoord = this._getNextX(curCoord, finalCoord);
+ var tmpX = (nextCoord) ? nextCoord[0] : curCoord[0];
+ nextCoord = this._getNextY([tmpX, curCoord[1]], finalCoord);
+
+ } else if (t._isHoriz) {
+ nextCoord = this._getNextX(curCoord, finalCoord);
+ } else {
+ nextCoord = this._getNextY(curCoord, finalCoord);
+ }
+
+
+ if (nextCoord) {
+
+ // move to the next coord
+ // YAHOO.util.Dom.setXY(t.getEl(), nextCoord);
+
+ // var el = t.getEl();
+ // YAHOO.util.Dom.setStyle(el, "left", (nextCoord[0] + this.thumb.deltaSetXY[0]) + "px");
+ // YAHOO.util.Dom.setStyle(el, "top", (nextCoord[1] + this.thumb.deltaSetXY[1]) + "px");
+
+ this.thumb.alignElWithMouse(t.getEl(), nextCoord[0], nextCoord[1]);
+
+ // check if we are in the final position, if not make a recursive call
+ if (!(nextCoord[0] == finalCoord[0] && nextCoord[1] == finalCoord[1])) {
+ var self = this;
+ setTimeout(function() { self.moveOneTick(finalCoord); },
+ this.tickPause);
+ } else {
+ this.endMove();
+ }
+ } else {
+ this.endMove();
+ }
+
+ //this.tickPause = Math.round(this.tickPause/2);
+ },
+
+ /**
+ * Returns the next X tick value based on the current coord and the target coord.
+ * @method _getNextX
+ * @private
+ */
+ _getNextX: function(curCoord, finalCoord) {
+ var t = this.thumb;
+ var thresh;
+ var tmp = [];
+ var nextCoord = null;
+ if (curCoord[0] > finalCoord[0]) {
+ thresh = t.tickSize - this.thumbCenterPoint.x;
+ tmp = t.getTargetCoord( curCoord[0] - thresh, curCoord[1] );
+ nextCoord = [tmp.x, tmp.y];
+ } else if (curCoord[0] < finalCoord[0]) {
+ thresh = t.tickSize + this.thumbCenterPoint.x;
+ tmp = t.getTargetCoord( curCoord[0] + thresh, curCoord[1] );
+ nextCoord = [tmp.x, tmp.y];
+ } else {
+ // equal, do nothing
+ }
+
+ return nextCoord;
+ },
+
+ /**
+ * Returns the next Y tick value based on the current coord and the target coord.
+ * @method _getNextY
+ * @private
+ */
+ _getNextY: function(curCoord, finalCoord) {
+ var t = this.thumb;
+ var thresh;
+ var tmp = [];
+ var nextCoord = null;
+
+ if (curCoord[1] > finalCoord[1]) {
+ thresh = t.tickSize - this.thumbCenterPoint.y;
+ tmp = t.getTargetCoord( curCoord[0], curCoord[1] - thresh );
+ nextCoord = [tmp.x, tmp.y];
+ } else if (curCoord[1] < finalCoord[1]) {
+ thresh = t.tickSize + this.thumbCenterPoint.y;
+ tmp = t.getTargetCoord( curCoord[0], curCoord[1] + thresh );
+ nextCoord = [tmp.x, tmp.y];
+ } else {
+ // equal, do nothing
+ }
+
+ return nextCoord;
+ },
+
+ /**
+ * Resets the constraints before moving the thumb.
+ * @method b4MouseDown
+ * @private
+ */
+ b4MouseDown: function(e) {
+ this.thumb.autoOffset();
+ this.thumb.resetConstraints();
+ },
+
+ /**
+ * Handles the mousedown event for the slider background
+ * @method onMouseDown
+ * @private
+ */
+ onMouseDown: function(e) {
+ // this.resetConstraints(true);
+ // this.thumb.resetConstraints(true);
+
+ if (! this.isLocked() && this.backgroundEnabled) {
+ var x = YAHOO.util.Event.getPageX(e);
+ var y = YAHOO.util.Event.getPageY(e);
+
+ this.focus();
+ this.moveThumb(x, y);
+ }
+
+ },
+
+ /**
+ * Handles the onDrag event for the slider background
+ * @method onDrag
+ * @private
+ */
+ onDrag: function(e) {
+ if (! this.isLocked()) {
+ var x = YAHOO.util.Event.getPageX(e);
+ var y = YAHOO.util.Event.getPageY(e);
+ this.moveThumb(x, y, true);
+ }
+ },
+
+ /**
+ * Fired when the slider movement ends
+ * @method endMove
+ * @private
+ */
+ endMove: function () {
+ // this._animating = false;
+ this.unlock();
+ this.moveComplete = true;
+ this.fireEvents();
+ },
+
+ /**
+ * Fires the change event if the value has been changed. Ignored if we are in
+ * the middle of an animation as the event will fire when the animation is
+ * complete
+ * @method fireEvents
+ * @private
+ */
+ fireEvents: function () {
+
+ var t = this.thumb;
+
+ t.cachePosition();
+
+ if (! this.isLocked()) {
+ if (t._isRegion) {
+ var newX = t.getXValue();
+ var newY = t.getYValue();
+
+ if (newX != this.previousX || newY != this.previousY) {
+ this.onChange(newX, newY);
+ this.fireEvent("change", { x: newX, y: newY });
+ }
+
+ this.previousX = newX;
+ this.previousY = newY;
+
+ } else {
+ var newVal = t.getValue();
+ if (newVal != this.previousVal) {
+ this.onChange( newVal );
+ this.fireEvent("change", newVal);
+ }
+ this.previousVal = newVal;
+ }
+
+ if (this.moveComplete) {
+ this.onSlideEnd();
+ this.fireEvent("slideEnd");
+ this.moveComplete = false;
+ }
+
+ }
+ },
+
+ /**
+ * Slider toString
+ * @method toString
+ * @return {string} string representation of the instance
+ */
+ toString: function () {
+ return ("Slider (" + this.type +") " + this.id);
+ }
+
+});
+
+YAHOO.augment(YAHOO.widget.Slider, YAHOO.util.EventProvider);
+
+/**
+ * A drag and drop implementation to be used as the thumb of a slider.
+ * @class SliderThumb
+ * @extends YAHOO.util.DD
+ * @constructor
+ * @param {String} id the id of the slider html element
+ * @param {String} sGroup the group of related DragDrop items
+ * @param {int} iLeft the number of pixels the element can move left
+ * @param {int} iRight the number of pixels the element can move right
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize optional parameter for specifying that the element
+ * should move a certain number pixels at a time.
+ */
+YAHOO.widget.SliderThumb = function(id, sGroup, iLeft, iRight, iUp, iDown, iTickSize) {
+
+ if (id) {
+ this.init(id, sGroup);
+
+ /**
+ * The id of the thumbs parent HTML element (the slider background
+ * element).
+ * @property parentElId
+ * @type string
+ */
+ this.parentElId = sGroup;
+ }
+
+ //this.removeInvalidHandleType("A");
+
+
+ /**
+ * Overrides the isTarget property in YAHOO.util.DragDrop
+ * @property isTarget
+ * @private
+ */
+ this.isTarget = false;
+
+ /**
+ * The tick size for this slider
+ * @property tickSize
+ * @type int
+ * @private
+ */
+ this.tickSize = iTickSize;
+
+ /**
+ * Informs the drag and drop util that the offsets should remain when
+ * resetting the constraints. This preserves the slider value when
+ * the constraints are reset
+ * @property maintainOffset
+ * @type boolean
+ * @private
+ */
+ this.maintainOffset = true;
+
+ this.initSlider(iLeft, iRight, iUp, iDown, iTickSize);
+
+ /**
+ * Turns off the autoscroll feature in drag and drop
+ * @property scroll
+ * @private
+ */
+ this.scroll = false;
+
+};
+
+YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, {
+
+ /**
+ * The (X and Y) difference between the thumb location and its parent
+ * (the slider background) when the control is instantiated.
+ * @property startOffset
+ * @type [int, int]
+ */
+ startOffset: null,
+
+ /**
+ * Flag used to figure out if this is a horizontal or vertical slider
+ * @property _isHoriz
+ * @type boolean
+ * @private
+ */
+ _isHoriz: false,
+
+ /**
+ * Cache the last value so we can check for change
+ * @property _prevVal
+ * @type int
+ * @private
+ */
+ _prevVal: 0,
+
+ /**
+ * The slider is _graduated if there is a tick interval defined
+ * @property _graduated
+ * @type boolean
+ * @private
+ */
+ _graduated: false,
+
+ /**
+ * Returns the difference between the location of the thumb and its parent.
+ * @method getOffsetFromParent
+ * @param {[int, int]} parentPos Optionally accepts the position of the parent
+ * @type [int, int]
+ */
+ getOffsetFromParent: function(parentPos) {
+ var myPos = YAHOO.util.Dom.getXY(this.getEl());
+ var ppos = parentPos || YAHOO.util.Dom.getXY(this.parentElId);
+
+ return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ];
+ },
+
+ /**
+ * Set up the slider, must be called in the constructor of all subclasses
+ * @method initSlider
+ * @param {int} iLeft the number of pixels the element can move left
+ * @param {int} iRight the number of pixels the element can move right
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize the width of the tick interval.
+ */
+ initSlider: function (iLeft, iRight, iUp, iDown, iTickSize) {
+
+ this.setXConstraint(iLeft, iRight, iTickSize);
+ this.setYConstraint(iUp, iDown, iTickSize);
+
+ if (iTickSize && iTickSize > 1) {
+ this._graduated = true;
+ }
+
+ this._isHoriz = (iLeft || iRight);
+ this._isVert = (iUp || iDown);
+ this._isRegion = (this._isHoriz && this._isVert);
+
+ },
+
+ /**
+ * Clear's the slider's ticks
+ * @method clearTicks
+ */
+ clearTicks: function () {
+ YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);
+ this._graduated = false;
+ },
+
+ /**
+ * Gets the current offset from the element's start position in
+ * pixels.
+ * @method getValue
+ * @return {int} the number of pixels (positive or negative) the
+ * slider has moved from the start position.
+ */
+ getValue: function () {
+ if (!this.available) { return 0; }
+ var val = (this._isHoriz) ? this.getXValue() : this.getYValue();
+ return val;
+ },
+
+ /**
+ * Gets the current X offset from the element's start position in
+ * pixels.
+ * @method getXValue
+ * @return {int} the number of pixels (positive or negative) the
+ * slider has moved horizontally from the start position.
+ */
+ getXValue: function () {
+ if (!this.available) { return 0; }
+ var newOffset = this.getOffsetFromParent();
+ return (newOffset[0] - this.startOffset[0]);
+ },
+
+ /**
+ * Gets the current Y offset from the element's start position in
+ * pixels.
+ * @method getYValue
+ * @return {int} the number of pixels (positive or negative) the
+ * slider has moved vertically from the start position.
+ */
+ getYValue: function () {
+ if (!this.available) { return 0; }
+ var newOffset = this.getOffsetFromParent();
+ return (newOffset[1] - this.startOffset[1]);
+ },
+
+ /**
+ * Thumb toString
+ * @method toString
+ * @return {string} string representation of the instance
+ */
+ toString: function () {
+ return "SliderThumb " + this.id;
+ },
+
+ /**
+ * The onchange event for the handle/thumb is delegated to the YAHOO.widget.Slider
+ * instance it belongs to.
+ * @method onChange
+ * @private
+ */
+ onChange: function (x, y) {
+ }
+
+});
+
+if ("undefined" == typeof YAHOO.util.Anim) {
+ YAHOO.widget.Slider.ANIM_AVAIL = false;
+}
+
diff --git a/thirdpartyjs/yui/tabview/README b/thirdpartyjs/yui/tabview/README
index b24caa0..064d073 100644
--- a/thirdpartyjs/yui/tabview/README
+++ b/thirdpartyjs/yui/tabview/README
@@ -1,6 +1,6 @@
-Tabview Release Notes
-
-*** version 0.12.0 ***
-
-* Initial release
-
+Tabview Release Notes
+
+*** version 0.12.0 ***
+
+* Initial release
+
diff --git a/thirdpartyjs/yui/tabview/assets/border_tabs.css b/thirdpartyjs/yui/tabview/assets/border_tabs.css
index 7a1bd32..c9fc5ea 100644
--- a/thirdpartyjs/yui/tabview/assets/border_tabs.css
+++ b/thirdpartyjs/yui/tabview/assets/border_tabs.css
@@ -1,44 +1,44 @@
-.yui-navset .yui-nav li a, .yui-navset .yui-content {
- border:1px solid #000; /* label and content borders */
-}
-
-.yui-navset .yui-nav .selected a, .yui-navset .yui-nav a:hover, .yui-navset .yui-content {
- background-color:#f6f7ee; /* active tab, tab hover, and content bgcolor */
-}
-
-.yui-navset-top .yui-nav .selected a {
- border-bottom:0; /* no bottom border for active tab */
- padding-bottom:1px; /* to match height of other tabs */
-}
-
-.yui-navset-top .yui-content {
- margin-top:-1px; /* for active tab overlap */
-}
-
-.yui-navset-bottom .yui-nav .selected a {
- border-top:0; /* no bottom border for active tab */
- padding-top:1px; /* to match height of other tabs */
-}
-
-.yui-navset-bottom .yui-content {
- margin-bottom:-1px; /* for active tab overlap */
-}
-
-.yui-navset-left .yui-nav li.selected a {
- border-right:0; /* no bottom border for active tab */
- padding-right:1px; /* to match height of other tabs */
-}
-
-.yui-navset-left .yui-content {
- margin-left:-1px; /* for active tab overlap */
-}
-
-.yui-navset-right .yui-nav li.selected a {
- border-left:0; /* no bottom border for active tab */
- padding-left:1px; /* to match height of other tabs */
-}
-
-.yui-navset-right .yui-content {
- margin-right:-1px; /* for active tab overlap */
- *margin-right:0; /* except IE */
+.yui-navset .yui-nav li a, .yui-navset .yui-content {
+ border:1px solid #000; /* label and content borders */
+}
+
+.yui-navset .yui-nav .selected a, .yui-navset .yui-nav a:hover, .yui-navset .yui-content {
+ background-color:#f6f7ee; /* active tab, tab hover, and content bgcolor */
+}
+
+.yui-navset-top .yui-nav .selected a {
+ border-bottom:0; /* no bottom border for active tab */
+ padding-bottom:1px; /* to match height of other tabs */
+}
+
+.yui-navset-top .yui-content {
+ margin-top:-1px; /* for active tab overlap */
+}
+
+.yui-navset-bottom .yui-nav .selected a {
+ border-top:0; /* no bottom border for active tab */
+ padding-top:1px; /* to match height of other tabs */
+}
+
+.yui-navset-bottom .yui-content {
+ margin-bottom:-1px; /* for active tab overlap */
+}
+
+.yui-navset-left .yui-nav li.selected a {
+ border-right:0; /* no bottom border for active tab */
+ padding-right:1px; /* to match height of other tabs */
+}
+
+.yui-navset-left .yui-content {
+ margin-left:-1px; /* for active tab overlap */
+}
+
+.yui-navset-right .yui-nav li.selected a {
+ border-left:0; /* no bottom border for active tab */
+ padding-left:1px; /* to match height of other tabs */
+}
+
+.yui-navset-right .yui-content {
+ margin-right:-1px; /* for active tab overlap */
+ *margin-right:0; /* except IE */
}
\ No newline at end of file
diff --git a/thirdpartyjs/yui/tabview/assets/tabs.css b/thirdpartyjs/yui/tabview/assets/tabs.css
index da8ef13..76f616d 100644
--- a/thirdpartyjs/yui/tabview/assets/tabs.css
+++ b/thirdpartyjs/yui/tabview/assets/tabs.css
@@ -1,66 +1,66 @@
-/* default space between tabs */
-.yui-navset-top .yui-nav li, .yui-navset-bottom .yui-nav li {
- margin-right:0.5em; /* horizontal tabs */
-}
-.yui-navset-left .yui-nav li, .yui-navset-right .yui-nav li {
- margin-bottom:0.5em; /* vertical tabs */
-}
-
-.yui-navset .yui-nav li em { padding:.5em; } /* default tab padding */
-
-/* default width for side tabs */
-.yui-navset-left .yui-nav, .yui-navset-right .yui-nav { width:6em; }
-.yui-navset-left { padding-left:6em; } /* map to nav width */
-.yui-navset-right { padding-right:6em; } /* ditto */
-
-/* core */
-
-.yui-nav, .yui-nav li {
- margin:0;
- padding:0;
- list-style:none;
-}
-.yui-navset li em { font-style:normal; }
-
-.yui-navset {
- position:relative; /* contain absolute positioned tabs (left/right) */
- zoom:1;
-}
-
-.yui-navset .yui-content { zoom:1; }
-
-.yui-navset-top .yui-nav li, .yui-navset-bottom .yui-nav li {
- display:inline-block;
- display:-moz-inline-stack;
- *display:inline; /* IE */
- vertical-align:bottom; /* safari: for overlap */
- cursor:pointer; /* gecko: due to -moz-inline-stack on anchor */
- zoom:1; /* IE: kill space between horizontal tabs */
-}
-
-.yui-navset .yui-nav a {
- outline:0; /* gecko: keep from shifting */
-}
-
-.yui-navset .yui-nav a { position:relative; } /* IE: to allow overlap */
-
-.yui-navset .yui-nav li a {
- display:block;
- zoom:1;
-}
-
-.yui-navset-top .yui-nav li a, .yui-navset-bottom .yui-nav li a {
- display:inline-block;
- vertical-align:bottom; /* safari: for overlap */
-}
-
-.yui-navset-bottom .yui-nav li a {
- vertical-align:text-top; /* for inline overlap (reverse for Op border bug) */
-}
-
-.yui-navset .yui-nav li a em { display:block; }
-
-/* position left and right oriented tabs */
-.yui-navset-left .yui-nav, .yui-navset-right .yui-nav { position:absolute; z-index:1; }
-.yui-navset-left .yui-nav { left:0; }
-.yui-navset-right .yui-nav { right:0; }
+/* default space between tabs */
+.yui-navset-top .yui-nav li, .yui-navset-bottom .yui-nav li {
+ margin-right:0.5em; /* horizontal tabs */
+}
+.yui-navset-left .yui-nav li, .yui-navset-right .yui-nav li {
+ margin-bottom:0.5em; /* vertical tabs */
+}
+
+.yui-navset .yui-nav li em { padding:.5em; } /* default tab padding */
+
+/* default width for side tabs */
+.yui-navset-left .yui-nav, .yui-navset-right .yui-nav { width:6em; }
+.yui-navset-left { padding-left:6em; } /* map to nav width */
+.yui-navset-right { padding-right:6em; } /* ditto */
+
+/* core */
+
+.yui-nav, .yui-nav li {
+ margin:0;
+ padding:0;
+ list-style:none;
+}
+.yui-navset li em { font-style:normal; }
+
+.yui-navset {
+ position:relative; /* contain absolute positioned tabs (left/right) */
+ zoom:1;
+}
+
+.yui-navset .yui-content { zoom:1; }
+
+.yui-navset-top .yui-nav li, .yui-navset-bottom .yui-nav li {
+ display:inline-block;
+ display:-moz-inline-stack;
+ *display:inline; /* IE */
+ vertical-align:bottom; /* safari: for overlap */
+ cursor:pointer; /* gecko: due to -moz-inline-stack on anchor */
+ zoom:1; /* IE: kill space between horizontal tabs */
+}
+
+.yui-navset .yui-nav a {
+ outline:0; /* gecko: keep from shifting */
+}
+
+.yui-navset .yui-nav a { position:relative; } /* IE: to allow overlap */
+
+.yui-navset .yui-nav li a {
+ display:block;
+ zoom:1;
+}
+
+.yui-navset-top .yui-nav li a, .yui-navset-bottom .yui-nav li a {
+ display:inline-block;
+ vertical-align:bottom; /* safari: for overlap */
+}
+
+.yui-navset-bottom .yui-nav li a {
+ vertical-align:text-top; /* for inline overlap (reverse for Op border bug) */
+}
+
+.yui-navset .yui-nav li a em { display:block; }
+
+/* position left and right oriented tabs */
+.yui-navset-left .yui-nav, .yui-navset-right .yui-nav { position:absolute; z-index:1; }
+.yui-navset-left .yui-nav { left:0; }
+.yui-navset-right .yui-nav { right:0; }
diff --git a/thirdpartyjs/yui/tabview/tabview-debug.js b/thirdpartyjs/yui/tabview/tabview-debug.js
index 498fb0d..e412c33 100644
--- a/thirdpartyjs/yui/tabview/tabview-debug.js
+++ b/thirdpartyjs/yui/tabview/tabview-debug.js
@@ -1,1951 +1,1951 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-(function() {
-
- YAHOO.util.Lang = {
- isArray: function(val) { // frames lose type, so test constructor string
- if (val.constructor && val.constructor.toString().indexOf('Array') > -1) {
- return true;
- } else {
- return YAHOO.util.Lang.isObject(val) && val.constructor == Array;
- }
- },
-
- isBoolean: function(val) {
- return typeof val == 'boolean';
- },
-
- isFunction: function(val) {
- return typeof val == 'function';
- },
-
- isNull: function(val) {
- return val === null;
- },
-
- isNumber: function(val) {
- return !isNaN(val);
- },
-
- isObject: function(val) {
- return typeof val == 'object' || YAHOO.util.Lang.isFunction(val);
- },
-
- isString: function(val) {
- return typeof val == 'string';
- },
-
- isUndefined: function(val) {
- return typeof val == 'undefined';
- }
- };
-})();/**
- * Provides Attribute configurations.
- * @namespace YAHOO.util
- * @class Attribute
- * @constructor
- * @param hash {Object} The intial Attribute.
- * @param {YAHOO.util.AttributeProvider} The owner of the Attribute instance.
- */
-
-YAHOO.util.Attribute = function(hash, owner) {
- if (owner) {
- this.owner = owner;
- this.configure(hash, true);
- }
-};
-
-YAHOO.util.Attribute.prototype = {
- /**
- * The name of the attribute.
- * @property name
- * @type String
- */
- name: undefined,
-
- /**
- * The value of the attribute.
- * @property value
- * @type String
- */
- value: null,
-
- /**
- * The owner of the attribute.
- * @property owner
- * @type YAHOO.util.AttributeProvider
- */
- owner: null,
-
- /**
- * Whether or not the attribute is read only.
- * @property readOnly
- * @type Boolean
- */
- readOnly: false,
-
- /**
- * Whether or not the attribute can only be written once.
- * @property writeOnce
- * @type Boolean
- */
- writeOnce: false,
-
- /**
- * The attribute's initial configuration.
- * @private
- * @property _initialConfig
- * @type Object
- */
- _initialConfig: null,
-
- /**
- * Whether or not the attribute's value has been set.
- * @private
- * @property _written
- * @type Boolean
- */
- _written: false,
-
- /**
- * The method to use when setting the attribute's value.
- * The method recieves the new value as the only argument.
- * @property method
- * @type Function
- */
- method: null,
-
- /**
- * The validator to use when setting the attribute's value.
- * @property validator
- * @type Function
- * @return Boolean
- */
- validator: null,
-
- /**
- * Retrieves the current value of the attribute.
- * @method getValue
- * @return {any} The current value of the attribute.
- */
- getValue: function() {
- return this.value;
- },
-
- /**
- * Sets the value of the attribute and fires beforeChange and change events.
- * @method setValue
- * @param {Any} value The value to apply to the attribute.
- * @param {Boolean} silent If true the change events will not be fired.
- * @return {Boolean} Whether or not the value was set.
- */
- setValue: function(value, silent) {
- var beforeRetVal;
- var owner = this.owner;
- var name = this.name;
-
- var event = {
- type: name,
- prevValue: this.getValue(),
- newValue: value
- };
-
- if (this.readOnly || ( this.writeOnce && this._written) ) {
- return false; // write not allowed
- }
-
- if (this.validator && !this.validator.call(owner, value) ) {
- return false; // invalid value
- }
-
- if (!silent) {
- beforeRetVal = owner.fireBeforeChangeEvent(event);
- if (beforeRetVal === false) {
- YAHOO.log('setValue ' + name +
- 'cancelled by beforeChange event', 'info', 'Attribute');
- return false;
- }
- }
-
- if (this.method) {
- this.method.call(owner, value);
- }
-
- this.value = value;
- this._written = true;
-
- event.type = name;
-
- if (!silent) {
- this.owner.fireChangeEvent(event);
- }
-
- return true;
- },
-
- /**
- * Allows for configuring the Attribute's properties.
- * @method configure
- * @param {Object} map A key-value map of Attribute properties.
- * @param {Boolean} init Whether or not this should become the initial config.
- */
- configure: function(map, init) {
- map = map || {};
- this._written = false; // reset writeOnce
- this._initialConfig = this._initialConfig || {};
-
- for (var key in map) {
- if ( key && map.hasOwnProperty(key) ) {
- this[key] = map[key];
- if (init) {
- this._initialConfig[key] = map[key];
- }
- }
- }
- },
-
- /**
- * Resets the value to the initial config value.
- * @method resetValue
- * @return {Boolean} Whether or not the value was set.
- */
- resetValue: function() {
- return this.setValue(this._initialConfig.value);
- },
-
- /**
- * Resets the attribute config to the initial config state.
- * @method resetConfig
- */
- resetConfig: function() {
- this.configure(this._initialConfig);
- },
-
- /**
- * Resets the value to the current value.
- * Useful when values may have gotten out of sync with actual properties.
- * @method refresh
- * @return {Boolean} Whether or not the value was set.
- */
- refresh: function(silent) {
- this.setValue(this.value, silent);
- }
-};(function() {
- var Lang = YAHOO.util.Lang;
-
- /*
- Copyright (c) 2006, Yahoo! Inc. All rights reserved.
- Code licensed under the BSD License:
- http://developer.yahoo.net/yui/license.txt
- */
-
- /**
- * Provides and manages YAHOO.util.Attribute instances
- * @namespace YAHOO.util
- * @class AttributeProvider
- * @uses YAHOO.util.EventProvider
- */
- YAHOO.util.AttributeProvider = function() {};
-
- YAHOO.util.AttributeProvider.prototype = {
-
- /**
- * A key-value map of Attribute configurations
- * @property _configs
- * @protected (may be used by subclasses and augmentors)
- * @private
- * @type {Object}
- */
- _configs: null,
- /**
- * Returns the current value of the attribute.
- * @method get
- * @param {String} key The attribute whose value will be returned.
- */
- get: function(key){
- var configs = this._configs || {};
- var config = configs[key];
-
- if (!config) {
- YAHOO.log(key + ' not found', 'error', 'AttributeProvider');
- return undefined;
- }
-
- return config.value;
- },
-
- /**
- * Sets the value of a config.
- * @method set
- * @param {String} key The name of the attribute
- * @param {Any} value The value to apply to the attribute
- * @param {Boolean} silent Whether or not to suppress change events
- * @return {Boolean} Whether or not the value was set.
- */
- set: function(key, value, silent){
- var configs = this._configs || {};
- var config = configs[key];
-
- if (!config) {
- YAHOO.log('set failed: ' + key + ' not found',
- 'error', 'AttributeProvider');
- return false;
- }
-
- return config.setValue(value, silent);
- },
-
- /**
- * Returns an array of attribute names.
- * @method getAttributeKeys
- * @return {Array} An array of attribute names.
- */
- getAttributeKeys: function(){
- var configs = this._configs;
- var keys = [];
- var config;
- for (var key in configs) {
- config = configs[key];
- if ( configs.hasOwnProperty(key) &&
- !Lang.isUndefined(config) ) {
- keys[keys.length] = key;
- }
- }
-
- return keys;
- },
-
- /**
- * Sets multiple attribute values.
- * @method setAttributes
- * @param {Object} map A key-value map of attributes
- * @param {Boolean} silent Whether or not to suppress change events
- */
- setAttributes: function(map, silent){
- for (var key in map) {
- if ( map.hasOwnProperty(key) ) {
- this.set(key, map[key], silent);
- }
- }
- },
-
- /**
- * Resets the specified attribute's value to its initial value.
- * @method resetValue
- * @param {String} key The name of the attribute
- * @param {Boolean} silent Whether or not to suppress change events
- * @return {Boolean} Whether or not the value was set
- */
- resetValue: function(key, silent){
- var configs = this._configs || {};
- if (configs[key]) {
- this.set(key, configs[key]._initialConfig.value, silent);
- return true;
- }
- return false;
- },
-
- /**
- * Sets the attribute's value to its current value.
- * @method refresh
- * @param {String | Array} key The attribute(s) to refresh
- * @param {Boolean} silent Whether or not to suppress change events
- */
- refresh: function(key, silent){
- var configs = this._configs;
-
- key = ( ( Lang.isString(key) ) ? [key] : key ) ||
- this.getAttributeKeys();
-
- for (var i = 0, len = key.length; i < len; ++i) {
- if ( // only set if there is a value and not null
- configs[key[i]] &&
- ! Lang.isUndefined(configs[key[i]].value) &&
- ! Lang.isNull(configs[key[i]].value) ) {
- configs[key[i]].refresh(silent);
- }
- }
- },
-
- /**
- * Adds an Attribute to the AttributeProvider instance.
- * @method register
- * @param {String} key The attribute's name
- * @param {Object} map A key-value map containing the
- * attribute's properties.
- */
- register: function(key, map) {
- this._configs = this._configs || {};
-
- if (this._configs[key]) { // dont override
- return false;
- }
-
- map.name = key;
- this._configs[key] = new YAHOO.util.Attribute(map, this);
- return true;
- },
-
- /**
- * Returns the attribute's properties.
- * @method getAttributeConfig
- * @param {String} key The attribute's name
- * @private
- * @return {object} A key-value map containing all of the
- * attribute's properties.
- */
- getAttributeConfig: function(key) {
- var configs = this._configs || {};
- var config = configs[key] || {};
- var map = {}; // returning a copy to prevent overrides
-
- for (key in config) {
- if ( config.hasOwnProperty(key) ) {
- map[key] = config[key];
- }
- }
-
- return map;
- },
-
- /**
- * Sets or updates an Attribute instance's properties.
- * @method configureAttribute
- * @param {String} key The attribute's name.
- * @param {Object} map A key-value map of attribute properties
- * @param {Boolean} init Whether or not this should become the intial config.
- */
- configureAttribute: function(key, map, init) {
- var configs = this._configs || {};
-
- if (!configs[key]) {
- YAHOO.log('unable to configure, ' + key + ' not found',
- 'error', 'AttributeProvider');
- return false;
- }
-
- configs[key].configure(map, init);
- },
-
- /**
- * Resets an attribute to its intial configuration.
- * @method resetAttributeConfig
- * @param {String} key The attribute's name.
- * @private
- */
- resetAttributeConfig: function(key){
- var configs = this._configs || {};
- configs[key].resetConfig();
- },
-
- /**
- * Fires the attribute's beforeChange event.
- * @method fireBeforeChangeEvent
- * @param {String} key The attribute's name.
- * @param {Obj} e The event object to pass to handlers.
- */
- fireBeforeChangeEvent: function(e) {
- var type = 'before';
- type += e.type.charAt(0).toUpperCase() + e.type.substr(1) + 'Change';
- e.type = type;
- return this.fireEvent(e.type, e);
- },
-
- /**
- * Fires the attribute's change event.
- * @method fireChangeEvent
- * @param {String} key The attribute's name.
- * @param {Obj} e The event object to pass to the handlers.
- */
- fireChangeEvent: function(e) {
- e.type += 'Change';
- return this.fireEvent(e.type, e);
- }
- };
-
- YAHOO.augment(YAHOO.util.AttributeProvider, YAHOO.util.EventProvider);
-})();(function() {
-// internal shorthand
-var Dom = YAHOO.util.Dom,
- Lang = YAHOO.util.Lang,
- EventPublisher = YAHOO.util.EventPublisher,
- AttributeProvider = YAHOO.util.AttributeProvider;
-
-/**
- * Element provides an interface to an HTMLElement's attributes and common
- * methods. Other commonly used attributes are added as well.
- * @namespace YAHOO.util
- * @class Element
- * @uses YAHOO.util.AttributeProvider
- * @constructor
- * @param el {HTMLElement | String} The html element that
- * represents the Element.
- * @param {Object} map A key-value map of initial config names and values
- */
-YAHOO.util.Element = function(el, map) {
- if (arguments.length) {
- this.init(el, map);
- }
-};
-
-YAHOO.util.Element.prototype = {
- /**
- * Dom events supported by the Element instance.
- * @property DOM_EVENTS
- * @type Object
- */
- DOM_EVENTS: null,
-
- /**
- * Wrapper for HTMLElement method.
- * @method appendChild
- * @param {Boolean} deep Whether or not to do a deep clone
- */
- appendChild: function(child) {
- child = child.get ? child.get('element') : child;
- this.get('element').appendChild(child);
- },
-
- /**
- * Wrapper for HTMLElement method.
- * @method getElementsByTagName
- * @param {String} tag The tagName to collect
- */
- getElementsByTagName: function(tag) {
- return this.get('element').getElementsByTagName(tag);
- },
-
- /**
- * Wrapper for HTMLElement method.
- * @method hasChildNodes
- * @return {Boolean} Whether or not the element has childNodes
- */
- hasChildNodes: function() {
- return this.get('element').hasChildNodes();
- },
-
- /**
- * Wrapper for HTMLElement method.
- * @method insertBefore
- * @param {HTMLElement} element The HTMLElement to insert
- * @param {HTMLElement} before The HTMLElement to insert
- * the element before.
- */
- insertBefore: function(element, before) {
- element = element.get ? element.get('element') : element;
- before = (before && before.get) ? before.get('element') : before;
-
- this.get('element').insertBefore(element, before);
- },
-
- /**
- * Wrapper for HTMLElement method.
- * @method removeChild
- * @param {HTMLElement} child The HTMLElement to remove
- */
- removeChild: function(child) {
- child = child.get ? child.get('element') : child;
- this.get('element').removeChild(child);
- return true;
- },
-
- /**
- * Wrapper for HTMLElement method.
- * @method replaceChild
- * @param {HTMLElement} newNode The HTMLElement to insert
- * @param {HTMLElement} oldNode The HTMLElement to replace
- */
- replaceChild: function(newNode, oldNode) {
- newNode = newNode.get ? newNode.get('element') : newNode;
- oldNode = oldNode.get ? oldNode.get('element') : oldNode;
- return this.get('element').replaceChild(newNode, oldNode);
- },
-
-
- /**
- * Registers Element specific attributes.
- * @method initAttributes
- * @param {Object} map A key-value map of initial attribute configs
- */
- initAttributes: function(map) {
- map = map || {};
- var element = Dom.get(map.element) || null;
-
- /**
- * The HTMLElement the Element instance refers to.
- * @config element
- * @type HTMLElement
- */
- this.register('element', {
- value: element,
- readOnly: true
- });
- },
-
- /**
- * Adds a listener for the given event. These may be DOM or
- * customEvent listeners. Any event that is fired via fireEvent
- * can be listened for. All handlers receive an event object.
- * @method addListener
- * @param {String} type The name of the event to listen for
- * @param {Function} fn The handler to call when the event fires
- * @param {Any} obj A variable to pass to the handler
- * @param {Object} scope The object to use for the scope of the handler
- */
- addListener: function(type, fn, obj, scope) {
- var el = this.get('element');
- var scope = scope || this;
-
- el = this.get('id') || el;
-
- if (!this._events[type]) { // create on the fly
- if ( this.DOM_EVENTS[type] ) {
- YAHOO.util.Event.addListener(el, type, function(e) {
- if (e.srcElement && !e.target) { // supplement IE with target
- e.target = e.srcElement;
- }
- this.fireEvent(type, e);
- }, obj, scope);
- }
-
- this.createEvent(type, this);
- this._events[type] = true;
- }
-
- this.subscribe.apply(this, arguments); // notify via customEvent
- },
-
-
- /**
- * Alias for addListener
- * @method on
- * @param {String} type The name of the event to listen for
- * @param {Function} fn The function call when the event fires
- * @param {Any} obj A variable to pass to the handler
- * @param {Object} scope The object to use for the scope of the handler
- */
- on: function() { this.addListener.apply(this, arguments); },
-
-
- /**
- * Remove an event listener
- * @method removeListener
- * @param {String} type The name of the event to listen for
- * @param {Function} fn The function call when the event fires
- */
- removeListener: function(type, fn) {
- this.unsubscribe.apply(this, arguments);
- },
-
- /**
- * Wrapper for Dom method.
- * @method addClass
- * @param {String} className The className to add
- */
- addClass: function(className) {
- Dom.addClass(this.get('element'), className);
- },
-
- /**
- * Wrapper for Dom method.
- * @method getElementsByClassName
- * @param {String} className The className to collect
- * @param {String} tag (optional) The tag to use in
- * conjunction with class name
- * @return {Array} Array of HTMLElements
- */
- getElementsByClassName: function(className, tag) {
- return Dom.getElementsByClassName(className, tag,
- this.get('element') );
- },
-
- /**
- * Wrapper for Dom method.
- * @method hasClass
- * @param {String} className The className to add
- * @return {Boolean} Whether or not the element has the class name
- */
- hasClass: function(className) {
- return Dom.hasClass(this.get('element'), className);
- },
-
- /**
- * Wrapper for Dom method.
- * @method removeClass
- * @param {String} className The className to remove
- */
- removeClass: function(className) {
- return Dom.removeClass(this.get('element'), className);
- },
-
- /**
- * Wrapper for Dom method.
- * @method replaceClass
- * @param {String} oldClassName The className to replace
- * @param {String} newClassName The className to add
- */
- replaceClass: function(oldClassName, newClassName) {
- return Dom.replaceClass(this.get('element'),
- oldClassName, newClassName);
- },
-
- /**
- * Wrapper for Dom method.
- * @method setStyle
- * @param {String} property The style property to set
- * @param {String} value The value to apply to the style property
- */
- setStyle: function(property, value) {
- return Dom.setStyle(this.get('element'), property, value);
- },
-
- /**
- * Wrapper for Dom method.
- * @method getStyle
- * @param {String} property The style property to retrieve
- * @return {String} The current value of the property
- */
- getStyle: function(property) {
- return Dom.getStyle(this.get('element'), property);
- },
-
- /**
- * Apply any queued set calls.
- * @method fireQueue
- */
- fireQueue: function() {
- var queue = this._queue;
- for (var i = 0, len = queue.length; i < len; ++i) {
- this[queue[i][0]].apply(this, queue[i][1]);
- }
- },
-
- /**
- * Appends the HTMLElement into either the supplied parentNode.
- * @method appendTo
- * @param {HTMLElement | Element} parentNode The node to append to
- * @param {HTMLElement | Element} before An optional node to insert before
- */
- appendTo: function(parent, before) {
- parent = (parent.get) ? parent.get('element') : Dom.get(parent);
-
- before = (before && before.get) ?
- before.get('element') : Dom.get(before);
- var element = this.get('element');
-
- var newAddition = !Dom.inDocument(element);
-
- if (!element) {
- YAHOO.log('appendTo failed: element not available',
- 'error', 'Element');
- return false;
- }
-
- if (!parent) {
- YAHOO.log('appendTo failed: parent not available',
- 'error', 'Element');
- return false;
- }
-
- if (element.parent != parent) {
- if (before) {
- parent.insertBefore(element, before);
- } else {
- parent.appendChild(element);
- }
- }
-
- YAHOO.log(element + 'appended to ' + parent);
-
- if (!newAddition) {
- return false; // note return; no refresh if in document
- }
-
- // if a new addition, refresh HTMLElement any applied attributes
- var keys = this.getAttributeKeys();
-
- for (var key in keys) { // only refresh HTMLElement attributes
- if ( !Lang.isUndefined(element[key]) ) {
- this.refresh(key);
- }
- }
- },
-
- get: function(key) {
- var configs = this._configs || {};
- var el = configs.element; // avoid loop due to 'element'
- if (el && !configs[key] && !Lang.isUndefined(el.value[key]) ) {
- return el.value[key];
- }
-
- return AttributeProvider.prototype.get.call(this, key);
- },
-
- set: function(key, value, silent) {
- var el = this.get('element');
- if (!el) {
- this._queue[key] = ['set', arguments];
- return false;
- }
-
- // set it on the element if not a property
- if ( !this._configs[key] && !Lang.isUndefined(el[key]) ) {
- _registerHTMLAttr(this, key);
- }
-
- return AttributeProvider.prototype.set.apply(this, arguments);
- },
-
- register: function(key) { // protect html attributes
- var configs = this._configs || {};
- var element = this.get('element') || null;
-
- if ( element && !Lang.isUndefined(element[key]) ) {
- YAHOO.log(key + ' is reserved for ' + element,
- 'error', 'Element');
- return false;
- }
-
- return AttributeProvider.prototype.register.apply(this, arguments);
- },
-
- configureAttribute: function(property, map, init) { // protect html attributes
- if (!this._configs[property] && this._configs.element &&
- !Lang.isUndefined(this._configs.element[property]) ) {
- _registerHTMLAttr(this, property, map);
- return false;
- }
-
- return AttributeProvider.prototype.configure.apply(this, arguments);
- },
-
- getAttributeKeys: function() {
- var el = this.get('element');
- var keys = AttributeProvider.prototype.getAttributeKeys.call(this);
-
- //add any unconfigured element keys
- for (var key in el) {
- if (!this._configs[key]) {
- keys[key] = keys[key] || el[key];
- }
- }
-
- return keys;
- },
-
- init: function(el, attr) {
- this._queue = this._queue || [];
- this._events = this._events || {};
- this._configs = this._configs || {};
- attr = attr || {};
- attr.element = attr.element || el || null;
-
- this.DOM_EVENTS = {
- 'click': true,
- 'keydown': true,
- 'keypress': true,
- 'keyup': true,
- 'mousedown': true,
- 'mousemove': true,
- 'mouseout': true,
- 'mouseover': true,
- 'mouseup': true
- };
-
- var readyHandler = function() {
- this.initAttributes(attr);
-
- this.setAttributes(attr, true);
- this.fireQueue();
- this.fireEvent('contentReady', {
- type: 'contentReady',
- target: attr.element
- });
- };
-
- if ( Lang.isString(el) ) {
- _registerHTMLAttr(this, 'id', { value: el });
- YAHOO.util.Event.onAvailable(el, function() {
- attr.element = Dom.get(el);
- this.fireEvent('available', {
- type: 'available',
- target: attr.element
- });
- }, this, true);
-
- YAHOO.util.Event.onContentReady(el, function() {
- readyHandler.call(this);
- }, this, true);
- } else {
- readyHandler.call(this);
- }
- }
-};
-
-/**
- * Sets the value of the property and fires beforeChange and change events.
- * @private
- * @method _registerHTMLAttr
- * @param {YAHOO.util.Element} element The Element instance to
- * register the config to.
- * @param {String} key The name of the config to register
- * @param {Object} map A key-value map of the config's params
- */
-var _registerHTMLAttr = function(self, key, map) {
- var el = self.get('element');
- map = map || {};
- map.name = key;
- map.method = map.method || function(value) {
- el[key] = value;
- };
- map.value = map.value || el[key];
- self._configs[key] = new YAHOO.util.Attribute(map, self);
-};
-
-/**
- * Fires when the Element's HTMLElement can be retrieved by Id.
- * See: Element.addListener
- * Event fields:
- * <String> type available
- * <HTMLElement>
- * target the HTMLElement bound to this Element instance
- *
Usage:
- * var handler = function(e) {var target = e.target};
- * myTabs.addListener('available', handler);
- * @event available
- */
-
-/**
- * Fires when the Element's HTMLElement subtree is rendered.
- * See: Element.addListener
- * Event fields:
- * <String> type contentReady
- * <HTMLElement>
- * target the HTMLElement bound to this Element instance
- *
Usage:
- * var handler = function(e) {var target = e.target};
- * myTabs.addListener('contentReady', handler);
- * @event contentReady
- */
-
-
-YAHOO.augment(YAHOO.util.Element, AttributeProvider);
-})();(function() {
- var Dom = YAHOO.util.Dom,
- Event = YAHOO.util.Event,
- Lang = YAHOO.util.Lang;
-
- /**
- * A representation of a Tab's label and content.
- * @namespace YAHOO.widget
- * @class Tab
- * @extends YAHOO.util.Element
- * @constructor
- * @param element {HTMLElement | String} (optional) The html element that
- * represents the TabView. An element will be created if none provided.
- * @param {Object} properties A key map of initial properties
- */
- Tab = function(el, attr) {
- attr = attr || {};
- if (arguments.length == 1 && !Lang.isString(el) && !el.nodeName) {
- attr = el;
- el = attr.element;
- }
-
- if (!el && !attr.element) {
- el = _createTabElement.call(this, attr);
- }
-
- this.loadHandler = {
- success: function(o) {
- this.set('content', o.responseText);
- },
- failure: function(o) {
- YAHOO.log('loading failed: ' + o.statusText,
- 'error', 'Tab');
- }
- };
-
- Tab.superclass.constructor.call(this, el, attr);
-
- this.DOM_EVENTS = {}; // delegating to tabView
- };
-
- YAHOO.extend(Tab, YAHOO.util.Element);
- var proto = Tab.prototype;
-
- /**
- * The default tag name for a Tab's inner element.
- * @property LABEL_INNER_TAGNAME
- * @type String
- * @default "em"
- */
- proto.LABEL_TAGNAME = 'em';
-
- /**
- * The class name applied to active tabs.
- * @property ACTIVE_CLASSNAME
- * @type String
- * @default "on"
- */
- proto.ACTIVE_CLASSNAME = 'selected';
-
- /**
- * The class name applied to disabled tabs.
- * @property DISABLED_CLASSNAME
- * @type String
- * @default "disabled"
- */
- proto.DISABLED_CLASSNAME = 'disabled';
-
- /**
- * The class name applied to dynamic tabs while loading.
- * @property LOADING_CLASSNAME
- * @type String
- * @default "disabled"
- */
- proto.LOADING_CLASSNAME = 'loading';
-
- /**
- * Provides a reference to the connection request object when data is
- * loaded dynamically.
- * @property dataConnection
- * @type Object
- */
- proto.dataConnection = null;
-
- /**
- * Object containing success and failure callbacks for loading data.
- * @property loadHandler
- * @type object
- */
- proto.loadHandler = null;
-
- /**
- * Provides a readable name for the tab.
- * @method toString
- * @return String
- */
- proto.toString = function() {
- var el = this.get('element');
- var id = el.id || el.tagName;
- return "Tab " + id;
- };
-
- /**
- * Registers TabView specific properties.
- * @method initAttributes
- * @param {Object} attr Hash of initial attributes
- */
- proto.initAttributes = function(attr) {
- attr = attr || {};
- Tab.superclass.initAttributes.call(this, attr);
-
- var el = this.get('element');
-
- /**
- * The event that triggers the tab's activation.
- * @config activationEvent
- * @type String
- */
- this.register('activationEvent', {
- value: attr.activationEvent || 'click'
- });
-
- /**
- * The element that contains the tab's label.
- * @config labelEl
- * @type HTMLElement
- */
- this.register('labelEl', {
- value: attr.labelEl || _getlabelEl.call(this),
- method: function(value) {
- var current = this.get('labelEl');
-
- if (current) {
- if (current == value) {
- return false; // already set
- }
-
- this.replaceChild(value, current);
- } else if (el.firstChild) { // ensure label is firstChild by default
- this.insertBefore(value, el.firstChild);
- } else {
- this.appendChild(value);
- }
- }
- });
-
- /**
- * The tab's label text (or innerHTML).
- * @config label
- * @type String
- */
- this.register('label', {
- value: attr.label || _getLabel.call(this),
- method: function(value) {
- var labelEl = this.get('labelEl');
- if (!labelEl) { // create if needed
- this.set('labelEl', _createlabelEl.call(this));
- }
-
- _setLabel.call(this, value);
- }
- });
-
- /**
- * The HTMLElement that contains the tab's content.
- * @config contentEl
- * @type HTMLElement
- */
- this.register('contentEl', { // TODO: apply className?
- value: attr.contentEl || document.createElement('div'),
- method: function(value) {
- var current = this.get('contentEl');
-
- if (current) {
- if (current == value) {
- return false; // already set
- }
- this.replaceChild(value, current);
- }
- }
- });
-
- /**
- * The tab's content.
- * @config content
- * @type String
- */
- this.register('content', {
- value: attr.content, // TODO: what about existing?
- method: function(value) {
- this.get('contentEl').innerHTML = value;
- }
- });
-
- var _dataLoaded = false;
-
- /**
- * The tab's data source, used for loading content dynamically.
- * @config dataSrc
- * @type String
- */
- this.register('dataSrc', {
- value: attr.dataSrc
- });
-
- /**
- * Whether or not content should be reloaded for every view.
- * @config cacheData
- * @type Boolean
- * @default false
- */
- this.register('cacheData', {
- value: attr.cacheData || false,
- validator: Lang.isBoolean
- });
-
- /**
- * The method to use for the data request.
- * @config loadMethod
- * @type String
- * @default "GET"
- */
- this.register('loadMethod', {
- value: attr.loadMethod || 'GET',
- validator: Lang.isString
- });
-
- /**
- * Whether or not any data has been loaded from the server.
- * @config dataLoaded
- * @type Boolean
- */
- this.register('dataLoaded', {
- value: false,
- validator: Lang.isBoolean,
- writeOnce: true
- });
-
- /**
- * Number if milliseconds before aborting and calling failure handler.
- * @config dataTimeout
- * @type Number
- * @default null
- */
- this.register('dataTimeout', {
- value: attr.dataTimeout || null,
- validator: Lang.isNumber
- });
-
- /**
- * Whether or not the tab is currently active.
- * If a dataSrc is set for the tab, the content will be loaded from
- * the given source.
- * @config active
- * @type Boolean
- */
- this.register('active', {
- value: attr.active || this.hasClass(this.ACTIVE_CLASSNAME),
- method: function(value) {
- if (value === true) {
- this.addClass(this.ACTIVE_CLASSNAME);
- this.set('title', 'active');
- } else {
- this.removeClass(this.ACTIVE_CLASSNAME);
- this.set('title', '');
- }
- },
- validator: function(value) {
- return Lang.isBoolean(value) && !this.get('disabled') ;
- }
- });
-
- /**
- * Whether or not the tab is disabled.
- * @config disabled
- * @type Boolean
- */
- this.register('disabled', {
- value: attr.disabled || this.hasClass(this.DISABLED_CLASSNAME),
- method: function(value) {
- if (value === true) {
- Dom.addClass(this.get('element'), this.DISABLED_CLASSNAME);
- } else {
- Dom.removeClass(this.get('element'), this.DISABLED_CLASSNAME);
- }
- },
- validator: Lang.isBoolean
- });
-
- /**
- * The href of the tab's anchor element.
- * @config href
- * @type String
- * @default '#'
- */
- this.register('href', {
- value: attr.href || '#',
- method: function(value) {
- this.getElementsByTagName('a')[0].href = value;
- },
- validator: Lang.isString
- });
-
- /**
- * The Whether or not the tab's content is visible.
- * @config contentVisible
- * @type Boolean
- * @default false
- */
- this.register('contentVisible', {
- value: attr.contentVisible,
- method: function(value) {
- if (value == true) {
- this.get('contentEl').style.display = 'block';
-
- if ( this.get('dataSrc') ) {
- // load dynamic content unless already loaded and caching
- if ( !this.get('dataLoaded') || !this.get('cacheData') ) {
- _dataConnect.call(this);
- }
- }
- } else {
- this.get('contentEl').style.display = 'none';
- }
- },
- validator: Lang.isBoolean
- });
- };
-
- var _createTabElement = function(attr) {
- var el = document.createElement('li');
- var a = document.createElement('a');
-
- a.href = attr.href || '#';
-
- el.appendChild(a);
-
- var label = attr.label || null;
- var labelEl = attr.labelEl || null;
-
- if (labelEl) { // user supplied labelEl
- if (!label) { // user supplied label
- label = _getLabel.call(this, labelEl);
- }
- } else {
- labelEl = _createlabelEl.call(this);
- }
-
- a.appendChild(labelEl);
-
- return el;
- };
-
- var _getlabelEl = function() {
- return this.getElementsByTagName(this.LABEL_TAGNAME)[0];
- };
-
- var _createlabelEl = function() {
- var el = document.createElement(this.LABEL_TAGNAME);
- return el;
- };
-
- var _setLabel = function(label) {
- var el = this.get('labelEl');
- el.innerHTML = label;
- };
-
- var _getLabel = function() {
- var label,
- el = this.get('labelEl');
-
- if (!el) {
- return undefined;
- }
-
- return el.innerHTML;
- };
-
- var _dataConnect = function() {
- if (!YAHOO.util.Connect) {
- YAHOO.log('YAHOO.util.Connect dependency not met',
- 'error', 'Tab');
- return false;
- }
-
- Dom.addClass(this.get('contentEl').parentNode, this.LOADING_CLASSNAME);
-
- this.dataConnection = YAHOO.util.Connect.asyncRequest(
- this.get('loadMethod'),
- this.get('dataSrc'),
- {
- success: function(o) {
- this.loadHandler.success.call(this, o);
- this.set('dataLoaded', true);
- this.dataConnection = null;
- Dom.removeClass(this.get('contentEl').parentNode,
- this.LOADING_CLASSNAME);
- },
- failure: function(o) {
- this.loadHandler.failure.call(this, o);
- this.dataConnection = null;
- Dom.removeClass(this.get('contentEl').parentNode,
- this.LOADING_CLASSNAME);
- },
- scope: this,
- timeout: this.get('dataTimeout')
- }
- );
- };
-
- YAHOO.widget.Tab = Tab;
-
- /**
- * Fires before the active state is changed.
- * See: Element.addListener
- * If handler returns false, the change will be cancelled, and the value will not
- * be set.
- * Event fields:
- * <String> type beforeActiveChange
- * <Boolean>
- * prevValue the current value
- * <Boolean>
- * newValue the new value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('beforeActiveChange', handler);
- * @event beforeActiveChange
- */
-
- /**
- * Fires after the active state is changed.
- * See: Element.addListener
- * Event fields:
- * <String> type activeChange
- * <Boolean>
- * prevValue the previous value
- * <Boolean>
- * newValue the updated value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('activeChange', handler);
- * @event activeChange
- */
-
- /**
- * Fires before the tab label is changed.
- * See: Element.addListener
- * If handler returns false, the change will be cancelled, and the value will not
- * be set.
- * Event fields:
- * <String> type beforeLabelChange
- * <String>
- * prevValue the current value
- * <String>
- * newValue the new value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('beforeLabelChange', handler);
- * @event beforeLabelChange
- */
-
- /**
- * Fires after the tab label is changed.
- * See: Element.addListener
- * Event fields:
- * <String> type labelChange
- * <String>
- * prevValue the previous value
- * <String>
- * newValue the updated value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('labelChange', handler);
- * @event labelChange
- */
-
- /**
- * Fires before the tab content is changed.
- * See: Element.addListener
- * If handler returns false, the change will be cancelled, and the value will not
- * be set.
- * Event fields:
- * <String> type beforeContentChange
- * <String>
- * prevValue the current value
- * <String>
- * newValue the new value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('beforeContentChange', handler);
- * @event beforeContentChange
- */
-
- /**
- * Fires after the tab content is changed.
- * See: Element.addListener
- * Event fields:
- * <String> type contentChange
- * <String>
- * prevValue the previous value
- * <Boolean>
- * newValue the updated value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('contentChange', handler);
- * @event contentChange
- */
-})();(function() {
-
- /**
- * The tabview module provides a widget for managing content bound to tabs.
- * @module tabview
- *
- */
- /**
- * A widget to control tabbed views.
- * @namespace YAHOO.widget
- * @class TabView
- * @extends YAHOO.util.Element
- * @constructor
- * @param {HTMLElement | String | Object} el(optional) The html
- * element that represents the TabView, or the attribute object to use.
- * An element will be created if none provided.
- * @param {Object} attr (optional) A key map of the tabView's
- * initial attributes. Ignored if first arg is attributes object.
- */
- YAHOO.widget.TabView = function(el, attr) {
- attr = attr || {};
- if (arguments.length == 1 && !Lang.isString(el) && !el.nodeName) {
- attr = el; // treat first arg as attr object
- el = attr.element || null;
- }
-
- if (!el && !attr.element) { // create if we dont have one
- el = _createTabViewElement.call(this, attr);
- }
- YAHOO.widget.TabView.superclass.constructor.call(this, el, attr);
- };
-
- YAHOO.extend(YAHOO.widget.TabView, YAHOO.util.Element);
-
- var proto = YAHOO.widget.TabView.prototype;
- var Dom = YAHOO.util.Dom;
- var Lang = YAHOO.util.Lang;
- var Event = YAHOO.util.Event;
- var Tab = YAHOO.widget.Tab;
-
-
- /**
- * The className to add when building from scratch.
- * @property CLASSNAME
- * @default "navset"
- */
- proto.CLASSNAME = 'yui-navset';
-
- /**
- * The className of the HTMLElement containing the TabView's tab elements
- * to look for when building from existing markup, or to add when building
- * from scratch.
- * All childNodes of the tab container are treated as Tabs when building
- * from existing markup.
- * @property TAB_PARENT_CLASSNAME
- * @default "nav"
- */
- proto.TAB_PARENT_CLASSNAME = 'yui-nav';
-
- /**
- * The className of the HTMLElement containing the TabView's label elements
- * to look for when building from existing markup, or to add when building
- * from scratch.
- * All childNodes of the content container are treated as content elements when
- * building from existing markup.
- * @property CONTENT_PARENT_CLASSNAME
- * @default "nav-content"
- */
- proto.CONTENT_PARENT_CLASSNAME = 'yui-content';
-
- proto._tabParent = null;
- proto._contentParent = null;
-
- /**
- * Adds a Tab to the TabView instance.
- * If no index is specified, the tab is added to the end of the tab list.
- * @method addTab
- * @param {YAHOO.widget.Tab} tab A Tab instance to add.
- * @param {Integer} index The position to add the tab.
- * @return void
- */
- proto.addTab = function(tab, index) {
- var tabs = this.get('tabs');
- if (!tabs) { // not ready yet
- this._queue[this._queue.length] = ['addTab', arguments];
- return false;
- }
-
- index = (index === undefined) ? tabs.length : index;
-
- var before = this.getTab(index);
-
- var self = this;
- var el = this.get('element');
- var tabParent = this._tabParent;
- var contentParent = this._contentParent;
-
- var tabElement = tab.get('element');
- var contentEl = tab.get('contentEl');
-
- if ( before ) {
- tabParent.insertBefore(tabElement, before.get('element'));
- } else {
- tabParent.appendChild(tabElement);
- }
-
- if ( contentEl && !Dom.isAncestor(contentParent, contentEl) ) {
- contentParent.appendChild(contentEl);
- }
-
- if ( !tab.get('active') ) {
- tab.set('contentVisible', false, true); /* hide if not active */
- } else {
- this.set('activeTab', tab, true);
-
- }
-
- var activate = function(e) {
- YAHOO.util.Event.preventDefault(e);
- self.set('activeTab', this);
- };
-
- tab.addListener( tab.get('activationEvent'), activate);
-
- tab.addListener('activationEventChange', function(e) {
- if (e.prevValue != e.newValue) {
- tab.removeListener(e.prevValue, activate);
- tab.addListener(e.newValue, activate);
- }
- });
-
- tabs.splice(index, 0, tab);
- };
-
- /**
- * Routes childNode events.
- * @method DOMEventHandler
- * @param {event} e The Dom event that is being handled.
- * @return void
- */
- proto.DOMEventHandler = function(e) {
- var el = this.get('element');
- var target = YAHOO.util.Event.getTarget(e);
- var tabParent = this._tabParent;
-
- if (Dom.isAncestor(tabParent, target) ) {
- var tabEl;
- var tab = null;
- var contentEl;
- var tabs = this.get('tabs');
-
- for (var i = 0, len = tabs.length; i < len; i++) {
- tabEl = tabs[i].get('element');
- contentEl = tabs[i].get('contentEl');
-
- if ( target == tabEl || Dom.isAncestor(tabEl, target) ) {
- tab = tabs[i];
- break; // note break
- }
- }
-
- if (tab) {
- tab.fireEvent(e.type, e);
- }
- }
- };
-
- /**
- * Returns the Tab instance at the specified index.
- * @method getTab
- * @param {Integer} index The position of the Tab.
- * @return YAHOO.widget.Tab
- */
- proto.getTab = function(index) {
- return this.get('tabs')[index];
- };
-
- /**
- * Returns the index of given tab.
- * @method getTabIndex
- * @param {YAHOO.widget.Tab} tab The tab whose index will be returned.
- * @return int
- */
- proto.getTabIndex = function(tab) {
- var index = null;
- var tabs = this.get('tabs');
- for (var i = 0, len = tabs.length; i < len; ++i) {
- if (tab == tabs[i]) {
- index = i;
- break;
- }
- }
-
- return index;
- };
-
- /**
- * Removes the specified Tab from the TabView.
- * @method removeTab
- * @param {YAHOO.widget.Tab} item The Tab instance to be removed.
- * @return void
- */
- proto.removeTab = function(tab) {
- var tabCount = this.get('tabs').length;
-
- var index = this.getTabIndex(tab);
- var nextIndex = index + 1;
- if ( tab == this.get('activeTab') ) { // select next tab
- if (tabCount > 1) {
- if (index + 1 == tabCount) {
- this.set('activeIndex', index - 1);
- } else {
- this.set('activeIndex', index + 1);
- }
- }
- }
-
- this._tabParent.removeChild( tab.get('element') );
- this._contentParent.removeChild( tab.get('contentEl') );
- this._configs.tabs.value.splice(index, 1);
-
- };
-
- /**
- * Provides a readable name for the TabView instance.
- * @method toString
- * @return String
- */
- proto.toString = function() {
- var name = this.get('id') || this.get('tagName');
- return "TabView " + name;
- };
-
- /**
- * The transiton to use when switching between tabs.
- * @method contentTransition
- */
- proto.contentTransition = function(newTab, oldTab) {
- newTab.set('contentVisible', true);
- oldTab.set('contentVisible', false);
- };
-
- /**
- * Registers TabView specific properties.
- * @method initAttributes
- * @param {Object} attr Hash of initial attributes
- */
- proto.initAttributes = function(attr) {
- YAHOO.widget.TabView.superclass.initAttributes.call(this, attr);
-
- if (!attr.orientation) {
- attr.orientation = 'top';
- }
-
- var el = this.get('element');
-
- /**
- * The Tabs belonging to the TabView instance.
- * @config tabs
- * @type Array
- */
- this.register('tabs', {
- value: [],
- readOnly: true
- });
-
- /**
- * The container of the tabView's label elements.
- * @property _tabParent
- * @private
- * @type HTMLElement
- */
- this._tabParent =
- this.getElementsByClassName(this.TAB_PARENT_CLASSNAME,
- 'ul' )[0] || _createTabParent.call(this);
-
- /**
- * The container of the tabView's content elements.
- * @property _contentParent
- * @type HTMLElement
- * @private
- */
- this._contentParent =
- this.getElementsByClassName(this.CONTENT_PARENT_CLASSNAME,
- 'div')[0] || _createContentParent.call(this);
-
- /**
- * How the Tabs should be oriented relative to the TabView.
- * @config orientation
- * @type String
- * @default "top"
- */
- this.register('orientation', {
- value: attr.orientation,
- method: function(value) {
- var current = this.get('orientation');
- this.addClass('yui-navset-' + value);
-
- if (current != value) {
- this.removeClass('yui-navset-' + current);
- }
-
- switch(value) {
- case 'bottom':
- this.appendChild(this._tabParent);
- break;
- }
- }
- });
-
- /**
- * The index of the tab currently active.
- * @config activeIndex
- * @type Int
- */
- this.register('activeIndex', {
- value: attr.activeIndex,
- method: function(value) {
- this.set('activeTab', this.getTab(value));
- },
- validator: function(value) {
- return !this.getTab(value).get('disabled'); // cannot activate if disabled
- }
- });
-
- /**
- * The tab currently active.
- * @config activeTab
- * @type YAHOO.widget.Tab
- */
- this.register('activeTab', {
- value: attr.activeTab,
- method: function(tab) {
- var activeTab = this.get('activeTab');
-
- if (tab) {
- tab.set('active', true);
- }
-
- if (activeTab && activeTab != tab) {
- activeTab.set('active', false);
- }
-
- if (activeTab && tab != activeTab) { // no transition if only 1
- this.contentTransition(tab, activeTab);
- } else if (tab) {
- tab.set('contentVisible', true);
- }
- },
- validator: function(value) {
- return !value.get('disabled'); // cannot activate if disabled
- }
- });
-
- if ( this._tabParent ) {
- _initTabs.call(this);
- }
-
- for (var type in this.DOM_EVENTS) {
- if ( this.DOM_EVENTS.hasOwnProperty(type) ) {
- this.addListener.call(this, type, this.DOMEventHandler);
- }
- }
- };
-
- /**
- * Creates Tab instances from a collection of HTMLElements.
- * @method createTabs
- * @private
- * @param {Array|HTMLCollection} elements The elements to use for Tabs.
- * @return void
- */
- var _initTabs = function() {
- var tab,
- attr,
- contentEl;
-
- var el = this.get('element');
- var tabs = _getChildNodes(this._tabParent);
- var contentElements = _getChildNodes(this._contentParent);
-
- for (var i = 0, len = tabs.length; i < len; ++i) {
- attr = {};
-
- if (contentElements[i]) {
- attr.contentEl = contentElements[i];
- }
-
- tab = new YAHOO.widget.Tab(tabs[i], attr);
- this.addTab(tab);
-
- if (tab.hasClass(tab.ACTIVE_CLASSNAME) ) {
- this._configs.activeTab.value = tab; // dont invoke method
- }
- }
- };
-
- var _createTabViewElement = function(attr) {
- var el = document.createElement('div');
-
- if ( this.CLASSNAME ) {
- el.className = this.CLASSNAME;
- }
-
- return el;
- };
-
- var _createTabParent = function(attr) {
- var el = document.createElement('ul');
-
- if ( this.TAB_PARENT_CLASSNAME ) {
- el.className = this.TAB_PARENT_CLASSNAME;
- }
-
- this.get('element').appendChild(el);
-
- return el;
- };
-
- var _createContentParent = function(attr) {
- var el = document.createElement('div');
-
- if ( this.CONTENT_PARENT_CLASSNAME ) {
- el.className = this.CONTENT_PARENT_CLASSNAME;
- }
-
- this.get('element').appendChild(el);
-
- return el;
- };
-
- var _getChildNodes = function(el) {
- var nodes = [];
- var childNodes = el.childNodes;
-
- for (var i = 0, len = childNodes.length; i < len; ++i) {
- if (childNodes[i].nodeType == 1) {
- nodes[nodes.length] = childNodes[i];
- }
- }
-
- return nodes;
- };
-
-/**
- * Fires before the activeTab is changed.
- * See: Element.addListener
- * If handler returns false, the change will be cancelled, and the value will not
- * be set.
- * Event fields:
- * <String> type beforeActiveTabChange
- * <YAHOO.widget.Tab >
- * prevValue the currently active tab
- * <YAHOO.widget.Tab >
- * newValue the tab to be made active
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('beforeActiveTabChange', handler);
- * @event beforeActiveTabChange
- */
-
-/**
- * Fires after the activeTab is changed.
- * See: Element.addListener
- * Event fields:
- * <String> type activeTabChange
- * <YAHOO.widget.Tab >
- * prevValue the formerly active tab
- * <YAHOO.widget.Tab >
- * newValue the new active tab
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('activeTabChange', handler);
- * @event activeTabChange
- */
-
-/**
- * Fires before the orientation is changed.
- * See: Element.addListener
- * If handler returns false, the change will be cancelled, and the value will not
- * be set.
- * Event fields:
- * <String> type beforeOrientationChange
- * <String>
- * prevValue the current orientation
- * <String>
- * newValue the new orientation to be applied
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('beforeOrientationChange', handler);
- * @event beforeOrientationChange
- */
-
-/**
- * Fires after the orientation is changed.
- * See: Element.addListener
- * Event fields:
- * <String> type orientationChange
- * <String>
- * prevValue the former orientation
- * <String>
- * newValue the new orientation
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('orientationChange', handler);
- * @event orientationChange
- */
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+(function() {
+
+ YAHOO.util.Lang = {
+ isArray: function(val) { // frames lose type, so test constructor string
+ if (val.constructor && val.constructor.toString().indexOf('Array') > -1) {
+ return true;
+ } else {
+ return YAHOO.util.Lang.isObject(val) && val.constructor == Array;
+ }
+ },
+
+ isBoolean: function(val) {
+ return typeof val == 'boolean';
+ },
+
+ isFunction: function(val) {
+ return typeof val == 'function';
+ },
+
+ isNull: function(val) {
+ return val === null;
+ },
+
+ isNumber: function(val) {
+ return !isNaN(val);
+ },
+
+ isObject: function(val) {
+ return typeof val == 'object' || YAHOO.util.Lang.isFunction(val);
+ },
+
+ isString: function(val) {
+ return typeof val == 'string';
+ },
+
+ isUndefined: function(val) {
+ return typeof val == 'undefined';
+ }
+ };
+})();/**
+ * Provides Attribute configurations.
+ * @namespace YAHOO.util
+ * @class Attribute
+ * @constructor
+ * @param hash {Object} The intial Attribute.
+ * @param {YAHOO.util.AttributeProvider} The owner of the Attribute instance.
+ */
+
+YAHOO.util.Attribute = function(hash, owner) {
+ if (owner) {
+ this.owner = owner;
+ this.configure(hash, true);
+ }
+};
+
+YAHOO.util.Attribute.prototype = {
+ /**
+ * The name of the attribute.
+ * @property name
+ * @type String
+ */
+ name: undefined,
+
+ /**
+ * The value of the attribute.
+ * @property value
+ * @type String
+ */
+ value: null,
+
+ /**
+ * The owner of the attribute.
+ * @property owner
+ * @type YAHOO.util.AttributeProvider
+ */
+ owner: null,
+
+ /**
+ * Whether or not the attribute is read only.
+ * @property readOnly
+ * @type Boolean
+ */
+ readOnly: false,
+
+ /**
+ * Whether or not the attribute can only be written once.
+ * @property writeOnce
+ * @type Boolean
+ */
+ writeOnce: false,
+
+ /**
+ * The attribute's initial configuration.
+ * @private
+ * @property _initialConfig
+ * @type Object
+ */
+ _initialConfig: null,
+
+ /**
+ * Whether or not the attribute's value has been set.
+ * @private
+ * @property _written
+ * @type Boolean
+ */
+ _written: false,
+
+ /**
+ * The method to use when setting the attribute's value.
+ * The method recieves the new value as the only argument.
+ * @property method
+ * @type Function
+ */
+ method: null,
+
+ /**
+ * The validator to use when setting the attribute's value.
+ * @property validator
+ * @type Function
+ * @return Boolean
+ */
+ validator: null,
+
+ /**
+ * Retrieves the current value of the attribute.
+ * @method getValue
+ * @return {any} The current value of the attribute.
+ */
+ getValue: function() {
+ return this.value;
+ },
+
+ /**
+ * Sets the value of the attribute and fires beforeChange and change events.
+ * @method setValue
+ * @param {Any} value The value to apply to the attribute.
+ * @param {Boolean} silent If true the change events will not be fired.
+ * @return {Boolean} Whether or not the value was set.
+ */
+ setValue: function(value, silent) {
+ var beforeRetVal;
+ var owner = this.owner;
+ var name = this.name;
+
+ var event = {
+ type: name,
+ prevValue: this.getValue(),
+ newValue: value
+ };
+
+ if (this.readOnly || ( this.writeOnce && this._written) ) {
+ return false; // write not allowed
+ }
+
+ if (this.validator && !this.validator.call(owner, value) ) {
+ return false; // invalid value
+ }
+
+ if (!silent) {
+ beforeRetVal = owner.fireBeforeChangeEvent(event);
+ if (beforeRetVal === false) {
+ YAHOO.log('setValue ' + name +
+ 'cancelled by beforeChange event', 'info', 'Attribute');
+ return false;
+ }
+ }
+
+ if (this.method) {
+ this.method.call(owner, value);
+ }
+
+ this.value = value;
+ this._written = true;
+
+ event.type = name;
+
+ if (!silent) {
+ this.owner.fireChangeEvent(event);
+ }
+
+ return true;
+ },
+
+ /**
+ * Allows for configuring the Attribute's properties.
+ * @method configure
+ * @param {Object} map A key-value map of Attribute properties.
+ * @param {Boolean} init Whether or not this should become the initial config.
+ */
+ configure: function(map, init) {
+ map = map || {};
+ this._written = false; // reset writeOnce
+ this._initialConfig = this._initialConfig || {};
+
+ for (var key in map) {
+ if ( key && map.hasOwnProperty(key) ) {
+ this[key] = map[key];
+ if (init) {
+ this._initialConfig[key] = map[key];
+ }
+ }
+ }
+ },
+
+ /**
+ * Resets the value to the initial config value.
+ * @method resetValue
+ * @return {Boolean} Whether or not the value was set.
+ */
+ resetValue: function() {
+ return this.setValue(this._initialConfig.value);
+ },
+
+ /**
+ * Resets the attribute config to the initial config state.
+ * @method resetConfig
+ */
+ resetConfig: function() {
+ this.configure(this._initialConfig);
+ },
+
+ /**
+ * Resets the value to the current value.
+ * Useful when values may have gotten out of sync with actual properties.
+ * @method refresh
+ * @return {Boolean} Whether or not the value was set.
+ */
+ refresh: function(silent) {
+ this.setValue(this.value, silent);
+ }
+};(function() {
+ var Lang = YAHOO.util.Lang;
+
+ /*
+ Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+ Code licensed under the BSD License:
+ http://developer.yahoo.net/yui/license.txt
+ */
+
+ /**
+ * Provides and manages YAHOO.util.Attribute instances
+ * @namespace YAHOO.util
+ * @class AttributeProvider
+ * @uses YAHOO.util.EventProvider
+ */
+ YAHOO.util.AttributeProvider = function() {};
+
+ YAHOO.util.AttributeProvider.prototype = {
+
+ /**
+ * A key-value map of Attribute configurations
+ * @property _configs
+ * @protected (may be used by subclasses and augmentors)
+ * @private
+ * @type {Object}
+ */
+ _configs: null,
+ /**
+ * Returns the current value of the attribute.
+ * @method get
+ * @param {String} key The attribute whose value will be returned.
+ */
+ get: function(key){
+ var configs = this._configs || {};
+ var config = configs[key];
+
+ if (!config) {
+ YAHOO.log(key + ' not found', 'error', 'AttributeProvider');
+ return undefined;
+ }
+
+ return config.value;
+ },
+
+ /**
+ * Sets the value of a config.
+ * @method set
+ * @param {String} key The name of the attribute
+ * @param {Any} value The value to apply to the attribute
+ * @param {Boolean} silent Whether or not to suppress change events
+ * @return {Boolean} Whether or not the value was set.
+ */
+ set: function(key, value, silent){
+ var configs = this._configs || {};
+ var config = configs[key];
+
+ if (!config) {
+ YAHOO.log('set failed: ' + key + ' not found',
+ 'error', 'AttributeProvider');
+ return false;
+ }
+
+ return config.setValue(value, silent);
+ },
+
+ /**
+ * Returns an array of attribute names.
+ * @method getAttributeKeys
+ * @return {Array} An array of attribute names.
+ */
+ getAttributeKeys: function(){
+ var configs = this._configs;
+ var keys = [];
+ var config;
+ for (var key in configs) {
+ config = configs[key];
+ if ( configs.hasOwnProperty(key) &&
+ !Lang.isUndefined(config) ) {
+ keys[keys.length] = key;
+ }
+ }
+
+ return keys;
+ },
+
+ /**
+ * Sets multiple attribute values.
+ * @method setAttributes
+ * @param {Object} map A key-value map of attributes
+ * @param {Boolean} silent Whether or not to suppress change events
+ */
+ setAttributes: function(map, silent){
+ for (var key in map) {
+ if ( map.hasOwnProperty(key) ) {
+ this.set(key, map[key], silent);
+ }
+ }
+ },
+
+ /**
+ * Resets the specified attribute's value to its initial value.
+ * @method resetValue
+ * @param {String} key The name of the attribute
+ * @param {Boolean} silent Whether or not to suppress change events
+ * @return {Boolean} Whether or not the value was set
+ */
+ resetValue: function(key, silent){
+ var configs = this._configs || {};
+ if (configs[key]) {
+ this.set(key, configs[key]._initialConfig.value, silent);
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Sets the attribute's value to its current value.
+ * @method refresh
+ * @param {String | Array} key The attribute(s) to refresh
+ * @param {Boolean} silent Whether or not to suppress change events
+ */
+ refresh: function(key, silent){
+ var configs = this._configs;
+
+ key = ( ( Lang.isString(key) ) ? [key] : key ) ||
+ this.getAttributeKeys();
+
+ for (var i = 0, len = key.length; i < len; ++i) {
+ if ( // only set if there is a value and not null
+ configs[key[i]] &&
+ ! Lang.isUndefined(configs[key[i]].value) &&
+ ! Lang.isNull(configs[key[i]].value) ) {
+ configs[key[i]].refresh(silent);
+ }
+ }
+ },
+
+ /**
+ * Adds an Attribute to the AttributeProvider instance.
+ * @method register
+ * @param {String} key The attribute's name
+ * @param {Object} map A key-value map containing the
+ * attribute's properties.
+ */
+ register: function(key, map) {
+ this._configs = this._configs || {};
+
+ if (this._configs[key]) { // dont override
+ return false;
+ }
+
+ map.name = key;
+ this._configs[key] = new YAHOO.util.Attribute(map, this);
+ return true;
+ },
+
+ /**
+ * Returns the attribute's properties.
+ * @method getAttributeConfig
+ * @param {String} key The attribute's name
+ * @private
+ * @return {object} A key-value map containing all of the
+ * attribute's properties.
+ */
+ getAttributeConfig: function(key) {
+ var configs = this._configs || {};
+ var config = configs[key] || {};
+ var map = {}; // returning a copy to prevent overrides
+
+ for (key in config) {
+ if ( config.hasOwnProperty(key) ) {
+ map[key] = config[key];
+ }
+ }
+
+ return map;
+ },
+
+ /**
+ * Sets or updates an Attribute instance's properties.
+ * @method configureAttribute
+ * @param {String} key The attribute's name.
+ * @param {Object} map A key-value map of attribute properties
+ * @param {Boolean} init Whether or not this should become the intial config.
+ */
+ configureAttribute: function(key, map, init) {
+ var configs = this._configs || {};
+
+ if (!configs[key]) {
+ YAHOO.log('unable to configure, ' + key + ' not found',
+ 'error', 'AttributeProvider');
+ return false;
+ }
+
+ configs[key].configure(map, init);
+ },
+
+ /**
+ * Resets an attribute to its intial configuration.
+ * @method resetAttributeConfig
+ * @param {String} key The attribute's name.
+ * @private
+ */
+ resetAttributeConfig: function(key){
+ var configs = this._configs || {};
+ configs[key].resetConfig();
+ },
+
+ /**
+ * Fires the attribute's beforeChange event.
+ * @method fireBeforeChangeEvent
+ * @param {String} key The attribute's name.
+ * @param {Obj} e The event object to pass to handlers.
+ */
+ fireBeforeChangeEvent: function(e) {
+ var type = 'before';
+ type += e.type.charAt(0).toUpperCase() + e.type.substr(1) + 'Change';
+ e.type = type;
+ return this.fireEvent(e.type, e);
+ },
+
+ /**
+ * Fires the attribute's change event.
+ * @method fireChangeEvent
+ * @param {String} key The attribute's name.
+ * @param {Obj} e The event object to pass to the handlers.
+ */
+ fireChangeEvent: function(e) {
+ e.type += 'Change';
+ return this.fireEvent(e.type, e);
+ }
+ };
+
+ YAHOO.augment(YAHOO.util.AttributeProvider, YAHOO.util.EventProvider);
+})();(function() {
+// internal shorthand
+var Dom = YAHOO.util.Dom,
+ Lang = YAHOO.util.Lang,
+ EventPublisher = YAHOO.util.EventPublisher,
+ AttributeProvider = YAHOO.util.AttributeProvider;
+
+/**
+ * Element provides an interface to an HTMLElement's attributes and common
+ * methods. Other commonly used attributes are added as well.
+ * @namespace YAHOO.util
+ * @class Element
+ * @uses YAHOO.util.AttributeProvider
+ * @constructor
+ * @param el {HTMLElement | String} The html element that
+ * represents the Element.
+ * @param {Object} map A key-value map of initial config names and values
+ */
+YAHOO.util.Element = function(el, map) {
+ if (arguments.length) {
+ this.init(el, map);
+ }
+};
+
+YAHOO.util.Element.prototype = {
+ /**
+ * Dom events supported by the Element instance.
+ * @property DOM_EVENTS
+ * @type Object
+ */
+ DOM_EVENTS: null,
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method appendChild
+ * @param {Boolean} deep Whether or not to do a deep clone
+ */
+ appendChild: function(child) {
+ child = child.get ? child.get('element') : child;
+ this.get('element').appendChild(child);
+ },
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method getElementsByTagName
+ * @param {String} tag The tagName to collect
+ */
+ getElementsByTagName: function(tag) {
+ return this.get('element').getElementsByTagName(tag);
+ },
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method hasChildNodes
+ * @return {Boolean} Whether or not the element has childNodes
+ */
+ hasChildNodes: function() {
+ return this.get('element').hasChildNodes();
+ },
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method insertBefore
+ * @param {HTMLElement} element The HTMLElement to insert
+ * @param {HTMLElement} before The HTMLElement to insert
+ * the element before.
+ */
+ insertBefore: function(element, before) {
+ element = element.get ? element.get('element') : element;
+ before = (before && before.get) ? before.get('element') : before;
+
+ this.get('element').insertBefore(element, before);
+ },
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method removeChild
+ * @param {HTMLElement} child The HTMLElement to remove
+ */
+ removeChild: function(child) {
+ child = child.get ? child.get('element') : child;
+ this.get('element').removeChild(child);
+ return true;
+ },
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method replaceChild
+ * @param {HTMLElement} newNode The HTMLElement to insert
+ * @param {HTMLElement} oldNode The HTMLElement to replace
+ */
+ replaceChild: function(newNode, oldNode) {
+ newNode = newNode.get ? newNode.get('element') : newNode;
+ oldNode = oldNode.get ? oldNode.get('element') : oldNode;
+ return this.get('element').replaceChild(newNode, oldNode);
+ },
+
+
+ /**
+ * Registers Element specific attributes.
+ * @method initAttributes
+ * @param {Object} map A key-value map of initial attribute configs
+ */
+ initAttributes: function(map) {
+ map = map || {};
+ var element = Dom.get(map.element) || null;
+
+ /**
+ * The HTMLElement the Element instance refers to.
+ * @config element
+ * @type HTMLElement
+ */
+ this.register('element', {
+ value: element,
+ readOnly: true
+ });
+ },
+
+ /**
+ * Adds a listener for the given event. These may be DOM or
+ * customEvent listeners. Any event that is fired via fireEvent
+ * can be listened for. All handlers receive an event object.
+ * @method addListener
+ * @param {String} type The name of the event to listen for
+ * @param {Function} fn The handler to call when the event fires
+ * @param {Any} obj A variable to pass to the handler
+ * @param {Object} scope The object to use for the scope of the handler
+ */
+ addListener: function(type, fn, obj, scope) {
+ var el = this.get('element');
+ var scope = scope || this;
+
+ el = this.get('id') || el;
+
+ if (!this._events[type]) { // create on the fly
+ if ( this.DOM_EVENTS[type] ) {
+ YAHOO.util.Event.addListener(el, type, function(e) {
+ if (e.srcElement && !e.target) { // supplement IE with target
+ e.target = e.srcElement;
+ }
+ this.fireEvent(type, e);
+ }, obj, scope);
+ }
+
+ this.createEvent(type, this);
+ this._events[type] = true;
+ }
+
+ this.subscribe.apply(this, arguments); // notify via customEvent
+ },
+
+
+ /**
+ * Alias for addListener
+ * @method on
+ * @param {String} type The name of the event to listen for
+ * @param {Function} fn The function call when the event fires
+ * @param {Any} obj A variable to pass to the handler
+ * @param {Object} scope The object to use for the scope of the handler
+ */
+ on: function() { this.addListener.apply(this, arguments); },
+
+
+ /**
+ * Remove an event listener
+ * @method removeListener
+ * @param {String} type The name of the event to listen for
+ * @param {Function} fn The function call when the event fires
+ */
+ removeListener: function(type, fn) {
+ this.unsubscribe.apply(this, arguments);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method addClass
+ * @param {String} className The className to add
+ */
+ addClass: function(className) {
+ Dom.addClass(this.get('element'), className);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method getElementsByClassName
+ * @param {String} className The className to collect
+ * @param {String} tag (optional) The tag to use in
+ * conjunction with class name
+ * @return {Array} Array of HTMLElements
+ */
+ getElementsByClassName: function(className, tag) {
+ return Dom.getElementsByClassName(className, tag,
+ this.get('element') );
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method hasClass
+ * @param {String} className The className to add
+ * @return {Boolean} Whether or not the element has the class name
+ */
+ hasClass: function(className) {
+ return Dom.hasClass(this.get('element'), className);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method removeClass
+ * @param {String} className The className to remove
+ */
+ removeClass: function(className) {
+ return Dom.removeClass(this.get('element'), className);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method replaceClass
+ * @param {String} oldClassName The className to replace
+ * @param {String} newClassName The className to add
+ */
+ replaceClass: function(oldClassName, newClassName) {
+ return Dom.replaceClass(this.get('element'),
+ oldClassName, newClassName);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method setStyle
+ * @param {String} property The style property to set
+ * @param {String} value The value to apply to the style property
+ */
+ setStyle: function(property, value) {
+ return Dom.setStyle(this.get('element'), property, value);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method getStyle
+ * @param {String} property The style property to retrieve
+ * @return {String} The current value of the property
+ */
+ getStyle: function(property) {
+ return Dom.getStyle(this.get('element'), property);
+ },
+
+ /**
+ * Apply any queued set calls.
+ * @method fireQueue
+ */
+ fireQueue: function() {
+ var queue = this._queue;
+ for (var i = 0, len = queue.length; i < len; ++i) {
+ this[queue[i][0]].apply(this, queue[i][1]);
+ }
+ },
+
+ /**
+ * Appends the HTMLElement into either the supplied parentNode.
+ * @method appendTo
+ * @param {HTMLElement | Element} parentNode The node to append to
+ * @param {HTMLElement | Element} before An optional node to insert before
+ */
+ appendTo: function(parent, before) {
+ parent = (parent.get) ? parent.get('element') : Dom.get(parent);
+
+ before = (before && before.get) ?
+ before.get('element') : Dom.get(before);
+ var element = this.get('element');
+
+ var newAddition = !Dom.inDocument(element);
+
+ if (!element) {
+ YAHOO.log('appendTo failed: element not available',
+ 'error', 'Element');
+ return false;
+ }
+
+ if (!parent) {
+ YAHOO.log('appendTo failed: parent not available',
+ 'error', 'Element');
+ return false;
+ }
+
+ if (element.parent != parent) {
+ if (before) {
+ parent.insertBefore(element, before);
+ } else {
+ parent.appendChild(element);
+ }
+ }
+
+ YAHOO.log(element + 'appended to ' + parent);
+
+ if (!newAddition) {
+ return false; // note return; no refresh if in document
+ }
+
+ // if a new addition, refresh HTMLElement any applied attributes
+ var keys = this.getAttributeKeys();
+
+ for (var key in keys) { // only refresh HTMLElement attributes
+ if ( !Lang.isUndefined(element[key]) ) {
+ this.refresh(key);
+ }
+ }
+ },
+
+ get: function(key) {
+ var configs = this._configs || {};
+ var el = configs.element; // avoid loop due to 'element'
+ if (el && !configs[key] && !Lang.isUndefined(el.value[key]) ) {
+ return el.value[key];
+ }
+
+ return AttributeProvider.prototype.get.call(this, key);
+ },
+
+ set: function(key, value, silent) {
+ var el = this.get('element');
+ if (!el) {
+ this._queue[key] = ['set', arguments];
+ return false;
+ }
+
+ // set it on the element if not a property
+ if ( !this._configs[key] && !Lang.isUndefined(el[key]) ) {
+ _registerHTMLAttr(this, key);
+ }
+
+ return AttributeProvider.prototype.set.apply(this, arguments);
+ },
+
+ register: function(key) { // protect html attributes
+ var configs = this._configs || {};
+ var element = this.get('element') || null;
+
+ if ( element && !Lang.isUndefined(element[key]) ) {
+ YAHOO.log(key + ' is reserved for ' + element,
+ 'error', 'Element');
+ return false;
+ }
+
+ return AttributeProvider.prototype.register.apply(this, arguments);
+ },
+
+ configureAttribute: function(property, map, init) { // protect html attributes
+ if (!this._configs[property] && this._configs.element &&
+ !Lang.isUndefined(this._configs.element[property]) ) {
+ _registerHTMLAttr(this, property, map);
+ return false;
+ }
+
+ return AttributeProvider.prototype.configure.apply(this, arguments);
+ },
+
+ getAttributeKeys: function() {
+ var el = this.get('element');
+ var keys = AttributeProvider.prototype.getAttributeKeys.call(this);
+
+ //add any unconfigured element keys
+ for (var key in el) {
+ if (!this._configs[key]) {
+ keys[key] = keys[key] || el[key];
+ }
+ }
+
+ return keys;
+ },
+
+ init: function(el, attr) {
+ this._queue = this._queue || [];
+ this._events = this._events || {};
+ this._configs = this._configs || {};
+ attr = attr || {};
+ attr.element = attr.element || el || null;
+
+ this.DOM_EVENTS = {
+ 'click': true,
+ 'keydown': true,
+ 'keypress': true,
+ 'keyup': true,
+ 'mousedown': true,
+ 'mousemove': true,
+ 'mouseout': true,
+ 'mouseover': true,
+ 'mouseup': true
+ };
+
+ var readyHandler = function() {
+ this.initAttributes(attr);
+
+ this.setAttributes(attr, true);
+ this.fireQueue();
+ this.fireEvent('contentReady', {
+ type: 'contentReady',
+ target: attr.element
+ });
+ };
+
+ if ( Lang.isString(el) ) {
+ _registerHTMLAttr(this, 'id', { value: el });
+ YAHOO.util.Event.onAvailable(el, function() {
+ attr.element = Dom.get(el);
+ this.fireEvent('available', {
+ type: 'available',
+ target: attr.element
+ });
+ }, this, true);
+
+ YAHOO.util.Event.onContentReady(el, function() {
+ readyHandler.call(this);
+ }, this, true);
+ } else {
+ readyHandler.call(this);
+ }
+ }
+};
+
+/**
+ * Sets the value of the property and fires beforeChange and change events.
+ * @private
+ * @method _registerHTMLAttr
+ * @param {YAHOO.util.Element} element The Element instance to
+ * register the config to.
+ * @param {String} key The name of the config to register
+ * @param {Object} map A key-value map of the config's params
+ */
+var _registerHTMLAttr = function(self, key, map) {
+ var el = self.get('element');
+ map = map || {};
+ map.name = key;
+ map.method = map.method || function(value) {
+ el[key] = value;
+ };
+ map.value = map.value || el[key];
+ self._configs[key] = new YAHOO.util.Attribute(map, self);
+};
+
+/**
+ * Fires when the Element's HTMLElement can be retrieved by Id.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type available
+ * <HTMLElement>
+ * target the HTMLElement bound to this Element instance
+ *
Usage:
+ * var handler = function(e) {var target = e.target};
+ * myTabs.addListener('available', handler);
+ * @event available
+ */
+
+/**
+ * Fires when the Element's HTMLElement subtree is rendered.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type contentReady
+ * <HTMLElement>
+ * target the HTMLElement bound to this Element instance
+ *
Usage:
+ * var handler = function(e) {var target = e.target};
+ * myTabs.addListener('contentReady', handler);
+ * @event contentReady
+ */
+
+
+YAHOO.augment(YAHOO.util.Element, AttributeProvider);
+})();(function() {
+ var Dom = YAHOO.util.Dom,
+ Event = YAHOO.util.Event,
+ Lang = YAHOO.util.Lang;
+
+ /**
+ * A representation of a Tab's label and content.
+ * @namespace YAHOO.widget
+ * @class Tab
+ * @extends YAHOO.util.Element
+ * @constructor
+ * @param element {HTMLElement | String} (optional) The html element that
+ * represents the TabView. An element will be created if none provided.
+ * @param {Object} properties A key map of initial properties
+ */
+ Tab = function(el, attr) {
+ attr = attr || {};
+ if (arguments.length == 1 && !Lang.isString(el) && !el.nodeName) {
+ attr = el;
+ el = attr.element;
+ }
+
+ if (!el && !attr.element) {
+ el = _createTabElement.call(this, attr);
+ }
+
+ this.loadHandler = {
+ success: function(o) {
+ this.set('content', o.responseText);
+ },
+ failure: function(o) {
+ YAHOO.log('loading failed: ' + o.statusText,
+ 'error', 'Tab');
+ }
+ };
+
+ Tab.superclass.constructor.call(this, el, attr);
+
+ this.DOM_EVENTS = {}; // delegating to tabView
+ };
+
+ YAHOO.extend(Tab, YAHOO.util.Element);
+ var proto = Tab.prototype;
+
+ /**
+ * The default tag name for a Tab's inner element.
+ * @property LABEL_INNER_TAGNAME
+ * @type String
+ * @default "em"
+ */
+ proto.LABEL_TAGNAME = 'em';
+
+ /**
+ * The class name applied to active tabs.
+ * @property ACTIVE_CLASSNAME
+ * @type String
+ * @default "on"
+ */
+ proto.ACTIVE_CLASSNAME = 'selected';
+
+ /**
+ * The class name applied to disabled tabs.
+ * @property DISABLED_CLASSNAME
+ * @type String
+ * @default "disabled"
+ */
+ proto.DISABLED_CLASSNAME = 'disabled';
+
+ /**
+ * The class name applied to dynamic tabs while loading.
+ * @property LOADING_CLASSNAME
+ * @type String
+ * @default "disabled"
+ */
+ proto.LOADING_CLASSNAME = 'loading';
+
+ /**
+ * Provides a reference to the connection request object when data is
+ * loaded dynamically.
+ * @property dataConnection
+ * @type Object
+ */
+ proto.dataConnection = null;
+
+ /**
+ * Object containing success and failure callbacks for loading data.
+ * @property loadHandler
+ * @type object
+ */
+ proto.loadHandler = null;
+
+ /**
+ * Provides a readable name for the tab.
+ * @method toString
+ * @return String
+ */
+ proto.toString = function() {
+ var el = this.get('element');
+ var id = el.id || el.tagName;
+ return "Tab " + id;
+ };
+
+ /**
+ * Registers TabView specific properties.
+ * @method initAttributes
+ * @param {Object} attr Hash of initial attributes
+ */
+ proto.initAttributes = function(attr) {
+ attr = attr || {};
+ Tab.superclass.initAttributes.call(this, attr);
+
+ var el = this.get('element');
+
+ /**
+ * The event that triggers the tab's activation.
+ * @config activationEvent
+ * @type String
+ */
+ this.register('activationEvent', {
+ value: attr.activationEvent || 'click'
+ });
+
+ /**
+ * The element that contains the tab's label.
+ * @config labelEl
+ * @type HTMLElement
+ */
+ this.register('labelEl', {
+ value: attr.labelEl || _getlabelEl.call(this),
+ method: function(value) {
+ var current = this.get('labelEl');
+
+ if (current) {
+ if (current == value) {
+ return false; // already set
+ }
+
+ this.replaceChild(value, current);
+ } else if (el.firstChild) { // ensure label is firstChild by default
+ this.insertBefore(value, el.firstChild);
+ } else {
+ this.appendChild(value);
+ }
+ }
+ });
+
+ /**
+ * The tab's label text (or innerHTML).
+ * @config label
+ * @type String
+ */
+ this.register('label', {
+ value: attr.label || _getLabel.call(this),
+ method: function(value) {
+ var labelEl = this.get('labelEl');
+ if (!labelEl) { // create if needed
+ this.set('labelEl', _createlabelEl.call(this));
+ }
+
+ _setLabel.call(this, value);
+ }
+ });
+
+ /**
+ * The HTMLElement that contains the tab's content.
+ * @config contentEl
+ * @type HTMLElement
+ */
+ this.register('contentEl', { // TODO: apply className?
+ value: attr.contentEl || document.createElement('div'),
+ method: function(value) {
+ var current = this.get('contentEl');
+
+ if (current) {
+ if (current == value) {
+ return false; // already set
+ }
+ this.replaceChild(value, current);
+ }
+ }
+ });
+
+ /**
+ * The tab's content.
+ * @config content
+ * @type String
+ */
+ this.register('content', {
+ value: attr.content, // TODO: what about existing?
+ method: function(value) {
+ this.get('contentEl').innerHTML = value;
+ }
+ });
+
+ var _dataLoaded = false;
+
+ /**
+ * The tab's data source, used for loading content dynamically.
+ * @config dataSrc
+ * @type String
+ */
+ this.register('dataSrc', {
+ value: attr.dataSrc
+ });
+
+ /**
+ * Whether or not content should be reloaded for every view.
+ * @config cacheData
+ * @type Boolean
+ * @default false
+ */
+ this.register('cacheData', {
+ value: attr.cacheData || false,
+ validator: Lang.isBoolean
+ });
+
+ /**
+ * The method to use for the data request.
+ * @config loadMethod
+ * @type String
+ * @default "GET"
+ */
+ this.register('loadMethod', {
+ value: attr.loadMethod || 'GET',
+ validator: Lang.isString
+ });
+
+ /**
+ * Whether or not any data has been loaded from the server.
+ * @config dataLoaded
+ * @type Boolean
+ */
+ this.register('dataLoaded', {
+ value: false,
+ validator: Lang.isBoolean,
+ writeOnce: true
+ });
+
+ /**
+ * Number if milliseconds before aborting and calling failure handler.
+ * @config dataTimeout
+ * @type Number
+ * @default null
+ */
+ this.register('dataTimeout', {
+ value: attr.dataTimeout || null,
+ validator: Lang.isNumber
+ });
+
+ /**
+ * Whether or not the tab is currently active.
+ * If a dataSrc is set for the tab, the content will be loaded from
+ * the given source.
+ * @config active
+ * @type Boolean
+ */
+ this.register('active', {
+ value: attr.active || this.hasClass(this.ACTIVE_CLASSNAME),
+ method: function(value) {
+ if (value === true) {
+ this.addClass(this.ACTIVE_CLASSNAME);
+ this.set('title', 'active');
+ } else {
+ this.removeClass(this.ACTIVE_CLASSNAME);
+ this.set('title', '');
+ }
+ },
+ validator: function(value) {
+ return Lang.isBoolean(value) && !this.get('disabled') ;
+ }
+ });
+
+ /**
+ * Whether or not the tab is disabled.
+ * @config disabled
+ * @type Boolean
+ */
+ this.register('disabled', {
+ value: attr.disabled || this.hasClass(this.DISABLED_CLASSNAME),
+ method: function(value) {
+ if (value === true) {
+ Dom.addClass(this.get('element'), this.DISABLED_CLASSNAME);
+ } else {
+ Dom.removeClass(this.get('element'), this.DISABLED_CLASSNAME);
+ }
+ },
+ validator: Lang.isBoolean
+ });
+
+ /**
+ * The href of the tab's anchor element.
+ * @config href
+ * @type String
+ * @default '#'
+ */
+ this.register('href', {
+ value: attr.href || '#',
+ method: function(value) {
+ this.getElementsByTagName('a')[0].href = value;
+ },
+ validator: Lang.isString
+ });
+
+ /**
+ * The Whether or not the tab's content is visible.
+ * @config contentVisible
+ * @type Boolean
+ * @default false
+ */
+ this.register('contentVisible', {
+ value: attr.contentVisible,
+ method: function(value) {
+ if (value == true) {
+ this.get('contentEl').style.display = 'block';
+
+ if ( this.get('dataSrc') ) {
+ // load dynamic content unless already loaded and caching
+ if ( !this.get('dataLoaded') || !this.get('cacheData') ) {
+ _dataConnect.call(this);
+ }
+ }
+ } else {
+ this.get('contentEl').style.display = 'none';
+ }
+ },
+ validator: Lang.isBoolean
+ });
+ };
+
+ var _createTabElement = function(attr) {
+ var el = document.createElement('li');
+ var a = document.createElement('a');
+
+ a.href = attr.href || '#';
+
+ el.appendChild(a);
+
+ var label = attr.label || null;
+ var labelEl = attr.labelEl || null;
+
+ if (labelEl) { // user supplied labelEl
+ if (!label) { // user supplied label
+ label = _getLabel.call(this, labelEl);
+ }
+ } else {
+ labelEl = _createlabelEl.call(this);
+ }
+
+ a.appendChild(labelEl);
+
+ return el;
+ };
+
+ var _getlabelEl = function() {
+ return this.getElementsByTagName(this.LABEL_TAGNAME)[0];
+ };
+
+ var _createlabelEl = function() {
+ var el = document.createElement(this.LABEL_TAGNAME);
+ return el;
+ };
+
+ var _setLabel = function(label) {
+ var el = this.get('labelEl');
+ el.innerHTML = label;
+ };
+
+ var _getLabel = function() {
+ var label,
+ el = this.get('labelEl');
+
+ if (!el) {
+ return undefined;
+ }
+
+ return el.innerHTML;
+ };
+
+ var _dataConnect = function() {
+ if (!YAHOO.util.Connect) {
+ YAHOO.log('YAHOO.util.Connect dependency not met',
+ 'error', 'Tab');
+ return false;
+ }
+
+ Dom.addClass(this.get('contentEl').parentNode, this.LOADING_CLASSNAME);
+
+ this.dataConnection = YAHOO.util.Connect.asyncRequest(
+ this.get('loadMethod'),
+ this.get('dataSrc'),
+ {
+ success: function(o) {
+ this.loadHandler.success.call(this, o);
+ this.set('dataLoaded', true);
+ this.dataConnection = null;
+ Dom.removeClass(this.get('contentEl').parentNode,
+ this.LOADING_CLASSNAME);
+ },
+ failure: function(o) {
+ this.loadHandler.failure.call(this, o);
+ this.dataConnection = null;
+ Dom.removeClass(this.get('contentEl').parentNode,
+ this.LOADING_CLASSNAME);
+ },
+ scope: this,
+ timeout: this.get('dataTimeout')
+ }
+ );
+ };
+
+ YAHOO.widget.Tab = Tab;
+
+ /**
+ * Fires before the active state is changed.
+ * See: Element.addListener
+ * If handler returns false, the change will be cancelled, and the value will not
+ * be set.
+ * Event fields:
+ * <String> type beforeActiveChange
+ * <Boolean>
+ * prevValue the current value
+ * <Boolean>
+ * newValue the new value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('beforeActiveChange', handler);
+ * @event beforeActiveChange
+ */
+
+ /**
+ * Fires after the active state is changed.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type activeChange
+ * <Boolean>
+ * prevValue the previous value
+ * <Boolean>
+ * newValue the updated value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('activeChange', handler);
+ * @event activeChange
+ */
+
+ /**
+ * Fires before the tab label is changed.
+ * See: Element.addListener
+ * If handler returns false, the change will be cancelled, and the value will not
+ * be set.
+ * Event fields:
+ * <String> type beforeLabelChange
+ * <String>
+ * prevValue the current value
+ * <String>
+ * newValue the new value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('beforeLabelChange', handler);
+ * @event beforeLabelChange
+ */
+
+ /**
+ * Fires after the tab label is changed.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type labelChange
+ * <String>
+ * prevValue the previous value
+ * <String>
+ * newValue the updated value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('labelChange', handler);
+ * @event labelChange
+ */
+
+ /**
+ * Fires before the tab content is changed.
+ * See: Element.addListener
+ * If handler returns false, the change will be cancelled, and the value will not
+ * be set.
+ * Event fields:
+ * <String> type beforeContentChange
+ * <String>
+ * prevValue the current value
+ * <String>
+ * newValue the new value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('beforeContentChange', handler);
+ * @event beforeContentChange
+ */
+
+ /**
+ * Fires after the tab content is changed.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type contentChange
+ * <String>
+ * prevValue the previous value
+ * <Boolean>
+ * newValue the updated value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('contentChange', handler);
+ * @event contentChange
+ */
+})();(function() {
+
+ /**
+ * The tabview module provides a widget for managing content bound to tabs.
+ * @module tabview
+ *
+ */
+ /**
+ * A widget to control tabbed views.
+ * @namespace YAHOO.widget
+ * @class TabView
+ * @extends YAHOO.util.Element
+ * @constructor
+ * @param {HTMLElement | String | Object} el(optional) The html
+ * element that represents the TabView, or the attribute object to use.
+ * An element will be created if none provided.
+ * @param {Object} attr (optional) A key map of the tabView's
+ * initial attributes. Ignored if first arg is attributes object.
+ */
+ YAHOO.widget.TabView = function(el, attr) {
+ attr = attr || {};
+ if (arguments.length == 1 && !Lang.isString(el) && !el.nodeName) {
+ attr = el; // treat first arg as attr object
+ el = attr.element || null;
+ }
+
+ if (!el && !attr.element) { // create if we dont have one
+ el = _createTabViewElement.call(this, attr);
+ }
+ YAHOO.widget.TabView.superclass.constructor.call(this, el, attr);
+ };
+
+ YAHOO.extend(YAHOO.widget.TabView, YAHOO.util.Element);
+
+ var proto = YAHOO.widget.TabView.prototype;
+ var Dom = YAHOO.util.Dom;
+ var Lang = YAHOO.util.Lang;
+ var Event = YAHOO.util.Event;
+ var Tab = YAHOO.widget.Tab;
+
+
+ /**
+ * The className to add when building from scratch.
+ * @property CLASSNAME
+ * @default "navset"
+ */
+ proto.CLASSNAME = 'yui-navset';
+
+ /**
+ * The className of the HTMLElement containing the TabView's tab elements
+ * to look for when building from existing markup, or to add when building
+ * from scratch.
+ * All childNodes of the tab container are treated as Tabs when building
+ * from existing markup.
+ * @property TAB_PARENT_CLASSNAME
+ * @default "nav"
+ */
+ proto.TAB_PARENT_CLASSNAME = 'yui-nav';
+
+ /**
+ * The className of the HTMLElement containing the TabView's label elements
+ * to look for when building from existing markup, or to add when building
+ * from scratch.
+ * All childNodes of the content container are treated as content elements when
+ * building from existing markup.
+ * @property CONTENT_PARENT_CLASSNAME
+ * @default "nav-content"
+ */
+ proto.CONTENT_PARENT_CLASSNAME = 'yui-content';
+
+ proto._tabParent = null;
+ proto._contentParent = null;
+
+ /**
+ * Adds a Tab to the TabView instance.
+ * If no index is specified, the tab is added to the end of the tab list.
+ * @method addTab
+ * @param {YAHOO.widget.Tab} tab A Tab instance to add.
+ * @param {Integer} index The position to add the tab.
+ * @return void
+ */
+ proto.addTab = function(tab, index) {
+ var tabs = this.get('tabs');
+ if (!tabs) { // not ready yet
+ this._queue[this._queue.length] = ['addTab', arguments];
+ return false;
+ }
+
+ index = (index === undefined) ? tabs.length : index;
+
+ var before = this.getTab(index);
+
+ var self = this;
+ var el = this.get('element');
+ var tabParent = this._tabParent;
+ var contentParent = this._contentParent;
+
+ var tabElement = tab.get('element');
+ var contentEl = tab.get('contentEl');
+
+ if ( before ) {
+ tabParent.insertBefore(tabElement, before.get('element'));
+ } else {
+ tabParent.appendChild(tabElement);
+ }
+
+ if ( contentEl && !Dom.isAncestor(contentParent, contentEl) ) {
+ contentParent.appendChild(contentEl);
+ }
+
+ if ( !tab.get('active') ) {
+ tab.set('contentVisible', false, true); /* hide if not active */
+ } else {
+ this.set('activeTab', tab, true);
+
+ }
+
+ var activate = function(e) {
+ YAHOO.util.Event.preventDefault(e);
+ self.set('activeTab', this);
+ };
+
+ tab.addListener( tab.get('activationEvent'), activate);
+
+ tab.addListener('activationEventChange', function(e) {
+ if (e.prevValue != e.newValue) {
+ tab.removeListener(e.prevValue, activate);
+ tab.addListener(e.newValue, activate);
+ }
+ });
+
+ tabs.splice(index, 0, tab);
+ };
+
+ /**
+ * Routes childNode events.
+ * @method DOMEventHandler
+ * @param {event} e The Dom event that is being handled.
+ * @return void
+ */
+ proto.DOMEventHandler = function(e) {
+ var el = this.get('element');
+ var target = YAHOO.util.Event.getTarget(e);
+ var tabParent = this._tabParent;
+
+ if (Dom.isAncestor(tabParent, target) ) {
+ var tabEl;
+ var tab = null;
+ var contentEl;
+ var tabs = this.get('tabs');
+
+ for (var i = 0, len = tabs.length; i < len; i++) {
+ tabEl = tabs[i].get('element');
+ contentEl = tabs[i].get('contentEl');
+
+ if ( target == tabEl || Dom.isAncestor(tabEl, target) ) {
+ tab = tabs[i];
+ break; // note break
+ }
+ }
+
+ if (tab) {
+ tab.fireEvent(e.type, e);
+ }
+ }
+ };
+
+ /**
+ * Returns the Tab instance at the specified index.
+ * @method getTab
+ * @param {Integer} index The position of the Tab.
+ * @return YAHOO.widget.Tab
+ */
+ proto.getTab = function(index) {
+ return this.get('tabs')[index];
+ };
+
+ /**
+ * Returns the index of given tab.
+ * @method getTabIndex
+ * @param {YAHOO.widget.Tab} tab The tab whose index will be returned.
+ * @return int
+ */
+ proto.getTabIndex = function(tab) {
+ var index = null;
+ var tabs = this.get('tabs');
+ for (var i = 0, len = tabs.length; i < len; ++i) {
+ if (tab == tabs[i]) {
+ index = i;
+ break;
+ }
+ }
+
+ return index;
+ };
+
+ /**
+ * Removes the specified Tab from the TabView.
+ * @method removeTab
+ * @param {YAHOO.widget.Tab} item The Tab instance to be removed.
+ * @return void
+ */
+ proto.removeTab = function(tab) {
+ var tabCount = this.get('tabs').length;
+
+ var index = this.getTabIndex(tab);
+ var nextIndex = index + 1;
+ if ( tab == this.get('activeTab') ) { // select next tab
+ if (tabCount > 1) {
+ if (index + 1 == tabCount) {
+ this.set('activeIndex', index - 1);
+ } else {
+ this.set('activeIndex', index + 1);
+ }
+ }
+ }
+
+ this._tabParent.removeChild( tab.get('element') );
+ this._contentParent.removeChild( tab.get('contentEl') );
+ this._configs.tabs.value.splice(index, 1);
+
+ };
+
+ /**
+ * Provides a readable name for the TabView instance.
+ * @method toString
+ * @return String
+ */
+ proto.toString = function() {
+ var name = this.get('id') || this.get('tagName');
+ return "TabView " + name;
+ };
+
+ /**
+ * The transiton to use when switching between tabs.
+ * @method contentTransition
+ */
+ proto.contentTransition = function(newTab, oldTab) {
+ newTab.set('contentVisible', true);
+ oldTab.set('contentVisible', false);
+ };
+
+ /**
+ * Registers TabView specific properties.
+ * @method initAttributes
+ * @param {Object} attr Hash of initial attributes
+ */
+ proto.initAttributes = function(attr) {
+ YAHOO.widget.TabView.superclass.initAttributes.call(this, attr);
+
+ if (!attr.orientation) {
+ attr.orientation = 'top';
+ }
+
+ var el = this.get('element');
+
+ /**
+ * The Tabs belonging to the TabView instance.
+ * @config tabs
+ * @type Array
+ */
+ this.register('tabs', {
+ value: [],
+ readOnly: true
+ });
+
+ /**
+ * The container of the tabView's label elements.
+ * @property _tabParent
+ * @private
+ * @type HTMLElement
+ */
+ this._tabParent =
+ this.getElementsByClassName(this.TAB_PARENT_CLASSNAME,
+ 'ul' )[0] || _createTabParent.call(this);
+
+ /**
+ * The container of the tabView's content elements.
+ * @property _contentParent
+ * @type HTMLElement
+ * @private
+ */
+ this._contentParent =
+ this.getElementsByClassName(this.CONTENT_PARENT_CLASSNAME,
+ 'div')[0] || _createContentParent.call(this);
+
+ /**
+ * How the Tabs should be oriented relative to the TabView.
+ * @config orientation
+ * @type String
+ * @default "top"
+ */
+ this.register('orientation', {
+ value: attr.orientation,
+ method: function(value) {
+ var current = this.get('orientation');
+ this.addClass('yui-navset-' + value);
+
+ if (current != value) {
+ this.removeClass('yui-navset-' + current);
+ }
+
+ switch(value) {
+ case 'bottom':
+ this.appendChild(this._tabParent);
+ break;
+ }
+ }
+ });
+
+ /**
+ * The index of the tab currently active.
+ * @config activeIndex
+ * @type Int
+ */
+ this.register('activeIndex', {
+ value: attr.activeIndex,
+ method: function(value) {
+ this.set('activeTab', this.getTab(value));
+ },
+ validator: function(value) {
+ return !this.getTab(value).get('disabled'); // cannot activate if disabled
+ }
+ });
+
+ /**
+ * The tab currently active.
+ * @config activeTab
+ * @type YAHOO.widget.Tab
+ */
+ this.register('activeTab', {
+ value: attr.activeTab,
+ method: function(tab) {
+ var activeTab = this.get('activeTab');
+
+ if (tab) {
+ tab.set('active', true);
+ }
+
+ if (activeTab && activeTab != tab) {
+ activeTab.set('active', false);
+ }
+
+ if (activeTab && tab != activeTab) { // no transition if only 1
+ this.contentTransition(tab, activeTab);
+ } else if (tab) {
+ tab.set('contentVisible', true);
+ }
+ },
+ validator: function(value) {
+ return !value.get('disabled'); // cannot activate if disabled
+ }
+ });
+
+ if ( this._tabParent ) {
+ _initTabs.call(this);
+ }
+
+ for (var type in this.DOM_EVENTS) {
+ if ( this.DOM_EVENTS.hasOwnProperty(type) ) {
+ this.addListener.call(this, type, this.DOMEventHandler);
+ }
+ }
+ };
+
+ /**
+ * Creates Tab instances from a collection of HTMLElements.
+ * @method createTabs
+ * @private
+ * @param {Array|HTMLCollection} elements The elements to use for Tabs.
+ * @return void
+ */
+ var _initTabs = function() {
+ var tab,
+ attr,
+ contentEl;
+
+ var el = this.get('element');
+ var tabs = _getChildNodes(this._tabParent);
+ var contentElements = _getChildNodes(this._contentParent);
+
+ for (var i = 0, len = tabs.length; i < len; ++i) {
+ attr = {};
+
+ if (contentElements[i]) {
+ attr.contentEl = contentElements[i];
+ }
+
+ tab = new YAHOO.widget.Tab(tabs[i], attr);
+ this.addTab(tab);
+
+ if (tab.hasClass(tab.ACTIVE_CLASSNAME) ) {
+ this._configs.activeTab.value = tab; // dont invoke method
+ }
+ }
+ };
+
+ var _createTabViewElement = function(attr) {
+ var el = document.createElement('div');
+
+ if ( this.CLASSNAME ) {
+ el.className = this.CLASSNAME;
+ }
+
+ return el;
+ };
+
+ var _createTabParent = function(attr) {
+ var el = document.createElement('ul');
+
+ if ( this.TAB_PARENT_CLASSNAME ) {
+ el.className = this.TAB_PARENT_CLASSNAME;
+ }
+
+ this.get('element').appendChild(el);
+
+ return el;
+ };
+
+ var _createContentParent = function(attr) {
+ var el = document.createElement('div');
+
+ if ( this.CONTENT_PARENT_CLASSNAME ) {
+ el.className = this.CONTENT_PARENT_CLASSNAME;
+ }
+
+ this.get('element').appendChild(el);
+
+ return el;
+ };
+
+ var _getChildNodes = function(el) {
+ var nodes = [];
+ var childNodes = el.childNodes;
+
+ for (var i = 0, len = childNodes.length; i < len; ++i) {
+ if (childNodes[i].nodeType == 1) {
+ nodes[nodes.length] = childNodes[i];
+ }
+ }
+
+ return nodes;
+ };
+
+/**
+ * Fires before the activeTab is changed.
+ * See: Element.addListener
+ * If handler returns false, the change will be cancelled, and the value will not
+ * be set.
+ * Event fields:
+ * <String> type beforeActiveTabChange
+ * <YAHOO.widget.Tab >
+ * prevValue the currently active tab
+ * <YAHOO.widget.Tab >
+ * newValue the tab to be made active
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('beforeActiveTabChange', handler);
+ * @event beforeActiveTabChange
+ */
+
+/**
+ * Fires after the activeTab is changed.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type activeTabChange
+ * <YAHOO.widget.Tab >
+ * prevValue the formerly active tab
+ * <YAHOO.widget.Tab >
+ * newValue the new active tab
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('activeTabChange', handler);
+ * @event activeTabChange
+ */
+
+/**
+ * Fires before the orientation is changed.
+ * See: Element.addListener
+ * If handler returns false, the change will be cancelled, and the value will not
+ * be set.
+ * Event fields:
+ * <String> type beforeOrientationChange
+ * <String>
+ * prevValue the current orientation
+ * <String>
+ * newValue the new orientation to be applied
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('beforeOrientationChange', handler);
+ * @event beforeOrientationChange
+ */
+
+/**
+ * Fires after the orientation is changed.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type orientationChange
+ * <String>
+ * prevValue the former orientation
+ * <String>
+ * newValue the new orientation
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('orientationChange', handler);
+ * @event orientationChange
+ */
})();
\ No newline at end of file
diff --git a/thirdpartyjs/yui/tabview/tabview.js b/thirdpartyjs/yui/tabview/tabview.js
index 34a09bb..5e48fa7 100644
--- a/thirdpartyjs/yui/tabview/tabview.js
+++ b/thirdpartyjs/yui/tabview/tabview.js
@@ -1,1950 +1,1950 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-(function() {
-
- YAHOO.util.Lang = {
- isArray: function(val) { // frames lose type, so test constructor string
- if (val.constructor && val.constructor.toString().indexOf('Array') > -1) {
- return true;
- } else {
- return YAHOO.util.Lang.isObject(val) && val.constructor == Array;
- }
- },
-
- isBoolean: function(val) {
- return typeof val == 'boolean';
- },
-
- isFunction: function(val) {
- return typeof val == 'function';
- },
-
- isNull: function(val) {
- return val === null;
- },
-
- isNumber: function(val) {
- return !isNaN(val);
- },
-
- isObject: function(val) {
- return typeof val == 'object' || YAHOO.util.Lang.isFunction(val);
- },
-
- isString: function(val) {
- return typeof val == 'string';
- },
-
- isUndefined: function(val) {
- return typeof val == 'undefined';
- }
- };
-})();/**
- * Provides Attribute configurations.
- * @namespace YAHOO.util
- * @class Attribute
- * @constructor
- * @param hash {Object} The intial Attribute.
- * @param {YAHOO.util.AttributeProvider} The owner of the Attribute instance.
- */
-
-YAHOO.util.Attribute = function(hash, owner) {
- if (owner) {
- this.owner = owner;
- this.configure(hash, true);
- }
-};
-
-YAHOO.util.Attribute.prototype = {
- /**
- * The name of the attribute.
- * @property name
- * @type String
- */
- name: undefined,
-
- /**
- * The value of the attribute.
- * @property value
- * @type String
- */
- value: null,
-
- /**
- * The owner of the attribute.
- * @property owner
- * @type YAHOO.util.AttributeProvider
- */
- owner: null,
-
- /**
- * Whether or not the attribute is read only.
- * @property readOnly
- * @type Boolean
- */
- readOnly: false,
-
- /**
- * Whether or not the attribute can only be written once.
- * @property writeOnce
- * @type Boolean
- */
- writeOnce: false,
-
- /**
- * The attribute's initial configuration.
- * @private
- * @property _initialConfig
- * @type Object
- */
- _initialConfig: null,
-
- /**
- * Whether or not the attribute's value has been set.
- * @private
- * @property _written
- * @type Boolean
- */
- _written: false,
-
- /**
- * The method to use when setting the attribute's value.
- * The method recieves the new value as the only argument.
- * @property method
- * @type Function
- */
- method: null,
-
- /**
- * The validator to use when setting the attribute's value.
- * @property validator
- * @type Function
- * @return Boolean
- */
- validator: null,
-
- /**
- * Retrieves the current value of the attribute.
- * @method getValue
- * @return {any} The current value of the attribute.
- */
- getValue: function() {
- return this.value;
- },
-
- /**
- * Sets the value of the attribute and fires beforeChange and change events.
- * @method setValue
- * @param {Any} value The value to apply to the attribute.
- * @param {Boolean} silent If true the change events will not be fired.
- * @return {Boolean} Whether or not the value was set.
- */
- setValue: function(value, silent) {
- var beforeRetVal;
- var owner = this.owner;
- var name = this.name;
-
- var event = {
- type: name,
- prevValue: this.getValue(),
- newValue: value
- };
-
- if (this.readOnly || ( this.writeOnce && this._written) ) {
- return false; // write not allowed
- }
-
- if (this.validator && !this.validator.call(owner, value) ) {
- return false; // invalid value
- }
-
- if (!silent) {
- beforeRetVal = owner.fireBeforeChangeEvent(event);
- if (beforeRetVal === false) {
- YAHOO.log('setValue ' + name +
- 'cancelled by beforeChange event', 'info', 'Attribute');
- return false;
- }
- }
-
- if (this.method) {
- this.method.call(owner, value);
- }
-
- this.value = value;
- this._written = true;
-
- event.type = name;
-
- if (!silent) {
- this.owner.fireChangeEvent(event);
- }
-
- return true;
- },
-
- /**
- * Allows for configuring the Attribute's properties.
- * @method configure
- * @param {Object} map A key-value map of Attribute properties.
- * @param {Boolean} init Whether or not this should become the initial config.
- */
- configure: function(map, init) {
- map = map || {};
- this._written = false; // reset writeOnce
- this._initialConfig = this._initialConfig || {};
-
- for (var key in map) {
- if ( key && map.hasOwnProperty(key) ) {
- this[key] = map[key];
- if (init) {
- this._initialConfig[key] = map[key];
- }
- }
- }
- },
-
- /**
- * Resets the value to the initial config value.
- * @method resetValue
- * @return {Boolean} Whether or not the value was set.
- */
- resetValue: function() {
- return this.setValue(this._initialConfig.value);
- },
-
- /**
- * Resets the attribute config to the initial config state.
- * @method resetConfig
- */
- resetConfig: function() {
- this.configure(this._initialConfig);
- },
-
- /**
- * Resets the value to the current value.
- * Useful when values may have gotten out of sync with actual properties.
- * @method refresh
- * @return {Boolean} Whether or not the value was set.
- */
- refresh: function(silent) {
- this.setValue(this.value, silent);
- }
-};(function() {
- var Lang = YAHOO.util.Lang;
-
- /*
- Copyright (c) 2006, Yahoo! Inc. All rights reserved.
- Code licensed under the BSD License:
- http://developer.yahoo.net/yui/license.txt
- */
-
- /**
- * Provides and manages YAHOO.util.Attribute instances
- * @namespace YAHOO.util
- * @class AttributeProvider
- * @uses YAHOO.util.EventProvider
- */
- YAHOO.util.AttributeProvider = function() {};
-
- YAHOO.util.AttributeProvider.prototype = {
-
- /**
- * A key-value map of Attribute configurations
- * @property _configs
- * @protected (may be used by subclasses and augmentors)
- * @private
- * @type {Object}
- */
- _configs: null,
- /**
- * Returns the current value of the attribute.
- * @method get
- * @param {String} key The attribute whose value will be returned.
- */
- get: function(key){
- var configs = this._configs || {};
- var config = configs[key];
-
- if (!config) {
- YAHOO.log(key + ' not found', 'error', 'AttributeProvider');
- return undefined;
- }
-
- return config.value;
- },
-
- /**
- * Sets the value of a config.
- * @method set
- * @param {String} key The name of the attribute
- * @param {Any} value The value to apply to the attribute
- * @param {Boolean} silent Whether or not to suppress change events
- * @return {Boolean} Whether or not the value was set.
- */
- set: function(key, value, silent){
- var configs = this._configs || {};
- var config = configs[key];
-
- if (!config) {
- YAHOO.log('set failed: ' + key + ' not found',
- 'error', 'AttributeProvider');
- return false;
- }
-
- return config.setValue(value, silent);
- },
-
- /**
- * Returns an array of attribute names.
- * @method getAttributeKeys
- * @return {Array} An array of attribute names.
- */
- getAttributeKeys: function(){
- var configs = this._configs;
- var keys = [];
- var config;
- for (var key in configs) {
- config = configs[key];
- if ( configs.hasOwnProperty(key) &&
- !Lang.isUndefined(config) ) {
- keys[keys.length] = key;
- }
- }
-
- return keys;
- },
-
- /**
- * Sets multiple attribute values.
- * @method setAttributes
- * @param {Object} map A key-value map of attributes
- * @param {Boolean} silent Whether or not to suppress change events
- */
- setAttributes: function(map, silent){
- for (var key in map) {
- if ( map.hasOwnProperty(key) ) {
- this.set(key, map[key], silent);
- }
- }
- },
-
- /**
- * Resets the specified attribute's value to its initial value.
- * @method resetValue
- * @param {String} key The name of the attribute
- * @param {Boolean} silent Whether or not to suppress change events
- * @return {Boolean} Whether or not the value was set
- */
- resetValue: function(key, silent){
- var configs = this._configs || {};
- if (configs[key]) {
- this.set(key, configs[key]._initialConfig.value, silent);
- return true;
- }
- return false;
- },
-
- /**
- * Sets the attribute's value to its current value.
- * @method refresh
- * @param {String | Array} key The attribute(s) to refresh
- * @param {Boolean} silent Whether or not to suppress change events
- */
- refresh: function(key, silent){
- var configs = this._configs;
-
- key = ( ( Lang.isString(key) ) ? [key] : key ) ||
- this.getAttributeKeys();
-
- for (var i = 0, len = key.length; i < len; ++i) {
- if ( // only set if there is a value and not null
- configs[key[i]] &&
- ! Lang.isUndefined(configs[key[i]].value) &&
- ! Lang.isNull(configs[key[i]].value) ) {
- configs[key[i]].refresh(silent);
- }
- }
- },
-
- /**
- * Adds an Attribute to the AttributeProvider instance.
- * @method register
- * @param {String} key The attribute's name
- * @param {Object} map A key-value map containing the
- * attribute's properties.
- */
- register: function(key, map) {
- this._configs = this._configs || {};
-
- if (this._configs[key]) { // dont override
- return false;
- }
-
- map.name = key;
- this._configs[key] = new YAHOO.util.Attribute(map, this);
- return true;
- },
-
- /**
- * Returns the attribute's properties.
- * @method getAttributeConfig
- * @param {String} key The attribute's name
- * @private
- * @return {object} A key-value map containing all of the
- * attribute's properties.
- */
- getAttributeConfig: function(key) {
- var configs = this._configs || {};
- var config = configs[key] || {};
- var map = {}; // returning a copy to prevent overrides
-
- for (key in config) {
- if ( config.hasOwnProperty(key) ) {
- map[key] = config[key];
- }
- }
-
- return map;
- },
-
- /**
- * Sets or updates an Attribute instance's properties.
- * @method configureAttribute
- * @param {String} key The attribute's name.
- * @param {Object} map A key-value map of attribute properties
- * @param {Boolean} init Whether or not this should become the intial config.
- */
- configureAttribute: function(key, map, init) {
- var configs = this._configs || {};
-
- if (!configs[key]) {
- YAHOO.log('unable to configure, ' + key + ' not found',
- 'error', 'AttributeProvider');
- return false;
- }
-
- configs[key].configure(map, init);
- },
-
- /**
- * Resets an attribute to its intial configuration.
- * @method resetAttributeConfig
- * @param {String} key The attribute's name.
- * @private
- */
- resetAttributeConfig: function(key){
- var configs = this._configs || {};
- configs[key].resetConfig();
- },
-
- /**
- * Fires the attribute's beforeChange event.
- * @method fireBeforeChangeEvent
- * @param {String} key The attribute's name.
- * @param {Obj} e The event object to pass to handlers.
- */
- fireBeforeChangeEvent: function(e) {
- var type = 'before';
- type += e.type.charAt(0).toUpperCase() + e.type.substr(1) + 'Change';
- e.type = type;
- return this.fireEvent(e.type, e);
- },
-
- /**
- * Fires the attribute's change event.
- * @method fireChangeEvent
- * @param {String} key The attribute's name.
- * @param {Obj} e The event object to pass to the handlers.
- */
- fireChangeEvent: function(e) {
- e.type += 'Change';
- return this.fireEvent(e.type, e);
- }
- };
-
- YAHOO.augment(YAHOO.util.AttributeProvider, YAHOO.util.EventProvider);
-})();(function() {
-// internal shorthand
-var Dom = YAHOO.util.Dom,
- Lang = YAHOO.util.Lang,
- EventPublisher = YAHOO.util.EventPublisher,
- AttributeProvider = YAHOO.util.AttributeProvider;
-
-/**
- * Element provides an interface to an HTMLElement's attributes and common
- * methods. Other commonly used attributes are added as well.
- * @namespace YAHOO.util
- * @class Element
- * @uses YAHOO.util.AttributeProvider
- * @constructor
- * @param el {HTMLElement | String} The html element that
- * represents the Element.
- * @param {Object} map A key-value map of initial config names and values
- */
-YAHOO.util.Element = function(el, map) {
- if (arguments.length) {
- this.init(el, map);
- }
-};
-
-YAHOO.util.Element.prototype = {
- /**
- * Dom events supported by the Element instance.
- * @property DOM_EVENTS
- * @type Object
- */
- DOM_EVENTS: null,
-
- /**
- * Wrapper for HTMLElement method.
- * @method appendChild
- * @param {Boolean} deep Whether or not to do a deep clone
- */
- appendChild: function(child) {
- child = child.get ? child.get('element') : child;
- this.get('element').appendChild(child);
- },
-
- /**
- * Wrapper for HTMLElement method.
- * @method getElementsByTagName
- * @param {String} tag The tagName to collect
- */
- getElementsByTagName: function(tag) {
- return this.get('element').getElementsByTagName(tag);
- },
-
- /**
- * Wrapper for HTMLElement method.
- * @method hasChildNodes
- * @return {Boolean} Whether or not the element has childNodes
- */
- hasChildNodes: function() {
- return this.get('element').hasChildNodes();
- },
-
- /**
- * Wrapper for HTMLElement method.
- * @method insertBefore
- * @param {HTMLElement} element The HTMLElement to insert
- * @param {HTMLElement} before The HTMLElement to insert
- * the element before.
- */
- insertBefore: function(element, before) {
- element = element.get ? element.get('element') : element;
- before = (before && before.get) ? before.get('element') : before;
-
- this.get('element').insertBefore(element, before);
- },
-
- /**
- * Wrapper for HTMLElement method.
- * @method removeChild
- * @param {HTMLElement} child The HTMLElement to remove
- */
- removeChild: function(child) {
- child = child.get ? child.get('element') : child;
- this.get('element').removeChild(child);
- return true;
- },
-
- /**
- * Wrapper for HTMLElement method.
- * @method replaceChild
- * @param {HTMLElement} newNode The HTMLElement to insert
- * @param {HTMLElement} oldNode The HTMLElement to replace
- */
- replaceChild: function(newNode, oldNode) {
- newNode = newNode.get ? newNode.get('element') : newNode;
- oldNode = oldNode.get ? oldNode.get('element') : oldNode;
- return this.get('element').replaceChild(newNode, oldNode);
- },
-
-
- /**
- * Registers Element specific attributes.
- * @method initAttributes
- * @param {Object} map A key-value map of initial attribute configs
- */
- initAttributes: function(map) {
- map = map || {};
- var element = Dom.get(map.element) || null;
-
- /**
- * The HTMLElement the Element instance refers to.
- * @config element
- * @type HTMLElement
- */
- this.register('element', {
- value: element,
- readOnly: true
- });
- },
-
- /**
- * Adds a listener for the given event. These may be DOM or
- * customEvent listeners. Any event that is fired via fireEvent
- * can be listened for. All handlers receive an event object.
- * @method addListener
- * @param {String} type The name of the event to listen for
- * @param {Function} fn The handler to call when the event fires
- * @param {Any} obj A variable to pass to the handler
- * @param {Object} scope The object to use for the scope of the handler
- */
- addListener: function(type, fn, obj, scope) {
- var el = this.get('element');
- var scope = scope || this;
-
- el = this.get('id') || el;
-
- if (!this._events[type]) { // create on the fly
- if ( this.DOM_EVENTS[type] ) {
- YAHOO.util.Event.addListener(el, type, function(e) {
- if (e.srcElement && !e.target) { // supplement IE with target
- e.target = e.srcElement;
- }
- this.fireEvent(type, e);
- }, obj, scope);
- }
-
- this.createEvent(type, this);
- this._events[type] = true;
- }
-
- this.subscribe.apply(this, arguments); // notify via customEvent
- },
-
-
- /**
- * Alias for addListener
- * @method on
- * @param {String} type The name of the event to listen for
- * @param {Function} fn The function call when the event fires
- * @param {Any} obj A variable to pass to the handler
- * @param {Object} scope The object to use for the scope of the handler
- */
- on: function() { this.addListener.apply(this, arguments); },
-
-
- /**
- * Remove an event listener
- * @method removeListener
- * @param {String} type The name of the event to listen for
- * @param {Function} fn The function call when the event fires
- */
- removeListener: function(type, fn) {
- this.unsubscribe.apply(this, arguments);
- },
-
- /**
- * Wrapper for Dom method.
- * @method addClass
- * @param {String} className The className to add
- */
- addClass: function(className) {
- Dom.addClass(this.get('element'), className);
- },
-
- /**
- * Wrapper for Dom method.
- * @method getElementsByClassName
- * @param {String} className The className to collect
- * @param {String} tag (optional) The tag to use in
- * conjunction with class name
- * @return {Array} Array of HTMLElements
- */
- getElementsByClassName: function(className, tag) {
- return Dom.getElementsByClassName(className, tag,
- this.get('element') );
- },
-
- /**
- * Wrapper for Dom method.
- * @method hasClass
- * @param {String} className The className to add
- * @return {Boolean} Whether or not the element has the class name
- */
- hasClass: function(className) {
- return Dom.hasClass(this.get('element'), className);
- },
-
- /**
- * Wrapper for Dom method.
- * @method removeClass
- * @param {String} className The className to remove
- */
- removeClass: function(className) {
- return Dom.removeClass(this.get('element'), className);
- },
-
- /**
- * Wrapper for Dom method.
- * @method replaceClass
- * @param {String} oldClassName The className to replace
- * @param {String} newClassName The className to add
- */
- replaceClass: function(oldClassName, newClassName) {
- return Dom.replaceClass(this.get('element'),
- oldClassName, newClassName);
- },
-
- /**
- * Wrapper for Dom method.
- * @method setStyle
- * @param {String} property The style property to set
- * @param {String} value The value to apply to the style property
- */
- setStyle: function(property, value) {
- return Dom.setStyle(this.get('element'), property, value);
- },
-
- /**
- * Wrapper for Dom method.
- * @method getStyle
- * @param {String} property The style property to retrieve
- * @return {String} The current value of the property
- */
- getStyle: function(property) {
- return Dom.getStyle(this.get('element'), property);
- },
-
- /**
- * Apply any queued set calls.
- * @method fireQueue
- */
- fireQueue: function() {
- var queue = this._queue;
- for (var i = 0, len = queue.length; i < len; ++i) {
- this[queue[i][0]].apply(this, queue[i][1]);
- }
- },
-
- /**
- * Appends the HTMLElement into either the supplied parentNode.
- * @method appendTo
- * @param {HTMLElement | Element} parentNode The node to append to
- * @param {HTMLElement | Element} before An optional node to insert before
- */
- appendTo: function(parent, before) {
- parent = (parent.get) ? parent.get('element') : Dom.get(parent);
-
- before = (before && before.get) ?
- before.get('element') : Dom.get(before);
- var element = this.get('element');
-
- var newAddition = !Dom.inDocument(element);
-
- if (!element) {
- YAHOO.log('appendTo failed: element not available',
- 'error', 'Element');
- return false;
- }
-
- if (!parent) {
- YAHOO.log('appendTo failed: parent not available',
- 'error', 'Element');
- return false;
- }
-
- if (element.parent != parent) {
- if (before) {
- parent.insertBefore(element, before);
- } else {
- parent.appendChild(element);
- }
- }
-
- YAHOO.log(element + 'appended to ' + parent);
-
- if (!newAddition) {
- return false; // note return; no refresh if in document
- }
-
- // if a new addition, refresh HTMLElement any applied attributes
- var keys = this.getAttributeKeys();
-
- for (var key in keys) { // only refresh HTMLElement attributes
- if ( !Lang.isUndefined(element[key]) ) {
- this.refresh(key);
- }
- }
- },
-
- get: function(key) {
- var configs = this._configs || {};
- var el = configs.element; // avoid loop due to 'element'
- if (el && !configs[key] && !Lang.isUndefined(el.value[key]) ) {
- return el.value[key];
- }
-
- return AttributeProvider.prototype.get.call(this, key);
- },
-
- set: function(key, value, silent) {
- var el = this.get('element');
- if (!el) {
- this._queue[key] = ['set', arguments];
- return false;
- }
-
- // set it on the element if not a property
- if ( !this._configs[key] && !Lang.isUndefined(el[key]) ) {
- _registerHTMLAttr(this, key);
- }
-
- return AttributeProvider.prototype.set.apply(this, arguments);
- },
-
- register: function(key) { // protect html attributes
- var configs = this._configs || {};
- var element = this.get('element') || null;
-
- if ( element && !Lang.isUndefined(element[key]) ) {
- YAHOO.log(key + ' is reserved for ' + element,
- 'error', 'Element');
- return false;
- }
-
- return AttributeProvider.prototype.register.apply(this, arguments);
- },
-
- configureAttribute: function(property, map, init) { // protect html attributes
- if (!this._configs[property] && this._configs.element &&
- !Lang.isUndefined(this._configs.element[property]) ) {
- _registerHTMLAttr(this, property, map);
- return false;
- }
-
- return AttributeProvider.prototype.configure.apply(this, arguments);
- },
-
- getAttributeKeys: function() {
- var el = this.get('element');
- var keys = AttributeProvider.prototype.getAttributeKeys.call(this);
-
- //add any unconfigured element keys
- for (var key in el) {
- if (!this._configs[key]) {
- keys[key] = keys[key] || el[key];
- }
- }
-
- return keys;
- },
-
- init: function(el, attr) {
- this._queue = this._queue || [];
- this._events = this._events || {};
- this._configs = this._configs || {};
- attr = attr || {};
- attr.element = attr.element || el || null;
-
- this.DOM_EVENTS = {
- 'click': true,
- 'keydown': true,
- 'keypress': true,
- 'keyup': true,
- 'mousedown': true,
- 'mousemove': true,
- 'mouseout': true,
- 'mouseover': true,
- 'mouseup': true
- };
-
- var readyHandler = function() {
- this.initAttributes(attr);
-
- this.setAttributes(attr, true);
- this.fireQueue();
- this.fireEvent('contentReady', {
- type: 'contentReady',
- target: attr.element
- });
- };
-
- if ( Lang.isString(el) ) {
- _registerHTMLAttr(this, 'id', { value: el });
- YAHOO.util.Event.onAvailable(el, function() {
- attr.element = Dom.get(el);
- this.fireEvent('available', {
- type: 'available',
- target: attr.element
- });
- }, this, true);
-
- YAHOO.util.Event.onContentReady(el, function() {
- readyHandler.call(this);
- }, this, true);
- } else {
- readyHandler.call(this);
- }
- }
-};
-
-/**
- * Sets the value of the property and fires beforeChange and change events.
- * @private
- * @method _registerHTMLAttr
- * @param {YAHOO.util.Element} element The Element instance to
- * register the config to.
- * @param {String} key The name of the config to register
- * @param {Object} map A key-value map of the config's params
- */
-var _registerHTMLAttr = function(self, key, map) {
- var el = self.get('element');
- map = map || {};
- map.name = key;
- map.method = map.method || function(value) {
- el[key] = value;
- };
- map.value = map.value || el[key];
- self._configs[key] = new YAHOO.util.Attribute(map, self);
-};
-
-/**
- * Fires when the Element's HTMLElement can be retrieved by Id.
- * See: Element.addListener
- * Event fields:
- * <String> type available
- * <HTMLElement>
- * target the HTMLElement bound to this Element instance
- *
Usage:
- * var handler = function(e) {var target = e.target};
- * myTabs.addListener('available', handler);
- * @event available
- */
-
-/**
- * Fires when the Element's HTMLElement subtree is rendered.
- * See: Element.addListener
- * Event fields:
- * <String> type contentReady
- * <HTMLElement>
- * target the HTMLElement bound to this Element instance
- *
Usage:
- * var handler = function(e) {var target = e.target};
- * myTabs.addListener('contentReady', handler);
- * @event contentReady
- */
-
-YAHOO.augment(YAHOO.util.Element, AttributeProvider);
-})();(function() {
- var Dom = YAHOO.util.Dom,
- Event = YAHOO.util.Event,
- Lang = YAHOO.util.Lang;
-
- /**
- * A representation of a Tab's label and content.
- * @namespace YAHOO.widget
- * @class Tab
- * @extends YAHOO.util.Element
- * @constructor
- * @param element {HTMLElement | String} (optional) The html element that
- * represents the TabView. An element will be created if none provided.
- * @param {Object} properties A key map of initial properties
- */
- Tab = function(el, attr) {
- attr = attr || {};
- if (arguments.length == 1 && !Lang.isString(el) && !el.nodeName) {
- attr = el;
- el = attr.element;
- }
-
- if (!el && !attr.element) {
- el = _createTabElement.call(this, attr);
- }
-
- this.loadHandler = {
- success: function(o) {
- this.set('content', o.responseText);
- },
- failure: function(o) {
- YAHOO.log('loading failed: ' + o.statusText,
- 'error', 'Tab');
- }
- };
-
- Tab.superclass.constructor.call(this, el, attr);
-
- this.DOM_EVENTS = {}; // delegating to tabView
- };
-
- YAHOO.extend(Tab, YAHOO.util.Element);
- var proto = Tab.prototype;
-
- /**
- * The default tag name for a Tab's inner element.
- * @property LABEL_INNER_TAGNAME
- * @type String
- * @default "em"
- */
- proto.LABEL_TAGNAME = 'em';
-
- /**
- * The class name applied to active tabs.
- * @property ACTIVE_CLASSNAME
- * @type String
- * @default "on"
- */
- proto.ACTIVE_CLASSNAME = 'selected';
-
- /**
- * The class name applied to disabled tabs.
- * @property DISABLED_CLASSNAME
- * @type String
- * @default "disabled"
- */
- proto.DISABLED_CLASSNAME = 'disabled';
-
- /**
- * The class name applied to dynamic tabs while loading.
- * @property LOADING_CLASSNAME
- * @type String
- * @default "disabled"
- */
- proto.LOADING_CLASSNAME = 'loading';
-
- /**
- * Provides a reference to the connection request object when data is
- * loaded dynamically.
- * @property dataConnection
- * @type Object
- */
- proto.dataConnection = null;
-
- /**
- * Object containing success and failure callbacks for loading data.
- * @property loadHandler
- * @type object
- */
- proto.loadHandler = null;
-
- /**
- * Provides a readable name for the tab.
- * @method toString
- * @return String
- */
- proto.toString = function() {
- var el = this.get('element');
- var id = el.id || el.tagName;
- return "Tab " + id;
- };
-
- /**
- * Registers TabView specific properties.
- * @method initAttributes
- * @param {Object} attr Hash of initial attributes
- */
- proto.initAttributes = function(attr) {
- attr = attr || {};
- Tab.superclass.initAttributes.call(this, attr);
-
- var el = this.get('element');
-
- /**
- * The event that triggers the tab's activation.
- * @config activationEvent
- * @type String
- */
- this.register('activationEvent', {
- value: attr.activationEvent || 'click'
- });
-
- /**
- * The element that contains the tab's label.
- * @config labelEl
- * @type HTMLElement
- */
- this.register('labelEl', {
- value: attr.labelEl || _getlabelEl.call(this),
- method: function(value) {
- var current = this.get('labelEl');
-
- if (current) {
- if (current == value) {
- return false; // already set
- }
-
- this.replaceChild(value, current);
- } else if (el.firstChild) { // ensure label is firstChild by default
- this.insertBefore(value, el.firstChild);
- } else {
- this.appendChild(value);
- }
- }
- });
-
- /**
- * The tab's label text (or innerHTML).
- * @config label
- * @type String
- */
- this.register('label', {
- value: attr.label || _getLabel.call(this),
- method: function(value) {
- var labelEl = this.get('labelEl');
- if (!labelEl) { // create if needed
- this.set('labelEl', _createlabelEl.call(this));
- }
-
- _setLabel.call(this, value);
- }
- });
-
- /**
- * The HTMLElement that contains the tab's content.
- * @config contentEl
- * @type HTMLElement
- */
- this.register('contentEl', { // TODO: apply className?
- value: attr.contentEl || document.createElement('div'),
- method: function(value) {
- var current = this.get('contentEl');
-
- if (current) {
- if (current == value) {
- return false; // already set
- }
- this.replaceChild(value, current);
- }
- }
- });
-
- /**
- * The tab's content.
- * @config content
- * @type String
- */
- this.register('content', {
- value: attr.content, // TODO: what about existing?
- method: function(value) {
- this.get('contentEl').innerHTML = value;
- }
- });
-
- var _dataLoaded = false;
-
- /**
- * The tab's data source, used for loading content dynamically.
- * @config dataSrc
- * @type String
- */
- this.register('dataSrc', {
- value: attr.dataSrc
- });
-
- /**
- * Whether or not content should be reloaded for every view.
- * @config cacheData
- * @type Boolean
- * @default false
- */
- this.register('cacheData', {
- value: attr.cacheData || false,
- validator: Lang.isBoolean
- });
-
- /**
- * The method to use for the data request.
- * @config loadMethod
- * @type String
- * @default "GET"
- */
- this.register('loadMethod', {
- value: attr.loadMethod || 'GET',
- validator: Lang.isString
- });
-
- /**
- * Whether or not any data has been loaded from the server.
- * @config dataLoaded
- * @type Boolean
- */
- this.register('dataLoaded', {
- value: false,
- validator: Lang.isBoolean,
- writeOnce: true
- });
-
- /**
- * Number if milliseconds before aborting and calling failure handler.
- * @config dataTimeout
- * @type Number
- * @default null
- */
- this.register('dataTimeout', {
- value: attr.dataTimeout || null,
- validator: Lang.isNumber
- });
-
- /**
- * Whether or not the tab is currently active.
- * If a dataSrc is set for the tab, the content will be loaded from
- * the given source.
- * @config active
- * @type Boolean
- */
- this.register('active', {
- value: attr.active || this.hasClass(this.ACTIVE_CLASSNAME),
- method: function(value) {
- if (value === true) {
- this.addClass(this.ACTIVE_CLASSNAME);
- this.set('title', 'active');
- } else {
- this.removeClass(this.ACTIVE_CLASSNAME);
- this.set('title', '');
- }
- },
- validator: function(value) {
- return Lang.isBoolean(value) && !this.get('disabled') ;
- }
- });
-
- /**
- * Whether or not the tab is disabled.
- * @config disabled
- * @type Boolean
- */
- this.register('disabled', {
- value: attr.disabled || this.hasClass(this.DISABLED_CLASSNAME),
- method: function(value) {
- if (value === true) {
- Dom.addClass(this.get('element'), this.DISABLED_CLASSNAME);
- } else {
- Dom.removeClass(this.get('element'), this.DISABLED_CLASSNAME);
- }
- },
- validator: Lang.isBoolean
- });
-
- /**
- * The href of the tab's anchor element.
- * @config href
- * @type String
- * @default '#'
- */
- this.register('href', {
- value: attr.href || '#',
- method: function(value) {
- this.getElementsByTagName('a')[0].href = value;
- },
- validator: Lang.isString
- });
-
- /**
- * The Whether or not the tab's content is visible.
- * @config contentVisible
- * @type Boolean
- * @default false
- */
- this.register('contentVisible', {
- value: attr.contentVisible,
- method: function(value) {
- if (value == true) {
- this.get('contentEl').style.display = 'block';
-
- if ( this.get('dataSrc') ) {
- // load dynamic content unless already loaded and caching
- if ( !this.get('dataLoaded') || !this.get('cacheData') ) {
- _dataConnect.call(this);
- }
- }
- } else {
- this.get('contentEl').style.display = 'none';
- }
- },
- validator: Lang.isBoolean
- });
- };
-
- var _createTabElement = function(attr) {
- var el = document.createElement('li');
- var a = document.createElement('a');
-
- a.href = attr.href || '#';
-
- el.appendChild(a);
-
- var label = attr.label || null;
- var labelEl = attr.labelEl || null;
-
- if (labelEl) { // user supplied labelEl
- if (!label) { // user supplied label
- label = _getLabel.call(this, labelEl);
- }
- } else {
- labelEl = _createlabelEl.call(this);
- }
-
- a.appendChild(labelEl);
-
- return el;
- };
-
- var _getlabelEl = function() {
- return this.getElementsByTagName(this.LABEL_TAGNAME)[0];
- };
-
- var _createlabelEl = function() {
- var el = document.createElement(this.LABEL_TAGNAME);
- return el;
- };
-
- var _setLabel = function(label) {
- var el = this.get('labelEl');
- el.innerHTML = label;
- };
-
- var _getLabel = function() {
- var label,
- el = this.get('labelEl');
-
- if (!el) {
- return undefined;
- }
-
- return el.innerHTML;
- };
-
- var _dataConnect = function() {
- if (!YAHOO.util.Connect) {
- YAHOO.log('YAHOO.util.Connect dependency not met',
- 'error', 'Tab');
- return false;
- }
-
- Dom.addClass(this.get('contentEl').parentNode, this.LOADING_CLASSNAME);
-
- this.dataConnection = YAHOO.util.Connect.asyncRequest(
- this.get('loadMethod'),
- this.get('dataSrc'),
- {
- success: function(o) {
- this.loadHandler.success.call(this, o);
- this.set('dataLoaded', true);
- this.dataConnection = null;
- Dom.removeClass(this.get('contentEl').parentNode,
- this.LOADING_CLASSNAME);
- },
- failure: function(o) {
- this.loadHandler.failure.call(this, o);
- this.dataConnection = null;
- Dom.removeClass(this.get('contentEl').parentNode,
- this.LOADING_CLASSNAME);
- },
- scope: this,
- timeout: this.get('dataTimeout')
- }
- );
- };
-
- YAHOO.widget.Tab = Tab;
-
- /**
- * Fires before the active state is changed.
- * See: Element.addListener
- * If handler returns false, the change will be cancelled, and the value will not
- * be set.
- * Event fields:
- * <String> type beforeActiveChange
- * <Boolean>
- * prevValue the current value
- * <Boolean>
- * newValue the new value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('beforeActiveChange', handler);
- * @event beforeActiveChange
- */
-
- /**
- * Fires after the active state is changed.
- * See: Element.addListener
- * Event fields:
- * <String> type activeChange
- * <Boolean>
- * prevValue the previous value
- * <Boolean>
- * newValue the updated value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('activeChange', handler);
- * @event activeChange
- */
-
- /**
- * Fires before the tab label is changed.
- * See: Element.addListener
- * If handler returns false, the change will be cancelled, and the value will not
- * be set.
- * Event fields:
- * <String> type beforeLabelChange
- * <String>
- * prevValue the current value
- * <String>
- * newValue the new value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('beforeLabelChange', handler);
- * @event beforeLabelChange
- */
-
- /**
- * Fires after the tab label is changed.
- * See: Element.addListener
- * Event fields:
- * <String> type labelChange
- * <String>
- * prevValue the previous value
- * <String>
- * newValue the updated value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('labelChange', handler);
- * @event labelChange
- */
-
- /**
- * Fires before the tab content is changed.
- * See: Element.addListener
- * If handler returns false, the change will be cancelled, and the value will not
- * be set.
- * Event fields:
- * <String> type beforeContentChange
- * <String>
- * prevValue the current value
- * <String>
- * newValue the new value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('beforeContentChange', handler);
- * @event beforeContentChange
- */
-
- /**
- * Fires after the tab content is changed.
- * See: Element.addListener
- * Event fields:
- * <String> type contentChange
- * <String>
- * prevValue the previous value
- * <Boolean>
- * newValue the updated value
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('contentChange', handler);
- * @event contentChange
- */
-})();(function() {
-
- /**
- * The tabview module provides a widget for managing content bound to tabs.
- * @module tabview
- *
- */
- /**
- * A widget to control tabbed views.
- * @namespace YAHOO.widget
- * @class TabView
- * @extends YAHOO.util.Element
- * @constructor
- * @param {HTMLElement | String | Object} el(optional) The html
- * element that represents the TabView, or the attribute object to use.
- * An element will be created if none provided.
- * @param {Object} attr (optional) A key map of the tabView's
- * initial attributes. Ignored if first arg is attributes object.
- */
- YAHOO.widget.TabView = function(el, attr) {
- attr = attr || {};
- if (arguments.length == 1 && !Lang.isString(el) && !el.nodeName) {
- attr = el; // treat first arg as attr object
- el = attr.element || null;
- }
-
- if (!el && !attr.element) { // create if we dont have one
- el = _createTabViewElement.call(this, attr);
- }
- YAHOO.widget.TabView.superclass.constructor.call(this, el, attr);
- };
-
- YAHOO.extend(YAHOO.widget.TabView, YAHOO.util.Element);
-
- var proto = YAHOO.widget.TabView.prototype;
- var Dom = YAHOO.util.Dom;
- var Lang = YAHOO.util.Lang;
- var Event = YAHOO.util.Event;
- var Tab = YAHOO.widget.Tab;
-
-
- /**
- * The className to add when building from scratch.
- * @property CLASSNAME
- * @default "navset"
- */
- proto.CLASSNAME = 'yui-navset';
-
- /**
- * The className of the HTMLElement containing the TabView's tab elements
- * to look for when building from existing markup, or to add when building
- * from scratch.
- * All childNodes of the tab container are treated as Tabs when building
- * from existing markup.
- * @property TAB_PARENT_CLASSNAME
- * @default "nav"
- */
- proto.TAB_PARENT_CLASSNAME = 'yui-nav';
-
- /**
- * The className of the HTMLElement containing the TabView's label elements
- * to look for when building from existing markup, or to add when building
- * from scratch.
- * All childNodes of the content container are treated as content elements when
- * building from existing markup.
- * @property CONTENT_PARENT_CLASSNAME
- * @default "nav-content"
- */
- proto.CONTENT_PARENT_CLASSNAME = 'yui-content';
-
- proto._tabParent = null;
- proto._contentParent = null;
-
- /**
- * Adds a Tab to the TabView instance.
- * If no index is specified, the tab is added to the end of the tab list.
- * @method addTab
- * @param {YAHOO.widget.Tab} tab A Tab instance to add.
- * @param {Integer} index The position to add the tab.
- * @return void
- */
- proto.addTab = function(tab, index) {
- var tabs = this.get('tabs');
- if (!tabs) { // not ready yet
- this._queue[this._queue.length] = ['addTab', arguments];
- return false;
- }
-
- index = (index === undefined) ? tabs.length : index;
-
- var before = this.getTab(index);
-
- var self = this;
- var el = this.get('element');
- var tabParent = this._tabParent;
- var contentParent = this._contentParent;
-
- var tabElement = tab.get('element');
- var contentEl = tab.get('contentEl');
-
- if ( before ) {
- tabParent.insertBefore(tabElement, before.get('element'));
- } else {
- tabParent.appendChild(tabElement);
- }
-
- if ( contentEl && !Dom.isAncestor(contentParent, contentEl) ) {
- contentParent.appendChild(contentEl);
- }
-
- if ( !tab.get('active') ) {
- tab.set('contentVisible', false, true); /* hide if not active */
- } else {
- this.set('activeTab', tab, true);
-
- }
-
- var activate = function(e) {
- YAHOO.util.Event.preventDefault(e);
- self.set('activeTab', this);
- };
-
- tab.addListener( tab.get('activationEvent'), activate);
-
- tab.addListener('activationEventChange', function(e) {
- if (e.prevValue != e.newValue) {
- tab.removeListener(e.prevValue, activate);
- tab.addListener(e.newValue, activate);
- }
- });
-
- tabs.splice(index, 0, tab);
- };
-
- /**
- * Routes childNode events.
- * @method DOMEventHandler
- * @param {event} e The Dom event that is being handled.
- * @return void
- */
- proto.DOMEventHandler = function(e) {
- var el = this.get('element');
- var target = YAHOO.util.Event.getTarget(e);
- var tabParent = this._tabParent;
-
- if (Dom.isAncestor(tabParent, target) ) {
- var tabEl;
- var tab = null;
- var contentEl;
- var tabs = this.get('tabs');
-
- for (var i = 0, len = tabs.length; i < len; i++) {
- tabEl = tabs[i].get('element');
- contentEl = tabs[i].get('contentEl');
-
- if ( target == tabEl || Dom.isAncestor(tabEl, target) ) {
- tab = tabs[i];
- break; // note break
- }
- }
-
- if (tab) {
- tab.fireEvent(e.type, e);
- }
- }
- };
-
- /**
- * Returns the Tab instance at the specified index.
- * @method getTab
- * @param {Integer} index The position of the Tab.
- * @return YAHOO.widget.Tab
- */
- proto.getTab = function(index) {
- return this.get('tabs')[index];
- };
-
- /**
- * Returns the index of given tab.
- * @method getTabIndex
- * @param {YAHOO.widget.Tab} tab The tab whose index will be returned.
- * @return int
- */
- proto.getTabIndex = function(tab) {
- var index = null;
- var tabs = this.get('tabs');
- for (var i = 0, len = tabs.length; i < len; ++i) {
- if (tab == tabs[i]) {
- index = i;
- break;
- }
- }
-
- return index;
- };
-
- /**
- * Removes the specified Tab from the TabView.
- * @method removeTab
- * @param {YAHOO.widget.Tab} item The Tab instance to be removed.
- * @return void
- */
- proto.removeTab = function(tab) {
- var tabCount = this.get('tabs').length;
-
- var index = this.getTabIndex(tab);
- var nextIndex = index + 1;
- if ( tab == this.get('activeTab') ) { // select next tab
- if (tabCount > 1) {
- if (index + 1 == tabCount) {
- this.set('activeIndex', index - 1);
- } else {
- this.set('activeIndex', index + 1);
- }
- }
- }
-
- this._tabParent.removeChild( tab.get('element') );
- this._contentParent.removeChild( tab.get('contentEl') );
- this._configs.tabs.value.splice(index, 1);
-
- };
-
- /**
- * Provides a readable name for the TabView instance.
- * @method toString
- * @return String
- */
- proto.toString = function() {
- var name = this.get('id') || this.get('tagName');
- return "TabView " + name;
- };
-
- /**
- * The transiton to use when switching between tabs.
- * @method contentTransition
- */
- proto.contentTransition = function(newTab, oldTab) {
- newTab.set('contentVisible', true);
- oldTab.set('contentVisible', false);
- };
-
- /**
- * Registers TabView specific properties.
- * @method initAttributes
- * @param {Object} attr Hash of initial attributes
- */
- proto.initAttributes = function(attr) {
- YAHOO.widget.TabView.superclass.initAttributes.call(this, attr);
-
- if (!attr.orientation) {
- attr.orientation = 'top';
- }
-
- var el = this.get('element');
-
- /**
- * The Tabs belonging to the TabView instance.
- * @config tabs
- * @type Array
- */
- this.register('tabs', {
- value: [],
- readOnly: true
- });
-
- /**
- * The container of the tabView's label elements.
- * @property _tabParent
- * @private
- * @type HTMLElement
- */
- this._tabParent =
- this.getElementsByClassName(this.TAB_PARENT_CLASSNAME,
- 'ul' )[0] || _createTabParent.call(this);
-
- /**
- * The container of the tabView's content elements.
- * @property _contentParent
- * @type HTMLElement
- * @private
- */
- this._contentParent =
- this.getElementsByClassName(this.CONTENT_PARENT_CLASSNAME,
- 'div')[0] || _createContentParent.call(this);
-
- /**
- * How the Tabs should be oriented relative to the TabView.
- * @config orientation
- * @type String
- * @default "top"
- */
- this.register('orientation', {
- value: attr.orientation,
- method: function(value) {
- var current = this.get('orientation');
- this.addClass('yui-navset-' + value);
-
- if (current != value) {
- this.removeClass('yui-navset-' + current);
- }
-
- switch(value) {
- case 'bottom':
- this.appendChild(this._tabParent);
- break;
- }
- }
- });
-
- /**
- * The index of the tab currently active.
- * @config activeIndex
- * @type Int
- */
- this.register('activeIndex', {
- value: attr.activeIndex,
- method: function(value) {
- this.set('activeTab', this.getTab(value));
- },
- validator: function(value) {
- return !this.getTab(value).get('disabled'); // cannot activate if disabled
- }
- });
-
- /**
- * The tab currently active.
- * @config activeTab
- * @type YAHOO.widget.Tab
- */
- this.register('activeTab', {
- value: attr.activeTab,
- method: function(tab) {
- var activeTab = this.get('activeTab');
-
- if (tab) {
- tab.set('active', true);
- }
-
- if (activeTab && activeTab != tab) {
- activeTab.set('active', false);
- }
-
- if (activeTab && tab != activeTab) { // no transition if only 1
- this.contentTransition(tab, activeTab);
- } else if (tab) {
- tab.set('contentVisible', true);
- }
- },
- validator: function(value) {
- return !value.get('disabled'); // cannot activate if disabled
- }
- });
-
- if ( this._tabParent ) {
- _initTabs.call(this);
- }
-
- for (var type in this.DOM_EVENTS) {
- if ( this.DOM_EVENTS.hasOwnProperty(type) ) {
- this.addListener.call(this, type, this.DOMEventHandler);
- }
- }
- };
-
- /**
- * Creates Tab instances from a collection of HTMLElements.
- * @method createTabs
- * @private
- * @param {Array|HTMLCollection} elements The elements to use for Tabs.
- * @return void
- */
- var _initTabs = function() {
- var tab,
- attr,
- contentEl;
-
- var el = this.get('element');
- var tabs = _getChildNodes(this._tabParent);
- var contentElements = _getChildNodes(this._contentParent);
-
- for (var i = 0, len = tabs.length; i < len; ++i) {
- attr = {};
-
- if (contentElements[i]) {
- attr.contentEl = contentElements[i];
- }
-
- tab = new YAHOO.widget.Tab(tabs[i], attr);
- this.addTab(tab);
-
- if (tab.hasClass(tab.ACTIVE_CLASSNAME) ) {
- this._configs.activeTab.value = tab; // dont invoke method
- }
- }
- };
-
- var _createTabViewElement = function(attr) {
- var el = document.createElement('div');
-
- if ( this.CLASSNAME ) {
- el.className = this.CLASSNAME;
- }
-
- return el;
- };
-
- var _createTabParent = function(attr) {
- var el = document.createElement('ul');
-
- if ( this.TAB_PARENT_CLASSNAME ) {
- el.className = this.TAB_PARENT_CLASSNAME;
- }
-
- this.get('element').appendChild(el);
-
- return el;
- };
-
- var _createContentParent = function(attr) {
- var el = document.createElement('div');
-
- if ( this.CONTENT_PARENT_CLASSNAME ) {
- el.className = this.CONTENT_PARENT_CLASSNAME;
- }
-
- this.get('element').appendChild(el);
-
- return el;
- };
-
- var _getChildNodes = function(el) {
- var nodes = [];
- var childNodes = el.childNodes;
-
- for (var i = 0, len = childNodes.length; i < len; ++i) {
- if (childNodes[i].nodeType == 1) {
- nodes[nodes.length] = childNodes[i];
- }
- }
-
- return nodes;
- };
-
-/**
- * Fires before the activeTab is changed.
- * See: Element.addListener
- * If handler returns false, the change will be cancelled, and the value will not
- * be set.
- * Event fields:
- * <String> type beforeActiveTabChange
- * <YAHOO.widget.Tab >
- * prevValue the currently active tab
- * <YAHOO.widget.Tab >
- * newValue the tab to be made active
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('beforeActiveTabChange', handler);
- * @event beforeActiveTabChange
- */
-
-/**
- * Fires after the activeTab is changed.
- * See: Element.addListener
- * Event fields:
- * <String> type activeTabChange
- * <YAHOO.widget.Tab >
- * prevValue the formerly active tab
- * <YAHOO.widget.Tab >
- * newValue the new active tab
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('activeTabChange', handler);
- * @event activeTabChange
- */
-
-/**
- * Fires before the orientation is changed.
- * See: Element.addListener
- * If handler returns false, the change will be cancelled, and the value will not
- * be set.
- * Event fields:
- * <String> type beforeOrientationChange
- * <String>
- * prevValue the current orientation
- * <String>
- * newValue the new orientation to be applied
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('beforeOrientationChange', handler);
- * @event beforeOrientationChange
- */
-
-/**
- * Fires after the orientation is changed.
- * See: Element.addListener
- * Event fields:
- * <String> type orientationChange
- * <String>
- * prevValue the former orientation
- * <String>
- * newValue the new orientation
- * Usage:
- * var handler = function(e) {var previous = e.prevValue};
- * myTabs.addListener('orientationChange', handler);
- * @event orientationChange
- */
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+(function() {
+
+ YAHOO.util.Lang = {
+ isArray: function(val) { // frames lose type, so test constructor string
+ if (val.constructor && val.constructor.toString().indexOf('Array') > -1) {
+ return true;
+ } else {
+ return YAHOO.util.Lang.isObject(val) && val.constructor == Array;
+ }
+ },
+
+ isBoolean: function(val) {
+ return typeof val == 'boolean';
+ },
+
+ isFunction: function(val) {
+ return typeof val == 'function';
+ },
+
+ isNull: function(val) {
+ return val === null;
+ },
+
+ isNumber: function(val) {
+ return !isNaN(val);
+ },
+
+ isObject: function(val) {
+ return typeof val == 'object' || YAHOO.util.Lang.isFunction(val);
+ },
+
+ isString: function(val) {
+ return typeof val == 'string';
+ },
+
+ isUndefined: function(val) {
+ return typeof val == 'undefined';
+ }
+ };
+})();/**
+ * Provides Attribute configurations.
+ * @namespace YAHOO.util
+ * @class Attribute
+ * @constructor
+ * @param hash {Object} The intial Attribute.
+ * @param {YAHOO.util.AttributeProvider} The owner of the Attribute instance.
+ */
+
+YAHOO.util.Attribute = function(hash, owner) {
+ if (owner) {
+ this.owner = owner;
+ this.configure(hash, true);
+ }
+};
+
+YAHOO.util.Attribute.prototype = {
+ /**
+ * The name of the attribute.
+ * @property name
+ * @type String
+ */
+ name: undefined,
+
+ /**
+ * The value of the attribute.
+ * @property value
+ * @type String
+ */
+ value: null,
+
+ /**
+ * The owner of the attribute.
+ * @property owner
+ * @type YAHOO.util.AttributeProvider
+ */
+ owner: null,
+
+ /**
+ * Whether or not the attribute is read only.
+ * @property readOnly
+ * @type Boolean
+ */
+ readOnly: false,
+
+ /**
+ * Whether or not the attribute can only be written once.
+ * @property writeOnce
+ * @type Boolean
+ */
+ writeOnce: false,
+
+ /**
+ * The attribute's initial configuration.
+ * @private
+ * @property _initialConfig
+ * @type Object
+ */
+ _initialConfig: null,
+
+ /**
+ * Whether or not the attribute's value has been set.
+ * @private
+ * @property _written
+ * @type Boolean
+ */
+ _written: false,
+
+ /**
+ * The method to use when setting the attribute's value.
+ * The method recieves the new value as the only argument.
+ * @property method
+ * @type Function
+ */
+ method: null,
+
+ /**
+ * The validator to use when setting the attribute's value.
+ * @property validator
+ * @type Function
+ * @return Boolean
+ */
+ validator: null,
+
+ /**
+ * Retrieves the current value of the attribute.
+ * @method getValue
+ * @return {any} The current value of the attribute.
+ */
+ getValue: function() {
+ return this.value;
+ },
+
+ /**
+ * Sets the value of the attribute and fires beforeChange and change events.
+ * @method setValue
+ * @param {Any} value The value to apply to the attribute.
+ * @param {Boolean} silent If true the change events will not be fired.
+ * @return {Boolean} Whether or not the value was set.
+ */
+ setValue: function(value, silent) {
+ var beforeRetVal;
+ var owner = this.owner;
+ var name = this.name;
+
+ var event = {
+ type: name,
+ prevValue: this.getValue(),
+ newValue: value
+ };
+
+ if (this.readOnly || ( this.writeOnce && this._written) ) {
+ return false; // write not allowed
+ }
+
+ if (this.validator && !this.validator.call(owner, value) ) {
+ return false; // invalid value
+ }
+
+ if (!silent) {
+ beforeRetVal = owner.fireBeforeChangeEvent(event);
+ if (beforeRetVal === false) {
+ YAHOO.log('setValue ' + name +
+ 'cancelled by beforeChange event', 'info', 'Attribute');
+ return false;
+ }
+ }
+
+ if (this.method) {
+ this.method.call(owner, value);
+ }
+
+ this.value = value;
+ this._written = true;
+
+ event.type = name;
+
+ if (!silent) {
+ this.owner.fireChangeEvent(event);
+ }
+
+ return true;
+ },
+
+ /**
+ * Allows for configuring the Attribute's properties.
+ * @method configure
+ * @param {Object} map A key-value map of Attribute properties.
+ * @param {Boolean} init Whether or not this should become the initial config.
+ */
+ configure: function(map, init) {
+ map = map || {};
+ this._written = false; // reset writeOnce
+ this._initialConfig = this._initialConfig || {};
+
+ for (var key in map) {
+ if ( key && map.hasOwnProperty(key) ) {
+ this[key] = map[key];
+ if (init) {
+ this._initialConfig[key] = map[key];
+ }
+ }
+ }
+ },
+
+ /**
+ * Resets the value to the initial config value.
+ * @method resetValue
+ * @return {Boolean} Whether or not the value was set.
+ */
+ resetValue: function() {
+ return this.setValue(this._initialConfig.value);
+ },
+
+ /**
+ * Resets the attribute config to the initial config state.
+ * @method resetConfig
+ */
+ resetConfig: function() {
+ this.configure(this._initialConfig);
+ },
+
+ /**
+ * Resets the value to the current value.
+ * Useful when values may have gotten out of sync with actual properties.
+ * @method refresh
+ * @return {Boolean} Whether or not the value was set.
+ */
+ refresh: function(silent) {
+ this.setValue(this.value, silent);
+ }
+};(function() {
+ var Lang = YAHOO.util.Lang;
+
+ /*
+ Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+ Code licensed under the BSD License:
+ http://developer.yahoo.net/yui/license.txt
+ */
+
+ /**
+ * Provides and manages YAHOO.util.Attribute instances
+ * @namespace YAHOO.util
+ * @class AttributeProvider
+ * @uses YAHOO.util.EventProvider
+ */
+ YAHOO.util.AttributeProvider = function() {};
+
+ YAHOO.util.AttributeProvider.prototype = {
+
+ /**
+ * A key-value map of Attribute configurations
+ * @property _configs
+ * @protected (may be used by subclasses and augmentors)
+ * @private
+ * @type {Object}
+ */
+ _configs: null,
+ /**
+ * Returns the current value of the attribute.
+ * @method get
+ * @param {String} key The attribute whose value will be returned.
+ */
+ get: function(key){
+ var configs = this._configs || {};
+ var config = configs[key];
+
+ if (!config) {
+ YAHOO.log(key + ' not found', 'error', 'AttributeProvider');
+ return undefined;
+ }
+
+ return config.value;
+ },
+
+ /**
+ * Sets the value of a config.
+ * @method set
+ * @param {String} key The name of the attribute
+ * @param {Any} value The value to apply to the attribute
+ * @param {Boolean} silent Whether or not to suppress change events
+ * @return {Boolean} Whether or not the value was set.
+ */
+ set: function(key, value, silent){
+ var configs = this._configs || {};
+ var config = configs[key];
+
+ if (!config) {
+ YAHOO.log('set failed: ' + key + ' not found',
+ 'error', 'AttributeProvider');
+ return false;
+ }
+
+ return config.setValue(value, silent);
+ },
+
+ /**
+ * Returns an array of attribute names.
+ * @method getAttributeKeys
+ * @return {Array} An array of attribute names.
+ */
+ getAttributeKeys: function(){
+ var configs = this._configs;
+ var keys = [];
+ var config;
+ for (var key in configs) {
+ config = configs[key];
+ if ( configs.hasOwnProperty(key) &&
+ !Lang.isUndefined(config) ) {
+ keys[keys.length] = key;
+ }
+ }
+
+ return keys;
+ },
+
+ /**
+ * Sets multiple attribute values.
+ * @method setAttributes
+ * @param {Object} map A key-value map of attributes
+ * @param {Boolean} silent Whether or not to suppress change events
+ */
+ setAttributes: function(map, silent){
+ for (var key in map) {
+ if ( map.hasOwnProperty(key) ) {
+ this.set(key, map[key], silent);
+ }
+ }
+ },
+
+ /**
+ * Resets the specified attribute's value to its initial value.
+ * @method resetValue
+ * @param {String} key The name of the attribute
+ * @param {Boolean} silent Whether or not to suppress change events
+ * @return {Boolean} Whether or not the value was set
+ */
+ resetValue: function(key, silent){
+ var configs = this._configs || {};
+ if (configs[key]) {
+ this.set(key, configs[key]._initialConfig.value, silent);
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Sets the attribute's value to its current value.
+ * @method refresh
+ * @param {String | Array} key The attribute(s) to refresh
+ * @param {Boolean} silent Whether or not to suppress change events
+ */
+ refresh: function(key, silent){
+ var configs = this._configs;
+
+ key = ( ( Lang.isString(key) ) ? [key] : key ) ||
+ this.getAttributeKeys();
+
+ for (var i = 0, len = key.length; i < len; ++i) {
+ if ( // only set if there is a value and not null
+ configs[key[i]] &&
+ ! Lang.isUndefined(configs[key[i]].value) &&
+ ! Lang.isNull(configs[key[i]].value) ) {
+ configs[key[i]].refresh(silent);
+ }
+ }
+ },
+
+ /**
+ * Adds an Attribute to the AttributeProvider instance.
+ * @method register
+ * @param {String} key The attribute's name
+ * @param {Object} map A key-value map containing the
+ * attribute's properties.
+ */
+ register: function(key, map) {
+ this._configs = this._configs || {};
+
+ if (this._configs[key]) { // dont override
+ return false;
+ }
+
+ map.name = key;
+ this._configs[key] = new YAHOO.util.Attribute(map, this);
+ return true;
+ },
+
+ /**
+ * Returns the attribute's properties.
+ * @method getAttributeConfig
+ * @param {String} key The attribute's name
+ * @private
+ * @return {object} A key-value map containing all of the
+ * attribute's properties.
+ */
+ getAttributeConfig: function(key) {
+ var configs = this._configs || {};
+ var config = configs[key] || {};
+ var map = {}; // returning a copy to prevent overrides
+
+ for (key in config) {
+ if ( config.hasOwnProperty(key) ) {
+ map[key] = config[key];
+ }
+ }
+
+ return map;
+ },
+
+ /**
+ * Sets or updates an Attribute instance's properties.
+ * @method configureAttribute
+ * @param {String} key The attribute's name.
+ * @param {Object} map A key-value map of attribute properties
+ * @param {Boolean} init Whether or not this should become the intial config.
+ */
+ configureAttribute: function(key, map, init) {
+ var configs = this._configs || {};
+
+ if (!configs[key]) {
+ YAHOO.log('unable to configure, ' + key + ' not found',
+ 'error', 'AttributeProvider');
+ return false;
+ }
+
+ configs[key].configure(map, init);
+ },
+
+ /**
+ * Resets an attribute to its intial configuration.
+ * @method resetAttributeConfig
+ * @param {String} key The attribute's name.
+ * @private
+ */
+ resetAttributeConfig: function(key){
+ var configs = this._configs || {};
+ configs[key].resetConfig();
+ },
+
+ /**
+ * Fires the attribute's beforeChange event.
+ * @method fireBeforeChangeEvent
+ * @param {String} key The attribute's name.
+ * @param {Obj} e The event object to pass to handlers.
+ */
+ fireBeforeChangeEvent: function(e) {
+ var type = 'before';
+ type += e.type.charAt(0).toUpperCase() + e.type.substr(1) + 'Change';
+ e.type = type;
+ return this.fireEvent(e.type, e);
+ },
+
+ /**
+ * Fires the attribute's change event.
+ * @method fireChangeEvent
+ * @param {String} key The attribute's name.
+ * @param {Obj} e The event object to pass to the handlers.
+ */
+ fireChangeEvent: function(e) {
+ e.type += 'Change';
+ return this.fireEvent(e.type, e);
+ }
+ };
+
+ YAHOO.augment(YAHOO.util.AttributeProvider, YAHOO.util.EventProvider);
+})();(function() {
+// internal shorthand
+var Dom = YAHOO.util.Dom,
+ Lang = YAHOO.util.Lang,
+ EventPublisher = YAHOO.util.EventPublisher,
+ AttributeProvider = YAHOO.util.AttributeProvider;
+
+/**
+ * Element provides an interface to an HTMLElement's attributes and common
+ * methods. Other commonly used attributes are added as well.
+ * @namespace YAHOO.util
+ * @class Element
+ * @uses YAHOO.util.AttributeProvider
+ * @constructor
+ * @param el {HTMLElement | String} The html element that
+ * represents the Element.
+ * @param {Object} map A key-value map of initial config names and values
+ */
+YAHOO.util.Element = function(el, map) {
+ if (arguments.length) {
+ this.init(el, map);
+ }
+};
+
+YAHOO.util.Element.prototype = {
+ /**
+ * Dom events supported by the Element instance.
+ * @property DOM_EVENTS
+ * @type Object
+ */
+ DOM_EVENTS: null,
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method appendChild
+ * @param {Boolean} deep Whether or not to do a deep clone
+ */
+ appendChild: function(child) {
+ child = child.get ? child.get('element') : child;
+ this.get('element').appendChild(child);
+ },
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method getElementsByTagName
+ * @param {String} tag The tagName to collect
+ */
+ getElementsByTagName: function(tag) {
+ return this.get('element').getElementsByTagName(tag);
+ },
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method hasChildNodes
+ * @return {Boolean} Whether or not the element has childNodes
+ */
+ hasChildNodes: function() {
+ return this.get('element').hasChildNodes();
+ },
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method insertBefore
+ * @param {HTMLElement} element The HTMLElement to insert
+ * @param {HTMLElement} before The HTMLElement to insert
+ * the element before.
+ */
+ insertBefore: function(element, before) {
+ element = element.get ? element.get('element') : element;
+ before = (before && before.get) ? before.get('element') : before;
+
+ this.get('element').insertBefore(element, before);
+ },
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method removeChild
+ * @param {HTMLElement} child The HTMLElement to remove
+ */
+ removeChild: function(child) {
+ child = child.get ? child.get('element') : child;
+ this.get('element').removeChild(child);
+ return true;
+ },
+
+ /**
+ * Wrapper for HTMLElement method.
+ * @method replaceChild
+ * @param {HTMLElement} newNode The HTMLElement to insert
+ * @param {HTMLElement} oldNode The HTMLElement to replace
+ */
+ replaceChild: function(newNode, oldNode) {
+ newNode = newNode.get ? newNode.get('element') : newNode;
+ oldNode = oldNode.get ? oldNode.get('element') : oldNode;
+ return this.get('element').replaceChild(newNode, oldNode);
+ },
+
+
+ /**
+ * Registers Element specific attributes.
+ * @method initAttributes
+ * @param {Object} map A key-value map of initial attribute configs
+ */
+ initAttributes: function(map) {
+ map = map || {};
+ var element = Dom.get(map.element) || null;
+
+ /**
+ * The HTMLElement the Element instance refers to.
+ * @config element
+ * @type HTMLElement
+ */
+ this.register('element', {
+ value: element,
+ readOnly: true
+ });
+ },
+
+ /**
+ * Adds a listener for the given event. These may be DOM or
+ * customEvent listeners. Any event that is fired via fireEvent
+ * can be listened for. All handlers receive an event object.
+ * @method addListener
+ * @param {String} type The name of the event to listen for
+ * @param {Function} fn The handler to call when the event fires
+ * @param {Any} obj A variable to pass to the handler
+ * @param {Object} scope The object to use for the scope of the handler
+ */
+ addListener: function(type, fn, obj, scope) {
+ var el = this.get('element');
+ var scope = scope || this;
+
+ el = this.get('id') || el;
+
+ if (!this._events[type]) { // create on the fly
+ if ( this.DOM_EVENTS[type] ) {
+ YAHOO.util.Event.addListener(el, type, function(e) {
+ if (e.srcElement && !e.target) { // supplement IE with target
+ e.target = e.srcElement;
+ }
+ this.fireEvent(type, e);
+ }, obj, scope);
+ }
+
+ this.createEvent(type, this);
+ this._events[type] = true;
+ }
+
+ this.subscribe.apply(this, arguments); // notify via customEvent
+ },
+
+
+ /**
+ * Alias for addListener
+ * @method on
+ * @param {String} type The name of the event to listen for
+ * @param {Function} fn The function call when the event fires
+ * @param {Any} obj A variable to pass to the handler
+ * @param {Object} scope The object to use for the scope of the handler
+ */
+ on: function() { this.addListener.apply(this, arguments); },
+
+
+ /**
+ * Remove an event listener
+ * @method removeListener
+ * @param {String} type The name of the event to listen for
+ * @param {Function} fn The function call when the event fires
+ */
+ removeListener: function(type, fn) {
+ this.unsubscribe.apply(this, arguments);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method addClass
+ * @param {String} className The className to add
+ */
+ addClass: function(className) {
+ Dom.addClass(this.get('element'), className);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method getElementsByClassName
+ * @param {String} className The className to collect
+ * @param {String} tag (optional) The tag to use in
+ * conjunction with class name
+ * @return {Array} Array of HTMLElements
+ */
+ getElementsByClassName: function(className, tag) {
+ return Dom.getElementsByClassName(className, tag,
+ this.get('element') );
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method hasClass
+ * @param {String} className The className to add
+ * @return {Boolean} Whether or not the element has the class name
+ */
+ hasClass: function(className) {
+ return Dom.hasClass(this.get('element'), className);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method removeClass
+ * @param {String} className The className to remove
+ */
+ removeClass: function(className) {
+ return Dom.removeClass(this.get('element'), className);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method replaceClass
+ * @param {String} oldClassName The className to replace
+ * @param {String} newClassName The className to add
+ */
+ replaceClass: function(oldClassName, newClassName) {
+ return Dom.replaceClass(this.get('element'),
+ oldClassName, newClassName);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method setStyle
+ * @param {String} property The style property to set
+ * @param {String} value The value to apply to the style property
+ */
+ setStyle: function(property, value) {
+ return Dom.setStyle(this.get('element'), property, value);
+ },
+
+ /**
+ * Wrapper for Dom method.
+ * @method getStyle
+ * @param {String} property The style property to retrieve
+ * @return {String} The current value of the property
+ */
+ getStyle: function(property) {
+ return Dom.getStyle(this.get('element'), property);
+ },
+
+ /**
+ * Apply any queued set calls.
+ * @method fireQueue
+ */
+ fireQueue: function() {
+ var queue = this._queue;
+ for (var i = 0, len = queue.length; i < len; ++i) {
+ this[queue[i][0]].apply(this, queue[i][1]);
+ }
+ },
+
+ /**
+ * Appends the HTMLElement into either the supplied parentNode.
+ * @method appendTo
+ * @param {HTMLElement | Element} parentNode The node to append to
+ * @param {HTMLElement | Element} before An optional node to insert before
+ */
+ appendTo: function(parent, before) {
+ parent = (parent.get) ? parent.get('element') : Dom.get(parent);
+
+ before = (before && before.get) ?
+ before.get('element') : Dom.get(before);
+ var element = this.get('element');
+
+ var newAddition = !Dom.inDocument(element);
+
+ if (!element) {
+ YAHOO.log('appendTo failed: element not available',
+ 'error', 'Element');
+ return false;
+ }
+
+ if (!parent) {
+ YAHOO.log('appendTo failed: parent not available',
+ 'error', 'Element');
+ return false;
+ }
+
+ if (element.parent != parent) {
+ if (before) {
+ parent.insertBefore(element, before);
+ } else {
+ parent.appendChild(element);
+ }
+ }
+
+ YAHOO.log(element + 'appended to ' + parent);
+
+ if (!newAddition) {
+ return false; // note return; no refresh if in document
+ }
+
+ // if a new addition, refresh HTMLElement any applied attributes
+ var keys = this.getAttributeKeys();
+
+ for (var key in keys) { // only refresh HTMLElement attributes
+ if ( !Lang.isUndefined(element[key]) ) {
+ this.refresh(key);
+ }
+ }
+ },
+
+ get: function(key) {
+ var configs = this._configs || {};
+ var el = configs.element; // avoid loop due to 'element'
+ if (el && !configs[key] && !Lang.isUndefined(el.value[key]) ) {
+ return el.value[key];
+ }
+
+ return AttributeProvider.prototype.get.call(this, key);
+ },
+
+ set: function(key, value, silent) {
+ var el = this.get('element');
+ if (!el) {
+ this._queue[key] = ['set', arguments];
+ return false;
+ }
+
+ // set it on the element if not a property
+ if ( !this._configs[key] && !Lang.isUndefined(el[key]) ) {
+ _registerHTMLAttr(this, key);
+ }
+
+ return AttributeProvider.prototype.set.apply(this, arguments);
+ },
+
+ register: function(key) { // protect html attributes
+ var configs = this._configs || {};
+ var element = this.get('element') || null;
+
+ if ( element && !Lang.isUndefined(element[key]) ) {
+ YAHOO.log(key + ' is reserved for ' + element,
+ 'error', 'Element');
+ return false;
+ }
+
+ return AttributeProvider.prototype.register.apply(this, arguments);
+ },
+
+ configureAttribute: function(property, map, init) { // protect html attributes
+ if (!this._configs[property] && this._configs.element &&
+ !Lang.isUndefined(this._configs.element[property]) ) {
+ _registerHTMLAttr(this, property, map);
+ return false;
+ }
+
+ return AttributeProvider.prototype.configure.apply(this, arguments);
+ },
+
+ getAttributeKeys: function() {
+ var el = this.get('element');
+ var keys = AttributeProvider.prototype.getAttributeKeys.call(this);
+
+ //add any unconfigured element keys
+ for (var key in el) {
+ if (!this._configs[key]) {
+ keys[key] = keys[key] || el[key];
+ }
+ }
+
+ return keys;
+ },
+
+ init: function(el, attr) {
+ this._queue = this._queue || [];
+ this._events = this._events || {};
+ this._configs = this._configs || {};
+ attr = attr || {};
+ attr.element = attr.element || el || null;
+
+ this.DOM_EVENTS = {
+ 'click': true,
+ 'keydown': true,
+ 'keypress': true,
+ 'keyup': true,
+ 'mousedown': true,
+ 'mousemove': true,
+ 'mouseout': true,
+ 'mouseover': true,
+ 'mouseup': true
+ };
+
+ var readyHandler = function() {
+ this.initAttributes(attr);
+
+ this.setAttributes(attr, true);
+ this.fireQueue();
+ this.fireEvent('contentReady', {
+ type: 'contentReady',
+ target: attr.element
+ });
+ };
+
+ if ( Lang.isString(el) ) {
+ _registerHTMLAttr(this, 'id', { value: el });
+ YAHOO.util.Event.onAvailable(el, function() {
+ attr.element = Dom.get(el);
+ this.fireEvent('available', {
+ type: 'available',
+ target: attr.element
+ });
+ }, this, true);
+
+ YAHOO.util.Event.onContentReady(el, function() {
+ readyHandler.call(this);
+ }, this, true);
+ } else {
+ readyHandler.call(this);
+ }
+ }
+};
+
+/**
+ * Sets the value of the property and fires beforeChange and change events.
+ * @private
+ * @method _registerHTMLAttr
+ * @param {YAHOO.util.Element} element The Element instance to
+ * register the config to.
+ * @param {String} key The name of the config to register
+ * @param {Object} map A key-value map of the config's params
+ */
+var _registerHTMLAttr = function(self, key, map) {
+ var el = self.get('element');
+ map = map || {};
+ map.name = key;
+ map.method = map.method || function(value) {
+ el[key] = value;
+ };
+ map.value = map.value || el[key];
+ self._configs[key] = new YAHOO.util.Attribute(map, self);
+};
+
+/**
+ * Fires when the Element's HTMLElement can be retrieved by Id.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type available
+ * <HTMLElement>
+ * target the HTMLElement bound to this Element instance
+ *
Usage:
+ * var handler = function(e) {var target = e.target};
+ * myTabs.addListener('available', handler);
+ * @event available
+ */
+
+/**
+ * Fires when the Element's HTMLElement subtree is rendered.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type contentReady
+ * <HTMLElement>
+ * target the HTMLElement bound to this Element instance
+ *
Usage:
+ * var handler = function(e) {var target = e.target};
+ * myTabs.addListener('contentReady', handler);
+ * @event contentReady
+ */
+
+YAHOO.augment(YAHOO.util.Element, AttributeProvider);
+})();(function() {
+ var Dom = YAHOO.util.Dom,
+ Event = YAHOO.util.Event,
+ Lang = YAHOO.util.Lang;
+
+ /**
+ * A representation of a Tab's label and content.
+ * @namespace YAHOO.widget
+ * @class Tab
+ * @extends YAHOO.util.Element
+ * @constructor
+ * @param element {HTMLElement | String} (optional) The html element that
+ * represents the TabView. An element will be created if none provided.
+ * @param {Object} properties A key map of initial properties
+ */
+ Tab = function(el, attr) {
+ attr = attr || {};
+ if (arguments.length == 1 && !Lang.isString(el) && !el.nodeName) {
+ attr = el;
+ el = attr.element;
+ }
+
+ if (!el && !attr.element) {
+ el = _createTabElement.call(this, attr);
+ }
+
+ this.loadHandler = {
+ success: function(o) {
+ this.set('content', o.responseText);
+ },
+ failure: function(o) {
+ YAHOO.log('loading failed: ' + o.statusText,
+ 'error', 'Tab');
+ }
+ };
+
+ Tab.superclass.constructor.call(this, el, attr);
+
+ this.DOM_EVENTS = {}; // delegating to tabView
+ };
+
+ YAHOO.extend(Tab, YAHOO.util.Element);
+ var proto = Tab.prototype;
+
+ /**
+ * The default tag name for a Tab's inner element.
+ * @property LABEL_INNER_TAGNAME
+ * @type String
+ * @default "em"
+ */
+ proto.LABEL_TAGNAME = 'em';
+
+ /**
+ * The class name applied to active tabs.
+ * @property ACTIVE_CLASSNAME
+ * @type String
+ * @default "on"
+ */
+ proto.ACTIVE_CLASSNAME = 'selected';
+
+ /**
+ * The class name applied to disabled tabs.
+ * @property DISABLED_CLASSNAME
+ * @type String
+ * @default "disabled"
+ */
+ proto.DISABLED_CLASSNAME = 'disabled';
+
+ /**
+ * The class name applied to dynamic tabs while loading.
+ * @property LOADING_CLASSNAME
+ * @type String
+ * @default "disabled"
+ */
+ proto.LOADING_CLASSNAME = 'loading';
+
+ /**
+ * Provides a reference to the connection request object when data is
+ * loaded dynamically.
+ * @property dataConnection
+ * @type Object
+ */
+ proto.dataConnection = null;
+
+ /**
+ * Object containing success and failure callbacks for loading data.
+ * @property loadHandler
+ * @type object
+ */
+ proto.loadHandler = null;
+
+ /**
+ * Provides a readable name for the tab.
+ * @method toString
+ * @return String
+ */
+ proto.toString = function() {
+ var el = this.get('element');
+ var id = el.id || el.tagName;
+ return "Tab " + id;
+ };
+
+ /**
+ * Registers TabView specific properties.
+ * @method initAttributes
+ * @param {Object} attr Hash of initial attributes
+ */
+ proto.initAttributes = function(attr) {
+ attr = attr || {};
+ Tab.superclass.initAttributes.call(this, attr);
+
+ var el = this.get('element');
+
+ /**
+ * The event that triggers the tab's activation.
+ * @config activationEvent
+ * @type String
+ */
+ this.register('activationEvent', {
+ value: attr.activationEvent || 'click'
+ });
+
+ /**
+ * The element that contains the tab's label.
+ * @config labelEl
+ * @type HTMLElement
+ */
+ this.register('labelEl', {
+ value: attr.labelEl || _getlabelEl.call(this),
+ method: function(value) {
+ var current = this.get('labelEl');
+
+ if (current) {
+ if (current == value) {
+ return false; // already set
+ }
+
+ this.replaceChild(value, current);
+ } else if (el.firstChild) { // ensure label is firstChild by default
+ this.insertBefore(value, el.firstChild);
+ } else {
+ this.appendChild(value);
+ }
+ }
+ });
+
+ /**
+ * The tab's label text (or innerHTML).
+ * @config label
+ * @type String
+ */
+ this.register('label', {
+ value: attr.label || _getLabel.call(this),
+ method: function(value) {
+ var labelEl = this.get('labelEl');
+ if (!labelEl) { // create if needed
+ this.set('labelEl', _createlabelEl.call(this));
+ }
+
+ _setLabel.call(this, value);
+ }
+ });
+
+ /**
+ * The HTMLElement that contains the tab's content.
+ * @config contentEl
+ * @type HTMLElement
+ */
+ this.register('contentEl', { // TODO: apply className?
+ value: attr.contentEl || document.createElement('div'),
+ method: function(value) {
+ var current = this.get('contentEl');
+
+ if (current) {
+ if (current == value) {
+ return false; // already set
+ }
+ this.replaceChild(value, current);
+ }
+ }
+ });
+
+ /**
+ * The tab's content.
+ * @config content
+ * @type String
+ */
+ this.register('content', {
+ value: attr.content, // TODO: what about existing?
+ method: function(value) {
+ this.get('contentEl').innerHTML = value;
+ }
+ });
+
+ var _dataLoaded = false;
+
+ /**
+ * The tab's data source, used for loading content dynamically.
+ * @config dataSrc
+ * @type String
+ */
+ this.register('dataSrc', {
+ value: attr.dataSrc
+ });
+
+ /**
+ * Whether or not content should be reloaded for every view.
+ * @config cacheData
+ * @type Boolean
+ * @default false
+ */
+ this.register('cacheData', {
+ value: attr.cacheData || false,
+ validator: Lang.isBoolean
+ });
+
+ /**
+ * The method to use for the data request.
+ * @config loadMethod
+ * @type String
+ * @default "GET"
+ */
+ this.register('loadMethod', {
+ value: attr.loadMethod || 'GET',
+ validator: Lang.isString
+ });
+
+ /**
+ * Whether or not any data has been loaded from the server.
+ * @config dataLoaded
+ * @type Boolean
+ */
+ this.register('dataLoaded', {
+ value: false,
+ validator: Lang.isBoolean,
+ writeOnce: true
+ });
+
+ /**
+ * Number if milliseconds before aborting and calling failure handler.
+ * @config dataTimeout
+ * @type Number
+ * @default null
+ */
+ this.register('dataTimeout', {
+ value: attr.dataTimeout || null,
+ validator: Lang.isNumber
+ });
+
+ /**
+ * Whether or not the tab is currently active.
+ * If a dataSrc is set for the tab, the content will be loaded from
+ * the given source.
+ * @config active
+ * @type Boolean
+ */
+ this.register('active', {
+ value: attr.active || this.hasClass(this.ACTIVE_CLASSNAME),
+ method: function(value) {
+ if (value === true) {
+ this.addClass(this.ACTIVE_CLASSNAME);
+ this.set('title', 'active');
+ } else {
+ this.removeClass(this.ACTIVE_CLASSNAME);
+ this.set('title', '');
+ }
+ },
+ validator: function(value) {
+ return Lang.isBoolean(value) && !this.get('disabled') ;
+ }
+ });
+
+ /**
+ * Whether or not the tab is disabled.
+ * @config disabled
+ * @type Boolean
+ */
+ this.register('disabled', {
+ value: attr.disabled || this.hasClass(this.DISABLED_CLASSNAME),
+ method: function(value) {
+ if (value === true) {
+ Dom.addClass(this.get('element'), this.DISABLED_CLASSNAME);
+ } else {
+ Dom.removeClass(this.get('element'), this.DISABLED_CLASSNAME);
+ }
+ },
+ validator: Lang.isBoolean
+ });
+
+ /**
+ * The href of the tab's anchor element.
+ * @config href
+ * @type String
+ * @default '#'
+ */
+ this.register('href', {
+ value: attr.href || '#',
+ method: function(value) {
+ this.getElementsByTagName('a')[0].href = value;
+ },
+ validator: Lang.isString
+ });
+
+ /**
+ * The Whether or not the tab's content is visible.
+ * @config contentVisible
+ * @type Boolean
+ * @default false
+ */
+ this.register('contentVisible', {
+ value: attr.contentVisible,
+ method: function(value) {
+ if (value == true) {
+ this.get('contentEl').style.display = 'block';
+
+ if ( this.get('dataSrc') ) {
+ // load dynamic content unless already loaded and caching
+ if ( !this.get('dataLoaded') || !this.get('cacheData') ) {
+ _dataConnect.call(this);
+ }
+ }
+ } else {
+ this.get('contentEl').style.display = 'none';
+ }
+ },
+ validator: Lang.isBoolean
+ });
+ };
+
+ var _createTabElement = function(attr) {
+ var el = document.createElement('li');
+ var a = document.createElement('a');
+
+ a.href = attr.href || '#';
+
+ el.appendChild(a);
+
+ var label = attr.label || null;
+ var labelEl = attr.labelEl || null;
+
+ if (labelEl) { // user supplied labelEl
+ if (!label) { // user supplied label
+ label = _getLabel.call(this, labelEl);
+ }
+ } else {
+ labelEl = _createlabelEl.call(this);
+ }
+
+ a.appendChild(labelEl);
+
+ return el;
+ };
+
+ var _getlabelEl = function() {
+ return this.getElementsByTagName(this.LABEL_TAGNAME)[0];
+ };
+
+ var _createlabelEl = function() {
+ var el = document.createElement(this.LABEL_TAGNAME);
+ return el;
+ };
+
+ var _setLabel = function(label) {
+ var el = this.get('labelEl');
+ el.innerHTML = label;
+ };
+
+ var _getLabel = function() {
+ var label,
+ el = this.get('labelEl');
+
+ if (!el) {
+ return undefined;
+ }
+
+ return el.innerHTML;
+ };
+
+ var _dataConnect = function() {
+ if (!YAHOO.util.Connect) {
+ YAHOO.log('YAHOO.util.Connect dependency not met',
+ 'error', 'Tab');
+ return false;
+ }
+
+ Dom.addClass(this.get('contentEl').parentNode, this.LOADING_CLASSNAME);
+
+ this.dataConnection = YAHOO.util.Connect.asyncRequest(
+ this.get('loadMethod'),
+ this.get('dataSrc'),
+ {
+ success: function(o) {
+ this.loadHandler.success.call(this, o);
+ this.set('dataLoaded', true);
+ this.dataConnection = null;
+ Dom.removeClass(this.get('contentEl').parentNode,
+ this.LOADING_CLASSNAME);
+ },
+ failure: function(o) {
+ this.loadHandler.failure.call(this, o);
+ this.dataConnection = null;
+ Dom.removeClass(this.get('contentEl').parentNode,
+ this.LOADING_CLASSNAME);
+ },
+ scope: this,
+ timeout: this.get('dataTimeout')
+ }
+ );
+ };
+
+ YAHOO.widget.Tab = Tab;
+
+ /**
+ * Fires before the active state is changed.
+ * See: Element.addListener
+ * If handler returns false, the change will be cancelled, and the value will not
+ * be set.
+ * Event fields:
+ * <String> type beforeActiveChange
+ * <Boolean>
+ * prevValue the current value
+ * <Boolean>
+ * newValue the new value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('beforeActiveChange', handler);
+ * @event beforeActiveChange
+ */
+
+ /**
+ * Fires after the active state is changed.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type activeChange
+ * <Boolean>
+ * prevValue the previous value
+ * <Boolean>
+ * newValue the updated value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('activeChange', handler);
+ * @event activeChange
+ */
+
+ /**
+ * Fires before the tab label is changed.
+ * See: Element.addListener
+ * If handler returns false, the change will be cancelled, and the value will not
+ * be set.
+ * Event fields:
+ * <String> type beforeLabelChange
+ * <String>
+ * prevValue the current value
+ * <String>
+ * newValue the new value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('beforeLabelChange', handler);
+ * @event beforeLabelChange
+ */
+
+ /**
+ * Fires after the tab label is changed.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type labelChange
+ * <String>
+ * prevValue the previous value
+ * <String>
+ * newValue the updated value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('labelChange', handler);
+ * @event labelChange
+ */
+
+ /**
+ * Fires before the tab content is changed.
+ * See: Element.addListener
+ * If handler returns false, the change will be cancelled, and the value will not
+ * be set.
+ * Event fields:
+ * <String> type beforeContentChange
+ * <String>
+ * prevValue the current value
+ * <String>
+ * newValue the new value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('beforeContentChange', handler);
+ * @event beforeContentChange
+ */
+
+ /**
+ * Fires after the tab content is changed.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type contentChange
+ * <String>
+ * prevValue the previous value
+ * <Boolean>
+ * newValue the updated value
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('contentChange', handler);
+ * @event contentChange
+ */
+})();(function() {
+
+ /**
+ * The tabview module provides a widget for managing content bound to tabs.
+ * @module tabview
+ *
+ */
+ /**
+ * A widget to control tabbed views.
+ * @namespace YAHOO.widget
+ * @class TabView
+ * @extends YAHOO.util.Element
+ * @constructor
+ * @param {HTMLElement | String | Object} el(optional) The html
+ * element that represents the TabView, or the attribute object to use.
+ * An element will be created if none provided.
+ * @param {Object} attr (optional) A key map of the tabView's
+ * initial attributes. Ignored if first arg is attributes object.
+ */
+ YAHOO.widget.TabView = function(el, attr) {
+ attr = attr || {};
+ if (arguments.length == 1 && !Lang.isString(el) && !el.nodeName) {
+ attr = el; // treat first arg as attr object
+ el = attr.element || null;
+ }
+
+ if (!el && !attr.element) { // create if we dont have one
+ el = _createTabViewElement.call(this, attr);
+ }
+ YAHOO.widget.TabView.superclass.constructor.call(this, el, attr);
+ };
+
+ YAHOO.extend(YAHOO.widget.TabView, YAHOO.util.Element);
+
+ var proto = YAHOO.widget.TabView.prototype;
+ var Dom = YAHOO.util.Dom;
+ var Lang = YAHOO.util.Lang;
+ var Event = YAHOO.util.Event;
+ var Tab = YAHOO.widget.Tab;
+
+
+ /**
+ * The className to add when building from scratch.
+ * @property CLASSNAME
+ * @default "navset"
+ */
+ proto.CLASSNAME = 'yui-navset';
+
+ /**
+ * The className of the HTMLElement containing the TabView's tab elements
+ * to look for when building from existing markup, or to add when building
+ * from scratch.
+ * All childNodes of the tab container are treated as Tabs when building
+ * from existing markup.
+ * @property TAB_PARENT_CLASSNAME
+ * @default "nav"
+ */
+ proto.TAB_PARENT_CLASSNAME = 'yui-nav';
+
+ /**
+ * The className of the HTMLElement containing the TabView's label elements
+ * to look for when building from existing markup, or to add when building
+ * from scratch.
+ * All childNodes of the content container are treated as content elements when
+ * building from existing markup.
+ * @property CONTENT_PARENT_CLASSNAME
+ * @default "nav-content"
+ */
+ proto.CONTENT_PARENT_CLASSNAME = 'yui-content';
+
+ proto._tabParent = null;
+ proto._contentParent = null;
+
+ /**
+ * Adds a Tab to the TabView instance.
+ * If no index is specified, the tab is added to the end of the tab list.
+ * @method addTab
+ * @param {YAHOO.widget.Tab} tab A Tab instance to add.
+ * @param {Integer} index The position to add the tab.
+ * @return void
+ */
+ proto.addTab = function(tab, index) {
+ var tabs = this.get('tabs');
+ if (!tabs) { // not ready yet
+ this._queue[this._queue.length] = ['addTab', arguments];
+ return false;
+ }
+
+ index = (index === undefined) ? tabs.length : index;
+
+ var before = this.getTab(index);
+
+ var self = this;
+ var el = this.get('element');
+ var tabParent = this._tabParent;
+ var contentParent = this._contentParent;
+
+ var tabElement = tab.get('element');
+ var contentEl = tab.get('contentEl');
+
+ if ( before ) {
+ tabParent.insertBefore(tabElement, before.get('element'));
+ } else {
+ tabParent.appendChild(tabElement);
+ }
+
+ if ( contentEl && !Dom.isAncestor(contentParent, contentEl) ) {
+ contentParent.appendChild(contentEl);
+ }
+
+ if ( !tab.get('active') ) {
+ tab.set('contentVisible', false, true); /* hide if not active */
+ } else {
+ this.set('activeTab', tab, true);
+
+ }
+
+ var activate = function(e) {
+ YAHOO.util.Event.preventDefault(e);
+ self.set('activeTab', this);
+ };
+
+ tab.addListener( tab.get('activationEvent'), activate);
+
+ tab.addListener('activationEventChange', function(e) {
+ if (e.prevValue != e.newValue) {
+ tab.removeListener(e.prevValue, activate);
+ tab.addListener(e.newValue, activate);
+ }
+ });
+
+ tabs.splice(index, 0, tab);
+ };
+
+ /**
+ * Routes childNode events.
+ * @method DOMEventHandler
+ * @param {event} e The Dom event that is being handled.
+ * @return void
+ */
+ proto.DOMEventHandler = function(e) {
+ var el = this.get('element');
+ var target = YAHOO.util.Event.getTarget(e);
+ var tabParent = this._tabParent;
+
+ if (Dom.isAncestor(tabParent, target) ) {
+ var tabEl;
+ var tab = null;
+ var contentEl;
+ var tabs = this.get('tabs');
+
+ for (var i = 0, len = tabs.length; i < len; i++) {
+ tabEl = tabs[i].get('element');
+ contentEl = tabs[i].get('contentEl');
+
+ if ( target == tabEl || Dom.isAncestor(tabEl, target) ) {
+ tab = tabs[i];
+ break; // note break
+ }
+ }
+
+ if (tab) {
+ tab.fireEvent(e.type, e);
+ }
+ }
+ };
+
+ /**
+ * Returns the Tab instance at the specified index.
+ * @method getTab
+ * @param {Integer} index The position of the Tab.
+ * @return YAHOO.widget.Tab
+ */
+ proto.getTab = function(index) {
+ return this.get('tabs')[index];
+ };
+
+ /**
+ * Returns the index of given tab.
+ * @method getTabIndex
+ * @param {YAHOO.widget.Tab} tab The tab whose index will be returned.
+ * @return int
+ */
+ proto.getTabIndex = function(tab) {
+ var index = null;
+ var tabs = this.get('tabs');
+ for (var i = 0, len = tabs.length; i < len; ++i) {
+ if (tab == tabs[i]) {
+ index = i;
+ break;
+ }
+ }
+
+ return index;
+ };
+
+ /**
+ * Removes the specified Tab from the TabView.
+ * @method removeTab
+ * @param {YAHOO.widget.Tab} item The Tab instance to be removed.
+ * @return void
+ */
+ proto.removeTab = function(tab) {
+ var tabCount = this.get('tabs').length;
+
+ var index = this.getTabIndex(tab);
+ var nextIndex = index + 1;
+ if ( tab == this.get('activeTab') ) { // select next tab
+ if (tabCount > 1) {
+ if (index + 1 == tabCount) {
+ this.set('activeIndex', index - 1);
+ } else {
+ this.set('activeIndex', index + 1);
+ }
+ }
+ }
+
+ this._tabParent.removeChild( tab.get('element') );
+ this._contentParent.removeChild( tab.get('contentEl') );
+ this._configs.tabs.value.splice(index, 1);
+
+ };
+
+ /**
+ * Provides a readable name for the TabView instance.
+ * @method toString
+ * @return String
+ */
+ proto.toString = function() {
+ var name = this.get('id') || this.get('tagName');
+ return "TabView " + name;
+ };
+
+ /**
+ * The transiton to use when switching between tabs.
+ * @method contentTransition
+ */
+ proto.contentTransition = function(newTab, oldTab) {
+ newTab.set('contentVisible', true);
+ oldTab.set('contentVisible', false);
+ };
+
+ /**
+ * Registers TabView specific properties.
+ * @method initAttributes
+ * @param {Object} attr Hash of initial attributes
+ */
+ proto.initAttributes = function(attr) {
+ YAHOO.widget.TabView.superclass.initAttributes.call(this, attr);
+
+ if (!attr.orientation) {
+ attr.orientation = 'top';
+ }
+
+ var el = this.get('element');
+
+ /**
+ * The Tabs belonging to the TabView instance.
+ * @config tabs
+ * @type Array
+ */
+ this.register('tabs', {
+ value: [],
+ readOnly: true
+ });
+
+ /**
+ * The container of the tabView's label elements.
+ * @property _tabParent
+ * @private
+ * @type HTMLElement
+ */
+ this._tabParent =
+ this.getElementsByClassName(this.TAB_PARENT_CLASSNAME,
+ 'ul' )[0] || _createTabParent.call(this);
+
+ /**
+ * The container of the tabView's content elements.
+ * @property _contentParent
+ * @type HTMLElement
+ * @private
+ */
+ this._contentParent =
+ this.getElementsByClassName(this.CONTENT_PARENT_CLASSNAME,
+ 'div')[0] || _createContentParent.call(this);
+
+ /**
+ * How the Tabs should be oriented relative to the TabView.
+ * @config orientation
+ * @type String
+ * @default "top"
+ */
+ this.register('orientation', {
+ value: attr.orientation,
+ method: function(value) {
+ var current = this.get('orientation');
+ this.addClass('yui-navset-' + value);
+
+ if (current != value) {
+ this.removeClass('yui-navset-' + current);
+ }
+
+ switch(value) {
+ case 'bottom':
+ this.appendChild(this._tabParent);
+ break;
+ }
+ }
+ });
+
+ /**
+ * The index of the tab currently active.
+ * @config activeIndex
+ * @type Int
+ */
+ this.register('activeIndex', {
+ value: attr.activeIndex,
+ method: function(value) {
+ this.set('activeTab', this.getTab(value));
+ },
+ validator: function(value) {
+ return !this.getTab(value).get('disabled'); // cannot activate if disabled
+ }
+ });
+
+ /**
+ * The tab currently active.
+ * @config activeTab
+ * @type YAHOO.widget.Tab
+ */
+ this.register('activeTab', {
+ value: attr.activeTab,
+ method: function(tab) {
+ var activeTab = this.get('activeTab');
+
+ if (tab) {
+ tab.set('active', true);
+ }
+
+ if (activeTab && activeTab != tab) {
+ activeTab.set('active', false);
+ }
+
+ if (activeTab && tab != activeTab) { // no transition if only 1
+ this.contentTransition(tab, activeTab);
+ } else if (tab) {
+ tab.set('contentVisible', true);
+ }
+ },
+ validator: function(value) {
+ return !value.get('disabled'); // cannot activate if disabled
+ }
+ });
+
+ if ( this._tabParent ) {
+ _initTabs.call(this);
+ }
+
+ for (var type in this.DOM_EVENTS) {
+ if ( this.DOM_EVENTS.hasOwnProperty(type) ) {
+ this.addListener.call(this, type, this.DOMEventHandler);
+ }
+ }
+ };
+
+ /**
+ * Creates Tab instances from a collection of HTMLElements.
+ * @method createTabs
+ * @private
+ * @param {Array|HTMLCollection} elements The elements to use for Tabs.
+ * @return void
+ */
+ var _initTabs = function() {
+ var tab,
+ attr,
+ contentEl;
+
+ var el = this.get('element');
+ var tabs = _getChildNodes(this._tabParent);
+ var contentElements = _getChildNodes(this._contentParent);
+
+ for (var i = 0, len = tabs.length; i < len; ++i) {
+ attr = {};
+
+ if (contentElements[i]) {
+ attr.contentEl = contentElements[i];
+ }
+
+ tab = new YAHOO.widget.Tab(tabs[i], attr);
+ this.addTab(tab);
+
+ if (tab.hasClass(tab.ACTIVE_CLASSNAME) ) {
+ this._configs.activeTab.value = tab; // dont invoke method
+ }
+ }
+ };
+
+ var _createTabViewElement = function(attr) {
+ var el = document.createElement('div');
+
+ if ( this.CLASSNAME ) {
+ el.className = this.CLASSNAME;
+ }
+
+ return el;
+ };
+
+ var _createTabParent = function(attr) {
+ var el = document.createElement('ul');
+
+ if ( this.TAB_PARENT_CLASSNAME ) {
+ el.className = this.TAB_PARENT_CLASSNAME;
+ }
+
+ this.get('element').appendChild(el);
+
+ return el;
+ };
+
+ var _createContentParent = function(attr) {
+ var el = document.createElement('div');
+
+ if ( this.CONTENT_PARENT_CLASSNAME ) {
+ el.className = this.CONTENT_PARENT_CLASSNAME;
+ }
+
+ this.get('element').appendChild(el);
+
+ return el;
+ };
+
+ var _getChildNodes = function(el) {
+ var nodes = [];
+ var childNodes = el.childNodes;
+
+ for (var i = 0, len = childNodes.length; i < len; ++i) {
+ if (childNodes[i].nodeType == 1) {
+ nodes[nodes.length] = childNodes[i];
+ }
+ }
+
+ return nodes;
+ };
+
+/**
+ * Fires before the activeTab is changed.
+ * See: Element.addListener
+ * If handler returns false, the change will be cancelled, and the value will not
+ * be set.
+ * Event fields:
+ * <String> type beforeActiveTabChange
+ * <YAHOO.widget.Tab >
+ * prevValue the currently active tab
+ * <YAHOO.widget.Tab >
+ * newValue the tab to be made active
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('beforeActiveTabChange', handler);
+ * @event beforeActiveTabChange
+ */
+
+/**
+ * Fires after the activeTab is changed.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type activeTabChange
+ * <YAHOO.widget.Tab >
+ * prevValue the formerly active tab
+ * <YAHOO.widget.Tab >
+ * newValue the new active tab
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('activeTabChange', handler);
+ * @event activeTabChange
+ */
+
+/**
+ * Fires before the orientation is changed.
+ * See: Element.addListener
+ * If handler returns false, the change will be cancelled, and the value will not
+ * be set.
+ * Event fields:
+ * <String> type beforeOrientationChange
+ * <String>
+ * prevValue the current orientation
+ * <String>
+ * newValue the new orientation to be applied
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('beforeOrientationChange', handler);
+ * @event beforeOrientationChange
+ */
+
+/**
+ * Fires after the orientation is changed.
+ * See: Element.addListener
+ * Event fields:
+ * <String> type orientationChange
+ * <String>
+ * prevValue the former orientation
+ * <String>
+ * newValue the new orientation
+ * Usage:
+ * var handler = function(e) {var previous = e.prevValue};
+ * myTabs.addListener('orientationChange', handler);
+ * @event orientationChange
+ */
})();
\ No newline at end of file
diff --git a/thirdpartyjs/yui/treeview/README b/thirdpartyjs/yui/treeview/README
index cb715bb..b3e34f7 100644
--- a/thirdpartyjs/yui/treeview/README
+++ b/thirdpartyjs/yui/treeview/README
@@ -1,112 +1,112 @@
-TreeView - Release Notes
-
-0.12.0
-
- * TreeView now augments EventProvider, and has custom events for expand,
- collapse, animStart, animComplete, and labelClick. Existing implementations
- using abstract methods for these events (if they exist) will still work.
- New events can be plugged into the tree by the Node implementation. For
- example, TaskNode adds a checkClick event. EventProvider makes it safe
- to do this because implementing code can call subscribe() prior to the
- event creation.
-
- * YAHOO.util.Event is now a requirement for the widget
-
- * TreeView::removeChildren no longer expands and collapses the node.
-
- * Documented the moveComplete property
-
- * createElement("DIV") changed to createElement("div")
-
-0.11.4
-
- * Fixed a javascript error on the HTML node example page.
-
-0.11.3
-
- * popNode now clears the tree, previousSibling, nextSibling, and parent
- properties of the node that is being removed from the tree.
-
- * Fixed the paths to the images in the tree.css file that is included in
- build/assets.
-
-0.11.0
-
- * Added TreeView -> popNode, which differs from removeNode in that the
- node's children are preserved so the entire branch can be re-inserted
- into another part of the tree, or another tree.
-
- * Added TreeView -> getNodesByProperty, which differs from
- getNodeByProperty by returning an array of all nodes that have the
- specified property rather than just the first one.
-
- * Added Node -> insertBefore, insertAfter, and appendTo. These method
- can be used to reorganize the tree.
-
- * removeChildren properly resets the node icon when executed against a
- collpased node.
-
- * Moved depth assignment from the constructor to appendChild so that the
- value is set properly if the node is moved within the tree.
-
- * Fixed broken loop in removeChildren.
-
- * RootNode -> loadComplete calls tree.draw for hot-wiring the dynamic load
- feature for the top level nodes.
-
- * The treeview constructor will accept an element instead of an id.
-
-0.10.0
-
- * If the child collection changes prior to a refresh(), the icon is now
- changed appropriately.
-
- * Added TreeView removeChildren(node). This will recursively purge the node's
- children, and reset its dynamic load state.
-
- * previousSibling and nextSibling are now adjusted correctly when a
- node is deleted.
-
- * expand()/collapse() now will not expand/collapse the node if false is
- returned from the onExpand/onCollapse event handlers.
-
- * The onExpand and onCollapse events now fire before the node is expanded
- or collapsed so that the implementer can modify the node's child collection
- prior to display.
-
- * The childrenRendered property previous was used to indicate both that
- a dynamically loaded node has received its data, and also to indicate
- that the children html has been created. This has been split into
- two properties. dynamicLoadComplete and childrenRendered.
-
- * Implemented the renderHidden flag. If set to true, the html for the entire
- tree will be created when tree.draw() is called, not just the html for the
- visible nodes.
-
- * Added an onLabelClick listener to TextNode
-
- * TreeView.removeNode no longer automatically refreshes the tree. It has an
- optional parameter to perform the refresh.
-
- * removeNode can now be executed on nodes that have not been rendered.
-
- * You can now delete top-level nodes.
-
- * Added onCheckClick listener to the TaskNode example
-
- * Added Node.iconMode, which is a property that configures the way
- dynamically loaded nodes are displayed when they are expanded and contain
- no children.
-
- * TreeView/Node.setDynamicLoad now accepts an optional second parameter to
- set the iconMode property.
-
- * Fixed an issue in the TaskNode.js example that prevented setting the checked
- state of a node through the constructor.
-
- * Fixed an issue in HTMLNode that caused rendering issues when hasIcon was
- set to true.
-
- * Added TreeView.removeNode
-
- * Added Node.refresh
+TreeView - Release Notes
+
+0.12.0
+
+ * TreeView now augments EventProvider, and has custom events for expand,
+ collapse, animStart, animComplete, and labelClick. Existing implementations
+ using abstract methods for these events (if they exist) will still work.
+ New events can be plugged into the tree by the Node implementation. For
+ example, TaskNode adds a checkClick event. EventProvider makes it safe
+ to do this because implementing code can call subscribe() prior to the
+ event creation.
+
+ * YAHOO.util.Event is now a requirement for the widget
+
+ * TreeView::removeChildren no longer expands and collapses the node.
+
+ * Documented the moveComplete property
+
+ * createElement("DIV") changed to createElement("div")
+
+0.11.4
+
+ * Fixed a javascript error on the HTML node example page.
+
+0.11.3
+
+ * popNode now clears the tree, previousSibling, nextSibling, and parent
+ properties of the node that is being removed from the tree.
+
+ * Fixed the paths to the images in the tree.css file that is included in
+ build/assets.
+
+0.11.0
+
+ * Added TreeView -> popNode, which differs from removeNode in that the
+ node's children are preserved so the entire branch can be re-inserted
+ into another part of the tree, or another tree.
+
+ * Added TreeView -> getNodesByProperty, which differs from
+ getNodeByProperty by returning an array of all nodes that have the
+ specified property rather than just the first one.
+
+ * Added Node -> insertBefore, insertAfter, and appendTo. These method
+ can be used to reorganize the tree.
+
+ * removeChildren properly resets the node icon when executed against a
+ collpased node.
+
+ * Moved depth assignment from the constructor to appendChild so that the
+ value is set properly if the node is moved within the tree.
+
+ * Fixed broken loop in removeChildren.
+
+ * RootNode -> loadComplete calls tree.draw for hot-wiring the dynamic load
+ feature for the top level nodes.
+
+ * The treeview constructor will accept an element instead of an id.
+
+0.10.0
+
+ * If the child collection changes prior to a refresh(), the icon is now
+ changed appropriately.
+
+ * Added TreeView removeChildren(node). This will recursively purge the node's
+ children, and reset its dynamic load state.
+
+ * previousSibling and nextSibling are now adjusted correctly when a
+ node is deleted.
+
+ * expand()/collapse() now will not expand/collapse the node if false is
+ returned from the onExpand/onCollapse event handlers.
+
+ * The onExpand and onCollapse events now fire before the node is expanded
+ or collapsed so that the implementer can modify the node's child collection
+ prior to display.
+
+ * The childrenRendered property previous was used to indicate both that
+ a dynamically loaded node has received its data, and also to indicate
+ that the children html has been created. This has been split into
+ two properties. dynamicLoadComplete and childrenRendered.
+
+ * Implemented the renderHidden flag. If set to true, the html for the entire
+ tree will be created when tree.draw() is called, not just the html for the
+ visible nodes.
+
+ * Added an onLabelClick listener to TextNode
+
+ * TreeView.removeNode no longer automatically refreshes the tree. It has an
+ optional parameter to perform the refresh.
+
+ * removeNode can now be executed on nodes that have not been rendered.
+
+ * You can now delete top-level nodes.
+
+ * Added onCheckClick listener to the TaskNode example
+
+ * Added Node.iconMode, which is a property that configures the way
+ dynamically loaded nodes are displayed when they are expanded and contain
+ no children.
+
+ * TreeView/Node.setDynamicLoad now accepts an optional second parameter to
+ set the iconMode property.
+
+ * Fixed an issue in the TaskNode.js example that prevented setting the checked
+ state of a node through the constructor.
+
+ * Fixed an issue in HTMLNode that caused rendering issues when hasIcon was
+ set to true.
+
+ * Added TreeView.removeNode
+
+ * Added Node.refresh
diff --git a/thirdpartyjs/yui/treeview/assets/tree.css b/thirdpartyjs/yui/treeview/assets/tree.css
index 8686839..0d805f5 100644
--- a/thirdpartyjs/yui/treeview/assets/tree.css
+++ b/thirdpartyjs/yui/treeview/assets/tree.css
@@ -1,98 +1,98 @@
-/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
-
-/* first or middle sibling, no children */
-.ygtvtn {
- width:16px; height:22px;
- background: url(tn.gif) 0 0 no-repeat;
-}
-
-/* first or middle sibling, collapsable */
-.ygtvtm {
- width:16px; height:22px;
- cursor:pointer ;
- background: url(tm.gif) 0 0 no-repeat;
-}
-
-/* first or middle sibling, collapsable, hover */
-.ygtvtmh {
- width:16px; height:22px;
- cursor:pointer ;
- background: url(tmh.gif) 0 0 no-repeat;
-}
-
-/* first or middle sibling, expandable */
-.ygtvtp {
- width:16px; height:22px;
- cursor:pointer ;
- background: url(tp.gif) 0 0 no-repeat;
-}
-
-/* first or middle sibling, expandable, hover */
-.ygtvtph {
- width:16px; height:22px;
- cursor:pointer ;
- background: url(tph.gif) 0 0 no-repeat;
-}
-
-/* last sibling, no children */
-.ygtvln {
- width:16px; height:22px;
- background: url(ln.gif) 0 0 no-repeat;
-}
-
-/* Last sibling, collapsable */
-.ygtvlm {
- width:16px; height:22px;
- cursor:pointer ;
- background: url(lm.gif) 0 0 no-repeat;
-}
-
-/* Last sibling, collapsable, hover */
-.ygtvlmh {
- width:16px; height:22px;
- cursor:pointer ;
- background: url(lmh.gif) 0 0 no-repeat;
-}
-
-/* Last sibling, expandable */
-.ygtvlp {
- width:16px; height:22px;
- cursor:pointer ;
- background: url(lp.gif) 0 0 no-repeat;
-}
-
-/* Last sibling, expandable, hover */
-.ygtvlph {
- width:16px; height:22px; cursor:pointer ;
- background: url(lph.gif) 0 0 no-repeat;
-}
-
-/* Loading icon */
-.ygtvloading {
- width:16px; height:22px;
- background: url(loading.gif) 0 0 no-repeat;
-}
-
-/* the style for the empty cells that are used for rendering the depth
- * of the node */
-.ygtvdepthcell {
- width:16px; height:22px;
- background: url(vline.gif) 0 0 no-repeat;
-}
-
-.ygtvblankdepthcell { width:16px; height:22px; }
-
-/* the style of the div around each node */
-.ygtvitem { }
-
-/* the style of the div around each node's collection of children */
-.ygtvchildren { }
-* html .ygtvchildren { height:2%; }
-
-/* the style of the text label in ygTextNode */
-.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover {
- margin-left:2px;
- text-decoration: none;
-}
-
-.ygtvspacer { height: 10px; width: 10px; margin: 2px; }
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/* first or middle sibling, no children */
+.ygtvtn {
+ width:16px; height:22px;
+ background: url(tn.gif) 0 0 no-repeat;
+}
+
+/* first or middle sibling, collapsable */
+.ygtvtm {
+ width:16px; height:22px;
+ cursor:pointer ;
+ background: url(tm.gif) 0 0 no-repeat;
+}
+
+/* first or middle sibling, collapsable, hover */
+.ygtvtmh {
+ width:16px; height:22px;
+ cursor:pointer ;
+ background: url(tmh.gif) 0 0 no-repeat;
+}
+
+/* first or middle sibling, expandable */
+.ygtvtp {
+ width:16px; height:22px;
+ cursor:pointer ;
+ background: url(tp.gif) 0 0 no-repeat;
+}
+
+/* first or middle sibling, expandable, hover */
+.ygtvtph {
+ width:16px; height:22px;
+ cursor:pointer ;
+ background: url(tph.gif) 0 0 no-repeat;
+}
+
+/* last sibling, no children */
+.ygtvln {
+ width:16px; height:22px;
+ background: url(ln.gif) 0 0 no-repeat;
+}
+
+/* Last sibling, collapsable */
+.ygtvlm {
+ width:16px; height:22px;
+ cursor:pointer ;
+ background: url(lm.gif) 0 0 no-repeat;
+}
+
+/* Last sibling, collapsable, hover */
+.ygtvlmh {
+ width:16px; height:22px;
+ cursor:pointer ;
+ background: url(lmh.gif) 0 0 no-repeat;
+}
+
+/* Last sibling, expandable */
+.ygtvlp {
+ width:16px; height:22px;
+ cursor:pointer ;
+ background: url(lp.gif) 0 0 no-repeat;
+}
+
+/* Last sibling, expandable, hover */
+.ygtvlph {
+ width:16px; height:22px; cursor:pointer ;
+ background: url(lph.gif) 0 0 no-repeat;
+}
+
+/* Loading icon */
+.ygtvloading {
+ width:16px; height:22px;
+ background: url(loading.gif) 0 0 no-repeat;
+}
+
+/* the style for the empty cells that are used for rendering the depth
+ * of the node */
+.ygtvdepthcell {
+ width:16px; height:22px;
+ background: url(vline.gif) 0 0 no-repeat;
+}
+
+.ygtvblankdepthcell { width:16px; height:22px; }
+
+/* the style of the div around each node */
+.ygtvitem { }
+
+/* the style of the div around each node's collection of children */
+.ygtvchildren { }
+* html .ygtvchildren { height:2%; }
+
+/* the style of the text label in ygTextNode */
+.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover {
+ margin-left:2px;
+ text-decoration: none;
+}
+
+.ygtvspacer { height: 10px; width: 10px; margin: 2px; }
diff --git a/thirdpartyjs/yui/treeview/treeview-debug.js b/thirdpartyjs/yui/treeview/treeview-debug.js
index 94d0310..8db67db 100644
--- a/thirdpartyjs/yui/treeview/treeview-debug.js
+++ b/thirdpartyjs/yui/treeview/treeview-debug.js
@@ -1,2228 +1,2228 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-/**
- * The treeview widget is a generic tree building tool.
- * @module treeview
- * @title TreeView Widget
- * @requires yahoo
- * @optional animation
- * @namespace YAHOO.widget
- */
-
-/**
- * Contains the tree view state data and the root node.
- *
- * @class TreeView
- * @constructor
- * @param {string|HTMLElement} id The id of the element, or the element
- * itself that the tree will be inserted into.
- */
-YAHOO.widget.TreeView = function(id) {
- if (id) { this.init(id); }
-};
-
-
-
-YAHOO.widget.TreeView.prototype = {
-
- /**
- * The id of tree container element
- * @property id
- * @type String
- */
- id: null,
-
- /**
- * The host element for this tree
- * @property _el
- * @private
- */
- _el: null,
-
- /**
- * Flat collection of all nodes in this tree
- * @property _nodes
- * @type Node[]
- * @private
- */
- _nodes: null,
-
- /**
- * We lock the tree control while waiting for the dynamic loader to return
- * @property locked
- * @type boolean
- */
- locked: false,
-
- /**
- * The animation to use for expanding children, if any
- * @property _expandAnim
- * @type string
- * @private
- */
- _expandAnim: null,
-
- /**
- * The animation to use for collapsing children, if any
- * @property _collapseAnim
- * @type string
- * @private
- */
- _collapseAnim: null,
-
- /**
- * The current number of animations that are executing
- * @property _animCount
- * @type int
- * @private
- */
- _animCount: 0,
-
- /**
- * The maximum number of animations to run at one time.
- * @property maxAnim
- * @type int
- */
- maxAnim: 2,
-
- /**
- * Sets up the animation for expanding children
- * @method setExpandAnim
- * @param {string} type the type of animation (acceptable values defined
- * in YAHOO.widget.TVAnim)
- */
- setExpandAnim: function(type) {
- if (YAHOO.widget.TVAnim.isValid(type)) {
- this._expandAnim = type;
- }
- },
-
- /**
- * Sets up the animation for collapsing children
- * @method setCollapseAnim
- * @param {string} the type of animation (acceptable values defined in
- * YAHOO.widget.TVAnim)
- */
- setCollapseAnim: function(type) {
- if (YAHOO.widget.TVAnim.isValid(type)) {
- this._collapseAnim = type;
- }
- },
-
- /**
- * Perform the expand animation if configured, or just show the
- * element if not configured or too many animations are in progress
- * @method animateExpand
- * @param el {HTMLElement} the element to animate
- * @param node {YAHOO.util.Node} the node that was expanded
- * @return {boolean} true if animation could be invoked, false otherwise
- */
- animateExpand: function(el, node) {
- this.logger.log("animating expand");
-
- if (this._expandAnim && this._animCount < this.maxAnim) {
- // this.locked = true;
- var tree = this;
- var a = YAHOO.widget.TVAnim.getAnim(this._expandAnim, el,
- function() { tree.expandComplete(node); });
- if (a) {
- ++this._animCount;
- this.fireEvent("animStart", {
- "node": node,
- "type": "expand"
- });
- a.animate();
- }
-
- return true;
- }
-
- return false;
- },
-
- /**
- * Perform the collapse animation if configured, or just show the
- * element if not configured or too many animations are in progress
- * @method animateCollapse
- * @param el {HTMLElement} the element to animate
- * @param node {YAHOO.util.Node} the node that was expanded
- * @return {boolean} true if animation could be invoked, false otherwise
- */
- animateCollapse: function(el, node) {
- this.logger.log("animating collapse");
-
- if (this._collapseAnim && this._animCount < this.maxAnim) {
- // this.locked = true;
- var tree = this;
- var a = YAHOO.widget.TVAnim.getAnim(this._collapseAnim, el,
- function() { tree.collapseComplete(node); });
- if (a) {
- ++this._animCount;
- this.fireEvent("animStart", {
- "node": node,
- "type": "collapse"
- });
- a.animate();
- }
-
- return true;
- }
-
- return false;
- },
-
- /**
- * Function executed when the expand animation completes
- * @method expandComplete
- */
- expandComplete: function(node) {
- this.logger.log("expand complete: " + this.id);
- --this._animCount;
- this.fireEvent("animComplete", {
- "node": node,
- "type": "expand"
- });
- // this.locked = false;
- },
-
- /**
- * Function executed when the collapse animation completes
- * @method collapseComplete
- */
- collapseComplete: function(node) {
- this.logger.log("collapse complete: " + this.id);
- --this._animCount;
- this.fireEvent("animComplete", {
- "node": node,
- "type": "collapse"
- });
- // this.locked = false;
- },
-
- /**
- * Initializes the tree
- * @method init
- * @parm {string|HTMLElement} id the id of the element that will hold the tree
- * @private
- */
- init: function(id) {
-
- this.id = id;
-
- if ("string" !== typeof id) {
- this._el = id;
- this.id = this.generateId(id);
- }
-
- /**
- * When animation is enabled, this event fires when the animation
- * starts
- * @event animStart
- * @type CustomEvent
- * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
- * @parm {String} type the type of animation ("expand" or "collapse")
- */
- this.createEvent("animStart", this);
-
- /**
- * When animation is enabled, this event fires when the animation
- * completes
- * @event animComplete
- * @type CustomEvent
- * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
- * @parm {String} type the type of animation ("expand" or "collapse")
- */
- this.createEvent("animComplete", this);
-
- /**
- * Fires when a node is going to be expanded. Return false to stop
- * the expand.
- * @event collapse
- * @type CustomEvent
- * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
- */
- this.createEvent("collapse", this);
-
- /**
- * Fires when a node is going to be collapsed. Return false to stop
- * the collapse.
- * @event expand
- * @type CustomEvent
- * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
- */
- this.createEvent("expand", this);
-
- this._nodes = [];
-
- // store a global reference
- YAHOO.widget.TreeView.trees[this.id] = this;
-
- // Set up the root node
- this.root = new YAHOO.widget.RootNode(this);
-
- this.logger = new YAHOO.widget.LogWriter(this.toString());
-
- this.logger.log("tree init: " + this.id);
- },
-
- /**
- * Renders the tree boilerplate and visible nodes
- * @method draw
- */
- draw: function() {
- var html = this.root.getHtml();
- this.getEl().innerHTML = html;
- this.firstDraw = false;
- },
-
- /**
- * Returns the tree's host element
- * @method getEl
- * @return {HTMLElement} the host element
- */
- getEl: function() {
- if (! this._el) {
- this._el = document.getElementById(this.id);
- }
- return this._el;
- },
-
- /**
- * Nodes register themselves with the tree instance when they are created.
- * @method regNode
- * @param node {Node} the node to register
- * @private
- */
- regNode: function(node) {
- this._nodes[node.index] = node;
- },
-
- /**
- * Returns the root node of this tree
- * @method getRoot
- * @return {Node} the root node
- */
- getRoot: function() {
- return this.root;
- },
-
- /**
- * Configures this tree to dynamically load all child data
- * @method setDynamicLoad
- * @param {function} fnDataLoader the function that will be called to get the data
- * @param iconMode {int} configures the icon that is displayed when a dynamic
- * load node is expanded the first time without children. By default, the
- * "collapse" icon will be used. If set to 1, the leaf node icon will be
- * displayed.
- */
- setDynamicLoad: function(fnDataLoader, iconMode) {
- this.root.setDynamicLoad(fnDataLoader, iconMode);
- },
-
- /**
- * Expands all child nodes. Note: this conflicts with the "multiExpand"
- * node property. If expand all is called in a tree with nodes that
- * do not allow multiple siblings to be displayed, only the last sibling
- * will be expanded.
- * @method expandAll
- */
- expandAll: function() {
- if (!this.locked) {
- this.root.expandAll();
- }
- },
-
- /**
- * Collapses all expanded child nodes in the entire tree.
- * @method collapseAll
- */
- collapseAll: function() {
- if (!this.locked) {
- this.root.collapseAll();
- }
- },
-
- /**
- * Returns a node in the tree that has the specified index (this index
- * is created internally, so this function probably will only be used
- * in html generated for a given node.)
- * @method getNodeByIndex
- * @param {int} nodeIndex the index of the node wanted
- * @return {Node} the node with index=nodeIndex, null if no match
- */
- getNodeByIndex: function(nodeIndex) {
- var n = this._nodes[nodeIndex];
- return (n) ? n : null;
- },
-
- /**
- * Returns a node that has a matching property and value in the data
- * object that was passed into its constructor.
- * @method getNodeByProperty
- * @param {object} property the property to search (usually a string)
- * @param {object} value the value we want to find (usuall an int or string)
- * @return {Node} the matching node, null if no match
- */
- getNodeByProperty: function(property, value) {
- for (var i in this._nodes) {
- var n = this._nodes[i];
- if (n.data && value == n.data[property]) {
- return n;
- }
- }
-
- return null;
- },
-
- /**
- * Returns a collection of nodes that have a matching property
- * and value in the data object that was passed into its constructor.
- * @method getNodesByProperty
- * @param {object} property the property to search (usually a string)
- * @param {object} value the value we want to find (usuall an int or string)
- * @return {Array} the matching collection of nodes, null if no match
- */
- getNodesByProperty: function(property, value) {
- var values = [];
- for (var i in this._nodes) {
- var n = this._nodes[i];
- if (n.data && value == n.data[property]) {
- values.push(n);
- }
- }
-
- return (values.length) ? values : null;
- },
-
- /**
- * Removes the node and its children, and optionally refreshes the
- * branch of the tree that was affected.
- * @method removeNode
- * @param {Node} The node to remove
- * @param {boolean} autoRefresh automatically refreshes branch if true
- * @return {boolean} False is there was a problem, true otherwise.
- */
- removeNode: function(node, autoRefresh) {
-
- // Don't delete the root node
- if (node.isRoot()) {
- return false;
- }
-
- // Get the branch that we may need to refresh
- var p = node.parent;
- if (p.parent) {
- p = p.parent;
- }
-
- // Delete the node and its children
- this._deleteNode(node);
-
- // Refresh the parent of the parent
- if (autoRefresh && p && p.childrenRendered) {
- p.refresh();
- }
-
- return true;
- },
-
- /**
- * Deletes this nodes child collection, recursively. Also collapses
- * the node, and resets the dynamic load flag. The primary use for
- * this method is to purge a node and allow it to fetch its data
- * dynamically again.
- * @method removeChildren
- * @param {Node} node the node to purge
- */
- removeChildren: function(node) {
- this.logger.log("Removing children for " + node);
- while (node.children.length) {
- this._deleteNode(node.children[0]);
- }
-
- node.childrenRendered = false;
- node.dynamicLoadComplete = false;
- if (node.expanded) {
- node.collapse();
- } else {
- node.updateIcon();
- }
- },
-
- /**
- * Deletes the node and recurses children
- * @method _deleteNode
- * @private
- */
- _deleteNode: function(node) {
- // Remove all the child nodes first
- this.removeChildren(node);
-
- // Remove the node from the tree
- this.popNode(node);
- },
-
- /**
- * Removes the node from the tree, preserving the child collection
- * to make it possible to insert the branch into another part of the
- * tree, or another tree.
- * @method popNode
- * @param {Node} the node to remove
- */
- popNode: function(node) {
- var p = node.parent;
-
- // Update the parent's collection of children
- var a = [];
-
- for (var i=0, len=p.children.length;i ';
- }
-
- var f = document.createElement("div");
- var s = f.style;
- s.position = "absolute";
- s.top = "-1000px";
- s.left = "-1000px";
- f.innerHTML = sb.join("");
-
- document.body.appendChild(f);
-
- YAHOO.widget.TreeView.removeHandler(window,
- "load", YAHOO.widget.TreeView.preload);
-
-};
-
-YAHOO.widget.TreeView.addHandler(window,
- "load", YAHOO.widget.TreeView.preload);
-
-/**
- * The base class for all tree nodes. The node's presentation and behavior in
- * response to mouse events is handled in Node subclasses.
- * @namespace YAHOO.widget
- * @class Node
- * @param oData {object} a string or object containing the data that will
- * be used to render this node
- * @param oParent {Node} this node's parent node
- * @param expanded {boolean} the initial expanded/collapsed state
- * @constructor
- */
-YAHOO.widget.Node = function(oData, oParent, expanded) {
- if (oData) { this.init(oData, oParent, expanded); }
-};
-
-YAHOO.widget.Node.prototype = {
-
- /**
- * The index for this instance obtained from global counter in YAHOO.widget.TreeView.
- * @property index
- * @type int
- */
- index: 0,
-
- /**
- * This node's child node collection.
- * @property children
- * @type Node[]
- */
- children: null,
-
- /**
- * Tree instance this node is part of
- * @property tree
- * @type TreeView
- */
- tree: null,
-
- /**
- * The data linked to this node. This can be any object or primitive
- * value, and the data can be used in getNodeHtml().
- * @property data
- * @type object
- */
- data: null,
-
- /**
- * Parent node
- * @property parent
- * @type Node
- */
- parent: null,
-
- /**
- * The depth of this node. We start at -1 for the root node.
- * @property depth
- * @type int
- */
- depth: -1,
-
- /**
- * The href for the node's label. If one is not specified, the href will
- * be set so that it toggles the node.
- * @property href
- * @type string
- */
- href: null,
-
- /**
- * The label href target, defaults to current window
- * @property target
- * @type string
- */
- target: "_self",
-
- /**
- * The node's expanded/collapsed state
- * @property expanded
- * @type boolean
- */
- expanded: false,
-
- /**
- * Can multiple children be expanded at once?
- * @property multiExpand
- * @type boolean
- */
- multiExpand: true,
-
- /**
- * Should we render children for a collapsed node? It is possible that the
- * implementer will want to render the hidden data... @todo verify that we
- * need this, and implement it if we do.
- * @property renderHidden
- * @type boolean
- */
- renderHidden: false,
-
- /**
- * This flag is set to true when the html is generated for this node's
- * children, and set to false when new children are added.
- * @property childrenRendered
- * @type boolean
- */
- childrenRendered: false,
-
- /**
- * Dynamically loaded nodes only fetch the data the first time they are
- * expanded. This flag is set to true once the data has been fetched.
- * @property dynamicLoadComplete
- * @type boolean
- */
- dynamicLoadComplete: false,
-
- /**
- * This node's previous sibling
- * @property previousSibling
- * @type Node
- */
- previousSibling: null,
-
- /**
- * This node's next sibling
- * @property nextSibling
- * @type Node
- */
- nextSibling: null,
-
- /**
- * We can set the node up to call an external method to get the child
- * data dynamically.
- * @property _dynLoad
- * @type boolean
- * @private
- */
- _dynLoad: false,
-
- /**
- * Function to execute when we need to get this node's child data.
- * @property dataLoader
- * @type function
- */
- dataLoader: null,
-
- /**
- * This is true for dynamically loading nodes while waiting for the
- * callback to return.
- * @property isLoading
- * @type boolean
- */
- isLoading: false,
-
- /**
- * The toggle/branch icon will not show if this is set to false. This
- * could be useful if the implementer wants to have the child contain
- * extra info about the parent, rather than an actual node.
- * @property hasIcon
- * @type boolean
- */
- hasIcon: true,
-
- /**
- * Used to configure what happens when a dynamic load node is expanded
- * and we discover that it does not have children. By default, it is
- * treated as if it still could have children (plus/minus icon). Set
- * iconMode to have it display like a leaf node instead.
- * @property iconMode
- * @type int
- */
- iconMode: 0,
-
- /**
- * The node type
- * @property _type
- * @private
- */
- _type: "Node",
-
- /*
- spacerPath: "http://us.i1.yimg.com/us.yimg.com/i/space.gif",
- expandedText: "Expanded",
- collapsedText: "Collapsed",
- loadingText: "Loading",
- */
-
- /**
- * Initializes this node, gets some of the properties from the parent
- * @method init
- * @param oData {object} a string or object containing the data that will
- * be used to render this node
- * @param oParent {Node} this node's parent node
- * @param expanded {boolean} the initial expanded/collapsed state
- */
- init: function(oData, oParent, expanded) {
-
- this.data = oData;
- this.children = [];
- this.index = YAHOO.widget.TreeView.nodeCount;
- ++YAHOO.widget.TreeView.nodeCount;
- this.expanded = expanded;
- this.logger = new YAHOO.widget.LogWriter(this.toString());
-
- /**
- * The parentChange event is fired when a parent element is applied
- * to the node. This is useful if you need to apply tree-level
- * properties to a tree that need to happen if a node is moved from
- * one tre to another.
- *
- * @event parentChange
- * @type CustomEvent
- */
- this.createEvent("parentChange", this);
-
- // oParent should never be null except when we create the root node.
- if (oParent) {
- oParent.appendChild(this);
- }
- },
-
- /**
- * Certain properties for the node cannot be set until the parent
- * is known. This is called after the node is inserted into a tree.
- * the parent is also applied to this node's children in order to
- * make it possible to move a branch from one tree to another.
- * @method applyParent
- * @param {Node} parentNode this node's parent node
- * @return {boolean} true if the application was successful
- */
- applyParent: function(parentNode) {
- if (!parentNode) {
- return false;
- }
-
- this.tree = parentNode.tree;
- this.parent = parentNode;
- this.depth = parentNode.depth + 1;
-
- if (!this.href) {
- this.href = "javascript:" + this.getToggleLink();
- }
-
- if (! this.multiExpand) {
- this.multiExpand = parentNode.multiExpand;
- }
-
- this.tree.regNode(this);
- parentNode.childrenRendered = false;
-
- // cascade update existing children
- for (var i=0, len=this.children.length;i 0 ||
- (checkForLazyLoad && this.isDynamic() && !this.dynamicLoadComplete) );
- },
-
- /**
- * Expands if node is collapsed, collapses otherwise.
- * @method toggle
- */
- toggle: function() {
- if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) {
- if (this.expanded) { this.collapse(); } else { this.expand(); }
- }
- },
-
- /**
- * Returns the markup for this node and its children.
- * @method getHtml
- * @return {string} the markup for this node and its expanded children.
- */
- getHtml: function() {
-
- this.childrenRendered = false;
-
- var sb = [];
- sb[sb.length] = '';
- sb[sb.length] = this.getNodeHtml();
- sb[sb.length] = this.getChildrenHtml();
- sb[sb.length] = '
';
- return sb.join("");
- },
-
- /**
- * Called when first rendering the tree. We always build the div that will
- * contain this nodes children, but we don't render the children themselves
- * unless this node is expanded.
- * @method getChildrenHtml
- * @return {string} the children container div html and any expanded children
- * @private
- */
- getChildrenHtml: function() {
-
- var sb = [];
- sb[sb.length] = '';
-
- // Don't render the actual child node HTML unless this node is expanded.
- if ( (this.hasChildren(true) && this.expanded) ||
- (this.renderHidden && !this.isDynamic()) ) {
- sb[sb.length] = this.renderChildren();
- }
-
- sb[sb.length] = '
';
-
- return sb.join("");
- },
-
- /**
- * Generates the markup for the child nodes. This is not done until the node
- * is expanded.
- * @method renderChildren
- * @return {string} the html for this node's children
- * @private
- */
- renderChildren: function() {
-
- this.logger.log("rendering children for " + this.index);
-
- var node = this;
-
- if (this.isDynamic() && !this.dynamicLoadComplete) {
- this.isLoading = true;
- this.tree.locked = true;
-
- if (this.dataLoader) {
- this.logger.log("Using dynamic loader defined for this node");
-
- setTimeout(
- function() {
- node.dataLoader(node,
- function() {
- node.loadComplete();
- });
- }, 10);
-
- } else if (this.tree.root.dataLoader) {
- this.logger.log("Using the tree-level dynamic loader");
-
- setTimeout(
- function() {
- node.tree.root.dataLoader(node,
- function() {
- node.loadComplete();
- });
- }, 10);
-
- } else {
- this.logger.log("no loader found");
- return "Error: data loader not found or not specified.";
- }
-
- return "";
-
- } else {
- return this.completeRender();
- }
- },
-
- /**
- * Called when we know we have all the child data.
- * @method completeRender
- * @return {string} children html
- */
- completeRender: function() {
- this.logger.log("completeRender: " + this.index + ", # of children: " + this.children.length);
- var sb = [];
-
- for (var i=0; i < this.children.length; ++i) {
- // this.children[i].childrenRendered = false;
- sb[sb.length] = this.children[i].getHtml();
- }
-
- this.childrenRendered = true;
-
- return sb.join("");
- },
-
- /**
- * Load complete is the callback function we pass to the data provider
- * in dynamic load situations.
- * @method loadComplete
- */
- loadComplete: function() {
- this.logger.log("loadComplete: " + this.index);
- this.getChildrenEl().innerHTML = this.completeRender();
- this.dynamicLoadComplete = true;
- this.isLoading = false;
- this.expand();
- this.tree.locked = false;
- },
-
- /**
- * Returns this node's ancestor at the specified depth.
- * @method getAncestor
- * @param {int} depth the depth of the ancestor.
- * @return {Node} the ancestor
- */
- getAncestor: function(depth) {
- if (depth >= this.depth || depth < 0) {
- this.logger.log("illegal getAncestor depth: " + depth);
- return null;
- }
-
- var p = this.parent;
-
- while (p.depth > depth) {
- p = p.parent;
- }
-
- return p;
- },
-
- /**
- * Returns the css class for the spacer at the specified depth for
- * this node. If this node's ancestor at the specified depth
- * has a next sibling the presentation is different than if it
- * does not have a next sibling
- * @method getDepthStyle
- * @param {int} depth the depth of the ancestor.
- * @return {string} the css class for the spacer
- */
- getDepthStyle: function(depth) {
- return (this.getAncestor(depth).nextSibling) ?
- "ygtvdepthcell" : "ygtvblankdepthcell";
- },
-
- /**
- * Get the markup for the node. This is designed to be overrided so that we can
- * support different types of nodes.
- * @method getNodeHtml
- * @return {string} The HTML that will render this node.
- */
- getNodeHtml: function() {
- this.logger.log("Generating html");
- return "";
- },
-
- /**
- * Regenerates the html for this node and its children. To be used when the
- * node is expanded and new children have been added.
- * @method refresh
- */
- refresh: function() {
- // this.loadComplete();
- this.getChildrenEl().innerHTML = this.completeRender();
-
- if (this.hasIcon) {
- var el = this.getToggleEl();
- if (el) {
- el.className = this.getStyle();
- }
- }
- },
-
- /**
- * Node toString
- * @method toString
- * @return {string} string representation of the node
- */
- toString: function() {
- return "Node (" + this.index + ")";
- }
-
-};
-
-YAHOO.augment(YAHOO.widget.Node, YAHOO.util.EventProvider);
-
-/**
- * A custom YAHOO.widget.Node that handles the unique nature of
- * the virtual, presentationless root node.
- * @namespace YAHOO.widget
- * @class RootNode
- * @extends YAHOO.widget.Node
- * @param oTree {YAHOO.widget.TreeView} The tree instance this node belongs to
- * @constructor
- */
-YAHOO.widget.RootNode = function(oTree) {
- // Initialize the node with null params. The root node is a
- // special case where the node has no presentation. So we have
- // to alter the standard properties a bit.
- this.init(null, null, true);
-
- /*
- * For the root node, we get the tree reference from as a param
- * to the constructor instead of from the parent element.
- */
- this.tree = oTree;
-};
-
-YAHOO.extend(YAHOO.widget.RootNode, YAHOO.widget.Node, {
-
- // overrides YAHOO.widget.Node
- getNodeHtml: function() {
- return "";
- },
-
- toString: function() {
- return "RootNode";
- },
-
- loadComplete: function() {
- this.tree.draw();
- }
-
-});
-/**
- * The default node presentation. The first parameter should be
- * either a string that will be used as the node's label, or an object
- * that has a string propery called label. By default, the clicking the
- * label will toggle the expanded/collapsed state of the node. By
- * changing the href property of the instance, this behavior can be
- * changed so that the label will go to the specified href.
- * @namespace YAHOO.widget
- * @class TextNode
- * @extends YAHOO.widget.Node
- * @constructor
- * @param oData {object} a string or object containing the data that will
- * be used to render this node
- * @param oParent {YAHOO.widget.Node} this node's parent node
- * @param expanded {boolean} the initial expanded/collapsed state
- */
-YAHOO.widget.TextNode = function(oData, oParent, expanded) {
-
- if (oData) {
- this.init(oData, oParent, expanded);
- this.setUpLabel(oData);
- }
-
- this.logger = new YAHOO.widget.LogWriter(this.toString());
-};
-
-YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, {
-
- /**
- * The CSS class for the label href. Defaults to ygtvlabel, but can be
- * overridden to provide a custom presentation for a specific node.
- * @property labelStyle
- * @type string
- */
- labelStyle: "ygtvlabel",
-
- /**
- * The derived element id of the label for this node
- * @property labelElId
- * @type string
- */
- labelElId: null,
-
- /**
- * The text for the label. It is assumed that the oData parameter will
- * either be a string that will be used as the label, or an object that
- * has a property called "label" that we will use.
- * @property label
- * @type string
- */
- label: null,
-
- textNodeParentChange: function() {
-
- /**
- * Custom event that is fired when the text node label is clicked. The
- * custom event is defined on the tree instance, so there is a single
- * event that handles all nodes in the tree. The node clicked is
- * provided as an argument
- *
- * @event labelClick
- * @for YAHOO.widget.TreeView
- * @param {YAHOO.widget.Node} node the node clicked
- */
- if (this.tree && !this.tree.hasEvent("labelClick")) {
- this.tree.createEvent("labelClick", this.tree);
- }
-
- },
-
- /**
- * Sets up the node label
- * @method setUpLabel
- * @param oData string containing the label, or an object with a label property
- */
- setUpLabel: function(oData) {
-
- // set up the custom event on the tree
- this.textNodeParentChange();
- this.subscribe("parentChange", this.textNodeParentChange);
-
- if (typeof oData == "string") {
- oData = { label: oData };
- }
- this.label = oData.label;
-
- // update the link
- if (oData.href) {
- this.href = oData.href;
- }
-
- // set the target
- if (oData.target) {
- this.target = oData.target;
- }
-
- if (oData.style) {
- this.labelStyle = oData.style;
- }
-
- this.labelElId = "ygtvlabelel" + this.index;
- },
-
- /**
- * Returns the label element
- * @for YAHOO.widget.TextNode
- * @method getLabelEl
- * @return {object} the element
- */
- getLabelEl: function() {
- return document.getElementById(this.labelElId);
- },
-
- // overrides YAHOO.widget.Node
- getNodeHtml: function() {
- this.logger.log("Generating html");
- var sb = [];
-
- sb[sb.length] = '';
- sb[sb.length] = '';
-
- for (var i=0;i ';
- sb[sb.length] = ' ';
- }
-
- var getNode = 'YAHOO.widget.TreeView.getNode(\'' +
- this.tree.id + '\',' + this.index + ')';
-
- sb[sb.length] = '';
-
- /*
- sb[sb.length] = ' ';
- */
-
- sb[sb.length] = ' ';
-
- sb[sb.length] = ' ';
- sb[sb.length] = '';
- sb[sb.length] = '';
- sb[sb.length] = this.label;
- sb[sb.length] = ' ';
- sb[sb.length] = ' ';
- sb[sb.length] = ' ';
- sb[sb.length] = '
';
-
- return sb.join("");
- },
-
-
- /**
- * Executed when the label is clicked. Fires the labelClick custom event.
- * @method onLabelClick
- * @param me {Node} this node
- * @scope the anchor tag clicked
- * @return false to cancel the anchor click
- */
- onLabelClick: function(me) {
- me.logger.log("onLabelClick " + me.label);
- return me.tree.fireEvent("labelClick", me);
- //return true;
- },
-
- toString: function() {
- return "TextNode (" + this.index + ") " + this.label;
- }
-
-});
-/**
- * A menu-specific implementation that differs from TextNode in that only
- * one sibling can be expanded at a time.
- * @namespace YAHOO.widget
- * @class MenuNode
- * @extends YAHOO.widget.TextNode
- * @param oData {object} a string or object containing the data that will
- * be used to render this node
- * @param oParent {YAHOO.widget.Node} this node's parent node
- * @param expanded {boolean} the initial expanded/collapsed state
- * @constructor
- */
-YAHOO.widget.MenuNode = function(oData, oParent, expanded) {
- if (oData) {
- this.init(oData, oParent, expanded);
- this.setUpLabel(oData);
- }
-
- /*
- * Menus usually allow only one branch to be open at a time.
- */
- this.multiExpand = false;
-
- this.logger = new YAHOO.widget.LogWriter(this.toString());
-
-};
-
-YAHOO.extend(YAHOO.widget.MenuNode, YAHOO.widget.TextNode, {
-
- toString: function() {
- return "MenuNode (" + this.index + ") " + this.label;
- }
-
-});
-/**
- * This implementation takes either a string or object for the
- * oData argument. If is it a string, we will use it for the display
- * of this node (and it can contain any html code). If the parameter
- * is an object, we look for a parameter called "html" that will be
- * used for this node's display.
- * @namespace YAHOO.widget
- * @class HTMLNode
- * @extends YAHOO.widget.Node
- * @constructor
- * @param oData {object} a string or object containing the data that will
- * be used to render this node
- * @param oParent {YAHOO.widget.Node} this node's parent node
- * @param expanded {boolean} the initial expanded/collapsed state
- * @param hasIcon {boolean} specifies whether or not leaf nodes should
- * have an icon
- */
-YAHOO.widget.HTMLNode = function(oData, oParent, expanded, hasIcon) {
- if (oData) {
- this.init(oData, oParent, expanded);
- this.initContent(oData, hasIcon);
- }
-};
-
-YAHOO.extend(YAHOO.widget.HTMLNode, YAHOO.widget.Node, {
-
- /**
- * The CSS class for the html content container. Defaults to ygtvhtml, but
- * can be overridden to provide a custom presentation for a specific node.
- * @property contentStyle
- * @type string
- */
- contentStyle: "ygtvhtml",
-
- /**
- * The generated id that will contain the data passed in by the implementer.
- * @property contentElId
- * @type string
- */
- contentElId: null,
-
- /**
- * The HTML content to use for this node's display
- * @property content
- * @type string
- */
- content: null,
-
- /**
- * Sets up the node label
- * @property initContent
- * @param {object} An html string or object containing an html property
- * @param {boolean} hasIcon determines if the node will be rendered with an
- * icon or not
- */
- initContent: function(oData, hasIcon) {
- if (typeof oData == "string") {
- oData = { html: oData };
- }
-
- this.html = oData.html;
- this.contentElId = "ygtvcontentel" + this.index;
- this.hasIcon = hasIcon;
-
- this.logger = new YAHOO.widget.LogWriter(this.toString());
- },
-
- /**
- * Returns the outer html element for this node's content
- * @method getContentEl
- * @return {HTMLElement} the element
- */
- getContentEl: function() {
- return document.getElementById(this.contentElId);
- },
-
- // overrides YAHOO.widget.Node
- getNodeHtml: function() {
- this.logger.log("Generating html");
- var sb = [];
-
- sb[sb.length] = '';
- sb[sb.length] = '';
-
- for (var i=0;i ';
- }
-
- if (this.hasIcon) {
- sb[sb.length] = ' ';
- }
-
- sb[sb.length] = '';
- sb[sb.length] = this.html;
- sb[sb.length] = ' ';
- sb[sb.length] = ' ';
- sb[sb.length] = '
';
-
- return sb.join("");
- },
-
- toString: function() {
- return "HTMLNode (" + this.index + ")";
- }
-
-});
-/**
- * A static factory class for tree view expand/collapse animations
- * @class TVAnim
- * @static
- */
-YAHOO.widget.TVAnim = function() {
- return {
- /**
- * Constant for the fade in animation
- * @property FADE_IN
- * @type string
- * @static
- */
- FADE_IN: "TVFadeIn",
-
- /**
- * Constant for the fade out animation
- * @property FADE_OUT
- * @type string
- * @static
- */
- FADE_OUT: "TVFadeOut",
-
- /**
- * Returns a ygAnim instance of the given type
- * @method getAnim
- * @param type {string} the type of animation
- * @param el {HTMLElement} the element to element (probably the children div)
- * @param callback {function} function to invoke when the animation is done.
- * @return {YAHOO.util.Animation} the animation instance
- * @static
- */
- getAnim: function(type, el, callback) {
- if (YAHOO.widget[type]) {
- return new YAHOO.widget[type](el, callback);
- } else {
- return null;
- }
- },
-
- /**
- * Returns true if the specified animation class is available
- * @method isValid
- * @param type {string} the type of animation
- * @return {boolean} true if valid, false if not
- * @static
- */
- isValid: function(type) {
- return (YAHOO.widget[type]);
- }
- };
-} ();
-
-/**
- * A 1/2 second fade-in animation.
- * @class TVFadeIn
- * @constructor
- * @param el {HTMLElement} the element to animate
- * @param callback {function} function to invoke when the animation is finished
- */
-YAHOO.widget.TVFadeIn = function(el, callback) {
- /**
- * The element to animate
- * @property el
- * @type HTMLElement
- */
- this.el = el;
-
- /**
- * the callback to invoke when the animation is complete
- * @property callback
- * @type function
- */
- this.callback = callback;
-
- this.logger = new YAHOO.widget.LogWriter(this.toString());
-};
-
-YAHOO.widget.TVFadeIn.prototype = {
- /**
- * Performs the animation
- * @method animate
- */
- animate: function() {
- var tvanim = this;
-
- var s = this.el.style;
- s.opacity = 0.1;
- s.filter = "alpha(opacity=10)";
- s.display = "";
-
- var dur = 0.4;
- var a = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit:""}}, dur);
- a.onComplete.subscribe( function() { tvanim.onComplete(); } );
- a.animate();
- },
-
- /**
- * Clean up and invoke callback
- * @method onComplete
- */
- onComplete: function() {
- this.callback();
- },
-
- /**
- * toString
- * @method toString
- * @return {string} the string representation of the instance
- */
- toString: function() {
- return "TVFadeIn";
- }
-};
-
-/**
- * A 1/2 second fade out animation.
- * @class TVFadeOut
- * @constructor
- * @param el {HTMLElement} the element to animate
- * @param callback {Function} function to invoke when the animation is finished
- */
-YAHOO.widget.TVFadeOut = function(el, callback) {
- /**
- * The element to animate
- * @property el
- * @type HTMLElement
- */
- this.el = el;
-
- /**
- * the callback to invoke when the animation is complete
- * @property callback
- * @type function
- */
- this.callback = callback;
-
- this.logger = new YAHOO.widget.LogWriter(this.toString());
-};
-
-YAHOO.widget.TVFadeOut.prototype = {
- /**
- * Performs the animation
- * @method animate
- */
- animate: function() {
- var tvanim = this;
- var dur = 0.4;
- var a = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit:""}}, dur);
- a.onComplete.subscribe( function() { tvanim.onComplete(); } );
- a.animate();
- },
-
- /**
- * Clean up and invoke callback
- * @method onComplete
- */
- onComplete: function() {
- var s = this.el.style;
- s.display = "none";
- // s.opacity = 1;
- s.filter = "alpha(opacity=100)";
- this.callback();
- },
-
- /**
- * toString
- * @method toString
- * @return {string} the string representation of the instance
- */
- toString: function() {
- return "TVFadeOut";
- }
-};
-
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+ * The treeview widget is a generic tree building tool.
+ * @module treeview
+ * @title TreeView Widget
+ * @requires yahoo
+ * @optional animation
+ * @namespace YAHOO.widget
+ */
+
+/**
+ * Contains the tree view state data and the root node.
+ *
+ * @class TreeView
+ * @constructor
+ * @param {string|HTMLElement} id The id of the element, or the element
+ * itself that the tree will be inserted into.
+ */
+YAHOO.widget.TreeView = function(id) {
+ if (id) { this.init(id); }
+};
+
+
+
+YAHOO.widget.TreeView.prototype = {
+
+ /**
+ * The id of tree container element
+ * @property id
+ * @type String
+ */
+ id: null,
+
+ /**
+ * The host element for this tree
+ * @property _el
+ * @private
+ */
+ _el: null,
+
+ /**
+ * Flat collection of all nodes in this tree
+ * @property _nodes
+ * @type Node[]
+ * @private
+ */
+ _nodes: null,
+
+ /**
+ * We lock the tree control while waiting for the dynamic loader to return
+ * @property locked
+ * @type boolean
+ */
+ locked: false,
+
+ /**
+ * The animation to use for expanding children, if any
+ * @property _expandAnim
+ * @type string
+ * @private
+ */
+ _expandAnim: null,
+
+ /**
+ * The animation to use for collapsing children, if any
+ * @property _collapseAnim
+ * @type string
+ * @private
+ */
+ _collapseAnim: null,
+
+ /**
+ * The current number of animations that are executing
+ * @property _animCount
+ * @type int
+ * @private
+ */
+ _animCount: 0,
+
+ /**
+ * The maximum number of animations to run at one time.
+ * @property maxAnim
+ * @type int
+ */
+ maxAnim: 2,
+
+ /**
+ * Sets up the animation for expanding children
+ * @method setExpandAnim
+ * @param {string} type the type of animation (acceptable values defined
+ * in YAHOO.widget.TVAnim)
+ */
+ setExpandAnim: function(type) {
+ if (YAHOO.widget.TVAnim.isValid(type)) {
+ this._expandAnim = type;
+ }
+ },
+
+ /**
+ * Sets up the animation for collapsing children
+ * @method setCollapseAnim
+ * @param {string} the type of animation (acceptable values defined in
+ * YAHOO.widget.TVAnim)
+ */
+ setCollapseAnim: function(type) {
+ if (YAHOO.widget.TVAnim.isValid(type)) {
+ this._collapseAnim = type;
+ }
+ },
+
+ /**
+ * Perform the expand animation if configured, or just show the
+ * element if not configured or too many animations are in progress
+ * @method animateExpand
+ * @param el {HTMLElement} the element to animate
+ * @param node {YAHOO.util.Node} the node that was expanded
+ * @return {boolean} true if animation could be invoked, false otherwise
+ */
+ animateExpand: function(el, node) {
+ this.logger.log("animating expand");
+
+ if (this._expandAnim && this._animCount < this.maxAnim) {
+ // this.locked = true;
+ var tree = this;
+ var a = YAHOO.widget.TVAnim.getAnim(this._expandAnim, el,
+ function() { tree.expandComplete(node); });
+ if (a) {
+ ++this._animCount;
+ this.fireEvent("animStart", {
+ "node": node,
+ "type": "expand"
+ });
+ a.animate();
+ }
+
+ return true;
+ }
+
+ return false;
+ },
+
+ /**
+ * Perform the collapse animation if configured, or just show the
+ * element if not configured or too many animations are in progress
+ * @method animateCollapse
+ * @param el {HTMLElement} the element to animate
+ * @param node {YAHOO.util.Node} the node that was expanded
+ * @return {boolean} true if animation could be invoked, false otherwise
+ */
+ animateCollapse: function(el, node) {
+ this.logger.log("animating collapse");
+
+ if (this._collapseAnim && this._animCount < this.maxAnim) {
+ // this.locked = true;
+ var tree = this;
+ var a = YAHOO.widget.TVAnim.getAnim(this._collapseAnim, el,
+ function() { tree.collapseComplete(node); });
+ if (a) {
+ ++this._animCount;
+ this.fireEvent("animStart", {
+ "node": node,
+ "type": "collapse"
+ });
+ a.animate();
+ }
+
+ return true;
+ }
+
+ return false;
+ },
+
+ /**
+ * Function executed when the expand animation completes
+ * @method expandComplete
+ */
+ expandComplete: function(node) {
+ this.logger.log("expand complete: " + this.id);
+ --this._animCount;
+ this.fireEvent("animComplete", {
+ "node": node,
+ "type": "expand"
+ });
+ // this.locked = false;
+ },
+
+ /**
+ * Function executed when the collapse animation completes
+ * @method collapseComplete
+ */
+ collapseComplete: function(node) {
+ this.logger.log("collapse complete: " + this.id);
+ --this._animCount;
+ this.fireEvent("animComplete", {
+ "node": node,
+ "type": "collapse"
+ });
+ // this.locked = false;
+ },
+
+ /**
+ * Initializes the tree
+ * @method init
+ * @parm {string|HTMLElement} id the id of the element that will hold the tree
+ * @private
+ */
+ init: function(id) {
+
+ this.id = id;
+
+ if ("string" !== typeof id) {
+ this._el = id;
+ this.id = this.generateId(id);
+ }
+
+ /**
+ * When animation is enabled, this event fires when the animation
+ * starts
+ * @event animStart
+ * @type CustomEvent
+ * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
+ * @parm {String} type the type of animation ("expand" or "collapse")
+ */
+ this.createEvent("animStart", this);
+
+ /**
+ * When animation is enabled, this event fires when the animation
+ * completes
+ * @event animComplete
+ * @type CustomEvent
+ * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
+ * @parm {String} type the type of animation ("expand" or "collapse")
+ */
+ this.createEvent("animComplete", this);
+
+ /**
+ * Fires when a node is going to be expanded. Return false to stop
+ * the expand.
+ * @event collapse
+ * @type CustomEvent
+ * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
+ */
+ this.createEvent("collapse", this);
+
+ /**
+ * Fires when a node is going to be collapsed. Return false to stop
+ * the collapse.
+ * @event expand
+ * @type CustomEvent
+ * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
+ */
+ this.createEvent("expand", this);
+
+ this._nodes = [];
+
+ // store a global reference
+ YAHOO.widget.TreeView.trees[this.id] = this;
+
+ // Set up the root node
+ this.root = new YAHOO.widget.RootNode(this);
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+
+ this.logger.log("tree init: " + this.id);
+ },
+
+ /**
+ * Renders the tree boilerplate and visible nodes
+ * @method draw
+ */
+ draw: function() {
+ var html = this.root.getHtml();
+ this.getEl().innerHTML = html;
+ this.firstDraw = false;
+ },
+
+ /**
+ * Returns the tree's host element
+ * @method getEl
+ * @return {HTMLElement} the host element
+ */
+ getEl: function() {
+ if (! this._el) {
+ this._el = document.getElementById(this.id);
+ }
+ return this._el;
+ },
+
+ /**
+ * Nodes register themselves with the tree instance when they are created.
+ * @method regNode
+ * @param node {Node} the node to register
+ * @private
+ */
+ regNode: function(node) {
+ this._nodes[node.index] = node;
+ },
+
+ /**
+ * Returns the root node of this tree
+ * @method getRoot
+ * @return {Node} the root node
+ */
+ getRoot: function() {
+ return this.root;
+ },
+
+ /**
+ * Configures this tree to dynamically load all child data
+ * @method setDynamicLoad
+ * @param {function} fnDataLoader the function that will be called to get the data
+ * @param iconMode {int} configures the icon that is displayed when a dynamic
+ * load node is expanded the first time without children. By default, the
+ * "collapse" icon will be used. If set to 1, the leaf node icon will be
+ * displayed.
+ */
+ setDynamicLoad: function(fnDataLoader, iconMode) {
+ this.root.setDynamicLoad(fnDataLoader, iconMode);
+ },
+
+ /**
+ * Expands all child nodes. Note: this conflicts with the "multiExpand"
+ * node property. If expand all is called in a tree with nodes that
+ * do not allow multiple siblings to be displayed, only the last sibling
+ * will be expanded.
+ * @method expandAll
+ */
+ expandAll: function() {
+ if (!this.locked) {
+ this.root.expandAll();
+ }
+ },
+
+ /**
+ * Collapses all expanded child nodes in the entire tree.
+ * @method collapseAll
+ */
+ collapseAll: function() {
+ if (!this.locked) {
+ this.root.collapseAll();
+ }
+ },
+
+ /**
+ * Returns a node in the tree that has the specified index (this index
+ * is created internally, so this function probably will only be used
+ * in html generated for a given node.)
+ * @method getNodeByIndex
+ * @param {int} nodeIndex the index of the node wanted
+ * @return {Node} the node with index=nodeIndex, null if no match
+ */
+ getNodeByIndex: function(nodeIndex) {
+ var n = this._nodes[nodeIndex];
+ return (n) ? n : null;
+ },
+
+ /**
+ * Returns a node that has a matching property and value in the data
+ * object that was passed into its constructor.
+ * @method getNodeByProperty
+ * @param {object} property the property to search (usually a string)
+ * @param {object} value the value we want to find (usuall an int or string)
+ * @return {Node} the matching node, null if no match
+ */
+ getNodeByProperty: function(property, value) {
+ for (var i in this._nodes) {
+ var n = this._nodes[i];
+ if (n.data && value == n.data[property]) {
+ return n;
+ }
+ }
+
+ return null;
+ },
+
+ /**
+ * Returns a collection of nodes that have a matching property
+ * and value in the data object that was passed into its constructor.
+ * @method getNodesByProperty
+ * @param {object} property the property to search (usually a string)
+ * @param {object} value the value we want to find (usuall an int or string)
+ * @return {Array} the matching collection of nodes, null if no match
+ */
+ getNodesByProperty: function(property, value) {
+ var values = [];
+ for (var i in this._nodes) {
+ var n = this._nodes[i];
+ if (n.data && value == n.data[property]) {
+ values.push(n);
+ }
+ }
+
+ return (values.length) ? values : null;
+ },
+
+ /**
+ * Removes the node and its children, and optionally refreshes the
+ * branch of the tree that was affected.
+ * @method removeNode
+ * @param {Node} The node to remove
+ * @param {boolean} autoRefresh automatically refreshes branch if true
+ * @return {boolean} False is there was a problem, true otherwise.
+ */
+ removeNode: function(node, autoRefresh) {
+
+ // Don't delete the root node
+ if (node.isRoot()) {
+ return false;
+ }
+
+ // Get the branch that we may need to refresh
+ var p = node.parent;
+ if (p.parent) {
+ p = p.parent;
+ }
+
+ // Delete the node and its children
+ this._deleteNode(node);
+
+ // Refresh the parent of the parent
+ if (autoRefresh && p && p.childrenRendered) {
+ p.refresh();
+ }
+
+ return true;
+ },
+
+ /**
+ * Deletes this nodes child collection, recursively. Also collapses
+ * the node, and resets the dynamic load flag. The primary use for
+ * this method is to purge a node and allow it to fetch its data
+ * dynamically again.
+ * @method removeChildren
+ * @param {Node} node the node to purge
+ */
+ removeChildren: function(node) {
+ this.logger.log("Removing children for " + node);
+ while (node.children.length) {
+ this._deleteNode(node.children[0]);
+ }
+
+ node.childrenRendered = false;
+ node.dynamicLoadComplete = false;
+ if (node.expanded) {
+ node.collapse();
+ } else {
+ node.updateIcon();
+ }
+ },
+
+ /**
+ * Deletes the node and recurses children
+ * @method _deleteNode
+ * @private
+ */
+ _deleteNode: function(node) {
+ // Remove all the child nodes first
+ this.removeChildren(node);
+
+ // Remove the node from the tree
+ this.popNode(node);
+ },
+
+ /**
+ * Removes the node from the tree, preserving the child collection
+ * to make it possible to insert the branch into another part of the
+ * tree, or another tree.
+ * @method popNode
+ * @param {Node} the node to remove
+ */
+ popNode: function(node) {
+ var p = node.parent;
+
+ // Update the parent's collection of children
+ var a = [];
+
+ for (var i=0, len=p.children.length;i ';
+ }
+
+ var f = document.createElement("div");
+ var s = f.style;
+ s.position = "absolute";
+ s.top = "-1000px";
+ s.left = "-1000px";
+ f.innerHTML = sb.join("");
+
+ document.body.appendChild(f);
+
+ YAHOO.widget.TreeView.removeHandler(window,
+ "load", YAHOO.widget.TreeView.preload);
+
+};
+
+YAHOO.widget.TreeView.addHandler(window,
+ "load", YAHOO.widget.TreeView.preload);
+
+/**
+ * The base class for all tree nodes. The node's presentation and behavior in
+ * response to mouse events is handled in Node subclasses.
+ * @namespace YAHOO.widget
+ * @class Node
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @constructor
+ */
+YAHOO.widget.Node = function(oData, oParent, expanded) {
+ if (oData) { this.init(oData, oParent, expanded); }
+};
+
+YAHOO.widget.Node.prototype = {
+
+ /**
+ * The index for this instance obtained from global counter in YAHOO.widget.TreeView.
+ * @property index
+ * @type int
+ */
+ index: 0,
+
+ /**
+ * This node's child node collection.
+ * @property children
+ * @type Node[]
+ */
+ children: null,
+
+ /**
+ * Tree instance this node is part of
+ * @property tree
+ * @type TreeView
+ */
+ tree: null,
+
+ /**
+ * The data linked to this node. This can be any object or primitive
+ * value, and the data can be used in getNodeHtml().
+ * @property data
+ * @type object
+ */
+ data: null,
+
+ /**
+ * Parent node
+ * @property parent
+ * @type Node
+ */
+ parent: null,
+
+ /**
+ * The depth of this node. We start at -1 for the root node.
+ * @property depth
+ * @type int
+ */
+ depth: -1,
+
+ /**
+ * The href for the node's label. If one is not specified, the href will
+ * be set so that it toggles the node.
+ * @property href
+ * @type string
+ */
+ href: null,
+
+ /**
+ * The label href target, defaults to current window
+ * @property target
+ * @type string
+ */
+ target: "_self",
+
+ /**
+ * The node's expanded/collapsed state
+ * @property expanded
+ * @type boolean
+ */
+ expanded: false,
+
+ /**
+ * Can multiple children be expanded at once?
+ * @property multiExpand
+ * @type boolean
+ */
+ multiExpand: true,
+
+ /**
+ * Should we render children for a collapsed node? It is possible that the
+ * implementer will want to render the hidden data... @todo verify that we
+ * need this, and implement it if we do.
+ * @property renderHidden
+ * @type boolean
+ */
+ renderHidden: false,
+
+ /**
+ * This flag is set to true when the html is generated for this node's
+ * children, and set to false when new children are added.
+ * @property childrenRendered
+ * @type boolean
+ */
+ childrenRendered: false,
+
+ /**
+ * Dynamically loaded nodes only fetch the data the first time they are
+ * expanded. This flag is set to true once the data has been fetched.
+ * @property dynamicLoadComplete
+ * @type boolean
+ */
+ dynamicLoadComplete: false,
+
+ /**
+ * This node's previous sibling
+ * @property previousSibling
+ * @type Node
+ */
+ previousSibling: null,
+
+ /**
+ * This node's next sibling
+ * @property nextSibling
+ * @type Node
+ */
+ nextSibling: null,
+
+ /**
+ * We can set the node up to call an external method to get the child
+ * data dynamically.
+ * @property _dynLoad
+ * @type boolean
+ * @private
+ */
+ _dynLoad: false,
+
+ /**
+ * Function to execute when we need to get this node's child data.
+ * @property dataLoader
+ * @type function
+ */
+ dataLoader: null,
+
+ /**
+ * This is true for dynamically loading nodes while waiting for the
+ * callback to return.
+ * @property isLoading
+ * @type boolean
+ */
+ isLoading: false,
+
+ /**
+ * The toggle/branch icon will not show if this is set to false. This
+ * could be useful if the implementer wants to have the child contain
+ * extra info about the parent, rather than an actual node.
+ * @property hasIcon
+ * @type boolean
+ */
+ hasIcon: true,
+
+ /**
+ * Used to configure what happens when a dynamic load node is expanded
+ * and we discover that it does not have children. By default, it is
+ * treated as if it still could have children (plus/minus icon). Set
+ * iconMode to have it display like a leaf node instead.
+ * @property iconMode
+ * @type int
+ */
+ iconMode: 0,
+
+ /**
+ * The node type
+ * @property _type
+ * @private
+ */
+ _type: "Node",
+
+ /*
+ spacerPath: "http://us.i1.yimg.com/us.yimg.com/i/space.gif",
+ expandedText: "Expanded",
+ collapsedText: "Collapsed",
+ loadingText: "Loading",
+ */
+
+ /**
+ * Initializes this node, gets some of the properties from the parent
+ * @method init
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ */
+ init: function(oData, oParent, expanded) {
+
+ this.data = oData;
+ this.children = [];
+ this.index = YAHOO.widget.TreeView.nodeCount;
+ ++YAHOO.widget.TreeView.nodeCount;
+ this.expanded = expanded;
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+
+ /**
+ * The parentChange event is fired when a parent element is applied
+ * to the node. This is useful if you need to apply tree-level
+ * properties to a tree that need to happen if a node is moved from
+ * one tre to another.
+ *
+ * @event parentChange
+ * @type CustomEvent
+ */
+ this.createEvent("parentChange", this);
+
+ // oParent should never be null except when we create the root node.
+ if (oParent) {
+ oParent.appendChild(this);
+ }
+ },
+
+ /**
+ * Certain properties for the node cannot be set until the parent
+ * is known. This is called after the node is inserted into a tree.
+ * the parent is also applied to this node's children in order to
+ * make it possible to move a branch from one tree to another.
+ * @method applyParent
+ * @param {Node} parentNode this node's parent node
+ * @return {boolean} true if the application was successful
+ */
+ applyParent: function(parentNode) {
+ if (!parentNode) {
+ return false;
+ }
+
+ this.tree = parentNode.tree;
+ this.parent = parentNode;
+ this.depth = parentNode.depth + 1;
+
+ if (!this.href) {
+ this.href = "javascript:" + this.getToggleLink();
+ }
+
+ if (! this.multiExpand) {
+ this.multiExpand = parentNode.multiExpand;
+ }
+
+ this.tree.regNode(this);
+ parentNode.childrenRendered = false;
+
+ // cascade update existing children
+ for (var i=0, len=this.children.length;i 0 ||
+ (checkForLazyLoad && this.isDynamic() && !this.dynamicLoadComplete) );
+ },
+
+ /**
+ * Expands if node is collapsed, collapses otherwise.
+ * @method toggle
+ */
+ toggle: function() {
+ if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) {
+ if (this.expanded) { this.collapse(); } else { this.expand(); }
+ }
+ },
+
+ /**
+ * Returns the markup for this node and its children.
+ * @method getHtml
+ * @return {string} the markup for this node and its expanded children.
+ */
+ getHtml: function() {
+
+ this.childrenRendered = false;
+
+ var sb = [];
+ sb[sb.length] = '';
+ sb[sb.length] = this.getNodeHtml();
+ sb[sb.length] = this.getChildrenHtml();
+ sb[sb.length] = '
';
+ return sb.join("");
+ },
+
+ /**
+ * Called when first rendering the tree. We always build the div that will
+ * contain this nodes children, but we don't render the children themselves
+ * unless this node is expanded.
+ * @method getChildrenHtml
+ * @return {string} the children container div html and any expanded children
+ * @private
+ */
+ getChildrenHtml: function() {
+
+ var sb = [];
+ sb[sb.length] = '';
+
+ // Don't render the actual child node HTML unless this node is expanded.
+ if ( (this.hasChildren(true) && this.expanded) ||
+ (this.renderHidden && !this.isDynamic()) ) {
+ sb[sb.length] = this.renderChildren();
+ }
+
+ sb[sb.length] = '
';
+
+ return sb.join("");
+ },
+
+ /**
+ * Generates the markup for the child nodes. This is not done until the node
+ * is expanded.
+ * @method renderChildren
+ * @return {string} the html for this node's children
+ * @private
+ */
+ renderChildren: function() {
+
+ this.logger.log("rendering children for " + this.index);
+
+ var node = this;
+
+ if (this.isDynamic() && !this.dynamicLoadComplete) {
+ this.isLoading = true;
+ this.tree.locked = true;
+
+ if (this.dataLoader) {
+ this.logger.log("Using dynamic loader defined for this node");
+
+ setTimeout(
+ function() {
+ node.dataLoader(node,
+ function() {
+ node.loadComplete();
+ });
+ }, 10);
+
+ } else if (this.tree.root.dataLoader) {
+ this.logger.log("Using the tree-level dynamic loader");
+
+ setTimeout(
+ function() {
+ node.tree.root.dataLoader(node,
+ function() {
+ node.loadComplete();
+ });
+ }, 10);
+
+ } else {
+ this.logger.log("no loader found");
+ return "Error: data loader not found or not specified.";
+ }
+
+ return "";
+
+ } else {
+ return this.completeRender();
+ }
+ },
+
+ /**
+ * Called when we know we have all the child data.
+ * @method completeRender
+ * @return {string} children html
+ */
+ completeRender: function() {
+ this.logger.log("completeRender: " + this.index + ", # of children: " + this.children.length);
+ var sb = [];
+
+ for (var i=0; i < this.children.length; ++i) {
+ // this.children[i].childrenRendered = false;
+ sb[sb.length] = this.children[i].getHtml();
+ }
+
+ this.childrenRendered = true;
+
+ return sb.join("");
+ },
+
+ /**
+ * Load complete is the callback function we pass to the data provider
+ * in dynamic load situations.
+ * @method loadComplete
+ */
+ loadComplete: function() {
+ this.logger.log("loadComplete: " + this.index);
+ this.getChildrenEl().innerHTML = this.completeRender();
+ this.dynamicLoadComplete = true;
+ this.isLoading = false;
+ this.expand();
+ this.tree.locked = false;
+ },
+
+ /**
+ * Returns this node's ancestor at the specified depth.
+ * @method getAncestor
+ * @param {int} depth the depth of the ancestor.
+ * @return {Node} the ancestor
+ */
+ getAncestor: function(depth) {
+ if (depth >= this.depth || depth < 0) {
+ this.logger.log("illegal getAncestor depth: " + depth);
+ return null;
+ }
+
+ var p = this.parent;
+
+ while (p.depth > depth) {
+ p = p.parent;
+ }
+
+ return p;
+ },
+
+ /**
+ * Returns the css class for the spacer at the specified depth for
+ * this node. If this node's ancestor at the specified depth
+ * has a next sibling the presentation is different than if it
+ * does not have a next sibling
+ * @method getDepthStyle
+ * @param {int} depth the depth of the ancestor.
+ * @return {string} the css class for the spacer
+ */
+ getDepthStyle: function(depth) {
+ return (this.getAncestor(depth).nextSibling) ?
+ "ygtvdepthcell" : "ygtvblankdepthcell";
+ },
+
+ /**
+ * Get the markup for the node. This is designed to be overrided so that we can
+ * support different types of nodes.
+ * @method getNodeHtml
+ * @return {string} The HTML that will render this node.
+ */
+ getNodeHtml: function() {
+ this.logger.log("Generating html");
+ return "";
+ },
+
+ /**
+ * Regenerates the html for this node and its children. To be used when the
+ * node is expanded and new children have been added.
+ * @method refresh
+ */
+ refresh: function() {
+ // this.loadComplete();
+ this.getChildrenEl().innerHTML = this.completeRender();
+
+ if (this.hasIcon) {
+ var el = this.getToggleEl();
+ if (el) {
+ el.className = this.getStyle();
+ }
+ }
+ },
+
+ /**
+ * Node toString
+ * @method toString
+ * @return {string} string representation of the node
+ */
+ toString: function() {
+ return "Node (" + this.index + ")";
+ }
+
+};
+
+YAHOO.augment(YAHOO.widget.Node, YAHOO.util.EventProvider);
+
+/**
+ * A custom YAHOO.widget.Node that handles the unique nature of
+ * the virtual, presentationless root node.
+ * @namespace YAHOO.widget
+ * @class RootNode
+ * @extends YAHOO.widget.Node
+ * @param oTree {YAHOO.widget.TreeView} The tree instance this node belongs to
+ * @constructor
+ */
+YAHOO.widget.RootNode = function(oTree) {
+ // Initialize the node with null params. The root node is a
+ // special case where the node has no presentation. So we have
+ // to alter the standard properties a bit.
+ this.init(null, null, true);
+
+ /*
+ * For the root node, we get the tree reference from as a param
+ * to the constructor instead of from the parent element.
+ */
+ this.tree = oTree;
+};
+
+YAHOO.extend(YAHOO.widget.RootNode, YAHOO.widget.Node, {
+
+ // overrides YAHOO.widget.Node
+ getNodeHtml: function() {
+ return "";
+ },
+
+ toString: function() {
+ return "RootNode";
+ },
+
+ loadComplete: function() {
+ this.tree.draw();
+ }
+
+});
+/**
+ * The default node presentation. The first parameter should be
+ * either a string that will be used as the node's label, or an object
+ * that has a string propery called label. By default, the clicking the
+ * label will toggle the expanded/collapsed state of the node. By
+ * changing the href property of the instance, this behavior can be
+ * changed so that the label will go to the specified href.
+ * @namespace YAHOO.widget
+ * @class TextNode
+ * @extends YAHOO.widget.Node
+ * @constructor
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ */
+YAHOO.widget.TextNode = function(oData, oParent, expanded) {
+
+ if (oData) {
+ this.init(oData, oParent, expanded);
+ this.setUpLabel(oData);
+ }
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+};
+
+YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, {
+
+ /**
+ * The CSS class for the label href. Defaults to ygtvlabel, but can be
+ * overridden to provide a custom presentation for a specific node.
+ * @property labelStyle
+ * @type string
+ */
+ labelStyle: "ygtvlabel",
+
+ /**
+ * The derived element id of the label for this node
+ * @property labelElId
+ * @type string
+ */
+ labelElId: null,
+
+ /**
+ * The text for the label. It is assumed that the oData parameter will
+ * either be a string that will be used as the label, or an object that
+ * has a property called "label" that we will use.
+ * @property label
+ * @type string
+ */
+ label: null,
+
+ textNodeParentChange: function() {
+
+ /**
+ * Custom event that is fired when the text node label is clicked. The
+ * custom event is defined on the tree instance, so there is a single
+ * event that handles all nodes in the tree. The node clicked is
+ * provided as an argument
+ *
+ * @event labelClick
+ * @for YAHOO.widget.TreeView
+ * @param {YAHOO.widget.Node} node the node clicked
+ */
+ if (this.tree && !this.tree.hasEvent("labelClick")) {
+ this.tree.createEvent("labelClick", this.tree);
+ }
+
+ },
+
+ /**
+ * Sets up the node label
+ * @method setUpLabel
+ * @param oData string containing the label, or an object with a label property
+ */
+ setUpLabel: function(oData) {
+
+ // set up the custom event on the tree
+ this.textNodeParentChange();
+ this.subscribe("parentChange", this.textNodeParentChange);
+
+ if (typeof oData == "string") {
+ oData = { label: oData };
+ }
+ this.label = oData.label;
+
+ // update the link
+ if (oData.href) {
+ this.href = oData.href;
+ }
+
+ // set the target
+ if (oData.target) {
+ this.target = oData.target;
+ }
+
+ if (oData.style) {
+ this.labelStyle = oData.style;
+ }
+
+ this.labelElId = "ygtvlabelel" + this.index;
+ },
+
+ /**
+ * Returns the label element
+ * @for YAHOO.widget.TextNode
+ * @method getLabelEl
+ * @return {object} the element
+ */
+ getLabelEl: function() {
+ return document.getElementById(this.labelElId);
+ },
+
+ // overrides YAHOO.widget.Node
+ getNodeHtml: function() {
+ this.logger.log("Generating html");
+ var sb = [];
+
+ sb[sb.length] = '';
+ sb[sb.length] = '';
+
+ for (var i=0;i ';
+ sb[sb.length] = ' ';
+ }
+
+ var getNode = 'YAHOO.widget.TreeView.getNode(\'' +
+ this.tree.id + '\',' + this.index + ')';
+
+ sb[sb.length] = '';
+
+ /*
+ sb[sb.length] = ' ';
+ */
+
+ sb[sb.length] = ' ';
+
+ sb[sb.length] = ' ';
+ sb[sb.length] = '';
+ sb[sb.length] = '';
+ sb[sb.length] = this.label;
+ sb[sb.length] = ' ';
+ sb[sb.length] = ' ';
+ sb[sb.length] = ' ';
+ sb[sb.length] = '
';
+
+ return sb.join("");
+ },
+
+
+ /**
+ * Executed when the label is clicked. Fires the labelClick custom event.
+ * @method onLabelClick
+ * @param me {Node} this node
+ * @scope the anchor tag clicked
+ * @return false to cancel the anchor click
+ */
+ onLabelClick: function(me) {
+ me.logger.log("onLabelClick " + me.label);
+ return me.tree.fireEvent("labelClick", me);
+ //return true;
+ },
+
+ toString: function() {
+ return "TextNode (" + this.index + ") " + this.label;
+ }
+
+});
+/**
+ * A menu-specific implementation that differs from TextNode in that only
+ * one sibling can be expanded at a time.
+ * @namespace YAHOO.widget
+ * @class MenuNode
+ * @extends YAHOO.widget.TextNode
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @constructor
+ */
+YAHOO.widget.MenuNode = function(oData, oParent, expanded) {
+ if (oData) {
+ this.init(oData, oParent, expanded);
+ this.setUpLabel(oData);
+ }
+
+ /*
+ * Menus usually allow only one branch to be open at a time.
+ */
+ this.multiExpand = false;
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+
+};
+
+YAHOO.extend(YAHOO.widget.MenuNode, YAHOO.widget.TextNode, {
+
+ toString: function() {
+ return "MenuNode (" + this.index + ") " + this.label;
+ }
+
+});
+/**
+ * This implementation takes either a string or object for the
+ * oData argument. If is it a string, we will use it for the display
+ * of this node (and it can contain any html code). If the parameter
+ * is an object, we look for a parameter called "html" that will be
+ * used for this node's display.
+ * @namespace YAHOO.widget
+ * @class HTMLNode
+ * @extends YAHOO.widget.Node
+ * @constructor
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @param hasIcon {boolean} specifies whether or not leaf nodes should
+ * have an icon
+ */
+YAHOO.widget.HTMLNode = function(oData, oParent, expanded, hasIcon) {
+ if (oData) {
+ this.init(oData, oParent, expanded);
+ this.initContent(oData, hasIcon);
+ }
+};
+
+YAHOO.extend(YAHOO.widget.HTMLNode, YAHOO.widget.Node, {
+
+ /**
+ * The CSS class for the html content container. Defaults to ygtvhtml, but
+ * can be overridden to provide a custom presentation for a specific node.
+ * @property contentStyle
+ * @type string
+ */
+ contentStyle: "ygtvhtml",
+
+ /**
+ * The generated id that will contain the data passed in by the implementer.
+ * @property contentElId
+ * @type string
+ */
+ contentElId: null,
+
+ /**
+ * The HTML content to use for this node's display
+ * @property content
+ * @type string
+ */
+ content: null,
+
+ /**
+ * Sets up the node label
+ * @property initContent
+ * @param {object} An html string or object containing an html property
+ * @param {boolean} hasIcon determines if the node will be rendered with an
+ * icon or not
+ */
+ initContent: function(oData, hasIcon) {
+ if (typeof oData == "string") {
+ oData = { html: oData };
+ }
+
+ this.html = oData.html;
+ this.contentElId = "ygtvcontentel" + this.index;
+ this.hasIcon = hasIcon;
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+ },
+
+ /**
+ * Returns the outer html element for this node's content
+ * @method getContentEl
+ * @return {HTMLElement} the element
+ */
+ getContentEl: function() {
+ return document.getElementById(this.contentElId);
+ },
+
+ // overrides YAHOO.widget.Node
+ getNodeHtml: function() {
+ this.logger.log("Generating html");
+ var sb = [];
+
+ sb[sb.length] = '';
+ sb[sb.length] = '';
+
+ for (var i=0;i ';
+ }
+
+ if (this.hasIcon) {
+ sb[sb.length] = ' ';
+ }
+
+ sb[sb.length] = '';
+ sb[sb.length] = this.html;
+ sb[sb.length] = ' ';
+ sb[sb.length] = ' ';
+ sb[sb.length] = '
';
+
+ return sb.join("");
+ },
+
+ toString: function() {
+ return "HTMLNode (" + this.index + ")";
+ }
+
+});
+/**
+ * A static factory class for tree view expand/collapse animations
+ * @class TVAnim
+ * @static
+ */
+YAHOO.widget.TVAnim = function() {
+ return {
+ /**
+ * Constant for the fade in animation
+ * @property FADE_IN
+ * @type string
+ * @static
+ */
+ FADE_IN: "TVFadeIn",
+
+ /**
+ * Constant for the fade out animation
+ * @property FADE_OUT
+ * @type string
+ * @static
+ */
+ FADE_OUT: "TVFadeOut",
+
+ /**
+ * Returns a ygAnim instance of the given type
+ * @method getAnim
+ * @param type {string} the type of animation
+ * @param el {HTMLElement} the element to element (probably the children div)
+ * @param callback {function} function to invoke when the animation is done.
+ * @return {YAHOO.util.Animation} the animation instance
+ * @static
+ */
+ getAnim: function(type, el, callback) {
+ if (YAHOO.widget[type]) {
+ return new YAHOO.widget[type](el, callback);
+ } else {
+ return null;
+ }
+ },
+
+ /**
+ * Returns true if the specified animation class is available
+ * @method isValid
+ * @param type {string} the type of animation
+ * @return {boolean} true if valid, false if not
+ * @static
+ */
+ isValid: function(type) {
+ return (YAHOO.widget[type]);
+ }
+ };
+} ();
+
+/**
+ * A 1/2 second fade-in animation.
+ * @class TVFadeIn
+ * @constructor
+ * @param el {HTMLElement} the element to animate
+ * @param callback {function} function to invoke when the animation is finished
+ */
+YAHOO.widget.TVFadeIn = function(el, callback) {
+ /**
+ * The element to animate
+ * @property el
+ * @type HTMLElement
+ */
+ this.el = el;
+
+ /**
+ * the callback to invoke when the animation is complete
+ * @property callback
+ * @type function
+ */
+ this.callback = callback;
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+};
+
+YAHOO.widget.TVFadeIn.prototype = {
+ /**
+ * Performs the animation
+ * @method animate
+ */
+ animate: function() {
+ var tvanim = this;
+
+ var s = this.el.style;
+ s.opacity = 0.1;
+ s.filter = "alpha(opacity=10)";
+ s.display = "";
+
+ var dur = 0.4;
+ var a = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit:""}}, dur);
+ a.onComplete.subscribe( function() { tvanim.onComplete(); } );
+ a.animate();
+ },
+
+ /**
+ * Clean up and invoke callback
+ * @method onComplete
+ */
+ onComplete: function() {
+ this.callback();
+ },
+
+ /**
+ * toString
+ * @method toString
+ * @return {string} the string representation of the instance
+ */
+ toString: function() {
+ return "TVFadeIn";
+ }
+};
+
+/**
+ * A 1/2 second fade out animation.
+ * @class TVFadeOut
+ * @constructor
+ * @param el {HTMLElement} the element to animate
+ * @param callback {Function} function to invoke when the animation is finished
+ */
+YAHOO.widget.TVFadeOut = function(el, callback) {
+ /**
+ * The element to animate
+ * @property el
+ * @type HTMLElement
+ */
+ this.el = el;
+
+ /**
+ * the callback to invoke when the animation is complete
+ * @property callback
+ * @type function
+ */
+ this.callback = callback;
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+};
+
+YAHOO.widget.TVFadeOut.prototype = {
+ /**
+ * Performs the animation
+ * @method animate
+ */
+ animate: function() {
+ var tvanim = this;
+ var dur = 0.4;
+ var a = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit:""}}, dur);
+ a.onComplete.subscribe( function() { tvanim.onComplete(); } );
+ a.animate();
+ },
+
+ /**
+ * Clean up and invoke callback
+ * @method onComplete
+ */
+ onComplete: function() {
+ var s = this.el.style;
+ s.display = "none";
+ // s.opacity = 1;
+ s.filter = "alpha(opacity=100)";
+ this.callback();
+ },
+
+ /**
+ * toString
+ * @method toString
+ * @return {string} the string representation of the instance
+ */
+ toString: function() {
+ return "TVFadeOut";
+ }
+};
+
diff --git a/thirdpartyjs/yui/treeview/treeview.js b/thirdpartyjs/yui/treeview/treeview.js
index ea6b6ef..850188c 100644
--- a/thirdpartyjs/yui/treeview/treeview.js
+++ b/thirdpartyjs/yui/treeview/treeview.js
@@ -1,2182 +1,2182 @@
-/*
-Copyright (c) 2006, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 0.12.0
-*/
-
-/**
- * The treeview widget is a generic tree building tool.
- * @module treeview
- * @title TreeView Widget
- * @requires yahoo
- * @optional animation
- * @namespace YAHOO.widget
- */
-
-/**
- * Contains the tree view state data and the root node.
- *
- * @class TreeView
- * @constructor
- * @param {string|HTMLElement} id The id of the element, or the element
- * itself that the tree will be inserted into.
- */
-YAHOO.widget.TreeView = function(id) {
- if (id) { this.init(id); }
-};
-
-YAHOO.widget.TreeView.prototype = {
-
- /**
- * The id of tree container element
- * @property id
- * @type String
- */
- id: null,
-
- /**
- * The host element for this tree
- * @property _el
- * @private
- */
- _el: null,
-
- /**
- * Flat collection of all nodes in this tree
- * @property _nodes
- * @type Node[]
- * @private
- */
- _nodes: null,
-
- /**
- * We lock the tree control while waiting for the dynamic loader to return
- * @property locked
- * @type boolean
- */
- locked: false,
-
- /**
- * The animation to use for expanding children, if any
- * @property _expandAnim
- * @type string
- * @private
- */
- _expandAnim: null,
-
- /**
- * The animation to use for collapsing children, if any
- * @property _collapseAnim
- * @type string
- * @private
- */
- _collapseAnim: null,
-
- /**
- * The current number of animations that are executing
- * @property _animCount
- * @type int
- * @private
- */
- _animCount: 0,
-
- /**
- * The maximum number of animations to run at one time.
- * @property maxAnim
- * @type int
- */
- maxAnim: 2,
-
- /**
- * Sets up the animation for expanding children
- * @method setExpandAnim
- * @param {string} type the type of animation (acceptable values defined
- * in YAHOO.widget.TVAnim)
- */
- setExpandAnim: function(type) {
- if (YAHOO.widget.TVAnim.isValid(type)) {
- this._expandAnim = type;
- }
- },
-
- /**
- * Sets up the animation for collapsing children
- * @method setCollapseAnim
- * @param {string} the type of animation (acceptable values defined in
- * YAHOO.widget.TVAnim)
- */
- setCollapseAnim: function(type) {
- if (YAHOO.widget.TVAnim.isValid(type)) {
- this._collapseAnim = type;
- }
- },
-
- /**
- * Perform the expand animation if configured, or just show the
- * element if not configured or too many animations are in progress
- * @method animateExpand
- * @param el {HTMLElement} the element to animate
- * @param node {YAHOO.util.Node} the node that was expanded
- * @return {boolean} true if animation could be invoked, false otherwise
- */
- animateExpand: function(el, node) {
-
- if (this._expandAnim && this._animCount < this.maxAnim) {
- // this.locked = true;
- var tree = this;
- var a = YAHOO.widget.TVAnim.getAnim(this._expandAnim, el,
- function() { tree.expandComplete(node); });
- if (a) {
- ++this._animCount;
- this.fireEvent("animStart", {
- "node": node,
- "type": "expand"
- });
- a.animate();
- }
-
- return true;
- }
-
- return false;
- },
-
- /**
- * Perform the collapse animation if configured, or just show the
- * element if not configured or too many animations are in progress
- * @method animateCollapse
- * @param el {HTMLElement} the element to animate
- * @param node {YAHOO.util.Node} the node that was expanded
- * @return {boolean} true if animation could be invoked, false otherwise
- */
- animateCollapse: function(el, node) {
-
- if (this._collapseAnim && this._animCount < this.maxAnim) {
- // this.locked = true;
- var tree = this;
- var a = YAHOO.widget.TVAnim.getAnim(this._collapseAnim, el,
- function() { tree.collapseComplete(node); });
- if (a) {
- ++this._animCount;
- this.fireEvent("animStart", {
- "node": node,
- "type": "collapse"
- });
- a.animate();
- }
-
- return true;
- }
-
- return false;
- },
-
- /**
- * Function executed when the expand animation completes
- * @method expandComplete
- */
- expandComplete: function(node) {
- --this._animCount;
- this.fireEvent("animComplete", {
- "node": node,
- "type": "expand"
- });
- // this.locked = false;
- },
-
- /**
- * Function executed when the collapse animation completes
- * @method collapseComplete
- */
- collapseComplete: function(node) {
- --this._animCount;
- this.fireEvent("animComplete", {
- "node": node,
- "type": "collapse"
- });
- // this.locked = false;
- },
-
- /**
- * Initializes the tree
- * @method init
- * @parm {string|HTMLElement} id the id of the element that will hold the tree
- * @private
- */
- init: function(id) {
-
- this.id = id;
-
- if ("string" !== typeof id) {
- this._el = id;
- this.id = this.generateId(id);
- }
-
- /**
- * When animation is enabled, this event fires when the animation
- * starts
- * @event animStart
- * @type CustomEvent
- * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
- * @parm {String} type the type of animation ("expand" or "collapse")
- */
- this.createEvent("animStart", this);
-
- /**
- * When animation is enabled, this event fires when the animation
- * completes
- * @event animComplete
- * @type CustomEvent
- * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
- * @parm {String} type the type of animation ("expand" or "collapse")
- */
- this.createEvent("animComplete", this);
-
- /**
- * Fires when a node is going to be expanded. Return false to stop
- * the expand.
- * @event collapse
- * @type CustomEvent
- * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
- */
- this.createEvent("collapse", this);
-
- /**
- * Fires when a node is going to be collapsed. Return false to stop
- * the collapse.
- * @event expand
- * @type CustomEvent
- * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
- */
- this.createEvent("expand", this);
-
- this._nodes = [];
-
- // store a global reference
- YAHOO.widget.TreeView.trees[this.id] = this;
-
- // Set up the root node
- this.root = new YAHOO.widget.RootNode(this);
-
-
- },
-
- /**
- * Renders the tree boilerplate and visible nodes
- * @method draw
- */
- draw: function() {
- var html = this.root.getHtml();
- this.getEl().innerHTML = html;
- this.firstDraw = false;
- },
-
- /**
- * Returns the tree's host element
- * @method getEl
- * @return {HTMLElement} the host element
- */
- getEl: function() {
- if (! this._el) {
- this._el = document.getElementById(this.id);
- }
- return this._el;
- },
-
- /**
- * Nodes register themselves with the tree instance when they are created.
- * @method regNode
- * @param node {Node} the node to register
- * @private
- */
- regNode: function(node) {
- this._nodes[node.index] = node;
- },
-
- /**
- * Returns the root node of this tree
- * @method getRoot
- * @return {Node} the root node
- */
- getRoot: function() {
- return this.root;
- },
-
- /**
- * Configures this tree to dynamically load all child data
- * @method setDynamicLoad
- * @param {function} fnDataLoader the function that will be called to get the data
- * @param iconMode {int} configures the icon that is displayed when a dynamic
- * load node is expanded the first time without children. By default, the
- * "collapse" icon will be used. If set to 1, the leaf node icon will be
- * displayed.
- */
- setDynamicLoad: function(fnDataLoader, iconMode) {
- this.root.setDynamicLoad(fnDataLoader, iconMode);
- },
-
- /**
- * Expands all child nodes. Note: this conflicts with the "multiExpand"
- * node property. If expand all is called in a tree with nodes that
- * do not allow multiple siblings to be displayed, only the last sibling
- * will be expanded.
- * @method expandAll
- */
- expandAll: function() {
- if (!this.locked) {
- this.root.expandAll();
- }
- },
-
- /**
- * Collapses all expanded child nodes in the entire tree.
- * @method collapseAll
- */
- collapseAll: function() {
- if (!this.locked) {
- this.root.collapseAll();
- }
- },
-
- /**
- * Returns a node in the tree that has the specified index (this index
- * is created internally, so this function probably will only be used
- * in html generated for a given node.)
- * @method getNodeByIndex
- * @param {int} nodeIndex the index of the node wanted
- * @return {Node} the node with index=nodeIndex, null if no match
- */
- getNodeByIndex: function(nodeIndex) {
- var n = this._nodes[nodeIndex];
- return (n) ? n : null;
- },
-
- /**
- * Returns a node that has a matching property and value in the data
- * object that was passed into its constructor.
- * @method getNodeByProperty
- * @param {object} property the property to search (usually a string)
- * @param {object} value the value we want to find (usuall an int or string)
- * @return {Node} the matching node, null if no match
- */
- getNodeByProperty: function(property, value) {
- for (var i in this._nodes) {
- var n = this._nodes[i];
- if (n.data && value == n.data[property]) {
- return n;
- }
- }
-
- return null;
- },
-
- /**
- * Returns a collection of nodes that have a matching property
- * and value in the data object that was passed into its constructor.
- * @method getNodesByProperty
- * @param {object} property the property to search (usually a string)
- * @param {object} value the value we want to find (usuall an int or string)
- * @return {Array} the matching collection of nodes, null if no match
- */
- getNodesByProperty: function(property, value) {
- var values = [];
- for (var i in this._nodes) {
- var n = this._nodes[i];
- if (n.data && value == n.data[property]) {
- values.push(n);
- }
- }
-
- return (values.length) ? values : null;
- },
-
- /**
- * Removes the node and its children, and optionally refreshes the
- * branch of the tree that was affected.
- * @method removeNode
- * @param {Node} The node to remove
- * @param {boolean} autoRefresh automatically refreshes branch if true
- * @return {boolean} False is there was a problem, true otherwise.
- */
- removeNode: function(node, autoRefresh) {
-
- // Don't delete the root node
- if (node.isRoot()) {
- return false;
- }
-
- // Get the branch that we may need to refresh
- var p = node.parent;
- if (p.parent) {
- p = p.parent;
- }
-
- // Delete the node and its children
- this._deleteNode(node);
-
- // Refresh the parent of the parent
- if (autoRefresh && p && p.childrenRendered) {
- p.refresh();
- }
-
- return true;
- },
-
- /**
- * Deletes this nodes child collection, recursively. Also collapses
- * the node, and resets the dynamic load flag. The primary use for
- * this method is to purge a node and allow it to fetch its data
- * dynamically again.
- * @method removeChildren
- * @param {Node} node the node to purge
- */
- removeChildren: function(node) {
- while (node.children.length) {
- this._deleteNode(node.children[0]);
- }
-
- node.childrenRendered = false;
- node.dynamicLoadComplete = false;
- if (node.expanded) {
- node.collapse();
- } else {
- node.updateIcon();
- }
- },
-
- /**
- * Deletes the node and recurses children
- * @method _deleteNode
- * @private
- */
- _deleteNode: function(node) {
- // Remove all the child nodes first
- this.removeChildren(node);
-
- // Remove the node from the tree
- this.popNode(node);
- },
-
- /**
- * Removes the node from the tree, preserving the child collection
- * to make it possible to insert the branch into another part of the
- * tree, or another tree.
- * @method popNode
- * @param {Node} the node to remove
- */
- popNode: function(node) {
- var p = node.parent;
-
- // Update the parent's collection of children
- var a = [];
-
- for (var i=0, len=p.children.length;i ';
- }
-
- var f = document.createElement("div");
- var s = f.style;
- s.position = "absolute";
- s.top = "-1000px";
- s.left = "-1000px";
- f.innerHTML = sb.join("");
-
- document.body.appendChild(f);
-
- YAHOO.widget.TreeView.removeHandler(window,
- "load", YAHOO.widget.TreeView.preload);
-
-};
-
-YAHOO.widget.TreeView.addHandler(window,
- "load", YAHOO.widget.TreeView.preload);
-
-/**
- * The base class for all tree nodes. The node's presentation and behavior in
- * response to mouse events is handled in Node subclasses.
- * @namespace YAHOO.widget
- * @class Node
- * @param oData {object} a string or object containing the data that will
- * be used to render this node
- * @param oParent {Node} this node's parent node
- * @param expanded {boolean} the initial expanded/collapsed state
- * @constructor
- */
-YAHOO.widget.Node = function(oData, oParent, expanded) {
- if (oData) { this.init(oData, oParent, expanded); }
-};
-
-YAHOO.widget.Node.prototype = {
-
- /**
- * The index for this instance obtained from global counter in YAHOO.widget.TreeView.
- * @property index
- * @type int
- */
- index: 0,
-
- /**
- * This node's child node collection.
- * @property children
- * @type Node[]
- */
- children: null,
-
- /**
- * Tree instance this node is part of
- * @property tree
- * @type TreeView
- */
- tree: null,
-
- /**
- * The data linked to this node. This can be any object or primitive
- * value, and the data can be used in getNodeHtml().
- * @property data
- * @type object
- */
- data: null,
-
- /**
- * Parent node
- * @property parent
- * @type Node
- */
- parent: null,
-
- /**
- * The depth of this node. We start at -1 for the root node.
- * @property depth
- * @type int
- */
- depth: -1,
-
- /**
- * The href for the node's label. If one is not specified, the href will
- * be set so that it toggles the node.
- * @property href
- * @type string
- */
- href: null,
-
- /**
- * The label href target, defaults to current window
- * @property target
- * @type string
- */
- target: "_self",
-
- /**
- * The node's expanded/collapsed state
- * @property expanded
- * @type boolean
- */
- expanded: false,
-
- /**
- * Can multiple children be expanded at once?
- * @property multiExpand
- * @type boolean
- */
- multiExpand: true,
-
- /**
- * Should we render children for a collapsed node? It is possible that the
- * implementer will want to render the hidden data... @todo verify that we
- * need this, and implement it if we do.
- * @property renderHidden
- * @type boolean
- */
- renderHidden: false,
-
- /**
- * This flag is set to true when the html is generated for this node's
- * children, and set to false when new children are added.
- * @property childrenRendered
- * @type boolean
- */
- childrenRendered: false,
-
- /**
- * Dynamically loaded nodes only fetch the data the first time they are
- * expanded. This flag is set to true once the data has been fetched.
- * @property dynamicLoadComplete
- * @type boolean
- */
- dynamicLoadComplete: false,
-
- /**
- * This node's previous sibling
- * @property previousSibling
- * @type Node
- */
- previousSibling: null,
-
- /**
- * This node's next sibling
- * @property nextSibling
- * @type Node
- */
- nextSibling: null,
-
- /**
- * We can set the node up to call an external method to get the child
- * data dynamically.
- * @property _dynLoad
- * @type boolean
- * @private
- */
- _dynLoad: false,
-
- /**
- * Function to execute when we need to get this node's child data.
- * @property dataLoader
- * @type function
- */
- dataLoader: null,
-
- /**
- * This is true for dynamically loading nodes while waiting for the
- * callback to return.
- * @property isLoading
- * @type boolean
- */
- isLoading: false,
-
- /**
- * The toggle/branch icon will not show if this is set to false. This
- * could be useful if the implementer wants to have the child contain
- * extra info about the parent, rather than an actual node.
- * @property hasIcon
- * @type boolean
- */
- hasIcon: true,
-
- /**
- * Used to configure what happens when a dynamic load node is expanded
- * and we discover that it does not have children. By default, it is
- * treated as if it still could have children (plus/minus icon). Set
- * iconMode to have it display like a leaf node instead.
- * @property iconMode
- * @type int
- */
- iconMode: 0,
-
- /**
- * The node type
- * @property _type
- * @private
- */
- _type: "Node",
-
- /*
- spacerPath: "http://us.i1.yimg.com/us.yimg.com/i/space.gif",
- expandedText: "Expanded",
- collapsedText: "Collapsed",
- loadingText: "Loading",
- */
-
- /**
- * Initializes this node, gets some of the properties from the parent
- * @method init
- * @param oData {object} a string or object containing the data that will
- * be used to render this node
- * @param oParent {Node} this node's parent node
- * @param expanded {boolean} the initial expanded/collapsed state
- */
- init: function(oData, oParent, expanded) {
-
- this.data = oData;
- this.children = [];
- this.index = YAHOO.widget.TreeView.nodeCount;
- ++YAHOO.widget.TreeView.nodeCount;
- this.expanded = expanded;
-
- /**
- * The parentChange event is fired when a parent element is applied
- * to the node. This is useful if you need to apply tree-level
- * properties to a tree that need to happen if a node is moved from
- * one tre to another.
- *
- * @event parentChange
- * @type CustomEvent
- */
- this.createEvent("parentChange", this);
-
- // oParent should never be null except when we create the root node.
- if (oParent) {
- oParent.appendChild(this);
- }
- },
-
- /**
- * Certain properties for the node cannot be set until the parent
- * is known. This is called after the node is inserted into a tree.
- * the parent is also applied to this node's children in order to
- * make it possible to move a branch from one tree to another.
- * @method applyParent
- * @param {Node} parentNode this node's parent node
- * @return {boolean} true if the application was successful
- */
- applyParent: function(parentNode) {
- if (!parentNode) {
- return false;
- }
-
- this.tree = parentNode.tree;
- this.parent = parentNode;
- this.depth = parentNode.depth + 1;
-
- if (!this.href) {
- this.href = "javascript:" + this.getToggleLink();
- }
-
- if (! this.multiExpand) {
- this.multiExpand = parentNode.multiExpand;
- }
-
- this.tree.regNode(this);
- parentNode.childrenRendered = false;
-
- // cascade update existing children
- for (var i=0, len=this.children.length;i 0 ||
- (checkForLazyLoad && this.isDynamic() && !this.dynamicLoadComplete) );
- },
-
- /**
- * Expands if node is collapsed, collapses otherwise.
- * @method toggle
- */
- toggle: function() {
- if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) {
- if (this.expanded) { this.collapse(); } else { this.expand(); }
- }
- },
-
- /**
- * Returns the markup for this node and its children.
- * @method getHtml
- * @return {string} the markup for this node and its expanded children.
- */
- getHtml: function() {
-
- this.childrenRendered = false;
-
- var sb = [];
- sb[sb.length] = '';
- sb[sb.length] = this.getNodeHtml();
- sb[sb.length] = this.getChildrenHtml();
- sb[sb.length] = '
';
- return sb.join("");
- },
-
- /**
- * Called when first rendering the tree. We always build the div that will
- * contain this nodes children, but we don't render the children themselves
- * unless this node is expanded.
- * @method getChildrenHtml
- * @return {string} the children container div html and any expanded children
- * @private
- */
- getChildrenHtml: function() {
-
- var sb = [];
- sb[sb.length] = '';
-
- // Don't render the actual child node HTML unless this node is expanded.
- if ( (this.hasChildren(true) && this.expanded) ||
- (this.renderHidden && !this.isDynamic()) ) {
- sb[sb.length] = this.renderChildren();
- }
-
- sb[sb.length] = '
';
-
- return sb.join("");
- },
-
- /**
- * Generates the markup for the child nodes. This is not done until the node
- * is expanded.
- * @method renderChildren
- * @return {string} the html for this node's children
- * @private
- */
- renderChildren: function() {
-
-
- var node = this;
-
- if (this.isDynamic() && !this.dynamicLoadComplete) {
- this.isLoading = true;
- this.tree.locked = true;
-
- if (this.dataLoader) {
-
- setTimeout(
- function() {
- node.dataLoader(node,
- function() {
- node.loadComplete();
- });
- }, 10);
-
- } else if (this.tree.root.dataLoader) {
-
- setTimeout(
- function() {
- node.tree.root.dataLoader(node,
- function() {
- node.loadComplete();
- });
- }, 10);
-
- } else {
- return "Error: data loader not found or not specified.";
- }
-
- return "";
-
- } else {
- return this.completeRender();
- }
- },
-
- /**
- * Called when we know we have all the child data.
- * @method completeRender
- * @return {string} children html
- */
- completeRender: function() {
- var sb = [];
-
- for (var i=0; i < this.children.length; ++i) {
- // this.children[i].childrenRendered = false;
- sb[sb.length] = this.children[i].getHtml();
- }
-
- this.childrenRendered = true;
-
- return sb.join("");
- },
-
- /**
- * Load complete is the callback function we pass to the data provider
- * in dynamic load situations.
- * @method loadComplete
- */
- loadComplete: function() {
- this.getChildrenEl().innerHTML = this.completeRender();
- this.dynamicLoadComplete = true;
- this.isLoading = false;
- this.expand();
- this.tree.locked = false;
- },
-
- /**
- * Returns this node's ancestor at the specified depth.
- * @method getAncestor
- * @param {int} depth the depth of the ancestor.
- * @return {Node} the ancestor
- */
- getAncestor: function(depth) {
- if (depth >= this.depth || depth < 0) {
- return null;
- }
-
- var p = this.parent;
-
- while (p.depth > depth) {
- p = p.parent;
- }
-
- return p;
- },
-
- /**
- * Returns the css class for the spacer at the specified depth for
- * this node. If this node's ancestor at the specified depth
- * has a next sibling the presentation is different than if it
- * does not have a next sibling
- * @method getDepthStyle
- * @param {int} depth the depth of the ancestor.
- * @return {string} the css class for the spacer
- */
- getDepthStyle: function(depth) {
- return (this.getAncestor(depth).nextSibling) ?
- "ygtvdepthcell" : "ygtvblankdepthcell";
- },
-
- /**
- * Get the markup for the node. This is designed to be overrided so that we can
- * support different types of nodes.
- * @method getNodeHtml
- * @return {string} The HTML that will render this node.
- */
- getNodeHtml: function() {
- return "";
- },
-
- /**
- * Regenerates the html for this node and its children. To be used when the
- * node is expanded and new children have been added.
- * @method refresh
- */
- refresh: function() {
- // this.loadComplete();
- this.getChildrenEl().innerHTML = this.completeRender();
-
- if (this.hasIcon) {
- var el = this.getToggleEl();
- if (el) {
- el.className = this.getStyle();
- }
- }
- },
-
- /**
- * Node toString
- * @method toString
- * @return {string} string representation of the node
- */
- toString: function() {
- return "Node (" + this.index + ")";
- }
-
-};
-
-YAHOO.augment(YAHOO.widget.Node, YAHOO.util.EventProvider);
-
-/**
- * A custom YAHOO.widget.Node that handles the unique nature of
- * the virtual, presentationless root node.
- * @namespace YAHOO.widget
- * @class RootNode
- * @extends YAHOO.widget.Node
- * @param oTree {YAHOO.widget.TreeView} The tree instance this node belongs to
- * @constructor
- */
-YAHOO.widget.RootNode = function(oTree) {
- // Initialize the node with null params. The root node is a
- // special case where the node has no presentation. So we have
- // to alter the standard properties a bit.
- this.init(null, null, true);
-
- /*
- * For the root node, we get the tree reference from as a param
- * to the constructor instead of from the parent element.
- */
- this.tree = oTree;
-};
-
-YAHOO.extend(YAHOO.widget.RootNode, YAHOO.widget.Node, {
-
- // overrides YAHOO.widget.Node
- getNodeHtml: function() {
- return "";
- },
-
- toString: function() {
- return "RootNode";
- },
-
- loadComplete: function() {
- this.tree.draw();
- }
-
-});
-/**
- * The default node presentation. The first parameter should be
- * either a string that will be used as the node's label, or an object
- * that has a string propery called label. By default, the clicking the
- * label will toggle the expanded/collapsed state of the node. By
- * changing the href property of the instance, this behavior can be
- * changed so that the label will go to the specified href.
- * @namespace YAHOO.widget
- * @class TextNode
- * @extends YAHOO.widget.Node
- * @constructor
- * @param oData {object} a string or object containing the data that will
- * be used to render this node
- * @param oParent {YAHOO.widget.Node} this node's parent node
- * @param expanded {boolean} the initial expanded/collapsed state
- */
-YAHOO.widget.TextNode = function(oData, oParent, expanded) {
-
- if (oData) {
- this.init(oData, oParent, expanded);
- this.setUpLabel(oData);
- }
-
-};
-
-YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, {
-
- /**
- * The CSS class for the label href. Defaults to ygtvlabel, but can be
- * overridden to provide a custom presentation for a specific node.
- * @property labelStyle
- * @type string
- */
- labelStyle: "ygtvlabel",
-
- /**
- * The derived element id of the label for this node
- * @property labelElId
- * @type string
- */
- labelElId: null,
-
- /**
- * The text for the label. It is assumed that the oData parameter will
- * either be a string that will be used as the label, or an object that
- * has a property called "label" that we will use.
- * @property label
- * @type string
- */
- label: null,
-
- textNodeParentChange: function() {
-
- /**
- * Custom event that is fired when the text node label is clicked. The
- * custom event is defined on the tree instance, so there is a single
- * event that handles all nodes in the tree. The node clicked is
- * provided as an argument
- *
- * @event labelClick
- * @for YAHOO.widget.TreeView
- * @param {YAHOO.widget.Node} node the node clicked
- */
- if (this.tree && !this.tree.hasEvent("labelClick")) {
- this.tree.createEvent("labelClick", this.tree);
- }
-
- },
-
- /**
- * Sets up the node label
- * @method setUpLabel
- * @param oData string containing the label, or an object with a label property
- */
- setUpLabel: function(oData) {
-
- // set up the custom event on the tree
- this.textNodeParentChange();
- this.subscribe("parentChange", this.textNodeParentChange);
-
- if (typeof oData == "string") {
- oData = { label: oData };
- }
- this.label = oData.label;
-
- // update the link
- if (oData.href) {
- this.href = oData.href;
- }
-
- // set the target
- if (oData.target) {
- this.target = oData.target;
- }
-
- if (oData.style) {
- this.labelStyle = oData.style;
- }
-
- this.labelElId = "ygtvlabelel" + this.index;
- },
-
- /**
- * Returns the label element
- * @for YAHOO.widget.TextNode
- * @method getLabelEl
- * @return {object} the element
- */
- getLabelEl: function() {
- return document.getElementById(this.labelElId);
- },
-
- // overrides YAHOO.widget.Node
- getNodeHtml: function() {
- var sb = [];
-
- sb[sb.length] = '';
- sb[sb.length] = '';
-
- for (var i=0;i ';
- sb[sb.length] = ' ';
- }
-
- var getNode = 'YAHOO.widget.TreeView.getNode(\'' +
- this.tree.id + '\',' + this.index + ')';
-
- sb[sb.length] = '';
-
- /*
- sb[sb.length] = ' ';
- */
-
- sb[sb.length] = ' ';
-
- sb[sb.length] = ' ';
- sb[sb.length] = '';
- sb[sb.length] = '';
- sb[sb.length] = this.label;
- sb[sb.length] = ' ';
- sb[sb.length] = ' ';
- sb[sb.length] = ' ';
- sb[sb.length] = '
';
-
- return sb.join("");
- },
-
- /**
- * Executed when the label is clicked. Fires the labelClick custom event.
- * @method onLabelClick
- * @param me {Node} this node
- * @scope the anchor tag clicked
- * @return false to cancel the anchor click
- */
- onLabelClick: function(me) {
- return me.tree.fireEvent("labelClick", me);
- //return true;
- },
-
- toString: function() {
- return "TextNode (" + this.index + ") " + this.label;
- }
-
-});
-/**
- * A menu-specific implementation that differs from TextNode in that only
- * one sibling can be expanded at a time.
- * @namespace YAHOO.widget
- * @class MenuNode
- * @extends YAHOO.widget.TextNode
- * @param oData {object} a string or object containing the data that will
- * be used to render this node
- * @param oParent {YAHOO.widget.Node} this node's parent node
- * @param expanded {boolean} the initial expanded/collapsed state
- * @constructor
- */
-YAHOO.widget.MenuNode = function(oData, oParent, expanded) {
- if (oData) {
- this.init(oData, oParent, expanded);
- this.setUpLabel(oData);
- }
-
- /*
- * Menus usually allow only one branch to be open at a time.
- */
- this.multiExpand = false;
-
-
-};
-
-YAHOO.extend(YAHOO.widget.MenuNode, YAHOO.widget.TextNode, {
-
- toString: function() {
- return "MenuNode (" + this.index + ") " + this.label;
- }
-
-});
-/**
- * This implementation takes either a string or object for the
- * oData argument. If is it a string, we will use it for the display
- * of this node (and it can contain any html code). If the parameter
- * is an object, we look for a parameter called "html" that will be
- * used for this node's display.
- * @namespace YAHOO.widget
- * @class HTMLNode
- * @extends YAHOO.widget.Node
- * @constructor
- * @param oData {object} a string or object containing the data that will
- * be used to render this node
- * @param oParent {YAHOO.widget.Node} this node's parent node
- * @param expanded {boolean} the initial expanded/collapsed state
- * @param hasIcon {boolean} specifies whether or not leaf nodes should
- * have an icon
- */
-YAHOO.widget.HTMLNode = function(oData, oParent, expanded, hasIcon) {
- if (oData) {
- this.init(oData, oParent, expanded);
- this.initContent(oData, hasIcon);
- }
-};
-
-YAHOO.extend(YAHOO.widget.HTMLNode, YAHOO.widget.Node, {
-
- /**
- * The CSS class for the html content container. Defaults to ygtvhtml, but
- * can be overridden to provide a custom presentation for a specific node.
- * @property contentStyle
- * @type string
- */
- contentStyle: "ygtvhtml",
-
- /**
- * The generated id that will contain the data passed in by the implementer.
- * @property contentElId
- * @type string
- */
- contentElId: null,
-
- /**
- * The HTML content to use for this node's display
- * @property content
- * @type string
- */
- content: null,
-
- /**
- * Sets up the node label
- * @property initContent
- * @param {object} An html string or object containing an html property
- * @param {boolean} hasIcon determines if the node will be rendered with an
- * icon or not
- */
- initContent: function(oData, hasIcon) {
- if (typeof oData == "string") {
- oData = { html: oData };
- }
-
- this.html = oData.html;
- this.contentElId = "ygtvcontentel" + this.index;
- this.hasIcon = hasIcon;
-
- },
-
- /**
- * Returns the outer html element for this node's content
- * @method getContentEl
- * @return {HTMLElement} the element
- */
- getContentEl: function() {
- return document.getElementById(this.contentElId);
- },
-
- // overrides YAHOO.widget.Node
- getNodeHtml: function() {
- var sb = [];
-
- sb[sb.length] = '';
- sb[sb.length] = '';
-
- for (var i=0;i ';
- }
-
- if (this.hasIcon) {
- sb[sb.length] = ' ';
- }
-
- sb[sb.length] = '';
- sb[sb.length] = this.html;
- sb[sb.length] = ' ';
- sb[sb.length] = ' ';
- sb[sb.length] = '
';
-
- return sb.join("");
- },
-
- toString: function() {
- return "HTMLNode (" + this.index + ")";
- }
-
-});
-/**
- * A static factory class for tree view expand/collapse animations
- * @class TVAnim
- * @static
- */
-YAHOO.widget.TVAnim = function() {
- return {
- /**
- * Constant for the fade in animation
- * @property FADE_IN
- * @type string
- * @static
- */
- FADE_IN: "TVFadeIn",
-
- /**
- * Constant for the fade out animation
- * @property FADE_OUT
- * @type string
- * @static
- */
- FADE_OUT: "TVFadeOut",
-
- /**
- * Returns a ygAnim instance of the given type
- * @method getAnim
- * @param type {string} the type of animation
- * @param el {HTMLElement} the element to element (probably the children div)
- * @param callback {function} function to invoke when the animation is done.
- * @return {YAHOO.util.Animation} the animation instance
- * @static
- */
- getAnim: function(type, el, callback) {
- if (YAHOO.widget[type]) {
- return new YAHOO.widget[type](el, callback);
- } else {
- return null;
- }
- },
-
- /**
- * Returns true if the specified animation class is available
- * @method isValid
- * @param type {string} the type of animation
- * @return {boolean} true if valid, false if not
- * @static
- */
- isValid: function(type) {
- return (YAHOO.widget[type]);
- }
- };
-} ();
-
-/**
- * A 1/2 second fade-in animation.
- * @class TVFadeIn
- * @constructor
- * @param el {HTMLElement} the element to animate
- * @param callback {function} function to invoke when the animation is finished
- */
-YAHOO.widget.TVFadeIn = function(el, callback) {
- /**
- * The element to animate
- * @property el
- * @type HTMLElement
- */
- this.el = el;
-
- /**
- * the callback to invoke when the animation is complete
- * @property callback
- * @type function
- */
- this.callback = callback;
-
-};
-
-YAHOO.widget.TVFadeIn.prototype = {
- /**
- * Performs the animation
- * @method animate
- */
- animate: function() {
- var tvanim = this;
-
- var s = this.el.style;
- s.opacity = 0.1;
- s.filter = "alpha(opacity=10)";
- s.display = "";
-
- var dur = 0.4;
- var a = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit:""}}, dur);
- a.onComplete.subscribe( function() { tvanim.onComplete(); } );
- a.animate();
- },
-
- /**
- * Clean up and invoke callback
- * @method onComplete
- */
- onComplete: function() {
- this.callback();
- },
-
- /**
- * toString
- * @method toString
- * @return {string} the string representation of the instance
- */
- toString: function() {
- return "TVFadeIn";
- }
-};
-
-/**
- * A 1/2 second fade out animation.
- * @class TVFadeOut
- * @constructor
- * @param el {HTMLElement} the element to animate
- * @param callback {Function} function to invoke when the animation is finished
- */
-YAHOO.widget.TVFadeOut = function(el, callback) {
- /**
- * The element to animate
- * @property el
- * @type HTMLElement
- */
- this.el = el;
-
- /**
- * the callback to invoke when the animation is complete
- * @property callback
- * @type function
- */
- this.callback = callback;
-
-};
-
-YAHOO.widget.TVFadeOut.prototype = {
- /**
- * Performs the animation
- * @method animate
- */
- animate: function() {
- var tvanim = this;
- var dur = 0.4;
- var a = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit:""}}, dur);
- a.onComplete.subscribe( function() { tvanim.onComplete(); } );
- a.animate();
- },
-
- /**
- * Clean up and invoke callback
- * @method onComplete
- */
- onComplete: function() {
- var s = this.el.style;
- s.display = "none";
- // s.opacity = 1;
- s.filter = "alpha(opacity=100)";
- this.callback();
- },
-
- /**
- * toString
- * @method toString
- * @return {string} the string representation of the instance
- */
- toString: function() {
- return "TVFadeOut";
- }
-};
-
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.0
+*/
+
+/**
+ * The treeview widget is a generic tree building tool.
+ * @module treeview
+ * @title TreeView Widget
+ * @requires yahoo
+ * @optional animation
+ * @namespace YAHOO.widget
+ */
+
+/**
+ * Contains the tree view state data and the root node.
+ *
+ * @class TreeView
+ * @constructor
+ * @param {string|HTMLElement} id The id of the element, or the element
+ * itself that the tree will be inserted into.
+ */
+YAHOO.widget.TreeView = function(id) {
+ if (id) { this.init(id); }
+};
+
+YAHOO.widget.TreeView.prototype = {
+
+ /**
+ * The id of tree container element
+ * @property id
+ * @type String
+ */
+ id: null,
+
+ /**
+ * The host element for this tree
+ * @property _el
+ * @private
+ */
+ _el: null,
+
+ /**
+ * Flat collection of all nodes in this tree
+ * @property _nodes
+ * @type Node[]
+ * @private
+ */
+ _nodes: null,
+
+ /**
+ * We lock the tree control while waiting for the dynamic loader to return
+ * @property locked
+ * @type boolean
+ */
+ locked: false,
+
+ /**
+ * The animation to use for expanding children, if any
+ * @property _expandAnim
+ * @type string
+ * @private
+ */
+ _expandAnim: null,
+
+ /**
+ * The animation to use for collapsing children, if any
+ * @property _collapseAnim
+ * @type string
+ * @private
+ */
+ _collapseAnim: null,
+
+ /**
+ * The current number of animations that are executing
+ * @property _animCount
+ * @type int
+ * @private
+ */
+ _animCount: 0,
+
+ /**
+ * The maximum number of animations to run at one time.
+ * @property maxAnim
+ * @type int
+ */
+ maxAnim: 2,
+
+ /**
+ * Sets up the animation for expanding children
+ * @method setExpandAnim
+ * @param {string} type the type of animation (acceptable values defined
+ * in YAHOO.widget.TVAnim)
+ */
+ setExpandAnim: function(type) {
+ if (YAHOO.widget.TVAnim.isValid(type)) {
+ this._expandAnim = type;
+ }
+ },
+
+ /**
+ * Sets up the animation for collapsing children
+ * @method setCollapseAnim
+ * @param {string} the type of animation (acceptable values defined in
+ * YAHOO.widget.TVAnim)
+ */
+ setCollapseAnim: function(type) {
+ if (YAHOO.widget.TVAnim.isValid(type)) {
+ this._collapseAnim = type;
+ }
+ },
+
+ /**
+ * Perform the expand animation if configured, or just show the
+ * element if not configured or too many animations are in progress
+ * @method animateExpand
+ * @param el {HTMLElement} the element to animate
+ * @param node {YAHOO.util.Node} the node that was expanded
+ * @return {boolean} true if animation could be invoked, false otherwise
+ */
+ animateExpand: function(el, node) {
+
+ if (this._expandAnim && this._animCount < this.maxAnim) {
+ // this.locked = true;
+ var tree = this;
+ var a = YAHOO.widget.TVAnim.getAnim(this._expandAnim, el,
+ function() { tree.expandComplete(node); });
+ if (a) {
+ ++this._animCount;
+ this.fireEvent("animStart", {
+ "node": node,
+ "type": "expand"
+ });
+ a.animate();
+ }
+
+ return true;
+ }
+
+ return false;
+ },
+
+ /**
+ * Perform the collapse animation if configured, or just show the
+ * element if not configured or too many animations are in progress
+ * @method animateCollapse
+ * @param el {HTMLElement} the element to animate
+ * @param node {YAHOO.util.Node} the node that was expanded
+ * @return {boolean} true if animation could be invoked, false otherwise
+ */
+ animateCollapse: function(el, node) {
+
+ if (this._collapseAnim && this._animCount < this.maxAnim) {
+ // this.locked = true;
+ var tree = this;
+ var a = YAHOO.widget.TVAnim.getAnim(this._collapseAnim, el,
+ function() { tree.collapseComplete(node); });
+ if (a) {
+ ++this._animCount;
+ this.fireEvent("animStart", {
+ "node": node,
+ "type": "collapse"
+ });
+ a.animate();
+ }
+
+ return true;
+ }
+
+ return false;
+ },
+
+ /**
+ * Function executed when the expand animation completes
+ * @method expandComplete
+ */
+ expandComplete: function(node) {
+ --this._animCount;
+ this.fireEvent("animComplete", {
+ "node": node,
+ "type": "expand"
+ });
+ // this.locked = false;
+ },
+
+ /**
+ * Function executed when the collapse animation completes
+ * @method collapseComplete
+ */
+ collapseComplete: function(node) {
+ --this._animCount;
+ this.fireEvent("animComplete", {
+ "node": node,
+ "type": "collapse"
+ });
+ // this.locked = false;
+ },
+
+ /**
+ * Initializes the tree
+ * @method init
+ * @parm {string|HTMLElement} id the id of the element that will hold the tree
+ * @private
+ */
+ init: function(id) {
+
+ this.id = id;
+
+ if ("string" !== typeof id) {
+ this._el = id;
+ this.id = this.generateId(id);
+ }
+
+ /**
+ * When animation is enabled, this event fires when the animation
+ * starts
+ * @event animStart
+ * @type CustomEvent
+ * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
+ * @parm {String} type the type of animation ("expand" or "collapse")
+ */
+ this.createEvent("animStart", this);
+
+ /**
+ * When animation is enabled, this event fires when the animation
+ * completes
+ * @event animComplete
+ * @type CustomEvent
+ * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
+ * @parm {String} type the type of animation ("expand" or "collapse")
+ */
+ this.createEvent("animComplete", this);
+
+ /**
+ * Fires when a node is going to be expanded. Return false to stop
+ * the expand.
+ * @event collapse
+ * @type CustomEvent
+ * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
+ */
+ this.createEvent("collapse", this);
+
+ /**
+ * Fires when a node is going to be collapsed. Return false to stop
+ * the collapse.
+ * @event expand
+ * @type CustomEvent
+ * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
+ */
+ this.createEvent("expand", this);
+
+ this._nodes = [];
+
+ // store a global reference
+ YAHOO.widget.TreeView.trees[this.id] = this;
+
+ // Set up the root node
+ this.root = new YAHOO.widget.RootNode(this);
+
+
+ },
+
+ /**
+ * Renders the tree boilerplate and visible nodes
+ * @method draw
+ */
+ draw: function() {
+ var html = this.root.getHtml();
+ this.getEl().innerHTML = html;
+ this.firstDraw = false;
+ },
+
+ /**
+ * Returns the tree's host element
+ * @method getEl
+ * @return {HTMLElement} the host element
+ */
+ getEl: function() {
+ if (! this._el) {
+ this._el = document.getElementById(this.id);
+ }
+ return this._el;
+ },
+
+ /**
+ * Nodes register themselves with the tree instance when they are created.
+ * @method regNode
+ * @param node {Node} the node to register
+ * @private
+ */
+ regNode: function(node) {
+ this._nodes[node.index] = node;
+ },
+
+ /**
+ * Returns the root node of this tree
+ * @method getRoot
+ * @return {Node} the root node
+ */
+ getRoot: function() {
+ return this.root;
+ },
+
+ /**
+ * Configures this tree to dynamically load all child data
+ * @method setDynamicLoad
+ * @param {function} fnDataLoader the function that will be called to get the data
+ * @param iconMode {int} configures the icon that is displayed when a dynamic
+ * load node is expanded the first time without children. By default, the
+ * "collapse" icon will be used. If set to 1, the leaf node icon will be
+ * displayed.
+ */
+ setDynamicLoad: function(fnDataLoader, iconMode) {
+ this.root.setDynamicLoad(fnDataLoader, iconMode);
+ },
+
+ /**
+ * Expands all child nodes. Note: this conflicts with the "multiExpand"
+ * node property. If expand all is called in a tree with nodes that
+ * do not allow multiple siblings to be displayed, only the last sibling
+ * will be expanded.
+ * @method expandAll
+ */
+ expandAll: function() {
+ if (!this.locked) {
+ this.root.expandAll();
+ }
+ },
+
+ /**
+ * Collapses all expanded child nodes in the entire tree.
+ * @method collapseAll
+ */
+ collapseAll: function() {
+ if (!this.locked) {
+ this.root.collapseAll();
+ }
+ },
+
+ /**
+ * Returns a node in the tree that has the specified index (this index
+ * is created internally, so this function probably will only be used
+ * in html generated for a given node.)
+ * @method getNodeByIndex
+ * @param {int} nodeIndex the index of the node wanted
+ * @return {Node} the node with index=nodeIndex, null if no match
+ */
+ getNodeByIndex: function(nodeIndex) {
+ var n = this._nodes[nodeIndex];
+ return (n) ? n : null;
+ },
+
+ /**
+ * Returns a node that has a matching property and value in the data
+ * object that was passed into its constructor.
+ * @method getNodeByProperty
+ * @param {object} property the property to search (usually a string)
+ * @param {object} value the value we want to find (usuall an int or string)
+ * @return {Node} the matching node, null if no match
+ */
+ getNodeByProperty: function(property, value) {
+ for (var i in this._nodes) {
+ var n = this._nodes[i];
+ if (n.data && value == n.data[property]) {
+ return n;
+ }
+ }
+
+ return null;
+ },
+
+ /**
+ * Returns a collection of nodes that have a matching property
+ * and value in the data object that was passed into its constructor.
+ * @method getNodesByProperty
+ * @param {object} property the property to search (usually a string)
+ * @param {object} value the value we want to find (usuall an int or string)
+ * @return {Array} the matching collection of nodes, null if no match
+ */
+ getNodesByProperty: function(property, value) {
+ var values = [];
+ for (var i in this._nodes) {
+ var n = this._nodes[i];
+ if (n.data && value == n.data[property]) {
+ values.push(n);
+ }
+ }
+
+ return (values.length) ? values : null;
+ },
+
+ /**
+ * Removes the node and its children, and optionally refreshes the
+ * branch of the tree that was affected.
+ * @method removeNode
+ * @param {Node} The node to remove
+ * @param {boolean} autoRefresh automatically refreshes branch if true
+ * @return {boolean} False is there was a problem, true otherwise.
+ */
+ removeNode: function(node, autoRefresh) {
+
+ // Don't delete the root node
+ if (node.isRoot()) {
+ return false;
+ }
+
+ // Get the branch that we may need to refresh
+ var p = node.parent;
+ if (p.parent) {
+ p = p.parent;
+ }
+
+ // Delete the node and its children
+ this._deleteNode(node);
+
+ // Refresh the parent of the parent
+ if (autoRefresh && p && p.childrenRendered) {
+ p.refresh();
+ }
+
+ return true;
+ },
+
+ /**
+ * Deletes this nodes child collection, recursively. Also collapses
+ * the node, and resets the dynamic load flag. The primary use for
+ * this method is to purge a node and allow it to fetch its data
+ * dynamically again.
+ * @method removeChildren
+ * @param {Node} node the node to purge
+ */
+ removeChildren: function(node) {
+ while (node.children.length) {
+ this._deleteNode(node.children[0]);
+ }
+
+ node.childrenRendered = false;
+ node.dynamicLoadComplete = false;
+ if (node.expanded) {
+ node.collapse();
+ } else {
+ node.updateIcon();
+ }
+ },
+
+ /**
+ * Deletes the node and recurses children
+ * @method _deleteNode
+ * @private
+ */
+ _deleteNode: function(node) {
+ // Remove all the child nodes first
+ this.removeChildren(node);
+
+ // Remove the node from the tree
+ this.popNode(node);
+ },
+
+ /**
+ * Removes the node from the tree, preserving the child collection
+ * to make it possible to insert the branch into another part of the
+ * tree, or another tree.
+ * @method popNode
+ * @param {Node} the node to remove
+ */
+ popNode: function(node) {
+ var p = node.parent;
+
+ // Update the parent's collection of children
+ var a = [];
+
+ for (var i=0, len=p.children.length;i ';
+ }
+
+ var f = document.createElement("div");
+ var s = f.style;
+ s.position = "absolute";
+ s.top = "-1000px";
+ s.left = "-1000px";
+ f.innerHTML = sb.join("");
+
+ document.body.appendChild(f);
+
+ YAHOO.widget.TreeView.removeHandler(window,
+ "load", YAHOO.widget.TreeView.preload);
+
+};
+
+YAHOO.widget.TreeView.addHandler(window,
+ "load", YAHOO.widget.TreeView.preload);
+
+/**
+ * The base class for all tree nodes. The node's presentation and behavior in
+ * response to mouse events is handled in Node subclasses.
+ * @namespace YAHOO.widget
+ * @class Node
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @constructor
+ */
+YAHOO.widget.Node = function(oData, oParent, expanded) {
+ if (oData) { this.init(oData, oParent, expanded); }
+};
+
+YAHOO.widget.Node.prototype = {
+
+ /**
+ * The index for this instance obtained from global counter in YAHOO.widget.TreeView.
+ * @property index
+ * @type int
+ */
+ index: 0,
+
+ /**
+ * This node's child node collection.
+ * @property children
+ * @type Node[]
+ */
+ children: null,
+
+ /**
+ * Tree instance this node is part of
+ * @property tree
+ * @type TreeView
+ */
+ tree: null,
+
+ /**
+ * The data linked to this node. This can be any object or primitive
+ * value, and the data can be used in getNodeHtml().
+ * @property data
+ * @type object
+ */
+ data: null,
+
+ /**
+ * Parent node
+ * @property parent
+ * @type Node
+ */
+ parent: null,
+
+ /**
+ * The depth of this node. We start at -1 for the root node.
+ * @property depth
+ * @type int
+ */
+ depth: -1,
+
+ /**
+ * The href for the node's label. If one is not specified, the href will
+ * be set so that it toggles the node.
+ * @property href
+ * @type string
+ */
+ href: null,
+
+ /**
+ * The label href target, defaults to current window
+ * @property target
+ * @type string
+ */
+ target: "_self",
+
+ /**
+ * The node's expanded/collapsed state
+ * @property expanded
+ * @type boolean
+ */
+ expanded: false,
+
+ /**
+ * Can multiple children be expanded at once?
+ * @property multiExpand
+ * @type boolean
+ */
+ multiExpand: true,
+
+ /**
+ * Should we render children for a collapsed node? It is possible that the
+ * implementer will want to render the hidden data... @todo verify that we
+ * need this, and implement it if we do.
+ * @property renderHidden
+ * @type boolean
+ */
+ renderHidden: false,
+
+ /**
+ * This flag is set to true when the html is generated for this node's
+ * children, and set to false when new children are added.
+ * @property childrenRendered
+ * @type boolean
+ */
+ childrenRendered: false,
+
+ /**
+ * Dynamically loaded nodes only fetch the data the first time they are
+ * expanded. This flag is set to true once the data has been fetched.
+ * @property dynamicLoadComplete
+ * @type boolean
+ */
+ dynamicLoadComplete: false,
+
+ /**
+ * This node's previous sibling
+ * @property previousSibling
+ * @type Node
+ */
+ previousSibling: null,
+
+ /**
+ * This node's next sibling
+ * @property nextSibling
+ * @type Node
+ */
+ nextSibling: null,
+
+ /**
+ * We can set the node up to call an external method to get the child
+ * data dynamically.
+ * @property _dynLoad
+ * @type boolean
+ * @private
+ */
+ _dynLoad: false,
+
+ /**
+ * Function to execute when we need to get this node's child data.
+ * @property dataLoader
+ * @type function
+ */
+ dataLoader: null,
+
+ /**
+ * This is true for dynamically loading nodes while waiting for the
+ * callback to return.
+ * @property isLoading
+ * @type boolean
+ */
+ isLoading: false,
+
+ /**
+ * The toggle/branch icon will not show if this is set to false. This
+ * could be useful if the implementer wants to have the child contain
+ * extra info about the parent, rather than an actual node.
+ * @property hasIcon
+ * @type boolean
+ */
+ hasIcon: true,
+
+ /**
+ * Used to configure what happens when a dynamic load node is expanded
+ * and we discover that it does not have children. By default, it is
+ * treated as if it still could have children (plus/minus icon). Set
+ * iconMode to have it display like a leaf node instead.
+ * @property iconMode
+ * @type int
+ */
+ iconMode: 0,
+
+ /**
+ * The node type
+ * @property _type
+ * @private
+ */
+ _type: "Node",
+
+ /*
+ spacerPath: "http://us.i1.yimg.com/us.yimg.com/i/space.gif",
+ expandedText: "Expanded",
+ collapsedText: "Collapsed",
+ loadingText: "Loading",
+ */
+
+ /**
+ * Initializes this node, gets some of the properties from the parent
+ * @method init
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ */
+ init: function(oData, oParent, expanded) {
+
+ this.data = oData;
+ this.children = [];
+ this.index = YAHOO.widget.TreeView.nodeCount;
+ ++YAHOO.widget.TreeView.nodeCount;
+ this.expanded = expanded;
+
+ /**
+ * The parentChange event is fired when a parent element is applied
+ * to the node. This is useful if you need to apply tree-level
+ * properties to a tree that need to happen if a node is moved from
+ * one tre to another.
+ *
+ * @event parentChange
+ * @type CustomEvent
+ */
+ this.createEvent("parentChange", this);
+
+ // oParent should never be null except when we create the root node.
+ if (oParent) {
+ oParent.appendChild(this);
+ }
+ },
+
+ /**
+ * Certain properties for the node cannot be set until the parent
+ * is known. This is called after the node is inserted into a tree.
+ * the parent is also applied to this node's children in order to
+ * make it possible to move a branch from one tree to another.
+ * @method applyParent
+ * @param {Node} parentNode this node's parent node
+ * @return {boolean} true if the application was successful
+ */
+ applyParent: function(parentNode) {
+ if (!parentNode) {
+ return false;
+ }
+
+ this.tree = parentNode.tree;
+ this.parent = parentNode;
+ this.depth = parentNode.depth + 1;
+
+ if (!this.href) {
+ this.href = "javascript:" + this.getToggleLink();
+ }
+
+ if (! this.multiExpand) {
+ this.multiExpand = parentNode.multiExpand;
+ }
+
+ this.tree.regNode(this);
+ parentNode.childrenRendered = false;
+
+ // cascade update existing children
+ for (var i=0, len=this.children.length;i 0 ||
+ (checkForLazyLoad && this.isDynamic() && !this.dynamicLoadComplete) );
+ },
+
+ /**
+ * Expands if node is collapsed, collapses otherwise.
+ * @method toggle
+ */
+ toggle: function() {
+ if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) {
+ if (this.expanded) { this.collapse(); } else { this.expand(); }
+ }
+ },
+
+ /**
+ * Returns the markup for this node and its children.
+ * @method getHtml
+ * @return {string} the markup for this node and its expanded children.
+ */
+ getHtml: function() {
+
+ this.childrenRendered = false;
+
+ var sb = [];
+ sb[sb.length] = '';
+ sb[sb.length] = this.getNodeHtml();
+ sb[sb.length] = this.getChildrenHtml();
+ sb[sb.length] = '
';
+ return sb.join("");
+ },
+
+ /**
+ * Called when first rendering the tree. We always build the div that will
+ * contain this nodes children, but we don't render the children themselves
+ * unless this node is expanded.
+ * @method getChildrenHtml
+ * @return {string} the children container div html and any expanded children
+ * @private
+ */
+ getChildrenHtml: function() {
+
+ var sb = [];
+ sb[sb.length] = '';
+
+ // Don't render the actual child node HTML unless this node is expanded.
+ if ( (this.hasChildren(true) && this.expanded) ||
+ (this.renderHidden && !this.isDynamic()) ) {
+ sb[sb.length] = this.renderChildren();
+ }
+
+ sb[sb.length] = '
';
+
+ return sb.join("");
+ },
+
+ /**
+ * Generates the markup for the child nodes. This is not done until the node
+ * is expanded.
+ * @method renderChildren
+ * @return {string} the html for this node's children
+ * @private
+ */
+ renderChildren: function() {
+
+
+ var node = this;
+
+ if (this.isDynamic() && !this.dynamicLoadComplete) {
+ this.isLoading = true;
+ this.tree.locked = true;
+
+ if (this.dataLoader) {
+
+ setTimeout(
+ function() {
+ node.dataLoader(node,
+ function() {
+ node.loadComplete();
+ });
+ }, 10);
+
+ } else if (this.tree.root.dataLoader) {
+
+ setTimeout(
+ function() {
+ node.tree.root.dataLoader(node,
+ function() {
+ node.loadComplete();
+ });
+ }, 10);
+
+ } else {
+ return "Error: data loader not found or not specified.";
+ }
+
+ return "";
+
+ } else {
+ return this.completeRender();
+ }
+ },
+
+ /**
+ * Called when we know we have all the child data.
+ * @method completeRender
+ * @return {string} children html
+ */
+ completeRender: function() {
+ var sb = [];
+
+ for (var i=0; i < this.children.length; ++i) {
+ // this.children[i].childrenRendered = false;
+ sb[sb.length] = this.children[i].getHtml();
+ }
+
+ this.childrenRendered = true;
+
+ return sb.join("");
+ },
+
+ /**
+ * Load complete is the callback function we pass to the data provider
+ * in dynamic load situations.
+ * @method loadComplete
+ */
+ loadComplete: function() {
+ this.getChildrenEl().innerHTML = this.completeRender();
+ this.dynamicLoadComplete = true;
+ this.isLoading = false;
+ this.expand();
+ this.tree.locked = false;
+ },
+
+ /**
+ * Returns this node's ancestor at the specified depth.
+ * @method getAncestor
+ * @param {int} depth the depth of the ancestor.
+ * @return {Node} the ancestor
+ */
+ getAncestor: function(depth) {
+ if (depth >= this.depth || depth < 0) {
+ return null;
+ }
+
+ var p = this.parent;
+
+ while (p.depth > depth) {
+ p = p.parent;
+ }
+
+ return p;
+ },
+
+ /**
+ * Returns the css class for the spacer at the specified depth for
+ * this node. If this node's ancestor at the specified depth
+ * has a next sibling the presentation is different than if it
+ * does not have a next sibling
+ * @method getDepthStyle
+ * @param {int} depth the depth of the ancestor.
+ * @return {string} the css class for the spacer
+ */
+ getDepthStyle: function(depth) {
+ return (this.getAncestor(depth).nextSibling) ?
+ "ygtvdepthcell" : "ygtvblankdepthcell";
+ },
+
+ /**
+ * Get the markup for the node. This is designed to be overrided so that we can
+ * support different types of nodes.
+ * @method getNodeHtml
+ * @return {string} The HTML that will render this node.
+ */
+ getNodeHtml: function() {
+ return "";
+ },
+
+ /**
+ * Regenerates the html for this node and its children. To be used when the
+ * node is expanded and new children have been added.
+ * @method refresh
+ */
+ refresh: function() {
+ // this.loadComplete();
+ this.getChildrenEl().innerHTML = this.completeRender();
+
+ if (this.hasIcon) {
+ var el = this.getToggleEl();
+ if (el) {
+ el.className = this.getStyle();
+ }
+ }
+ },
+
+ /**
+ * Node toString
+ * @method toString
+ * @return {string} string representation of the node
+ */
+ toString: function() {
+ return "Node (" + this.index + ")";
+ }
+
+};
+
+YAHOO.augment(YAHOO.widget.Node, YAHOO.util.EventProvider);
+
+/**
+ * A custom YAHOO.widget.Node that handles the unique nature of
+ * the virtual, presentationless root node.
+ * @namespace YAHOO.widget
+ * @class RootNode
+ * @extends YAHOO.widget.Node
+ * @param oTree {YAHOO.widget.TreeView} The tree instance this node belongs to
+ * @constructor
+ */
+YAHOO.widget.RootNode = function(oTree) {
+ // Initialize the node with null params. The root node is a
+ // special case where the node has no presentation. So we have
+ // to alter the standard properties a bit.
+ this.init(null, null, true);
+
+ /*
+ * For the root node, we get the tree reference from as a param
+ * to the constructor instead of from the parent element.
+ */
+ this.tree = oTree;
+};
+
+YAHOO.extend(YAHOO.widget.RootNode, YAHOO.widget.Node, {
+
+ // overrides YAHOO.widget.Node
+ getNodeHtml: function() {
+ return "";
+ },
+
+ toString: function() {
+ return "RootNode";
+ },
+
+ loadComplete: function() {
+ this.tree.draw();
+ }
+
+});
+/**
+ * The default node presentation. The first parameter should be
+ * either a string that will be used as the node's label, or an object
+ * that has a string propery called label. By default, the clicking the
+ * label will toggle the expanded/collapsed state of the node. By
+ * changing the href property of the instance, this behavior can be
+ * changed so that the label will go to the specified href.
+ * @namespace YAHOO.widget
+ * @class TextNode
+ * @extends YAHOO.widget.Node
+ * @constructor
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ */
+YAHOO.widget.TextNode = function(oData, oParent, expanded) {
+
+ if (oData) {
+ this.init(oData, oParent, expanded);
+ this.setUpLabel(oData);
+ }
+
+};
+
+YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, {
+
+ /**
+ * The CSS class for the label href. Defaults to ygtvlabel, but can be
+ * overridden to provide a custom presentation for a specific node.
+ * @property labelStyle
+ * @type string
+ */
+ labelStyle: "ygtvlabel",
+
+ /**
+ * The derived element id of the label for this node
+ * @property labelElId
+ * @type string
+ */
+ labelElId: null,
+
+ /**
+ * The text for the label. It is assumed that the oData parameter will
+ * either be a string that will be used as the label, or an object that
+ * has a property called "label" that we will use.
+ * @property label
+ * @type string
+ */
+ label: null,
+
+ textNodeParentChange: function() {
+
+ /**
+ * Custom event that is fired when the text node label is clicked. The
+ * custom event is defined on the tree instance, so there is a single
+ * event that handles all nodes in the tree. The node clicked is
+ * provided as an argument
+ *
+ * @event labelClick
+ * @for YAHOO.widget.TreeView
+ * @param {YAHOO.widget.Node} node the node clicked
+ */
+ if (this.tree && !this.tree.hasEvent("labelClick")) {
+ this.tree.createEvent("labelClick", this.tree);
+ }
+
+ },
+
+ /**
+ * Sets up the node label
+ * @method setUpLabel
+ * @param oData string containing the label, or an object with a label property
+ */
+ setUpLabel: function(oData) {
+
+ // set up the custom event on the tree
+ this.textNodeParentChange();
+ this.subscribe("parentChange", this.textNodeParentChange);
+
+ if (typeof oData == "string") {
+ oData = { label: oData };
+ }
+ this.label = oData.label;
+
+ // update the link
+ if (oData.href) {
+ this.href = oData.href;
+ }
+
+ // set the target
+ if (oData.target) {
+ this.target = oData.target;
+ }
+
+ if (oData.style) {
+ this.labelStyle = oData.style;
+ }
+
+ this.labelElId = "ygtvlabelel" + this.index;
+ },
+
+ /**
+ * Returns the label element
+ * @for YAHOO.widget.TextNode
+ * @method getLabelEl
+ * @return {object} the element
+ */
+ getLabelEl: function() {
+ return document.getElementById(this.labelElId);
+ },
+
+ // overrides YAHOO.widget.Node
+ getNodeHtml: function() {
+ var sb = [];
+
+ sb[sb.length] = '';
+ sb[sb.length] = '';
+
+ for (var i=0;i ';
+ sb[sb.length] = ' ';
+ }
+
+ var getNode = 'YAHOO.widget.TreeView.getNode(\'' +
+ this.tree.id + '\',' + this.index + ')';
+
+ sb[sb.length] = '';
+
+ /*
+ sb[sb.length] = ' ';
+ */
+
+ sb[sb.length] = ' ';
+
+ sb[sb.length] = ' ';
+ sb[sb.length] = '';
+ sb[sb.length] = '';
+ sb[sb.length] = this.label;
+ sb[sb.length] = ' ';
+ sb[sb.length] = ' ';
+ sb[sb.length] = ' ';
+ sb[sb.length] = '
';
+
+ return sb.join("");
+ },
+
+ /**
+ * Executed when the label is clicked. Fires the labelClick custom event.
+ * @method onLabelClick
+ * @param me {Node} this node
+ * @scope the anchor tag clicked
+ * @return false to cancel the anchor click
+ */
+ onLabelClick: function(me) {
+ return me.tree.fireEvent("labelClick", me);
+ //return true;
+ },
+
+ toString: function() {
+ return "TextNode (" + this.index + ") " + this.label;
+ }
+
+});
+/**
+ * A menu-specific implementation that differs from TextNode in that only
+ * one sibling can be expanded at a time.
+ * @namespace YAHOO.widget
+ * @class MenuNode
+ * @extends YAHOO.widget.TextNode
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @constructor
+ */
+YAHOO.widget.MenuNode = function(oData, oParent, expanded) {
+ if (oData) {
+ this.init(oData, oParent, expanded);
+ this.setUpLabel(oData);
+ }
+
+ /*
+ * Menus usually allow only one branch to be open at a time.
+ */
+ this.multiExpand = false;
+
+
+};
+
+YAHOO.extend(YAHOO.widget.MenuNode, YAHOO.widget.TextNode, {
+
+ toString: function() {
+ return "MenuNode (" + this.index + ") " + this.label;
+ }
+
+});
+/**
+ * This implementation takes either a string or object for the
+ * oData argument. If is it a string, we will use it for the display
+ * of this node (and it can contain any html code). If the parameter
+ * is an object, we look for a parameter called "html" that will be
+ * used for this node's display.
+ * @namespace YAHOO.widget
+ * @class HTMLNode
+ * @extends YAHOO.widget.Node
+ * @constructor
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @param hasIcon {boolean} specifies whether or not leaf nodes should
+ * have an icon
+ */
+YAHOO.widget.HTMLNode = function(oData, oParent, expanded, hasIcon) {
+ if (oData) {
+ this.init(oData, oParent, expanded);
+ this.initContent(oData, hasIcon);
+ }
+};
+
+YAHOO.extend(YAHOO.widget.HTMLNode, YAHOO.widget.Node, {
+
+ /**
+ * The CSS class for the html content container. Defaults to ygtvhtml, but
+ * can be overridden to provide a custom presentation for a specific node.
+ * @property contentStyle
+ * @type string
+ */
+ contentStyle: "ygtvhtml",
+
+ /**
+ * The generated id that will contain the data passed in by the implementer.
+ * @property contentElId
+ * @type string
+ */
+ contentElId: null,
+
+ /**
+ * The HTML content to use for this node's display
+ * @property content
+ * @type string
+ */
+ content: null,
+
+ /**
+ * Sets up the node label
+ * @property initContent
+ * @param {object} An html string or object containing an html property
+ * @param {boolean} hasIcon determines if the node will be rendered with an
+ * icon or not
+ */
+ initContent: function(oData, hasIcon) {
+ if (typeof oData == "string") {
+ oData = { html: oData };
+ }
+
+ this.html = oData.html;
+ this.contentElId = "ygtvcontentel" + this.index;
+ this.hasIcon = hasIcon;
+
+ },
+
+ /**
+ * Returns the outer html element for this node's content
+ * @method getContentEl
+ * @return {HTMLElement} the element
+ */
+ getContentEl: function() {
+ return document.getElementById(this.contentElId);
+ },
+
+ // overrides YAHOO.widget.Node
+ getNodeHtml: function() {
+ var sb = [];
+
+ sb[sb.length] = '';
+ sb[sb.length] = '';
+
+ for (var i=0;i ';
+ }
+
+ if (this.hasIcon) {
+ sb[sb.length] = ' ';
+ }
+
+ sb[sb.length] = '';
+ sb[sb.length] = this.html;
+ sb[sb.length] = ' ';
+ sb[sb.length] = ' ';
+ sb[sb.length] = '
';
+
+ return sb.join("");
+ },
+
+ toString: function() {
+ return "HTMLNode (" + this.index + ")";
+ }
+
+});
+/**
+ * A static factory class for tree view expand/collapse animations
+ * @class TVAnim
+ * @static
+ */
+YAHOO.widget.TVAnim = function() {
+ return {
+ /**
+ * Constant for the fade in animation
+ * @property FADE_IN
+ * @type string
+ * @static
+ */
+ FADE_IN: "TVFadeIn",
+
+ /**
+ * Constant for the fade out animation
+ * @property FADE_OUT
+ * @type string
+ * @static
+ */
+ FADE_OUT: "TVFadeOut",
+
+ /**
+ * Returns a ygAnim instance of the given type
+ * @method getAnim
+ * @param type {string} the type of animation
+ * @param el {HTMLElement} the element to element (probably the children div)
+ * @param callback {function} function to invoke when the animation is done.
+ * @return {YAHOO.util.Animation} the animation instance
+ * @static
+ */
+ getAnim: function(type, el, callback) {
+ if (YAHOO.widget[type]) {
+ return new YAHOO.widget[type](el, callback);
+ } else {
+ return null;
+ }
+ },
+
+ /**
+ * Returns true if the specified animation class is available
+ * @method isValid
+ * @param type {string} the type of animation
+ * @return {boolean} true if valid, false if not
+ * @static
+ */
+ isValid: function(type) {
+ return (YAHOO.widget[type]);
+ }
+ };
+} ();
+
+/**
+ * A 1/2 second fade-in animation.
+ * @class TVFadeIn
+ * @constructor
+ * @param el {HTMLElement} the element to animate
+ * @param callback {function} function to invoke when the animation is finished
+ */
+YAHOO.widget.TVFadeIn = function(el, callback) {
+ /**
+ * The element to animate
+ * @property el
+ * @type HTMLElement
+ */
+ this.el = el;
+
+ /**
+ * the callback to invoke when the animation is complete
+ * @property callback
+ * @type function
+ */
+ this.callback = callback;
+
+};
+
+YAHOO.widget.TVFadeIn.prototype = {
+ /**
+ * Performs the animation
+ * @method animate
+ */
+ animate: function() {
+ var tvanim = this;
+
+ var s = this.el.style;
+ s.opacity = 0.1;
+ s.filter = "alpha(opacity=10)";
+ s.display = "";
+
+ var dur = 0.4;
+ var a = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit:""}}, dur);
+ a.onComplete.subscribe( function() { tvanim.onComplete(); } );
+ a.animate();
+ },
+
+ /**
+ * Clean up and invoke callback
+ * @method onComplete
+ */
+ onComplete: function() {
+ this.callback();
+ },
+
+ /**
+ * toString
+ * @method toString
+ * @return {string} the string representation of the instance
+ */
+ toString: function() {
+ return "TVFadeIn";
+ }
+};
+
+/**
+ * A 1/2 second fade out animation.
+ * @class TVFadeOut
+ * @constructor
+ * @param el {HTMLElement} the element to animate
+ * @param callback {Function} function to invoke when the animation is finished
+ */
+YAHOO.widget.TVFadeOut = function(el, callback) {
+ /**
+ * The element to animate
+ * @property el
+ * @type HTMLElement
+ */
+ this.el = el;
+
+ /**
+ * the callback to invoke when the animation is complete
+ * @property callback
+ * @type function
+ */
+ this.callback = callback;
+
+};
+
+YAHOO.widget.TVFadeOut.prototype = {
+ /**
+ * Performs the animation
+ * @method animate
+ */
+ animate: function() {
+ var tvanim = this;
+ var dur = 0.4;
+ var a = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit:""}}, dur);
+ a.onComplete.subscribe( function() { tvanim.onComplete(); } );
+ a.animate();
+ },
+
+ /**
+ * Clean up and invoke callback
+ * @method onComplete
+ */
+ onComplete: function() {
+ var s = this.el.style;
+ s.display = "none";
+ // s.opacity = 1;
+ s.filter = "alpha(opacity=100)";
+ this.callback();
+ },
+
+ /**
+ * toString
+ * @method toString
+ * @return {string} the string representation of the instance
+ */
+ toString: function() {
+ return "TVFadeOut";
+ }
+};
+
diff --git a/thirdpartyjs/yui/utilities/README b/thirdpartyjs/yui/utilities/README
index a174dd9..4cf87c0 100644
--- a/thirdpartyjs/yui/utilities/README
+++ b/thirdpartyjs/yui/utilities/README
@@ -1,20 +1,20 @@
-utilities.js Release Notes
-
-*** version 0.12.0 ***
-
-The utilities.js file rolls up all of the YUI utility components into a single
-file; it includes the following components:
-
-* Yahoo Global Object
-* Event
-* Dom
-* Connection Manager
-* Animation
-* Drag & Drop
-
-For implementations that use a significant subset of these files, it may prove
-more efficient to include utilities.js as opposed to including separate files
-for each component.
-
-Note: If you are require only the Yahoo Global Object, Event Utility and Dom
-collection, consider using the special yahoo-event-dom.js aggregate instead.
+utilities.js Release Notes
+
+*** version 0.12.0 ***
+
+The utilities.js file rolls up all of the YUI utility components into a single
+file; it includes the following components:
+
+* Yahoo Global Object
+* Event
+* Dom
+* Connection Manager
+* Animation
+* Drag & Drop
+
+For implementations that use a significant subset of these files, it may prove
+more efficient to include utilities.js as opposed to including separate files
+for each component.
+
+Note: If you are require only the Yahoo Global Object, Event Utility and Dom
+collection, consider using the special yahoo-event-dom.js aggregate instead.
diff --git a/thirdpartyjs/yui/utilities/utilities.js b/thirdpartyjs/yui/utilities/utilities.js
index 0874a9a..e0d210c 100644
--- a/thirdpartyjs/yui/utilities/utilities.js
+++ b/thirdpartyjs/yui/utilities/utilities.js
@@ -1,100 +1,100 @@
-/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txtversion: 0.12.0 */
-if(typeof YAHOO=="undefined"){var YAHOO={};}YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}if(propertyCache[property]){return propertyCache[property];}while(patterns.HYPHEN.exec(property)){property=property.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}propertyCache[property]=property;return property;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}return val/100;break;default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}break;default:el.style[property]=val;}};}else{setStyle=function(el,property,val){el.style[property]=val;};}YAHOO.util.Dom={get:function(el){if(!el){return null;}if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.util.CustomEvent=function(_1,_2,_3,_4){this.type=_1;this.scope=_2||window;this.silent=_3;this.signature=_4||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var _5="_YUICEOnSubscribe";if(_1!==_5){this.subscribeEvent=new YAHOO.util.CustomEvent(_5,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_7,_8){if(this.subscribeEvent){this.subscribeEvent.fire(fn,_7,_8);}this.subscribers.push(new YAHOO.util.Subscriber(fn,_7,_8));},unsubscribe:function(fn,_9){var _10=false;for(var i=0,len=this.subscribers.length;i0){_17=_14[0];}ret=s.fn.call(_16,_17,s.obj);}else{ret=s.fn.call(_16,this.type,_14,s.obj);}if(false===ret){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i=0){_60=_23[_61];}if(!el||!_60){return false;}if(this.useLegacyEvent(el,_59)){var _62=this.getLegacyIndex(el,_59);var _63=_26[_62];if(_63){for(i=0,len=_63.length;i0);}var _76=[];for(var i=0,len=_28.length;i0){for(var i=0,len=_23.length;i0){j=_23.length;while(j){index=j-1;l=_23[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}j=j-1;}l=null;EU.clearCache();}for(i=0,len=_25.length;i0)?val:0;}YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();(function(){var _1=YAHOO.util.Event;var _2=YAHOO.util.Dom;YAHOO.util.DragDrop=function(id,_4,_5){if(id){this.init(id,_4,_5);}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=_2.get(this.id);}return this._domRef;},getDragEl:function(){return _2.get(this.dragElId);},init:function(id,_9,_10){this.initTarget(id,_9,_10);_1.on(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,_11,_12){this.config=_12||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.id=id;this.addToGroup((_11)?_11:"default");this.handleElId=id;_1.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(_13,_14,_15,_16){if(!_14&&0!==_14){this.padding=[_13,_13,_13,_13];}else{if(!_15&&0!==_15){this.padding=[_13,_14,_13,_14];}else{this.padding=[_13,_14,_15,_16];}}},setInitPosition:function(_17,_18){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}var dx=_17||0;var dy=_18||0;var p=_2.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||_2.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(_24){this.groups[_24]=true;this.DDM.regDragDrop(this,_24);},removeFromGroup:function(_25){if(this.groups[_25]){delete this.groups[_25];}this.DDM.removeDDFromGroup(this,_25);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}_1.on(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){_1.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return (this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var _27=e.which||e.button;if(this.primaryButtonOnly&&_27>1){return;}if(this.isLocked()){return;}this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(_1.getPageX(e),_1.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var _29=_1.getTarget(e);return (this.isValidHandleChild(_29)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_29,this.id)));},addInvalidHandleType:function(_30){var _31=_30.toUpperCase();this.invalidHandleTypes[_31]=_31;},addInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(_32){this.invalidHandleClasses.push(_32);},removeInvalidHandleType:function(_33){var _34=_33.toUpperCase();delete this.invalidHandleTypes[_34];},removeInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(_35){for(var i=0,len=this.invalidHandleClasses.length;i=this.minX;i=i-_41){if(!_42[i]){this.xTicks[this.xTicks.length]=i;_42[i]=true;}}for(i=this.initPageX;i<=this.maxX;i=i+_41){if(!_42[i]){this.xTicks[this.xTicks.length]=i;_42[i]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(_43,_44){this.yTicks=[];this.yTickSize=_44;var _45={};for(var i=this.initPageY;i>=this.minY;i=i-_44){if(!_45[i]){this.yTicks[this.yTicks.length]=i;_45[i]=true;}}for(i=this.initPageY;i<=this.maxY;i=i+_44){if(!_45[i]){this.yTicks[this.yTicks.length]=i;_45[i]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(_46,_47,_48){this.leftConstraint=_46;this.rightConstraint=_47;this.minX=this.initPageX-_46;this.maxX=this.initPageX+_47;if(_48){this.setXTicks(this.initPageX,_48);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,_50,_51){this.topConstraint=iUp;this.bottomConstraint=_50;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+_50;if(_51){this.setYTicks(this.initPageY,_51);}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,_53){if(!_53){return val;}else{if(_53[0]>=val){return _53[0];}else{for(var i=0,len=_53.length;i=val){var _55=val-_53[i];var _56=_53[_54]-val;return (_56>_55)?_53[i]:_53[_54];}}return _53[_53.length-1];}}},toString:function(){return ("DragDrop "+this.id);}};})();if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var _57=YAHOO.util.Event;return {ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(_58,_59){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}oDD[_58].apply(oDD,_59);}}},_onLoad:function(){this.init();_57.on(document,"mouseup",this.handleMouseUp,this,true);_57.on(document,"mousemove",this.handleMouseMove,this,true);_57.on(window,"unload",this._onUnload,this,true);_57.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,_61){if(!this.initialized){this.init();}if(!this.ids[_61]){this.ids[_61]={};}this.ids[_61][oDD.id]=oDD;},removeDDFromGroup:function(oDD,_62){if(!this.ids[_62]){this.ids[_62]={};}var obj=this.ids[_62];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}delete this.handleIds[oDD.id];},regHandle:function(_65,_66){if(!this.handleIds[_65]){this.handleIds[_65]={};}this.handleIds[_65][_66]=_66;},isDragDrop:function(id){return (this.getDDById(id))?true:false;},getRelated:function(_67,_68){var _69=[];for(var i in _67.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}if(!_68||dd.isTarget){_69[_69.length]=dd;}}}return _69;},isLegalTarget:function(oDD,_71){var _72=this.getRelated(oDD,true);for(var i=0,len=_72.length;ithis.clickPixelThresh||_77>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);}this.stopEvent(e);return true;},fireEvents:function(e,_78){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var _80=[];var _81=[];var _82=[];var _83=[];var _84=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}if(!this.isOverTarget(pt,ddo,this.mode)){_81.push(ddo);}_80[i]=true;delete this.dragOvers[i];}for(var _86 in dc.groups){if("string"!=typeof _86){continue;}for(i in this.ids[_86]){var oDD=this.ids[_86][i];if(!this.isTypeOfDD(oDD)){continue;}if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(_78){_83.push(oDD);}else{if(!_80[oDD.id]){_84.push(oDD);}else{_82.push(oDD);}this.dragOvers[oDD.id]=oDD;}}}}}if(this.mode){if(_81.length){dc.b4DragOut(e,_81);dc.onDragOut(e,_81);}if(_84.length){dc.onDragEnter(e,_84);}if(_82.length){dc.b4DragOver(e,_82);dc.onDragOver(e,_82);}if(_83.length){dc.b4DragDrop(e,_83);dc.onDragDrop(e,_83);}}else{var len=0;for(i=0,len=_81.length;i2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}YAHOO.util.DD=function(id,_111,_112){if(id){this.init(id,_111,_112);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(_113,_114){var x=_113-this.startPageX;var y=_114-this.startPageY;this.setDelta(x,y);},setDelta:function(_115,_116){this.deltaX=_115;this.deltaY=_116;},setDragElPos:function(_117,_118){var el=this.getDragEl();this.alignElWithMouse(el,_117,_118);},alignElWithMouse:function(el,_119,_120){var _121=this.getTargetCoord(_119,_120);if(!this.deltaSetXY){var _122=[_121.x,_121.y];YAHOO.util.Dom.setXY(el,_122);var _123=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var _124=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[_123-_121.x,_124-_121.y];}else{YAHOO.util.Dom.setStyle(el,"left",(_121.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(_121.y+this.deltaSetXY[1])+"px");}this.cachePosition(_121.x,_121.y);this.autoScroll(_121.x,_121.y,el.offsetHeight,el.offsetWidth);},cachePosition:function(_125,_126){if(_125){this.lastPageX=_125;this.lastPageY=_126;}else{var _127=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=_127[0];this.lastPageY=_127[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var _130=this.DDM.getClientHeight();var _131=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var _135=w+x;var _136=(_130+st-y-this.deltaY);var _137=(_131+sl-x-this.deltaX);var _138=40;var _139=(document.all)?80:30;if(bot>_130&&_136<_138){window.scrollTo(sl,st+_139);}if(y0&&y-st<_138){window.scrollTo(sl,st-_139);}if(_135>_131&&_137<_138){window.scrollTo(sl+_139,st);}if(x0&&x-sl<_138){window.scrollTo(sl-_139,st);}}},getTargetCoord:function(_140,_141){var x=_140-this.deltaX;var y=_141-this.deltaY;if(this.constrainX){if(xthis.maxX){x=this.maxX;}}if(this.constrainY){if(ythis.maxY){y=this.maxY;}}x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y};},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},b4Drag:function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},toString:function(){return ("DD "+this.id);}});YAHOO.util.DDProxy=function(id,_142,_143){if(id){this.init(id,_142,_143);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(_147,_148){var el=this.getEl();var _149=this.getDragEl();var s=_149.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}this.setDragElPos(_147,_148);YAHOO.util.Dom.setStyle(_149,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var DOM=YAHOO.util.Dom;var el=this.getEl();var _151=this.getDragEl();var bt=parseInt(DOM.getStyle(_151,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(_151,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(_151,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(_151,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;}if(isNaN(br)){br=0;}if(isNaN(bb)){bb=0;}if(isNaN(bl)){bl=0;}var _156=Math.max(0,el.offsetWidth-br-bl);var _157=Math.max(0,el.offsetHeight-bt-bb);DOM.setStyle(_151,"width",_156+"px");DOM.setStyle(_151,"height",_157+"px");}},b4MouseDown:function(e){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");},toString:function(){return ("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(id,_160,_161){if(id){this.initTarget(id,_160,_161);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return ("DDTarget "+this.id);}});
-YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded',_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,setProgId:function(id)
-{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
-{this._use_default_post_header=b;},setPollingInterval:function(i)
-{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
-{var obj,http;try
-{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
-catch(e)
-{for(var i=0;i=200&&httpStatus<300){try
-{responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
-else{callback.success.apply(callback.scope,[responseObject]);}}}
-catch(e){}}
-else{try
-{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
-else{callback.failure.apply(callback.scope,[responseObject]);}}
-break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
-else{callback.failure.apply(callback.scope,[responseObject]);}}}}
-catch(e){}}
-this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
-{var obj={};var headerObj={};try
-{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i ');if(typeof secureUri=='boolean'){io.src='javascript:false';}
-else if(typeof secureURI=='string'){io.src=secureUri;}}
-else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
-io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData)
-{var formElements=new Array();var postMessage=postData.split('&');for(var i=0;i0){try
-{for(var i=0;i-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}if(propertyCache[property]){return propertyCache[property];}while(patterns.HYPHEN.exec(property)){property=property.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}propertyCache[property]=property;return property;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}return val/100;break;default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}break;default:el.style[property]=val;}};}else{setStyle=function(el,property,val){el.style[property]=val;};}YAHOO.util.Dom={get:function(el){if(!el){return null;}if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.util.CustomEvent=function(_1,_2,_3,_4){this.type=_1;this.scope=_2||window;this.silent=_3;this.signature=_4||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var _5="_YUICEOnSubscribe";if(_1!==_5){this.subscribeEvent=new YAHOO.util.CustomEvent(_5,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_7,_8){if(this.subscribeEvent){this.subscribeEvent.fire(fn,_7,_8);}this.subscribers.push(new YAHOO.util.Subscriber(fn,_7,_8));},unsubscribe:function(fn,_9){var _10=false;for(var i=0,len=this.subscribers.length;i0){_17=_14[0];}ret=s.fn.call(_16,_17,s.obj);}else{ret=s.fn.call(_16,this.type,_14,s.obj);}if(false===ret){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i=0){_60=_23[_61];}if(!el||!_60){return false;}if(this.useLegacyEvent(el,_59)){var _62=this.getLegacyIndex(el,_59);var _63=_26[_62];if(_63){for(i=0,len=_63.length;i0);}var _76=[];for(var i=0,len=_28.length;i0){for(var i=0,len=_23.length;i0){j=_23.length;while(j){index=j-1;l=_23[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}j=j-1;}l=null;EU.clearCache();}for(i=0,len=_25.length;i0)?val:0;}YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();(function(){var _1=YAHOO.util.Event;var _2=YAHOO.util.Dom;YAHOO.util.DragDrop=function(id,_4,_5){if(id){this.init(id,_4,_5);}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=_2.get(this.id);}return this._domRef;},getDragEl:function(){return _2.get(this.dragElId);},init:function(id,_9,_10){this.initTarget(id,_9,_10);_1.on(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,_11,_12){this.config=_12||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.id=id;this.addToGroup((_11)?_11:"default");this.handleElId=id;_1.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(_13,_14,_15,_16){if(!_14&&0!==_14){this.padding=[_13,_13,_13,_13];}else{if(!_15&&0!==_15){this.padding=[_13,_14,_13,_14];}else{this.padding=[_13,_14,_15,_16];}}},setInitPosition:function(_17,_18){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}var dx=_17||0;var dy=_18||0;var p=_2.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||_2.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(_24){this.groups[_24]=true;this.DDM.regDragDrop(this,_24);},removeFromGroup:function(_25){if(this.groups[_25]){delete this.groups[_25];}this.DDM.removeDDFromGroup(this,_25);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}_1.on(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){_1.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return (this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var _27=e.which||e.button;if(this.primaryButtonOnly&&_27>1){return;}if(this.isLocked()){return;}this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(_1.getPageX(e),_1.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var _29=_1.getTarget(e);return (this.isValidHandleChild(_29)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_29,this.id)));},addInvalidHandleType:function(_30){var _31=_30.toUpperCase();this.invalidHandleTypes[_31]=_31;},addInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(_32){this.invalidHandleClasses.push(_32);},removeInvalidHandleType:function(_33){var _34=_33.toUpperCase();delete this.invalidHandleTypes[_34];},removeInvalidHandleId:function(id){if(typeof id!=="string"){YAHOO.log("id is not a string, assuming it is an HTMLElement");id=_2.generateId(id);}delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(_35){for(var i=0,len=this.invalidHandleClasses.length;i