[Jifty-commit] r4464 - in jifty/branches/prototype-1.6: . bin lib
lib/Jifty lib/Jifty/Filter lib/Jifty/Plugin
lib/Jifty/Plugin/Chart/Renderer lib/Jifty/Test/WWW
lib/Jifty/View lib/Jifty/View/Declare lib/Jifty/Web/Form
share/web/static/js share/web/static/js/scriptaculous t
t/TestApp-Plugin-OnClick/share/web/templates
t/TestApp-Plugin-OnClick/t t/TestApp/lib/TestApp/Model t/TestApp/t
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Nov 19 11:53:20 EST 2007
Author: clkao
Date: Mon Nov 19 11:53:17 2007
New Revision: 4464
Added:
jifty/branches/prototype-1.6/t/TestApp/lib/TestApp/Model/OtherThingy.pm
jifty/branches/prototype-1.6/t/TestApp/lib/TestApp/Model/Thingy.pm
jifty/branches/prototype-1.6/t/TestApp/t/19-rightsfrom.t
Removed:
jifty/branches/prototype-1.6/bin/generate-changelog
jifty/branches/prototype-1.6/bin/sort-changelog
Modified:
jifty/branches/prototype-1.6/ (props changed)
jifty/branches/prototype-1.6/AUTHORS
jifty/branches/prototype-1.6/Changelog
jifty/branches/prototype-1.6/MANIFEST
jifty/branches/prototype-1.6/META.yml
jifty/branches/prototype-1.6/Makefile.PL
jifty/branches/prototype-1.6/SIGNATURE
jifty/branches/prototype-1.6/lib/Jifty.pm
jifty/branches/prototype-1.6/lib/Jifty/ClassLoader.pm
jifty/branches/prototype-1.6/lib/Jifty/Collection.pm
jifty/branches/prototype-1.6/lib/Jifty/Everything.pm
jifty/branches/prototype-1.6/lib/Jifty/Filter/DateTime.pm
jifty/branches/prototype-1.6/lib/Jifty/JSON.pm
jifty/branches/prototype-1.6/lib/Jifty/LetMe.pm (props changed)
jifty/branches/prototype-1.6/lib/Jifty/Plugin/Chart/Renderer/XMLSWF.pm
jifty/branches/prototype-1.6/lib/Jifty/Plugin/CompressedCSSandJS.pm
jifty/branches/prototype-1.6/lib/Jifty/Plugin/Feedback/Action/SendFeedback.pm
jifty/branches/prototype-1.6/lib/Jifty/Record.pm
jifty/branches/prototype-1.6/lib/Jifty/RightsFrom.pm
jifty/branches/prototype-1.6/lib/Jifty/Test.pm
jifty/branches/prototype-1.6/lib/Jifty/Test/WWW/Selenium.pm
jifty/branches/prototype-1.6/lib/Jifty/View/Declare.pm
jifty/branches/prototype-1.6/lib/Jifty/View/Declare/Handler.pm
jifty/branches/prototype-1.6/lib/Jifty/View/Declare/Helpers.pm
jifty/branches/prototype-1.6/lib/Jifty/Web/Form/Element.pm
jifty/branches/prototype-1.6/share/web/static/js/jifty.js
jifty/branches/prototype-1.6/share/web/static/js/prototype.js
jifty/branches/prototype-1.6/share/web/static/js/scriptaculous/effects.js
jifty/branches/prototype-1.6/t/01-dependencies.t
jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/share/web/templates/content.html
jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/share/web/templates/onclick.html
jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/t/onclick.t
jifty/branches/prototype-1.6/t/TestApp/lib/TestApp/Model/User.pm
jifty/branches/prototype-1.6/t/TestApp/t/11-current_user.t
jifty/branches/prototype-1.6/t/TestApp/t/before_access.t
Log:
- Merge /bps/jifty/jifty/trunk to /bps/jifty/jifty/branches/prototype-1.6
Modified: jifty/branches/prototype-1.6/AUTHORS
==============================================================================
--- jifty/branches/prototype-1.6/AUTHORS (original)
+++ jifty/branches/prototype-1.6/AUTHORS Mon Nov 19 11:53:17 2007
@@ -33,3 +33,4 @@
Shawn M Moore <sartak at gmail.com>
Edward Funnekotter <efunneko at gmail.com>
Cornelius Lin <c9s at aiink.com>
+Todd Chapman <todd at chaka.net>
Modified: jifty/branches/prototype-1.6/Changelog
==============================================================================
--- jifty/branches/prototype-1.6/Changelog (original)
+++ jifty/branches/prototype-1.6/Changelog Mon Nov 19 11:53:17 2007
@@ -1,3 +1,696 @@
+Jifty 0.71116
+
+I18N
+====
+
+ * Delay i18n handle init until we have session. SkeletonApp dispatcher rule
+ to set language in session. - clkao
+
+ * I18N plugin: log when user is somehow able to pass in disallowed lang.
+ inline the initial dictionary json. - clkao
+
+ * I18N: load json dict from absolute path. - clkao
+
+ * I18N::Action::SetLang: scalar::defer is trigger some oddness, rewrite
+ available languages as normal runtime code, and cached. - clkao
+
+ * I18n: fix json dictionary fallback. - clkao
+
+ * Jifty::I18N - POD fixup. - audreyt
+
+ * Jifty::I18N: Implement the L10N.AllowedLang key to limit the set of
+ languages available to the user. Use case: ja.po is incomplete and we wish
+ to hide it from users. Requested by: clkao - audreyt
+
+ * Jifty::I18N: provide available_languages method. - clkao
+
+ * Jifty::I18N::promote_encoding - r4286 by yours truly broke auto- decoding
+ for POST requests. This is a better fix to avoid the "Unquoted / not
+ allowed in Content-Type" warning (which arugably is a
+ Email::MIME::ContentType glitch), by scanning the Content- Type header for
+ the substring "charset" before parsing it. This way, when "charset" is not
+ found in that header, we still fallback to Encode::Guess, regardless of
+ whether the request was of type "multipart/form-data". - audreyt
+
+ * Jifty::I18N::promote_encoding: Multi-part form data have no notion of
+ charsets, so we return the string verbatim here, to avoid the "Unquoted /
+ not allowed in Content-Type" warnings when the Base64- encoded MIME
+ boundary string contains "/". Prompted by this Content- Type header found
+ in real world: multipart/form-data; boundary=----
+ WebKitFormBoundaryRqXyEnBQ/5VSsexe which triggered this error: --
+ 2007/10/22 04:19:30 WARN> Carp.pm:46 Carp::carp Unquoted / not allowed in
+ Content-Type! at /usr/local/lib/perl5/site_perl/5.9.5/Jifty/I18N.pm line
+ 226 -- 2007/10/22 04:19:30 WARN> Carp.pm:46 Carp::carp Illegal Content-
+ Type parameter /5VSsexe at
+ /usr/local/lib/perl5/site_perl/5.9.5/Jifty/I18N.pm line 226 - audreyt
+
+ * Jifty::Plugin::I18N: provides SetLang action. provides loc.js and other
+ facilities to l10n your javascript along with po. - clkao
+
+ * Provide get_current language method in Jifty::I18N. - clkao
+
+ * Support serving json version of po and localization in javascript
+ space. - clkao
+
+ * Update zh-tw po to include translations for authentication::password
+ plugin. - clkao
+
+ * allow switching current language for Localization. - clkao
+
+ * bin/jifty po now takes two more options: --dir for additional directories
+ to look at so javascript files can be scanned. --js for generating json
+ dictionaries for messages appeared in javascript files declared with
+ Jifty::Web. - clkao
+
+ * loc.js cleanups. - clkao
+
+ * updated ja.po - ishigaki
+
+ * zh_tw l10n for Authenication::Password plugin. - clkao
+
+BUGFIX
+======
+
+ * Added missing jifty-result-popup div to the page detritus section of
+ Jifty::View::Declare::Page. - sterling
+
+ * Allow users to name their apps in lowercase (as pragmas ?!). Reported by
+ SteveH++ - jesse
+
+ * Bring the default back, but at 0.0.0 to prevent uninitialized complaints.
+ - sterling
+
+ * Class::Accessor::Fast cleanups - jesse
+
+ * Clean up Jifty::Web initialization a bit. - jesse
+
+ * Clean up the masonXXXXXXXXXX temp directory after each test run. - sterling
+
+ * Do not do clever & broken input_name for buttons when preserve_state is
+ false. - clkao
+
+ * Don't do weird things with loading model subclasses - jesse
+
+ * Don't override object_type if the CRUD view package already defines
+ object_type. - sterling
+
+ * Fix compatibility with Test::WWW::Mechanize - jesse
+
+ * Fix mismerge.. - sartak
+
+ * Fixes to several of my fixes for
+ Jifty::Request::load_from_data_structure - jesse
+
+ * Fixing a bug that prevents any but the first plugin being checked for
+ schema updates. - sterling
+
+ * Fixing a typo in the plugin DB version metadata key affecting upgrades.
+ - sterling
+
+ * Horrible Hash::Merge workaround, part 2 - alexmv
+
+ * Improving schema setup for plugins that are turned on after the application
+ is initially deployed. - sterling
+
+ * Jifty::Request::Mapper - Avoid uninitialized warnings when
+ $args{destination} ends up undefined. - audreyt
+
+ * Make sure Jifty::Filter::DateTime doesn't disturb Floating datetimes
+ Otherwise, dates would get set to the current_user's timezone, throwing a
+ wrench in the works - sartak
+
+ * Menu class is undef by default; fall back to the empty string - alexmv
+
+ * Minor edit: fixing reference to Jifty::Request::Action to Jifty::Action
+ - sterling
+
+ * Pg wants to connect to template1, but CREATE DATABASE foo TEMPLATE
+ template0 - alexmv
+
+ * Plugin upgrade incorrectly assumes a DB version of 0.0.1 when none is
+ found. - sterling
+
+ * Rather than helpfully failing to load model classes that have
+ compiletime errors, actually die with the error that caused the class
+ not to load. - jesse
+
+ * Remove debug info. - clkao
+
+ * Remove debugging statement - alexmv
+
+ * Removing the display style from the jifty-result-popup, which is breaking
+ it. - sterling
+
+ * Revert clkao's fixes for now because they break apps :/ - sartak
+
+ * Revert r4117 as the element readiness state is not compatible with what it
+ was. - clkao
+
+ * Reverting the addition of these files which were added by a push error.
+ - sterling
+
+ * Some databases have schema creation single-threadedness. If they block,
+ wait and retry for up to a minute - jesse
+
+ * Some parts of that last commit to use only one Module::Pluggable weren't as
+ hot as they appeared to be; - jesse
+
+ * The JIFTY_SITE_CONFIG environment variable was silently ignored. - audreyt
+
+ * Undoing 4302. There is such a class. Thanks to chmrr. - sterling
+
+ * Undoing previous accidental patch to Jifty::Continuation because I have not
+ finished proofing it. - sterling
+
+ * Use ->clone on DateTime objects to avoid possible DST issues, etc - sartak
+
+ * Use blessed() instead of ref() to keep an if statement from tripping on
+ ->isa(). - sterling
+
+ * We depend on the bugfix that
+ File::Spec->rel2abs("/foo","/foo") eq "." - alexmv
+
+ * When it's a ::Create action, $event_info won't have a record_id there,
+ cause a fatal error when it's published latter. - gugod
+
+ * When loading a web request from a data structure, don't totally throw away
+ the path it was requested at. - jesse
+
+ * Work around a "feature" in Hash::Merge < 0.10 - alexmv
+
+ * carp, don't warn, for a "title" Mason/TD warning - sartak
+
+ * collection generator may be called when we're loading models and not all
+ models have been loaded to the moment, so we have to try to require the
+ model before testing if it esists. - ruz
+
+ * don't gen a collection class if there is no model - ruz
+
+ * don't warn if database doesn't exist when dropping database - sunnavy
+
+ * friendly_date should be relative to the user, not floating - sartak
+
+ * no need to print STDERR, we can warn in $SIG{__WARN__} - sunnavy
+
+ * oops, should look for js files under js. - clkao
+
+ * our version of prototype can't deal with synchronous request. - clkao
+
+ * revert changes to ClassLoader. Collection classes are failing to be
+ generated in some TD views - falcone
+
+ * rollback r4242 which cached the gzipped js/css even through develmode
+ reload. - clkao
+
+ * tabview shouldn't force absolute paths to relative ones - jesse
+
+ * warnings should be to STDERR - sunnavy
+
+ * we want to compute UUIDs every time. really. it's not useful to always have
+ the same uuid - jesse
+
+ * webservices_rediret: don't redirect if there's any failed action. - clkao
+
+CORE
+====
+
+ * Add Jifty::DateTime::from_epoch which does our usual timezone magic, use
+ set_current_user_timezone more, too - sartak
+
+ * Add Jifty::Util->is_app_root to determine whether a path looks enough like
+ the app root - sartak
+
+ * Add a 'now' method to Jifty::DateTime which sets the timezone to the
+ current user's timezone. DateTime::now passes time_zone => UTC to
+ Jifty::DateTime::now, which caused it to skip over the currentuser/timezone
+ magic. - sartak
+
+ * Add a ForwardCompatible config in Database section. The usecase is that
+ when you switch your checkout to something with older version of app
+ schema, you can declare it is compatiable with the future version that is
+ currently in db. - clkao
+
+ * Add a Jifty::DateTime set_current_user_timezone method - sartak
+
+ * Add the ability for apps to have very fine-grained testing (such as
+ overriding config for a subdir of t/, or even a particular test file).
+ Still needs tests and I suppose some more doc :) - sartak
+
+ * Added the ability to craft a Jifty button with a "submit" link which
+ submits hardcoded arguments. - jesse
+
+ * Change how plugin is initialized so _pre_init is actually noted. - clkao
+
+ * Don't require recipients in Jifty::Notificaiton be objects. - clkao
+
+ * Finalize triggers if possible (supported in forthcoming Class::Trigger
+ release). Override JDBI's default of having refers_to null return undef,
+ instead of object with no id. RightsFrom 'foo_id' should work like
+ RightsFrom 'foo' - alexmv
+
+ * Fix the problem of tests having both config and a correctly-relative $0
+ Jifty::SubTest now makes available the old Cwd (which as 03-nosubtest
+ demonstrates doesn't break apps that don't use Jifty::SubTest) Also a bit
+ of doc in Jifty::Config The Feature is Done. :) - sartak
+
+ * Fixes to not cache compressed css+js while in devel mode. Refactoring js
+ compression code into the plugin where it belongs. - jesse
+
+ * Get rid of another place where we had a custom accessor that meant
+ 'arguments' - for great consistency - jesse
+
+ * In Jifty::DateTime->new, set the timezone to floating if it looks like just
+ a date - sartak
+
+ * Initial implementation of Jifty::Test::WWW::Declare, with basic tests in
+ TestApp - sartak
+
+ * Just a perltidy - alexmv
+
+ * Make action_arguments effective from js update() - clkao
+
+ * Making the as_*_action() methods accept a paramhash for additional
+ new_action() parameters. - sterling
+
+ * New as_string method for Jifty::Web::Form::Link. - clkao
+
+ * Override T:W:D's get with ours which prepends the server's URL Start
+ documentation - sartak
+
+ * Recursively transform content structures. Set a flag when we change the
+ method, in case apps care - alexmv
+
+ * Remove the unused drop-column logic from jifty schema --setup, since
+ ->columns returns only active cols - sartak
+
+ * Ripping out new_record_action() from Jifty::Web. Re-implementing it as
+ as_create_action(), as_update_action(), as_delete_action, and
+ as_search_action() in Jifty::Record and Jifty::Collection. - sterling
+
+ * Test config loading is now complete code-wise :) And it has tests now too!
+ Just need to doc it in manual or Jifty::Config - sartak
+
+ * Untabify - alexmv
+
+ * Updated the JSON and YAML transports for web service requests to allow
+ complex data structures in actions - jesse
+
+ * Updating the Jifty web menu component to respect classes added by
+ users - jesse
+
+ * allow onsubmit in form to include custom javascript. - clkao
+
+ * if refers_to is not mandatory field then add 'no_value' option to
+ select box - ruz
+
+ * merged prototype-1.6 to trunk - sunnavy
+
+ * use object calls instead of instance calls. use better handling of roots
+ so server relative paths work as expected unless you're bind to a
+ location - ruz
+
+ * working toward onclick => { submit => { action => $action, arguments
+ => { foo => 'value', bar => 'other value'} }} Jifty's js still needs
+ help - jesse
+
+CRUD
+====
+
+ * added a bit more semantic markup to the crud view - jesse
+
+DOC
+===
+
+ * A lot of POD for OAuth, and some tiny fixes elsewhere - sartak
+
+ * Add a Jifty::Manual which lists each of the manuals with a short
+ description. Secret confession: I was tired of perldoc Jifty::Manual::<tab>
+ failing :) - sartak
+
+ * Added a synopsis and license section to docs. - sterling
+
+ * Adding a description to Jifty::Everything docs. - sterling
+
+ * Adding another CRUD setup example to the synopsis. - sterling
+
+ * Adding documentation for Action and Static attributes to resolve POD
+ coverage test failures. - sterling
+
+ * Another example app: ShrinkURL, which is basically (surprise!)
+ tinyurl - sartak
+
+ * Clean up the Pod, added a Synopsis, added a Why? section, added code
+ comments, and some code tidying. - sterling
+
+ * Cleaning up documentation to fix pod coverage test failures. - sterling
+
+ * Doc - sartak
+
+ * Fix Jifty::Server::Prefork's document so it mentions Net::Server::PreFork,
+ instead of Net::Server::Prefork. (Yes this is very confusing.) - audreyt
+
+ * Fix package names, add copyright notices - sartak
+
+ * Fixing POD coverage errors in the AutoReference plugin. - sterling
+
+ * Fixing pod coverage problems with the jQuery plugin. - sterling
+
+ * Improving POD and minor tidying. - sterling
+
+ * Include the http method (GET, POST, etc) in the debug message - sartak
+
+ * Jifty::Notification - Minor doc fix - The html_body method was misspelled
+ as html-body. - audreyt
+
+ * More comments - sartak
+
+ * POD clean-up, some code commenting, and minor tidying. - sterling
+
+ * POD for LeakTracker's subs - sartak
+
+ * POD re-wrapping. perltidy. Use Jifty::DBI's new ->_new_record_args and
+ _new_collection_args. Bump the JDBI dep accordingly - alexmv
+
+ * SendFeedback.pm: Take away the phrase "hiveminder" from the
+ documentation. - audreyt
+
+ * Simplifying the CRUD code for generating the record_class and making it
+ more flexible. Adding a stub for CRUD testing. - sterling
+
+ * a tiny change and typo fix - sunnavy
+
+ * doc fixes - sunnavy
+
+ * pod fixes - jesse
+
+ * tiny typo fix - sunnavy
+
+ * typo fix - sunnavy
+
+ * updated my email address in AUTHORS to agentzh at agentzh.org - agentz
+
+INSTALL
+=======
+
+ * Add changelogger dependencies - sartak
+
+ * Added requirement for URI 1.31, which adds uri_escape_utf8(). - sterling
+
+ * Adding File::Temp 0.15 requirement for cleanup(). - sterling
+
+ * Bump JDBI dep to 0.45 (Filter::DateTime changes) - sartak
+
+ * Force a clone which doesn't have as many bugs - alexmv
+
+ * Jifty::DBI now uses Class::Trigger instead of Jifty::DBi::Class::Trigger
+ (since rev3968) - ishigaki
+
+ * Make Test::WWW::Declare an optional dep for now - sartak
+
+ * Modules other than Net::OAuth::Request in Net-OAuth distro don't have
+ version - ishigaki
+
+ * Move memleak deps into its own Makefile.PL section - sartak
+
+ * Removing Test::Log4perl. It isn't used anywhere anymore. - sterling
+
+ * Require Net::OAuth 0.04 because 0.03 needs my patch. Don't run tests if
+ Net::OAuth is uninstalled - sartak
+
+ * added Test::Log4perl dep again; it is surely used at t/TestApp/t/02-dispatch-show-rule-in-wrong-
+ ruleset.t - ishigaki
+
+ * older Email::LocalDelivery is buggy. - clkao
+
+ * require CSS::Squish 0.07, no need to call _resolve_file any more - sunnavy
+
+ * we need DateTime::Locale - sunnavy
+
+MISC
+====
+
+ * A command line completion script is added into contrib/ - c9s
+
+ * Add 'performance' tag to sort-changelog - sartak
+
+ * Add another changelog sorting program, this one I think works a bit better
+ :) - sartak
+
+ * Remove bin/*-changelog, as they've been moved into their own dist, App-
+ Changelogger - sartak
+
+ * Sort change groups by header, typo fix - sartak
+
+ * add a bug tag - falcone
+
+ * add an exclude command for logs you don't need to ship - falcone
+
+ * fix so we don't try to print to a bogus filehandle - falcone
+
+ * make format_entry return text rather than printing. use the returned
+ message to generate the changelog rather than printing to STDOUT - falcone
+
+ * remove doubled loop over log messages. explicitly loop over
+ uncategorized first, then offer the user to review all the changes
+ again. reformatting - falcone
+
+ * talk about how to do iterative editing - falcone
+
+ * usage documentation - falcone
+
+ * use existing t-discard tag. don't autoskip things, just group them together
+ and you can delete them - falcone
+
+PERFORMANCE
+===========
+
+ * The cache was actually a huge performance problem - jesse
+
+ * Use much less UNIVERSAL::require (to shave a second or two off start
+ times) - jesse
+
+ * When replacing a region, use the technique described in
+ http://blog.stevenlevithan.com/archives/faster-than-innerhtml to improve
+ performance. - clkao
+
+ * Cache gzipped output from the compressedcssandjs plugin - jesse
+
+ * Fix a bug that after you access a static css file, it breaks the compressed
+ css by not actually squishing main.css, hence requests static css files
+ under __jifty/css. - clkao
+
+ * In Jifty::Model::Session: Turn session_id, data_key, key_type into
+ case_sensitive, so we don't do useless tolower on loading sessions. index
+ session_id by default. - clkao
+
+ * Switch to a single call to Module::Pluggable to help improve startup
+ performance. - jesse
+
+PLUGIN
+======
+
+ * Add an additional trigger in Clickable for SinglePage to filter out state
+ variables for region-__page. - clkao
+
+ * Add cdn option to CompressedCSSandJS plugin. - clkao
+
+ * Add new LeakDetector plugin. It kinda sorta works :) - sartak
+
+ * Added a new plugin that provides an autocomplete widget specially for
+ record references. Helpful in cases when a select is just be too big to
+ contemplate. - sterling
+
+ * Adding missing JavaScript file and cleaning up a method left-over from
+ testing. - sterling
+
+ * Expanded the previous fix to cover sticky values and the initial value in
+ the input tag. - sterling
+
+ * Fix it so that AutoReference fields show the _brief_description rather than
+ the id in read mode. - sterling
+
+ * Fixed AutoReference so that it is possible to set the field to empty if not
+ mandatory. - sterling
+
+ * Fixed a problem where AutoReference breaks in Search actions. - sterling
+
+ * Fixed the feedback plugin so it works even if the current user doesn't have
+ permission to read their own email. - chapman
+
+ * Fixing the data fetcher on the AutoReference box so that it sends the text
+ being typed rather than the current value in the hidden field. - sterling
+
+ * Get rid of spurious warning in Auth::Password plugin - sartak
+
+ * Handle region redirect with continuation return (for spa). - clkao
+
+ * Implement callback URLs and test them - sartak
+
+ * Include the list of object types leaked in the request report - sartak
+
+ * Make find_plugins() sensitive to wantarray. - sterling
+
+ * Many improvements, including some pages - sartak
+
+ * Modified the JS to ignore the [id:1] text at the end of the references.
+ - sterling
+
+ * More cleanup, hide zero-leak requests by default - sartak
+
+ * More fixes to get protected resource requests going. We might need a
+ WWW::Mechanize::OAuth subclass, so that each get/post will be properly
+ wrapped as an OAuth request - sartak
+
+ * Move files from LeakDetector to LeakTracker (because that's the term Cat
+ uses) - sartak
+
+ * Name the first Jifty->new during test 'pre_init', and tell plugins not to
+ register triggers just yet to avoid duplicated triggers. - clkao
+
+ * Now we send responses to token requests (and test them) What's left:
+ Authorizing request tokens is coded, but it's slightly flawed somehow
+ Getting access tokens is coded, but not tested No code yet for the actual
+ accessing of resources - sartak
+
+ * Patch by Alex to make sp_submit_form to be happier with J:V vars. - clkao
+
+ * Provide an after_include_javascript for plugins to do javascript
+ initialisation. - clkao
+
+ * Refactor timestamp and nonce out of tokens and into consumers. Thanks to
+ hannesty for discussing how it should work - sartak
+
+ * Some cleanups in LeakDetector - sartak
+
+ * Some more fleshing out of the OAuth plugin - sartak
+
+ * Somehow this file got duplicated. I might've done it. shrug - sartak
+
+ * Start adding an OAuth plugin - sartak
+
+ * Start writing tests Change timestamp to (ugh) time_stamp, because timestamp
+ is a reserved word in a few SQL apps - sartak
+
+ * The REST dispatcher should warn $@ if an error occurs - sartak
+
+ * Turns out we can't (so easily) have the URLs be configurable. Not too much
+ of a problem though Other fixes - sartak
+
+ * Users can now authorize/deny request tokens - sartak
+
+ * Various improvements of try_oauth so it gets further (but not all the way)
+ in the correct codepath - sartak
+
+ * Various refactors and cleanups Request tokens are now properly set to
+ "used" Life of a request token lengthened on authorize Fixed duplicate
+ timestamp/nonce check (and test) - sartak
+
+ * Whoops, committed in a subdirectory - sartak
+
+ * Whoops, the consumer and user were using the same mech. But fixing that
+ didn't break anything :) - sartak
+
+ * actormetadata: provide a current_user_is_owner method. - clkao
+
+ * default not to preserve state when spa is replacing __page - clkao
+
+ * simplify ccjs plugin with static handler method call. - clkao
+
+ * spa: don't translate javascript: links. - clkao
+
+ * tabview: fix the logic for defered tabs. - clkao
+
+TESTING
+=======
+
+ * Add (grr, passing) tests for setting columns in the test app - sartak
+
+ * Add TestMode: 1 to the default test config - sartak
+
+ * Add some more tests for Jifty::DateTime in the TestApp - sartak
+
+ * Begin adding tests for protected resource requests - sartak
+
+ * Clearing out old new_record_action() tests. - sterling
+
+ * Correctly skip OAuth tests in the absence of Net::OAuth - sartak
+
+ * Dispatcher and config fixes, start adding a new test file - sartak
+
+ * Expand the tests, now they actually test something real! So right now the
+ OAuth plugin is rejecting a few kinds of bad requests (e.g. unknown
+ consumer) while accepting a good request. Now to make more requests of each
+ type :) - sartak
+
+ * First cut of Selenium testing support in Jifty. - clkao
+
+ * Fix test count - alexmv
+
+ * Fixing long-broken support for the "JIFTY_FASTTEST" env variable - jesse
+
+ * Mailboxes need to have unique names for parallel testing - alexmv
+
+ * More tests, start implementing callbacks, but failing :) - sartak
+
+ * Most AccessToken tests done :) first implementation was right on - sartak
+
+ * Refactor the tests - sartak
+
+ * Skip OAuth tests if Crypt::OpenSSL::RSA is unavailable RSA should be
+ optional, will fix later - sartak
+
+ * The first few test scripts are now complete, and uncovered many bugs.
+ Yay. - sartak
+
+ * When testing, don't just use a single global test database. Instead, use
+ one per testfile. This allows some measure of parallelization - jesse
+
+ * Wrote most of the authorization tests - sartak
+
+ * added TestApp-Plugin-OnClick, initially for the update of
+ prototype.js - sunnavy
+
+ * clean dependency test since changelogger has been moved out - sunnavy
+
+ * first cut of tests for singlepage app plugin. - clkao
+
+ * my computer is slow. be more patient about selenium rc startup. - clkao
+
+ * not dep test for bin/sort-changelog - sunnavy
+
+ * only run pod coverage tests if you're a developer - jesse
+
+ * refactor Jifty::Test a bit - sunnavy
+
+ * support SELENIUM_RC_TEST_AGAINST and SELENIUM_RC_BROWSER environment
+ variable, and allow args to be passed into selenium rc invoker. - clkao
+
+VIEW
+====
+
+ * <embed> isn't a tag which gets a close on it - alexmv
+
+ * Add a hook to change a menu item's label - sartak
+
+ * Add support for "title" attribute on elements, which shows tooltips -
+ sartak
+
+ * Added an app_page_footer page call to jifty view declare page - jesse
+
+ * Additional selector to make sure that autocomplete hides .hidden_value on
+ .inline forms. - sterling
+
+ * In TD View handler, don't just return without printing headers if the
+ response content is empty, as when you access /__jifty/empty. - clkao
+
+ * Making Jifty::Web::Menu more extensible. - sterling
+
+ * Upgrade a region error from a debug to a warning. - jesse
+
+
+
+
+
Jifty 0.70824
INSTALL
Modified: jifty/branches/prototype-1.6/MANIFEST
==============================================================================
--- jifty/branches/prototype-1.6/MANIFEST (original)
+++ jifty/branches/prototype-1.6/MANIFEST Mon Nov 19 11:53:17 2007
@@ -1,11 +1,11 @@
AUTHORS
bin/build_par
-bin/generate-changelog
bin/jifty
bin/runcover
bin/service
bin/xgettext
Changelog
+contrib/jifty_completion.sh
debian/changelog
debian/compat
debian/control
@@ -93,6 +93,13 @@
examples/Ping/share/web/templates/index.html
examples/Ping/t/00compile.t
examples/Ping/t/01startup.t
+examples/ShrinkURL/bin/jifty
+examples/ShrinkURL/etc/config.yml
+examples/ShrinkURL/lib/ShrinkURL/Action/CreateShrunkenURL.pm
+examples/ShrinkURL/lib/ShrinkURL/Dispatcher.pm
+examples/ShrinkURL/lib/ShrinkURL/Model/ShrunkenURL.pm
+examples/ShrinkURL/lib/ShrinkURL/View.pm
+examples/ShrinkURL/Makefile.PL
examples/Yada/bin/jifty
examples/Yada/etc/config.yml
examples/Yada/inc/Module/Install.pm
@@ -156,6 +163,7 @@
lib/Jifty/JSON.pm
lib/Jifty/LetMe.pm
lib/Jifty/Logger.pm
+lib/Jifty/Manual.pm
lib/Jifty/Manual/AccessControl.pod
lib/Jifty/Manual/Actions.pod
lib/Jifty/Manual/Continuations.pod
@@ -208,6 +216,8 @@
lib/Jifty/Plugin/Authentication/Password/Notification/ConfirmEmail.pm
lib/Jifty/Plugin/Authentication/Password/Notification/ConfirmLostPassword.pm
lib/Jifty/Plugin/Authentication/Password/View.pm
+lib/Jifty/Plugin/AutoReference.pm
+lib/Jifty/Plugin/AutoReference/Widget.pm
lib/Jifty/Plugin/Chart.pm
lib/Jifty/Plugin/Chart/Dispatcher.pm
lib/Jifty/Plugin/Chart/Renderer.pm
@@ -231,9 +241,22 @@
lib/Jifty/Plugin/GoogleMap.pm
lib/Jifty/Plugin/GoogleMap/Widget.pm
lib/Jifty/Plugin/Halo.pm
+lib/Jifty/Plugin/I18N.pm
+lib/Jifty/Plugin/I18N/Action/SetLang.pm
lib/Jifty/Plugin/JQuery.pm
+lib/Jifty/Plugin/LeakTracker.pm
+lib/Jifty/Plugin/LeakTracker/Dispatcher.pm
+lib/Jifty/Plugin/LeakTracker/View.pm
lib/Jifty/Plugin/LetMe.pm
lib/Jifty/Plugin/LetMe/Dispatcher.pm
+lib/Jifty/Plugin/OAuth.pm
+lib/Jifty/Plugin/OAuth/Action/AuthorizeRequestToken.pm
+lib/Jifty/Plugin/OAuth/Dispatcher.pm
+lib/Jifty/Plugin/OAuth/Model/AccessToken.pm
+lib/Jifty/Plugin/OAuth/Model/Consumer.pm
+lib/Jifty/Plugin/OAuth/Model/RequestToken.pm
+lib/Jifty/Plugin/OAuth/Token.pm
+lib/Jifty/Plugin/OAuth/View.pm
lib/Jifty/Plugin/OnlineDocs.pm
lib/Jifty/Plugin/OnlineDocs/Dispatcher.pm
lib/Jifty/Plugin/OpenID.pm
@@ -293,7 +316,9 @@
lib/Jifty/Subs.pm
lib/Jifty/Subs/Render.pm
lib/Jifty/Test.pm
+lib/Jifty/Test/WWW/Declare.pm
lib/Jifty/Test/WWW/Mechanize.pm
+lib/Jifty/Test/WWW/Selenium.pm
lib/Jifty/TestServer.pm
lib/Jifty/Upgrade.pm
lib/Jifty/Upgrade/Internal.pm
@@ -945,6 +970,7 @@
share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/fragments/list/view
share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/index.html
share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/model/dhandler
+share/plugins/Jifty/Plugin/AutoReference/web/static/js/autoreference.js
share/plugins/Jifty/Plugin/Chart/web/static/css/simple_bars.css
share/plugins/Jifty/Plugin/Chart/web/static/flash/xmlswf/charts.swf
share/plugins/Jifty/Plugin/Chart/web/static/flash/xmlswf/charts_library/arno.swf
@@ -974,6 +1000,7 @@
share/plugins/Jifty/Plugin/Chart/web/static/js/simple_bars.js
share/plugins/Jifty/Plugin/GoogleMap/web/static/css/google_map.css
share/plugins/Jifty/Plugin/GoogleMap/web/static/js/google_map.js
+share/plugins/Jifty/Plugin/I18N/web/static/js/loc.js
share/plugins/Jifty/Plugin/JQuery/web/static/js/jquery.js
share/plugins/Jifty/Plugin/JQuery/web/static/js/noConflict.js
share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/autohandler
@@ -1176,6 +1203,10 @@
t/TestApp-Plugin-Chart/Makefile.PL
t/TestApp-Plugin-Chart/t/chart.t
t/TestApp-Plugin-Chart/t/gd_graph.t
+t/TestApp-Plugin-CompressedCSSandJS/bin/jifty
+t/TestApp-Plugin-CompressedCSSandJS/etc/config.yml
+t/TestApp-Plugin-CompressedCSSandJS/Makefile.PL
+t/TestApp-Plugin-CompressedCSSandJS/t/css.t
t/TestApp-Plugin-JQuery/bin/jifty
t/TestApp-Plugin-JQuery/etc/config.yml
t/TestApp-Plugin-JQuery/Makefile.PL
@@ -1185,6 +1216,28 @@
t/TestApp-Plugin-News/lib/TestApp/Plugin/News/Model/News.pm
t/TestApp-Plugin-News/lib/TestApp/Plugin/News/View.pm
t/TestApp-Plugin-News/Makefile.PL
+t/TestApp-Plugin-OAuth/bin/jifty
+t/TestApp-Plugin-OAuth/etc/config.yml
+t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Dispatcher.pm
+t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Model/User.pm
+t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Test.pm
+t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/View.pm
+t/TestApp-Plugin-OAuth/Makefile.PL
+t/TestApp-Plugin-OAuth/t/00-test-setup.t
+t/TestApp-Plugin-OAuth/t/01-basic.t
+t/TestApp-Plugin-OAuth/t/02-request-token.t
+t/TestApp-Plugin-OAuth/t/03-authorize.t
+t/TestApp-Plugin-OAuth/t/04-access-token.t
+t/TestApp-Plugin-OAuth/t/05-protected-resource.t
+t/TestApp-Plugin-OAuth/t/id_rsa
+t/TestApp-Plugin-OAuth/t/id_rsa.pub
+t/TestApp-Plugin-OnClick/bin/jifty
+t/TestApp-Plugin-OnClick/etc/config.yml
+t/TestApp-Plugin-OnClick/Makefile.PL
+t/TestApp-Plugin-OnClick/share/web/templates/content.html
+t/TestApp-Plugin-OnClick/share/web/templates/content1.html
+t/TestApp-Plugin-OnClick/share/web/templates/onclick.html
+t/TestApp-Plugin-OnClick/t/onclick.t
t/TestApp-Plugin-PasswordAuth/bin/jifty
t/TestApp-Plugin-PasswordAuth/etc/config.yml
t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/FasterSwallow.pm
@@ -1209,11 +1262,21 @@
t/TestApp-Plugin-REST/t/00-prototype.t
t/TestApp-Plugin-REST/t/01-config.t
t/TestApp-Plugin-REST/t/02-basic-use.t
+t/TestApp-Plugin-SinglePage/bin/jifty
+t/TestApp-Plugin-SinglePage/etc/config.yml
+t/TestApp-Plugin-SinglePage/lib/TestApp/Plugin/SinglePage/Model/User.pm
+t/TestApp-Plugin-SinglePage/lib/TestApp/Plugin/SinglePage/View.pm
+t/TestApp-Plugin-SinglePage/Makefile.PL
t/TestApp/bin/jifty
+t/TestApp/etc/config.yml
+t/TestApp/etc/site_config.yml
t/TestApp/lib/TestApp/Action/DoSomething.pm
t/TestApp/lib/TestApp/Action/DoSomethingElse.pm
+t/TestApp/lib/TestApp/Action/SayHi.pm
t/TestApp/lib/TestApp/CurrentUser.pm
t/TestApp/lib/TestApp/Dispatcher.pm
+t/TestApp/lib/TestApp/Model/OtherThingy.pm
+t/TestApp/lib/TestApp/Model/Thingy.pm
t/TestApp/lib/TestApp/Model/User.pm
t/TestApp/lib/TestApp/Upgrade.pm
t/TestApp/lib/TestApp/View.pm
@@ -1261,11 +1324,20 @@
t/TestApp/t/15-template-subclass.t
t/TestApp/t/16-template-region.t
t/TestApp/t/17-template-region-internal-redirect.t
+t/TestApp/t/18-test-www-declare.t
+t/TestApp/t/19-rightsfrom.t
t/TestApp/t/before_access.t
t/TestApp/t/config-Cachable
t/TestApp/t/config-Record
+t/TestApp/t/config/01-basic.t
+t/TestApp/t/config/02-individual.t
+t/TestApp/t/config/02-individual.t-config.yml
+t/TestApp/t/config/03-nosubtest.t
+t/TestApp/t/config/test_config.yml
+t/TestApp/t/crud.t
t/TestApp/t/i18n-standalone.t
t/TestApp/t/instance_id.t
t/TestApp/t/regex_meta_in_path_info.t
+t/TestApp/t/test_config.yml
t/TestApp/t/upgrade.t
t/TestApp/t/use_mason_wrapper.t
Modified: jifty/branches/prototype-1.6/META.yml
==============================================================================
--- jifty/branches/prototype-1.6/META.yml (original)
+++ jifty/branches/prototype-1.6/META.yml Mon Nov 19 11:53:17 2007
@@ -53,13 +53,14 @@
Test::HTTP::Server::Simple: 0.02
Test::MockModule: 0.05
Test::MockObject: 1.07
+ Test::WWW::Declare: 0.01
WWW::Facebook::API: 0.3.6
XML::Simple: 0
requires:
App::CLI: 0.03
CGI: 3.19
CGI::Cookie::Splitter: 0
- CSS::Squish: 0.05
+ CSS::Squish: 0.07
Cache::Cache: 0
Calendar::Simple: 0
Class::Accessor: 0
@@ -75,8 +76,9 @@
Data::UUID: 0
Date::Manip: 0
DateTime: 0
+ DateTime::Locale: 0
Email::Folder: 0
- Email::LocalDelivery: 0
+ Email::LocalDelivery: 0.217
Email::MIME: 0
Email::MIME::ContentType: 0
Email::MIME::CreateHTML: 0
@@ -90,6 +92,7 @@
File::MMagic: 0
File::ShareDir: 0.04
File::Spec: 3.14
+ File::Temp: 0.15
HTML::Entities: 0
HTML::Lint: 0
HTML::Mason: 1.3101
@@ -103,7 +106,7 @@
IPC::PubSub: 0.23
IPC::Run3: 0
JSON::Syck: 0.15
- Jifty::DBI: 0.44
+ Jifty::DBI: 0.47
LWP::UserAgent: 0
Locale::Maketext::Extract: 0.20
Locale::Maketext::Lexicon: 0.60
@@ -128,7 +131,6 @@
Test::LongString: 0
Test::More: 0.62
Test::Pod::Coverage: 0
- Test::WWW::Declare: 0
Test::WWW::Mechanize: 1.04
Test::WWW::Selenium: 0
UNIVERSAL::require: 0
@@ -142,4 +144,4 @@
perl: 5.8.3
version: 0
tests: t/*.t t/*/*.t t/*/*/*.t t/*/*/*/*.t
-version: 0.70824
+version: 0.71116
Modified: jifty/branches/prototype-1.6/Makefile.PL
==============================================================================
--- jifty/branches/prototype-1.6/Makefile.PL (original)
+++ jifty/branches/prototype-1.6/Makefile.PL Mon Nov 19 11:53:17 2007
@@ -15,7 +15,7 @@
requires('Crypt::CBC');
requires('Crypt::Rijndael');
requires('Compress::Zlib');
-requires('CSS::Squish' => 0.05 );
+requires('CSS::Squish' => 0.07 );
requires('DBD::SQLite' => 1.11 );
requires('Data::Page');
requires('Data::UUID');
@@ -50,7 +50,7 @@
requires('Hook::LexWrap');
requires('IPC::PubSub' => '0.23' );
requires('IPC::Run3');
-requires('Jifty::DBI' => '0.45' ); # Jifty::DBI::Collection Jifty::DBI::Handle Jifty::DBI::Record::Cachable Jifty::DBI::SchemaGenerator
+requires('Jifty::DBI' => '0.47' ); # Jifty::DBI::Collection Jifty::DBI::Handle Jifty::DBI::Record::Cachable Jifty::DBI::SchemaGenerator
requires('Locale::Maketext::Extract' => '0.20');
requires('Locale::Maketext::Lexicon' => '0.60');
requires('Log::Log4perl' => '1.04');
Modified: jifty/branches/prototype-1.6/SIGNATURE
==============================================================================
--- jifty/branches/prototype-1.6/SIGNATURE (original)
+++ jifty/branches/prototype-1.6/SIGNATURE Mon Nov 19 11:53:17 2007
@@ -14,19 +14,19 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 17176d35b4f890942d4925d177aa5ee738bc8087 AUTHORS
-SHA1 cb3f86d393183a717f1a46f824c6aaf0d9aade49 Changelog
-SHA1 badc3476b33310cfcb8260c1fc108196acf5f54f MANIFEST
+SHA1 6f71fd6c08d5f693fa5da86b4d173b45d34106dd AUTHORS
+SHA1 4ac08eee20d796a783d41ea99614cfc74ebe4ffe Changelog
+SHA1 f653cf35f9324d8f9d4536bcc2af1df4205945cc MANIFEST
SHA1 d4adbf5948041cd460da5cb7ad21394a790e2022 MANIFEST.SKIP
-SHA1 64dceae5347277836a681070a3da49806f374db8 META.yml
-SHA1 7e06c5f49d98ac8808694f6b41246fdb0de5e564 Makefile.PL
+SHA1 371972007acfccc3a5ec7182d04d491d86584984 META.yml
+SHA1 f17cae18efd6d5cad8a22e33b2f551124d2d9979 Makefile.PL
SHA1 e395a2eabaf8faf8266dedc664c1eb52c6c589cf README
SHA1 aaf8f7a1025fc97077072672f325e2a5f3c03a41 bin/build_par
-SHA1 36c2486a0102933488558d0734b9e222d53a059b bin/generate-changelog
SHA1 c1ff9ff7f2a88bc4306b3866b6b80fb9aa8e8423 bin/jifty
SHA1 bc5d0dc181bffe0694e5282c2d2336eaec5a06ff bin/runcover
SHA1 9a91a81e3db1a12368153fed9e504aad492cd971 bin/service
SHA1 543a2677f66d3c8ca671b790509b6c1721ac6270 bin/xgettext
+SHA1 807b1f94b379fd537b780ecf43b0e6642ec00f4d contrib/jifty_completion.sh
SHA1 1c042485ba8a21f0f124dd8ed412d43d3805430e debian/README
SHA1 abd0bc47e8f6e42610dc1349564f9ab2a71d3857 debian/changelog
SHA1 5d9474c0309b7ca09a182d888f73b37a8fe1362c debian/compat
@@ -114,6 +114,13 @@
SHA1 05ac283a14e76750d63678d0864a0403aa18fd28 examples/Ping/share/web/templates/index.html
SHA1 53c8822ddf426e82fe239e4470574913411b1355 examples/Ping/t/00compile.t
SHA1 6d6c378447f9d74d53c06a2a027736b48b5d0670 examples/Ping/t/01startup.t
+SHA1 c291f424a0f57833ca391656383d3659ee30518f examples/ShrinkURL/Makefile.PL
+SHA1 c1ff9ff7f2a88bc4306b3866b6b80fb9aa8e8423 examples/ShrinkURL/bin/jifty
+SHA1 3167862eb1985f70a569077d4bdaabf2414e0be8 examples/ShrinkURL/etc/config.yml
+SHA1 f8e845578ba384150af148e1b5704ab67b79d365 examples/ShrinkURL/lib/ShrinkURL/Action/CreateShrunkenURL.pm
+SHA1 6c9d7448f280583d437ce45bfca5f6fa9e2a965f examples/ShrinkURL/lib/ShrinkURL/Dispatcher.pm
+SHA1 17c44063396555e73d65214d587b8231cdbed140 examples/ShrinkURL/lib/ShrinkURL/Model/ShrunkenURL.pm
+SHA1 d8b943e2fd860ac4215aec02cb86c95c4f859212 examples/ShrinkURL/lib/ShrinkURL/View.pm
SHA1 0d7b61a9ed50444ec98fd289965a8ce9b6d672bd examples/Yada/META.yml
SHA1 f3ef104950d63f97e7af2ed9bf7dc3f1cf2b80e2 examples/Yada/Makefile.PL
SHA1 f7f44f9a7337def0c97f981073e3ed970851d9ae examples/Yada/bin/jifty
@@ -148,35 +155,36 @@
SHA1 02af973fae2ac3531fa6b704574b2b8cb2a08148 inc/Module/Install/Win32.pm
SHA1 3a2eab96e91cca8d99938cda7791759ae9d97b3a inc/Module/Install/WriteAll.pm
SHA1 c17e8f3cf8ebe1eb4929fd2bd2fd530a9de1abd0 lib/Email/Send/Jifty/Test.pm
-SHA1 08ba4fd288d0a91c59a9c1995bf654123f7b7a7e lib/Jifty.pm
+SHA1 a53c6f6ca0bc2da57af6ce4f3b1c852d854c05e8 lib/Jifty.pm
SHA1 2d1948051cad65db5062c8f884ec42c85bd82ff1 lib/Jifty/API.pm
SHA1 0cc91932ee9cf2a93da8004bf4e170f5de391652 lib/Jifty/Action.pm
SHA1 14be4def02c11173c504eff60256df952b3c305f lib/Jifty/Action/Autocomplete.pm
-SHA1 6e368525e04d4733923682f9c314a0cde41c4f48 lib/Jifty/Action/Record.pm
+SHA1 c9e1cab1d36b20eb587baad7f99b98f03d564902 lib/Jifty/Action/Record.pm
SHA1 47d9ab2a7703960be292d141e69fc65c528deb1e lib/Jifty/Action/Record/Create.pm
SHA1 b5556afc5639dc3c5bd4ea8979ab6665ca6503d4 lib/Jifty/Action/Record/Delete.pm
SHA1 4f2fabd16d6e799b51e7161e488e71c9c608e32a lib/Jifty/Action/Record/Search.pm
-SHA1 165b1e15b83e1c34f8ec5a192b50e67b348ab7f5 lib/Jifty/Action/Record/Update.pm
+SHA1 ac1190edc6cdbc2eea3077448c60c53b1b5ce524 lib/Jifty/Action/Record/Update.pm
SHA1 90399bcddb1172f0c61a3fc357538ba08a3a8254 lib/Jifty/Action/Redirect.pm
SHA1 57f95b0fbfd55d09d079d7c200d3a2451764c40a lib/Jifty/Bootstrap.pm
-SHA1 92ed1f1ada38336b639ec0a7f519151ab3ec1fff lib/Jifty/ClassLoader.pm
-SHA1 9765c0412c127e3b7a35c49d5ad5ce4313ccd3b7 lib/Jifty/Client.pm
-SHA1 7ead6f337c0665069bfa9e58915e6f22ed83a16c lib/Jifty/Collection.pm
-SHA1 4d3c3b93ef230ce507de998fac9996037b4237b0 lib/Jifty/Config.pm
-SHA1 576f5ed38bf71febf19674e021c7ee919e38eff2 lib/Jifty/Continuation.pm
-SHA1 db9b2fcce2eba256349d6bdb5fb4a3c9b395ab0a lib/Jifty/CurrentUser.pm
-SHA1 2afb9e7c7bafe56dd12986ad99653880c5873a70 lib/Jifty/DateTime.pm
-SHA1 cef0407ef9bb8cf4c4e0ee349fdcb32046e7c216 lib/Jifty/Dispatcher.pm
+SHA1 cf0c59ed858cf62c324e5a2f1195c241ce1da93a lib/Jifty/ClassLoader.pm
+SHA1 c8f230dab4bb43b096a2e5ef90fb9f5f5810ebde lib/Jifty/Client.pm
+SHA1 f2dbb796ad56ace11459e428a823141049633878 lib/Jifty/Collection.pm
+SHA1 2030ddcc399cb097a3fd93b8cb399bbe32ffe9bb lib/Jifty/Config.pm
+SHA1 ece59049dead78c5de734ea9027299de419d1149 lib/Jifty/Continuation.pm
+SHA1 52767831d767d8b48aee80df53dc9a1eb4ced0e6 lib/Jifty/CurrentUser.pm
+SHA1 1ff73e9d244e21fcd1e0f851feede37f069d8281 lib/Jifty/DateTime.pm
+SHA1 efae9f981fcfda810181aee8fa8bf7d3bed372ff lib/Jifty/Dispatcher.pm
SHA1 e50bd211339e464cd5e17e05a12157e4f9bb5494 lib/Jifty/Event.pm
SHA1 a956a886b552b6abf1e8c1485297c1bb86ff438c lib/Jifty/Event/Model.pm
-SHA1 121cc604741f5a674cbbc2a55dfb6d4c8cf11bb8 lib/Jifty/Everything.pm
-SHA1 818bd0aa6afeb39bf96e0068fe3222c74133b4d8 lib/Jifty/Filter/DateTime.pm
-SHA1 53c0eb3380e3f1611866694a6e1294f3537f0d76 lib/Jifty/Handle.pm
-SHA1 886936781f71637eaf4e2f644032ba16194571e9 lib/Jifty/Handler.pm
-SHA1 24be261cc518d7d36bed0caebe79943b0e549b39 lib/Jifty/I18N.pm
-SHA1 fe370e2c51ca0f20cb0bce133b8c9067c02a524a lib/Jifty/JSON.pm
+SHA1 8052721bf1354b96fdc98f23b0bffa32595d514f lib/Jifty/Everything.pm
+SHA1 6357a183fc7b6d7f49b314c40198550ba1b6f972 lib/Jifty/Filter/DateTime.pm
+SHA1 8d3265226fc12101b86b523979f86b63b7fe19b0 lib/Jifty/Handle.pm
+SHA1 6ba3aa606558b85b3806330ffcfcf7ad2b80da6b lib/Jifty/Handler.pm
+SHA1 551ca6606a300a0048feeee1e176422d2f0f9b5f lib/Jifty/I18N.pm
+SHA1 581bad0bbce1be704e73fca441ef8a4d211d48d3 lib/Jifty/JSON.pm
SHA1 7083562103a0feb46db9bd0bd2323fe62dcb1b0c lib/Jifty/LetMe.pm
SHA1 1687a979438f24c95a6b857ab5305910108bfb49 lib/Jifty/Logger.pm
+SHA1 cc180ff223629e6c1c7b5f2becac4bde27f0fa69 lib/Jifty/Manual.pm
SHA1 9a01a2e586aa5799fdc0f04c6240220d9dd953b9 lib/Jifty/Manual/AccessControl.pod
SHA1 ef9ff36385a9f780ac0204bffb9425818d78b789 lib/Jifty/Manual/Actions.pod
SHA1 44c07eb236063f6978a945d0faabdcd2b4799126 lib/Jifty/Manual/Continuations.pod
@@ -197,16 +205,16 @@
SHA1 d0b7a4277c8a3d1a393d7c51fff48b059461f87c lib/Jifty/Manual/UsingCSSandJS.pod
SHA1 e8e0a5e342506f3656f7b642a0915b9339da3e2c lib/Jifty/Mason/Halo.pm
SHA1 c7a9988b0826f9c55af2415c7d314ff546193cee lib/Jifty/Model/Metadata.pm
-SHA1 4b89786af61d1490286bc02c4c3a8edb95aa0b60 lib/Jifty/Model/Session.pm
+SHA1 9612083e329a3366aed947c725340b5b858eca66 lib/Jifty/Model/Session.pm
SHA1 869954cc1c1a636bf45aa43fa3e565ba19e39007 lib/Jifty/Model/SessionCollection.pm
-SHA1 4d70ace015a3d020687aab814dae62f86d051428 lib/Jifty/Module/Pluggable.pm
-SHA1 88f2aacbfaeca55afa86f6b21bab250ce37f35ea lib/Jifty/Notification.pm
+SHA1 bb261929a2f58a0dbda883febc7842ae6db88aa4 lib/Jifty/Module/Pluggable.pm
+SHA1 b70ca16929be0c714bbb60403b253ceae5fb613e lib/Jifty/Notification.pm
SHA1 445f707ba7577b529bf7ca9ddcd2587250d0b272 lib/Jifty/Object.pm
SHA1 c3fde2a862013cd6284637d79c751c3c2e360720 lib/Jifty/Param.pm
-SHA1 c4c0387640f7eafb35b346798c5e150c6ecb7496 lib/Jifty/Param/Schema.pm
-SHA1 9ec6c409d8b0bc974d4feee07363ea458c30453f lib/Jifty/Plugin.pm
+SHA1 07d789d9e304da8e632ce1236dda4a3e7fab8fc7 lib/Jifty/Param/Schema.pm
+SHA1 ea8bc6f6595d6dcab26a5457638bd233d6b476d4 lib/Jifty/Plugin.pm
SHA1 e5af7b18d906a1e69fc96d97f13c3d003fe9f217 lib/Jifty/Plugin/ActorMetadata.pm
-SHA1 ed6aa344eca5c227c0b2e94f40c7f73455c93bea lib/Jifty/Plugin/ActorMetadata/Mixin/Model/ActorMetadata.pm
+SHA1 3932c22836be32e8d9ffcb2776dfb03ed4c8a2de lib/Jifty/Plugin/ActorMetadata/Mixin/Model/ActorMetadata.pm
SHA1 328b724a1f266999eb1f12e60a7ac6fcc533d177 lib/Jifty/Plugin/AdminUI.pm
SHA1 a4cf065e1e54ac09a715d89b107768b0ae19e0b6 lib/Jifty/Plugin/Authentication/Facebook.pm
SHA1 eb0ac23054f98ef6ae30ae06a03adaf896fd601c lib/Jifty/Plugin/Authentication/Facebook/Action/LinkFacebookUser.pm
@@ -222,13 +230,15 @@
SHA1 074fe2fa59464a78b69558f2c20b39fe45a6e56e lib/Jifty/Plugin/Authentication/Password/Action/ResendConfirmation.pm
SHA1 eb20b698db12db185f08e4d0e0a6c39dc2c1432f lib/Jifty/Plugin/Authentication/Password/Action/ResetLostPassword.pm
SHA1 204602d1b7b07f7c98b1369a25c18099e3ea5100 lib/Jifty/Plugin/Authentication/Password/Action/SendAccountConfirmation.pm
-SHA1 28604b89817992c647042420090a59fee0fe06bd lib/Jifty/Plugin/Authentication/Password/Action/SendPasswordReminder.pm
+SHA1 2a539002f3fd0b07c9132610f4cb01625aea3291 lib/Jifty/Plugin/Authentication/Password/Action/SendPasswordReminder.pm
SHA1 3d0b444280c3b0ae577e0ada5cb3fd2eb8803f9f lib/Jifty/Plugin/Authentication/Password/Action/Signup.pm
SHA1 e18879da7a75bd2fe96dcc380a72d005a3a82aad lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm
-SHA1 ea71250fa9cf6185d97a0b05529b20f92297f122 lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm
+SHA1 60cd4b172ffd30856756a944075fb6d0c528d3ed lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm
SHA1 9711ece6f3637e972708c8bda313aaa57fd1b405 lib/Jifty/Plugin/Authentication/Password/Notification/ConfirmEmail.pm
SHA1 f8e1724e5d0d3e490439f0ad761a96155ff1b5a4 lib/Jifty/Plugin/Authentication/Password/Notification/ConfirmLostPassword.pm
SHA1 ed84b2845c3b6b53e20f420862f8f8a23a569700 lib/Jifty/Plugin/Authentication/Password/View.pm
+SHA1 33e798ef8c54a46e9332c5c38a7dcfaf8b3aee26 lib/Jifty/Plugin/AutoReference.pm
+SHA1 bc86ea08d5055c8488f1836c8a3fa2c87975db30 lib/Jifty/Plugin/AutoReference/Widget.pm
SHA1 632df071506dc232b7855f31e216a05055262874 lib/Jifty/Plugin/Chart.pm
SHA1 8d018ee02a46e1ab758d2096b9a1039550dfe913 lib/Jifty/Plugin/Chart/Dispatcher.pm
SHA1 4bc7a990867f0482b2c49f8cd28e328fb5947797 lib/Jifty/Plugin/Chart/Renderer.pm
@@ -236,25 +246,38 @@
SHA1 ec469e4ef188a1fdeadd208974ffa2c0afa79f2c lib/Jifty/Plugin/Chart/Renderer/GD/Graph.pm
SHA1 5f5c9a658bef0074b24ec8567305085b28022cf2 lib/Jifty/Plugin/Chart/Renderer/PlotKit.pm
SHA1 3e11c9832ed05ad5cbb4095081654d53284628e5 lib/Jifty/Plugin/Chart/Renderer/SimpleBars.pm
-SHA1 332109e5a4e6b464814a6331fcbe1ddeec5d8502 lib/Jifty/Plugin/Chart/Renderer/XMLSWF.pm
+SHA1 387e83601ac32063ed23927a90bce4c7c5b8fc5c lib/Jifty/Plugin/Chart/Renderer/XMLSWF.pm
SHA1 436d7ef252dfe555b0d0d56cf126d30cad59728f lib/Jifty/Plugin/Chart/View.pm
SHA1 e842dafa977259712540df4639249689e3bd1c90 lib/Jifty/Plugin/Chart/Web.pm
SHA1 da70c7fbcd78d7ae9bd53deb74a022d0eeea4a12 lib/Jifty/Plugin/ClassLoader.pm
-SHA1 471913e19c92eebdcc3a338b8fdfdccbbb647959 lib/Jifty/Plugin/CompressedCSSandJS.pm
-SHA1 3547e9d0a2e53ae2c57cb07ba6ef88fa21ef8c28 lib/Jifty/Plugin/CompressedCSSandJS/Dispatcher.pm
+SHA1 f0390d573033b27d73e2ba1ab1dddaeabdf786df lib/Jifty/Plugin/CompressedCSSandJS.pm
+SHA1 3143510bdf480a1d42ea4199119d808443c3246b lib/Jifty/Plugin/CompressedCSSandJS/Dispatcher.pm
SHA1 f7c65a1e0fd9a9cc3a69238e5d0c94cfdacbf484 lib/Jifty/Plugin/Debug.pm
SHA1 bccc0b4e51396e7b3d95d43ce75774d922a4fc14 lib/Jifty/Plugin/Debug/Dispatcher.pm
SHA1 b6a34618e94885dac38d0a6b501a63f5c0184008 lib/Jifty/Plugin/ErrorTemplates.pm
SHA1 23acc252dd633a0c6873acadced84729dd6be728 lib/Jifty/Plugin/ErrorTemplates/View.pm
-SHA1 9afb7bc33b82dbc0f6de63c75b674c71858275eb lib/Jifty/Plugin/Feedback.pm
-SHA1 453a08b54bfd5cba652d304f4731f9208364a17e lib/Jifty/Plugin/Feedback/Action/SendFeedback.pm
+SHA1 2ce2a6c92f94c786e60d995ff88ac4c61538ef7a lib/Jifty/Plugin/Feedback.pm
+SHA1 c11790aee7ac9c20ea1dea6dbcdc392e25fb393b lib/Jifty/Plugin/Feedback/Action/SendFeedback.pm
SHA1 1c214a74f063384a7e59e516f917131a2338ace3 lib/Jifty/Plugin/Feedback/View.pm
SHA1 d4f28de89e6bc1bde247a7b5e4e78b19961772e0 lib/Jifty/Plugin/GoogleMap.pm
SHA1 e79fe2283de73ff1d369e386129ff0adfdfad61b lib/Jifty/Plugin/GoogleMap/Widget.pm
SHA1 f13f769cb4d6d529bcfc46647512544eaaa54774 lib/Jifty/Plugin/Halo.pm
+SHA1 2ba0c0d41adf3f9ae6102c4ee0339c69cb1fa41c lib/Jifty/Plugin/I18N.pm
+SHA1 9ab115aaab5a08b1b25e4acfdb338c736df13af1 lib/Jifty/Plugin/I18N/Action/SetLang.pm
SHA1 668a78f235a1b025f9d15328f646df5578178f3b lib/Jifty/Plugin/JQuery.pm
+SHA1 2b148ed613cee998ac790f8dca27148fd2521b2d lib/Jifty/Plugin/LeakTracker.pm
+SHA1 c6cc61f0b8e1d83dfb6ab54653c65322df50cabc lib/Jifty/Plugin/LeakTracker/Dispatcher.pm
+SHA1 fc29cecc82021c3079b9375ca86b911c56e731ab lib/Jifty/Plugin/LeakTracker/View.pm
SHA1 432d5c6343b4390dcd135918d7f729d2c01eee5c lib/Jifty/Plugin/LetMe.pm
SHA1 8692eb8735e17f6f9a25f41c368da4a6839363c8 lib/Jifty/Plugin/LetMe/Dispatcher.pm
+SHA1 0179fb90782af6cf4f8f0336d9ce4123f2fa4ee6 lib/Jifty/Plugin/OAuth.pm
+SHA1 ec118e0358980bd9095d4258c025177b340d241e lib/Jifty/Plugin/OAuth/Action/AuthorizeRequestToken.pm
+SHA1 97383f671fd34c2ed8c26cc98f0d7e557e51268e lib/Jifty/Plugin/OAuth/Dispatcher.pm
+SHA1 906219fce92eca4d483e4b571280a60b5320ecd3 lib/Jifty/Plugin/OAuth/Model/AccessToken.pm
+SHA1 a0a2965b3511771a3ac32e659adb33bc572b6ebd lib/Jifty/Plugin/OAuth/Model/Consumer.pm
+SHA1 6d90773d54a5cea5fc7ea35c1240bd5b5987f1ba lib/Jifty/Plugin/OAuth/Model/RequestToken.pm
+SHA1 0ecb471c00653630443029761dce4816f8b308d3 lib/Jifty/Plugin/OAuth/Token.pm
+SHA1 ef4c52b621a5b0af3dcd5668036ac46d479a31c8 lib/Jifty/Plugin/OAuth/View.pm
SHA1 af733b25eee3cc4e0e6b087a76bfd965534a2343 lib/Jifty/Plugin/OnlineDocs.pm
SHA1 fcc3ccbee7c9646745fc79475d53f67e81d7c0db lib/Jifty/Plugin/OnlineDocs/Dispatcher.pm
SHA1 c39eb405a1d25e84b582868e12279fcbdcede688 lib/Jifty/Plugin/OpenID.pm
@@ -265,18 +288,18 @@
SHA1 fe37000b633c08c77eaf6adb6cf0847a26450eb8 lib/Jifty/Plugin/OpenID/Mixin/Model/User.pm
SHA1 1a30f243c1f3efa0fd045f922eb5f062c80d80b9 lib/Jifty/Plugin/OpenID/View.pm
SHA1 df332565b291fd458fab232414b24283f379ac16 lib/Jifty/Plugin/REST.pm
-SHA1 056a963c9277e8f0cfba399b2c9b66531a2987c5 lib/Jifty/Plugin/REST/Dispatcher.pm
-SHA1 d2dd17c683748f9bbeb831ab6dc9f3a873fa1514 lib/Jifty/Plugin/SinglePage.pm
+SHA1 e9e5b593b8f16289618b06ceb79a819fda1b00f3 lib/Jifty/Plugin/REST/Dispatcher.pm
+SHA1 decbf7728e192b9fcb3f8d330279315bae429c3f lib/Jifty/Plugin/SinglePage.pm
SHA1 23720e49b68018925083f408d10de34d0f297042 lib/Jifty/Plugin/SinglePage/Dispatcher.pm
SHA1 f866590b203c18013cc2f667de7b889e84895670 lib/Jifty/Plugin/SiteNews.pm
SHA1 b72aeb9e89b787e0feb81e421c5e63de36f48726 lib/Jifty/Plugin/SiteNews/Dispatcher.pm
SHA1 654eec3ba80aa6199c558ac13484308a214a1219 lib/Jifty/Plugin/SiteNews/Mixin/Model/News.pm
SHA1 a3bf9e62b68d625ac0da1fd3b571d91258b303d1 lib/Jifty/Plugin/SiteNews/View/News.pm
SHA1 7fa0c5fa1ef6dbe8f1c4a351133f74ca32a70507 lib/Jifty/Plugin/SkeletonApp.pm
-SHA1 274d797b34ef684c58df7db353346973f8e1bbc2 lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm
-SHA1 f9e1002e94b28aaac932ecf09421e984ba02d1e3 lib/Jifty/Plugin/SkeletonApp/View.pm
-SHA1 5fdd02b758f8cbeb06a9012d4e28c76064e3d6b9 lib/Jifty/Plugin/TabView/View.pm
-SHA1 cbfe62b83a5ea089e1536ca54babf24006652406 lib/Jifty/Plugin/UUID.pm
+SHA1 63165112948dd17a86a0544ff60f82d4ed89a777 lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm
+SHA1 af327531d97512491cf14c42bad1dc2c606eab89 lib/Jifty/Plugin/SkeletonApp/View.pm
+SHA1 812425a5f9a9a108a3d878e347e77dcb532ae19a lib/Jifty/Plugin/TabView/View.pm
+SHA1 df4d15dcb23b75e7b785cfbc282a3bc1e6c37a18 lib/Jifty/Plugin/UUID.pm
SHA1 e58f034ec726d72becad8ff361097c4f115549f8 lib/Jifty/Plugin/UUID/Widget.pm
SHA1 5ce0a4dd684e7a9029f67a3679f268acbd1cbf31 lib/Jifty/Plugin/User.pm
SHA1 5811d61115c8162417885dec09180ab3f356a962 lib/Jifty/Plugin/User/Mixin/Model/User.pm
@@ -285,17 +308,17 @@
SHA1 37016b10d1f2f0cc479b549009d1307237099f22 lib/Jifty/Plugin/Userpic/View.pm
SHA1 5712e2f84235c7b57e38ac85513bbecbdc15dfdd lib/Jifty/Plugin/Userpic/Widget.pm
SHA1 c77500585cddf1c520b0438384481a1b68d13c57 lib/Jifty/Plugin/Yullio/View.pm
-SHA1 ae4a12074e7e1da9bf9628ecd4dbf36cac8369f6 lib/Jifty/Record.pm
-SHA1 a63b8179f42e38ebcd84ed803a15a75b9c4f84f5 lib/Jifty/Request.pm
-SHA1 574126a02a3c625710a849c1f9f7fd0dd226759b lib/Jifty/Request/Mapper.pm
+SHA1 9458fff3a4f56022672619c13b6a3db8e838d61f lib/Jifty/Record.pm
+SHA1 fc22db5499b913c86762c0e90c3b22a82e451e23 lib/Jifty/Request.pm
+SHA1 86d7ce58578cd3a06e17e7d3c8314e0741ba68f8 lib/Jifty/Request/Mapper.pm
SHA1 0a92b4cdb402463e303b897195c9ad914767c27f lib/Jifty/Response.pm
SHA1 669b0956c14105b4178875d6856b129b75941328 lib/Jifty/Result.pm
-SHA1 3ac318feed2accd50b61d8dc82709bd2a7882946 lib/Jifty/RightsFrom.pm
-SHA1 21247e3f5877c8954835e280b6c4eb4aa67fa5fb lib/Jifty/Schema.pm
-SHA1 522f2845a7cbea076dbc53c9ccfbadaa4de56483 lib/Jifty/Script.pm
+SHA1 d8bdfa7dfa44a99aa5ebf96b9e317ff31b54aad7 lib/Jifty/RightsFrom.pm
+SHA1 e153160eb4f058c779bf10bb823a47f7e2e0a77f lib/Jifty/Schema.pm
+SHA1 4d1aa083b1377fe5938f8e610d626995cb80d1fd lib/Jifty/Script.pm
SHA1 f97fb67cd7db7aa2374ef4a0f1b8b9705e3ce153 lib/Jifty/Script/Action.pm
SHA1 3aa3a449b282e05dfb312cf266572edabf2bae17 lib/Jifty/Script/Adopt.pm
-SHA1 b459c77c7f08c83b9808486cda074704c2d325c0 lib/Jifty/Script/App.pm
+SHA1 36ab3422992cd7286a01a48019d64b5b31e86b55 lib/Jifty/Script/App.pm
SHA1 f1c1078236ad2396a7c4b98979108980e3bcd25c lib/Jifty/Script/Console.pm
SHA1 2ae45f322b3b5904225465b85edb544ba6216eaa lib/Jifty/Script/Deps.pm
SHA1 3c26ea2d6e25c42ecd7edae41d4ad2fc552f1451 lib/Jifty/Script/Env.pm
@@ -304,56 +327,58 @@
SHA1 29d16baf7dbf778f6082f8852723b6ef82842ef0 lib/Jifty/Script/ModPerl2.pm
SHA1 ae7d6a97f55a111e10cbc127d3174c48dc896afc lib/Jifty/Script/Model.pm
SHA1 4fae01f79baf125856a69265fa9f4caeb5f858bf lib/Jifty/Script/Plugin.pm
-SHA1 3365d06f92ffe40175f2c9d7fa4175c48cd42ed9 lib/Jifty/Script/Po.pm
-SHA1 a3f347fd88bd12105ad21edf2a92dc330119adf0 lib/Jifty/Script/Schema.pm
+SHA1 163f0b9e8e01f4f4c7edf96fdbe1a27aee29b785 lib/Jifty/Script/Po.pm
+SHA1 c12c0206c00f40dbd511d71834d2499f73e0850b lib/Jifty/Script/Schema.pm
SHA1 e18ad09e9078c0a9782c588398cd38541f966b5d lib/Jifty/Script/Server.pm
SHA1 4918c842d52a7ab4de9d60da95a47a31d04d4631 lib/Jifty/Server.pm
SHA1 b49ae221b107519b3019b3f5e5ab5b7e8c6b4332 lib/Jifty/Server/Fork.pm
-SHA1 9a8c2f2cdc88fc00baaafaa72bc3413e086c0448 lib/Jifty/Server/Prefork.pm
+SHA1 d151b0cb6c1f9b63a2671a7211c30f965b12289e lib/Jifty/Server/Prefork.pm
SHA1 e7453a3cda290e60d5432e60e53bec8b92a91772 lib/Jifty/Server/Prefork/NetServer.pm
SHA1 3e117a5866ca55825f4f292e95af01f98fe67edc lib/Jifty/Subs.pm
SHA1 7b8eed10682b0e357b2049fa479e7d85bd4b1b58 lib/Jifty/Subs/Render.pm
-SHA1 9f4748146731512c6747b9eb15c6bf77d0c968be lib/Jifty/Test.pm
-SHA1 e28d417b36ca1d647a1cd5e4527465822a8ce09a lib/Jifty/Test/WWW/Mechanize.pm
+SHA1 565ba8120759b462ed66c4ce376ac21547d5f96f lib/Jifty/Test.pm
+SHA1 db34b059e165273d1474a858604abed5d73ef551 lib/Jifty/Test/WWW/Declare.pm
+SHA1 654f9c629de22884beefacf1194e6a89c94402c5 lib/Jifty/Test/WWW/Mechanize.pm
+SHA1 5011ef6d08ca86adb2f14bae1474df7ed94a50e8 lib/Jifty/Test/WWW/Selenium.pm
SHA1 47c5840fafd56473a0e1a9228f169d3813317c13 lib/Jifty/TestServer.pm
SHA1 5c0db87837a6a1311ec85b03f06623468afe8098 lib/Jifty/Upgrade.pm
SHA1 fa642baf010edb939aa7682ae68b07c8a69b06b6 lib/Jifty/Upgrade/Internal.pm
-SHA1 240bfd838f0b696c43499b05218eb10e470b610d lib/Jifty/Util.pm
+SHA1 a5f6803f9cb942696c2f875b0e6161b439c36a52 lib/Jifty/Util.pm
SHA1 45b78364045808eeb2c895760646d910ae06c709 lib/Jifty/View.pm
-SHA1 a1040a526ea0acb07c7aa26c7d1ac6f6c19f4212 lib/Jifty/View/Declare.pm
+SHA1 5da88edb702a7ad194a13656838fff0d1459760c lib/Jifty/View/Declare.pm
SHA1 f646c99eb386ca9ecb58e0f2184c2b153a547aaf lib/Jifty/View/Declare/BaseClass.pm
-SHA1 e58c71aeca97a483af2be912be08899de79e7d87 lib/Jifty/View/Declare/CRUD.pm
+SHA1 b9b0894f722dd9eca9107425c79434909cb6bc06 lib/Jifty/View/Declare/CRUD.pm
SHA1 d2b2fa668602ba5a46b604bc4d340afb408fabd6 lib/Jifty/View/Declare/Compile.pm
SHA1 a15bc046d04afb7f7985d65f9498d24b3bb6fdbd lib/Jifty/View/Declare/CoreTemplates.pm
-SHA1 3107a21569496a327245ca628271f2cc9bb4565e lib/Jifty/View/Declare/Handler.pm
-SHA1 bc7e7999c7d40c312eeddf1fbfef1b2bb979c37b lib/Jifty/View/Declare/Helpers.pm
-SHA1 ccbafe7217bcd46e55418c48c4dec9d82fdd71e6 lib/Jifty/View/Declare/Page.pm
-SHA1 aa6cd594be5a52a18dc40ebc01a0b8b8d943c297 lib/Jifty/View/Mason/Handler.pm
-SHA1 7c0239dd306fcdd6394771f634fb8403707e98c1 lib/Jifty/View/Static/Handler.pm
-SHA1 5182bc53778b35df9fa2d9b14c8e050016ec556b lib/Jifty/Web.pm
-SHA1 71761036222f20d7cf9f5b25e7a5d0a5ba619851 lib/Jifty/Web/Form.pm
-SHA1 f57b9359281b2a1b4334ee714da47baec4398c89 lib/Jifty/Web/Form/Clickable.pm
-SHA1 3ca9d352e41ff763c24a26d6f2780e03814cc66f lib/Jifty/Web/Form/Element.pm
-SHA1 e6b91ee72900aaa758bd2e3a46b2545b5b21133e lib/Jifty/Web/Form/Field.pm
-SHA1 d6735601c2c293b6ce0432d55bdb16fa2c5c6a68 lib/Jifty/Web/Form/Field/Button.pm
-SHA1 56fbb0c2fb940faaf086d49dcbea04825731540e lib/Jifty/Web/Form/Field/Checkbox.pm
-SHA1 02cb651fff375c73cef980ce675519f8118a6b69 lib/Jifty/Web/Form/Field/Collection.pm
-SHA1 7f64a31d99347ec482f2c95e6d06fffa6ed6d59e lib/Jifty/Web/Form/Field/Combobox.pm
+SHA1 98a230a110f1a4021dc6bd8affaa67fb608c68cf lib/Jifty/View/Declare/Handler.pm
+SHA1 149f7757d07f7ead613781ceaf1dcd17c2d1913c lib/Jifty/View/Declare/Helpers.pm
+SHA1 a7687bce27c03cd6f8a6928fbd03b291326933ed lib/Jifty/View/Declare/Page.pm
+SHA1 dd83643c2642a05950f05af9c7ebd5886504fc60 lib/Jifty/View/Mason/Handler.pm
+SHA1 baaa9dc12e0a3f7f4fa737c0842bc542bdad1e72 lib/Jifty/View/Static/Handler.pm
+SHA1 aedf4742499f18d7589f44f57d16a7bd8c5d2ac2 lib/Jifty/Web.pm
+SHA1 bf7ec95d6ce6c0ed7abd0d89b24d7521344a8ff3 lib/Jifty/Web/Form.pm
+SHA1 9ca1418c5fd7e539cc666cf7ab57285e49c7d0e4 lib/Jifty/Web/Form/Clickable.pm
+SHA1 47534929a065db0a5eaff83bfe3abc44292acc5d lib/Jifty/Web/Form/Element.pm
+SHA1 b3a69a7f5439e70b1104b015fda293c61eab62ab lib/Jifty/Web/Form/Field.pm
+SHA1 03322439e64fbaca08164b19de0d24cf0e5fdc82 lib/Jifty/Web/Form/Field/Button.pm
+SHA1 1f5e05a6cc7483112a86f9863752da7742797242 lib/Jifty/Web/Form/Field/Checkbox.pm
+SHA1 9ecf88f8cf1af8e08bc5cdcdd8357da794cca82f lib/Jifty/Web/Form/Field/Collection.pm
+SHA1 8ca1e7b6637720d0eb65c5391d52c573ad2510c7 lib/Jifty/Web/Form/Field/Combobox.pm
SHA1 a57b8a2908b9642320f07c91fab31d8eab63c97c lib/Jifty/Web/Form/Field/Date.pm
SHA1 d8fdc993320b9e81926181e028b5fc688ec874fe lib/Jifty/Web/Form/Field/Hidden.pm
SHA1 4db6a90ae2668ba11eb9e8633f949ee45e56cfad lib/Jifty/Web/Form/Field/InlineButton.pm
SHA1 1b98474c61f1065ffe76b5a9f8356e4a10afc202 lib/Jifty/Web/Form/Field/Password.pm
-SHA1 49a79b67248e87be7a3c452dc76bdc1356aaf025 lib/Jifty/Web/Form/Field/Radio.pm
-SHA1 7869f3c4a1bc2215fff467a43dec617053d8961c lib/Jifty/Web/Form/Field/ResetButton.pm
-SHA1 6e7d9e080def5cfd7fac0f6b4adf2a94b25506b1 lib/Jifty/Web/Form/Field/Select.pm
+SHA1 ceddfc29b6b45228497a0dcd33754fed669b6491 lib/Jifty/Web/Form/Field/Radio.pm
+SHA1 bbac35dafb24e72fa91643f6353796e5d856258e lib/Jifty/Web/Form/Field/ResetButton.pm
+SHA1 1957d01fa20adf8e9ee30bd44c180653c886bc11 lib/Jifty/Web/Form/Field/Select.pm
SHA1 04507f0d805d9e8e4ef4da4d7a919f5e7d7986fe lib/Jifty/Web/Form/Field/Text.pm
-SHA1 4ceb33e9dc6a8ee744e5ef977f4ad7634795bd91 lib/Jifty/Web/Form/Field/Textarea.pm
+SHA1 b287156ff11abaf1a09739b1372d240ff1c86171 lib/Jifty/Web/Form/Field/Textarea.pm
SHA1 20eb63da765651816b5c5c7c03bd8f8f8ca107f3 lib/Jifty/Web/Form/Field/Unrendered.pm
SHA1 3e19292cf95afaf08e811cd9814a33d69ddfddaa lib/Jifty/Web/Form/Field/Upload.pm
-SHA1 9ad5a13ed960af0d65ab69acda01251e5efdaaa1 lib/Jifty/Web/Form/Link.pm
-SHA1 6df07c4539c2d59113989bfd2499d7c4febef426 lib/Jifty/Web/Menu.pm
-SHA1 efbc2eb67a3b148f8edfc6ae26aa767438479cac lib/Jifty/Web/PageRegion.pm
-SHA1 5039d06b6112a7e1498ab46d2c4593a6addc10ef lib/Jifty/Web/Session.pm
+SHA1 40ca8f6a48095dbacbe8fe2c1cc7e97466a7339f lib/Jifty/Web/Form/Link.pm
+SHA1 0a5c4adca9b3af4680a919c58ff146f70c6d1918 lib/Jifty/Web/Menu.pm
+SHA1 d407e3f85e158fa3fe86295d63fb602c4a20fae0 lib/Jifty/Web/PageRegion.pm
+SHA1 46deb18cbea37dcbbb14581965a34147d21ba091 lib/Jifty/Web/Session.pm
SHA1 f655fb9734715ebf51fb5e9b554c02b9e4e2ac61 lib/Jifty/Web/Session/ClientSide.pm
SHA1 d7a8f92ddbc614904ad6aa53d818b0bd5df03317 lib/Jifty/Web/Session/None.pm
SHA1 c4de1ef964243aae5ab90d0a5a6dd9c213eb9f80 lib/Jifty/YAML.pm
@@ -961,6 +986,7 @@
SHA1 9d339e7acebf3e929b15c1d8b4642ecbddf7f4b6 share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/fragments/list/view
SHA1 9c6ec4bcfacc9091533b50eea7b01fe3dd81883c share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/index.html
SHA1 99ce3e69e2201664a1363ca2535dcc51a64a1f92 share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/model/dhandler
+SHA1 07b8ea847efe863f179013a7d23087488eee03bf share/plugins/Jifty/Plugin/AutoReference/web/static/js/autoreference.js
SHA1 0fc7fc9888d41402a0c079cb124769bd044a9f2d share/plugins/Jifty/Plugin/Chart/web/static/css/simple_bars.css
SHA1 5a544d4b79ad280727d6a3a24a549606c69b239c share/plugins/Jifty/Plugin/Chart/web/static/flash/xmlswf/charts.swf
SHA1 172c35bdf32dd3e7c31782a1959c7080778eb33e share/plugins/Jifty/Plugin/Chart/web/static/flash/xmlswf/charts_library/arno.swf
@@ -990,6 +1016,7 @@
SHA1 9ffed1b5658c22190f2124fa2e6bd344ee74a1e0 share/plugins/Jifty/Plugin/Chart/web/static/js/simple_bars.js
SHA1 15bd576afbe4cc9d44623cc8feb9b379fbe2a603 share/plugins/Jifty/Plugin/GoogleMap/web/static/css/google_map.css
SHA1 1178d664f92ecfdd4635363fed6b53ef843cb593 share/plugins/Jifty/Plugin/GoogleMap/web/static/js/google_map.js
+SHA1 8cf05fe74c914a1c3aaa50a1a21984e630ef2acc share/plugins/Jifty/Plugin/I18N/web/static/js/loc.js
SHA1 e1c9252b3e60673e4fa1bb1648cb18cd33139535 share/plugins/Jifty/Plugin/JQuery/web/static/js/jquery.js
SHA1 e9813f935b17859c91b651d992cae6c90776ad14 share/plugins/Jifty/Plugin/JQuery/web/static/js/noConflict.js
SHA1 7efa4f24d875a19035963c3955f2fc4e613b8cfe share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/autohandler
@@ -998,13 +1025,13 @@
SHA1 37555dd5c3acfbaecfc28416e0fa21b0aa6e1d77 share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/toc.html
SHA1 2996fff4ab04768018cfc0f617c18757e1847a7b share/po/en.po
SHA1 63a333ff328933df4082e868ba9115b3c0fa24bd share/po/fr.po
-SHA1 88408a7350d0599fd4e7cd7f709fd918b55b6b27 share/po/ja.po
+SHA1 ed8f6b98f97d0e65d7d34a67afbd01ed463bf551 share/po/ja.po
SHA1 12b260c8de9d985a8968254021cde5c7d56156b3 share/po/ru.po
SHA1 d3f30c5bc2a7ef0fc0ea8acaaa75f03563eb16d9 share/po/zh_cn.po
-SHA1 623dbb738a8db1e79de6127fc3af2c918d2c93e6 share/po/zh_tw.po
+SHA1 71d8302cdf676b5c34ac46d6bf670c1b4735bcd6 share/po/zh_tw.po
SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709 share/web/static/css/app-base.css
SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709 share/web/static/css/app.css
-SHA1 c566d7ab5005e82dcf2f90809ae757e07d338138 share/web/static/css/autocomplete.css
+SHA1 1a534de383a840e027c1fc9d75acdb44746e3023 share/web/static/css/autocomplete.css
SHA1 5f569fc23eb815ee6f6d086aa6df87f6c38952d3 share/web/static/css/autohandler
SHA1 98bd4a5fc5cdcf84794d85da8e6a91f13df875cc share/web/static/css/base.css
SHA1 669f07ab36d148383013733d8230d49e7e7b25ec share/web/static/css/calendar.css
@@ -1015,7 +1042,7 @@
SHA1 c7eede0c22f68e4417748bb0903b48195648f4c0 share/web/static/css/keybindings.css
SHA1 a67bd8704c0c8e8866e01de8a98feb9788b853bd share/web/static/css/main.css
SHA1 903069dae3de35d6a3226b8272ff317b8eebd58c share/web/static/css/nav.css
-SHA1 45861338bc40888737738521a44d4adf286b1204 share/web/static/css/notices.css
+SHA1 19b3b2e382f0c7e9619021c2e68da41a6bfc0057 share/web/static/css/notices.css
SHA1 6af7922df30a9bcbba91de135280f35020c3de75 share/web/static/css/yui/calendar/calendar.css
SHA1 c38a3f0ee9c3177b3b57c8a12259583937596252 share/web/static/css/yui/menu/map.gif
SHA1 454d5a1fc8a75cfdfda8da84fcdb3ad61bc28ecf share/web/static/css/yui/menu/menu.css
@@ -1068,7 +1095,7 @@
SHA1 4553f3cb184b09228ed4362898e9d30200a2a585 share/web/static/js/formatDate.js
SHA1 a1d2c6292d656c275383b97aad6ca913b8a1b031 share/web/static/js/halo.js
SHA1 08b20563e958e72c3e8a221d91614c412bdd068b share/web/static/js/iepngfix.htc
-SHA1 762552c69eda7c920f366e0fdabd5010399cc1c2 share/web/static/js/jifty.js
+SHA1 b0da2c62db377608f91b5ed075811399eb44da75 share/web/static/js/jifty.js
SHA1 29fe34f11192976f1a388562188b1eb9af7f4497 share/web/static/js/jifty_smoothscroll.js
SHA1 8723bf251531e79ab109ea0d3fb2187a8dac8cb6 share/web/static/js/jifty_subs.js
SHA1 1a4ccf6b5d376984d91c439e1642bd2b7fb11115 share/web/static/js/jifty_utils.js
@@ -1081,12 +1108,12 @@
SHA1 becdf6868ec4aec2dc93c8c33b0713d1c4f4eb34 share/web/static/js/jsan/Upgrade/Function/apply.js
SHA1 f15b0364f99d2e4c1af795c82883f89b9eaca9b2 share/web/static/js/json.js
SHA1 7a09ac75f9140b7faf2f3b0e97493c78997798f6 share/web/static/js/key_bindings.js
-SHA1 986a63bc533f6fa99c9b0f0226a14f9871b94ce5 share/web/static/js/prototype.js
+SHA1 7b049d5c904724df588f31fb104dee9b33ab03a7 share/web/static/js/prototype.js
SHA1 a1048deeafbc76659e54eb77c0e51b6b79cade19 share/web/static/js/rico.js
SHA1 164bc59cf75fe943edc80da65b19246fc9b9643e share/web/static/js/scriptaculous/builder.js
SHA1 afa5b63db51fc4c3c4ff2535d3af5fe5b00add19 share/web/static/js/scriptaculous/controls.js
SHA1 28f001d3c48395daf0de22876a70d918db3a461e share/web/static/js/scriptaculous/dragdrop.js
-SHA1 21ce51daa693e3716678ac4190369b499b35e8de share/web/static/js/scriptaculous/effects.js
+SHA1 136d82eaaca78f577292ee5df7886675cf897022 share/web/static/js/scriptaculous/effects.js
SHA1 914db330c7fe585dfeddce713558f04328fb51db share/web/static/js/scriptaculous/scriptaculous.js
SHA1 cc2e31820eed69ae87b1b2befa50e8c4a8519342 share/web/static/js/scriptaculous/slider.js
SHA1 6b42a40cac7d45f9fd6665e18c4e494704eff9e3 share/web/static/js/scriptaculous/unittest.js
@@ -1128,9 +1155,9 @@
SHA1 1bd17a07884f71740a048c41b67ac9b06915bf76 share/web/templates/index.html
SHA1 c118e782947f715afec7b5cffa4ebc413e990c12 share/web/transform_templates
SHA1 7f9dae91a9bfc2743eec1d7aaf78e16fc9f1baba t/00-load.t
-SHA1 7922f3d21505c630e6a694c7b3cc07e6bbf246f7 t/01-dependencies.t
+SHA1 4d2af70e8612e39f60cee6b9477d5da99d15fdd6 t/01-dependencies.t
SHA1 777e40e7d3c591c21883d0ed880df8712dd50ff3 t/01-test-mechanize.t
-SHA1 6fdfbd2d5db06e2f8ed23d2c551b8ac3f6e9cecf t/01-test-web.t
+SHA1 ade22974f54a6e0991e14be587be0c9797e72ed5 t/01-test-web.t
SHA1 95fe956e7bae756a7bc25e65a6761ee0c64981e7 t/01-version_checks.t
SHA1 4fa0e0143339298278c5e22a58236c6b71555508 t/02-connect.t
SHA1 46221e3b0272c3ef2f5ce0032239dc3aba1d2e04 t/03-form-protocol.t
@@ -1148,7 +1175,7 @@
SHA1 d571f6fae9d1a33060fda8c89951492a02b1af01 t/11-config-files.t
SHA1 bd4520e6f2bfdabc6dba2d27e0cb6d33453f82e7 t/12-param-schema.t
SHA1 d4b169132cc2aaaa2ff9c38b2e7009fc38918567 t/13-sessions.t
-SHA1 59c44900b1cb957d262f96363ceff21b46e0d598 t/99-pod-coverage.t
+SHA1 cf5b3950070fda63ba1b497f7d89dd6c36ae9c93 t/99-pod-coverage.t
SHA1 bb0da54f2b3f2d7955baa41ee458cb3d1887f475 t/99-pod.t
SHA1 a7dc1f376cac630ea28d2965e561469deb951cc7 t/Continuations/bin/jifty
SHA1 adbc53cbd328b4d49d3336586fe8f7b7124da970 t/Continuations/lib/Continuations/Action/CrossBridge.pm
@@ -1189,15 +1216,41 @@
SHA1 94c39dbef547367bb6e6da1b9223cf1608ed748e t/TestApp-Plugin-Chart/lib/TestApp/Plugin/Chart/View.pm
SHA1 ff856d51a878c5ff67f828c67088af5ca9248591 t/TestApp-Plugin-Chart/t/chart.t
SHA1 8912276067f1707ad2a05677bd54c2013bc49ff1 t/TestApp-Plugin-Chart/t/gd_graph.t
+SHA1 711894dd5ab6923eb725582e7cd739c2ca5c403e t/TestApp-Plugin-CompressedCSSandJS/Makefile.PL
+SHA1 c1ff9ff7f2a88bc4306b3866b6b80fb9aa8e8423 t/TestApp-Plugin-CompressedCSSandJS/bin/jifty
+SHA1 b51eb68ba760a5f48db573d44eb7588a57f02a57 t/TestApp-Plugin-CompressedCSSandJS/etc/config.yml
+SHA1 7056be7bdbb7d6eefdcf5581e60c48b5b588e567 t/TestApp-Plugin-CompressedCSSandJS/t/css.t
SHA1 711894dd5ab6923eb725582e7cd739c2ca5c403e t/TestApp-Plugin-JQuery/Makefile.PL
SHA1 c1ff9ff7f2a88bc4306b3866b6b80fb9aa8e8423 t/TestApp-Plugin-JQuery/bin/jifty
-SHA1 430cca6c8488b9f2f5b061bfcdadbd5f33db3b82 t/TestApp-Plugin-JQuery/etc/config.yml
+SHA1 f2b2073c99fd411f2b43db5cbcad29c1d6eafc74 t/TestApp-Plugin-JQuery/etc/config.yml
SHA1 93b414ca2f8f633893a5bc460c136754042772ac t/TestApp-Plugin-JQuery/t/jquery.t
SHA1 543e899febfce9d8b9c644d557ef3af98f6ad89e t/TestApp-Plugin-News/Makefile.PL
SHA1 f7f44f9a7337def0c97f981073e3ed970851d9ae t/TestApp-Plugin-News/bin/jifty
SHA1 47529b82ece48a5943eac7c1ab8b2de5c94f8795 t/TestApp-Plugin-News/etc/config.yml
SHA1 f69a79e81e98c9c6a99c74cedd9b060b6618970a t/TestApp-Plugin-News/lib/TestApp/Plugin/News/Model/News.pm
SHA1 53c30add7fff4ebeedf1b6b2ee8474c3bc34efd6 t/TestApp-Plugin-News/lib/TestApp/Plugin/News/View.pm
+SHA1 e30ec0746a5a0681129d963a55b36930c7f0b0c3 t/TestApp-Plugin-OAuth/Makefile.PL
+SHA1 c1ff9ff7f2a88bc4306b3866b6b80fb9aa8e8423 t/TestApp-Plugin-OAuth/bin/jifty
+SHA1 42e1e283dabedf44d2deae64ee46bab06c7f8643 t/TestApp-Plugin-OAuth/etc/config.yml
+SHA1 dc7624e59325207bbfc5205b6f46a840993b511a t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Dispatcher.pm
+SHA1 8a86bdcafd192866d1b713c2d8f5a3d7bf4ac5d4 t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Model/User.pm
+SHA1 027ce32b06ae148269ae68aa6c54d8ca3cef6d05 t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Test.pm
+SHA1 7a121b004811014f5674d55da450995680b23052 t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/View.pm
+SHA1 fceb03fe7a34fdff50a5c808364cec21e2a5cadf t/TestApp-Plugin-OAuth/t/00-test-setup.t
+SHA1 fdd04ef4b775843c808e4947805daab4eb213a86 t/TestApp-Plugin-OAuth/t/01-basic.t
+SHA1 1e4022b12b882130ecfca27d61a75e0ccfe7fca8 t/TestApp-Plugin-OAuth/t/02-request-token.t
+SHA1 2b118556b4d823f1e9a88eb501332e2ab0bda461 t/TestApp-Plugin-OAuth/t/03-authorize.t
+SHA1 72aadc20063aac4bb46d0f30617de4f0ece62772 t/TestApp-Plugin-OAuth/t/04-access-token.t
+SHA1 6f007457f45f1281cfa173562097ab8586a9fb52 t/TestApp-Plugin-OAuth/t/05-protected-resource.t
+SHA1 e38a2d7034e474f2efb95efdb01afdbb1c675d7d t/TestApp-Plugin-OAuth/t/id_rsa
+SHA1 73fd51a00ea7b52b0feffbc2e11d8fefc918b814 t/TestApp-Plugin-OAuth/t/id_rsa.pub
+SHA1 726df49c955a3ed0fe0a511f462b14408b3e34a1 t/TestApp-Plugin-OnClick/Makefile.PL
+SHA1 c1ff9ff7f2a88bc4306b3866b6b80fb9aa8e8423 t/TestApp-Plugin-OnClick/bin/jifty
+SHA1 750bc31fc1747ca292d3f2d6b82600eac85ee7ef t/TestApp-Plugin-OnClick/etc/config.yml
+SHA1 09c2f8647e14e49e922b955c194102070597c2d1 t/TestApp-Plugin-OnClick/share/web/templates/content.html
+SHA1 358cb997ccc4f7db96e5a3bb710a25b1affd8823 t/TestApp-Plugin-OnClick/share/web/templates/content1.html
+SHA1 dfe47fe40442840e7b738c7587a55c8324bff55d t/TestApp-Plugin-OnClick/share/web/templates/onclick.html
+SHA1 2a6feee9c6f26290b11f5293702dc38f87e86139 t/TestApp-Plugin-OnClick/t/onclick.t
SHA1 5151dae3d7ac5f80dcfaf39fdeea0157af85f189 t/TestApp-Plugin-PasswordAuth/Makefile.PL
SHA1 f7f44f9a7337def0c97f981073e3ed970851d9ae t/TestApp-Plugin-PasswordAuth/bin/jifty
SHA1 2ad861771e8cc20e90a5820cb4d3d0837a4fc047 t/TestApp-Plugin-PasswordAuth/etc/config.yml
@@ -1222,14 +1275,24 @@
SHA1 3b7b51b4428dcbf0b9b1d55c39fd139a3ee4868a t/TestApp-Plugin-REST/t/00-prototype.t
SHA1 b6c65e7f47ff136c7d370b85cf01f27537dd81ff t/TestApp-Plugin-REST/t/01-config.t
SHA1 daa99f581a0b42976ce7ae4fe8c3f4d79d799827 t/TestApp-Plugin-REST/t/02-basic-use.t
+SHA1 711894dd5ab6923eb725582e7cd739c2ca5c403e t/TestApp-Plugin-SinglePage/Makefile.PL
+SHA1 c1ff9ff7f2a88bc4306b3866b6b80fb9aa8e8423 t/TestApp-Plugin-SinglePage/bin/jifty
+SHA1 92ac1f7352e3e68ec39ef71e2c829f2cddec59af t/TestApp-Plugin-SinglePage/etc/config.yml
+SHA1 65259a1e0c8a8c45b36800da0d34d3f370f1f0c3 t/TestApp-Plugin-SinglePage/lib/TestApp/Plugin/SinglePage/Model/User.pm
+SHA1 238ee5edab29f5d6ac7d79be59c524c801028b87 t/TestApp-Plugin-SinglePage/lib/TestApp/Plugin/SinglePage/View.pm
SHA1 a7dc1f376cac630ea28d2965e561469deb951cc7 t/TestApp/bin/jifty
+SHA1 9de42ecbfd32964a392a2b1dbe39c077d8145737 t/TestApp/etc/config.yml
+SHA1 66da809653f3152522ce5760f0894a86624b2394 t/TestApp/etc/site_config.yml
SHA1 f9a9321b803e4f248ecdd86fd71613164c01bd86 t/TestApp/lib/TestApp/Action/DoSomething.pm
SHA1 f93118ca17be86a7c171ee47864d7149baf7344c t/TestApp/lib/TestApp/Action/DoSomethingElse.pm
+SHA1 05114360ab9678da24bbc0ad68562756d6300681 t/TestApp/lib/TestApp/Action/SayHi.pm
SHA1 6e27f855429d18181d6c5a0de6b83492fa5c6219 t/TestApp/lib/TestApp/CurrentUser.pm
SHA1 0ff8efa1a274a4e0db2256a7231886ab27f3eb18 t/TestApp/lib/TestApp/Dispatcher.pm
-SHA1 f1465b5bab96659951965e968b580d1c7c218485 t/TestApp/lib/TestApp/Model/User.pm
+SHA1 01cc97136094c4dcaa0b00f7b89ea679f35e752d t/TestApp/lib/TestApp/Model/OtherThingy.pm
+SHA1 60e2eed33da6b06ea32506cc17229f8ed3c4d482 t/TestApp/lib/TestApp/Model/Thingy.pm
+SHA1 24b88bd57bed05b8ef19edd5ac42773f934b8d23 t/TestApp/lib/TestApp/Model/User.pm
SHA1 b2d3474949dae7c171157e8697dbb208ef3805f8 t/TestApp/lib/TestApp/Upgrade.pm
-SHA1 ac8b1d259e0c4115ff4f0f11910fd55d80a4a6c8 t/TestApp/lib/TestApp/View.pm
+SHA1 0ebc732808b445f31c4dd54dec81d52329026bbf t/TestApp/lib/TestApp/View.pm
SHA1 f8be83226541599e4543484128fd209dfc664ff6 t/TestApp/lib/TestApp/View/base.pm
SHA1 e376d22f0db953b5c9ede1e4e07660fe94390bf5 t/TestApp/lib/TestApp/View/instance.pm
SHA1 67f41db40d62b81d71cb60c542695e0d7e6d393d t/TestApp/share/web/static/images/pony.jpg
@@ -1250,7 +1313,7 @@
SHA1 cc7e1174609f5ae92b441c4ecf7a4734cf5a9436 t/TestApp/share/web/templates/regions/long
SHA1 f7b091879df762cccacaf827fbadc1ad4b6294b1 t/TestApp/share/web/templates/regions/short
SHA1 9a50bb56338896f9cd50b7098a9e28397ad28a34 t/TestApp/share/web/templates/somedir/dhandler
-SHA1 350ab77f7c18d826ed91eaf251f3f80ebd9605ba t/TestApp/t/00-model-User.t
+SHA1 06ee53664c6d4dffb42190c5157dd682607f0818 t/TestApp/t/00-model-User.t
SHA1 3b7b51b4428dcbf0b9b1d55c39fd139a3ee4868a t/TestApp/t/00-prototype.t
SHA1 94a1fe86cc34fbdce9087f30a69a859063ca8714 t/TestApp/t/01-config.t
SHA1 77466bc82d8f48bb7890bcf7900749b73b2a9f97 t/TestApp/t/02-dispatch-http.t
@@ -1267,27 +1330,36 @@
SHA1 3c28d88a25d4f7ed0edf2450d7b4ab7577f04dbe t/TestApp/t/08-notifications.t
SHA1 3e648a4acabeb7a137f28a01698b8c1853a65aa1 t/TestApp/t/09-redirect.t
SHA1 55ba141d6c73a6dfa7ccccb6cb9f32253ed8decb t/TestApp/t/10-compress.t
-SHA1 5d013aae657f16eb75b6c929fc4fcd66c186f2b6 t/TestApp/t/11-current_user.t
+SHA1 1bbc046a6c6115b67087149fe5c7358c6bfa7ab9 t/TestApp/t/11-current_user.t
SHA1 019605c6e627bf65ee3d2ed1b8d2b34fc8e10853 t/TestApp/t/12-search.t
SHA1 1c80b396277bf78134c2aa3de9e0f375e7efef75 t/TestApp/t/13-page-regions.t
-SHA1 b57b4cf6832d53a3777fe65e56f9ae076f474b0a t/TestApp/t/14-template-paths.t
+SHA1 b2e93a99969307d1cec54016f6f23c3f15c66af4 t/TestApp/t/14-template-paths.t
SHA1 af490a8e49140d63e12feb96a8544bc1ea4fe925 t/TestApp/t/15-template-subclass.t
SHA1 10286b19e32167d07ad59c927dcbe46159edb184 t/TestApp/t/16-template-region.t
SHA1 e4f33eb967231751ce043a1be3cdbf526671127c t/TestApp/t/17-template-region-internal-redirect.t
-SHA1 cbf28439ca71f373a547db875732a0b2e5ce9a7f t/TestApp/t/before_access.t
+SHA1 338a0f857d73bbf76ca6490e1dc276813767e603 t/TestApp/t/18-test-www-declare.t
+SHA1 23c8686edc138faa7faa1db3eb8c460dd26cd191 t/TestApp/t/19-rightsfrom.t
+SHA1 5108b2617b04b1f903534f8cad9c4f307bbe8337 t/TestApp/t/before_access.t
SHA1 69401ad0579fa743f087731536229d2806dd1d6a t/TestApp/t/config-Cachable
SHA1 576e73eedda16d331b018da82b36d01510060422 t/TestApp/t/config-Record
+SHA1 eb2cf455fc2123ee3320f9fdcbc5a68fc1b8286f t/TestApp/t/config/01-basic.t
+SHA1 7ce5f003d1cda10b6cfcec2db107f08d9389339c t/TestApp/t/config/02-individual.t
+SHA1 9bd0b9d64c8bb22183beba7dd091c8f60f1718ee t/TestApp/t/config/02-individual.t-config.yml
+SHA1 91443737eab5ac3f4f51d1925917acd3b190fd3d t/TestApp/t/config/03-nosubtest.t
+SHA1 b9e3bfb1b277c9c61890cc292d711e61f5d5f1e8 t/TestApp/t/config/test_config.yml
+SHA1 e0d433ff3707e84d370b9b3a67306c66275ebe41 t/TestApp/t/crud.t
SHA1 6c16e68284cc30d81eba755c6986675690b78f77 t/TestApp/t/i18n-standalone.t
SHA1 30274351a6eb9342daef843ffb8a2aafee38afb4 t/TestApp/t/instance_id.t
SHA1 ee548850452b377e08f36a9269c1b8f7911bdb2d t/TestApp/t/regex_meta_in_path_info.t
+SHA1 0270868131aad30c20ef0be68a43393c088cc902 t/TestApp/t/test_config.yml
SHA1 f502e4937629f7525cf90cf982cadd29bc60ed5a t/TestApp/t/upgrade.t
SHA1 a415b718785f367c0c7c4e8f72b33613f5dbce44 t/TestApp/t/use_mason_wrapper.t
SHA1 ca61102870f9c092374d7d74c19174ce601d80e7 t/clientside/td.t
-SHA1 c8fb21f31b593627b38129ee9dd41eaf9c556ced t/lib/Jifty/SubTest.pm
+SHA1 5c0b3c689031ace0031a3520cca976b852a622ed t/lib/Jifty/SubTest.pm
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.3 (Darwin)
+Version: GnuPG v1.4.7 (Darwin)
-iD8DBQFGzlvEEi9d9xCOQEYRAqPEAKCOzwFVQ+R1uimjKfJQgAiOh69VAwCfUI6C
-XxD2rfrthtS5PgsTW0eahl4=
-=f54M
+iD8DBQFHPgg6sxfQtHhyRPoRAjyoAJ9YjgyyqaikziPGyud9BovlehSwUgCfYaUJ
+BKDsT/pMy7OqTHN7i7Uulf0=
+=oOHW
-----END PGP SIGNATURE-----
Modified: jifty/branches/prototype-1.6/lib/Jifty.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty.pm Mon Nov 19 11:53:17 2007
@@ -11,7 +11,7 @@
require Time::Local;
# Declare early to make sure Jifty::Record::schema_version works
- $Jifty::VERSION = '0.70824';
+ $Jifty::VERSION = '0.71116';
}
=head1 NAME
Modified: jifty/branches/prototype-1.6/lib/Jifty/ClassLoader.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/ClassLoader.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/ClassLoader.pm Mon Nov 19 11:53:17 2007
@@ -340,6 +340,7 @@
for my $full ($self->models) {
$self->_require_model_related_classes($full);
}
+ $_->finalize_triggers for grep {$_->can('finalize_triggers')} $self->models;
}
# This class helps Jifty::ClassLoader::require() load each model, the model's
Modified: jifty/branches/prototype-1.6/lib/Jifty/Collection.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/Collection.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/Collection.pm Mon Nov 19 11:53:17 2007
@@ -39,15 +39,16 @@
Returns a L<Data::Page> object associated with this collection. This
object defaults to 10 entries per page. You should use only use
-L<Data::Page> methods on this object to B<get> information about paging,
-not to B<set> it; use C<set_page_info> to set paging information.
+L<Data::Page> methods on this object to B<get> information about
+paging, not to B<set> it; use C<set_page_info> to set paging
+information.
=head2 results_are_readable
If your results from the query are guaranteed to be readable by
current_user, you can create the collection with
-C<results_are_readable => 1>. This causes check_read_rights to
-bypass normal current_user_can checks.
+C<results_are_readable => 1>. This causes check_read_rights to bypass
+normal current_user_can checks.
=cut
@@ -55,9 +56,11 @@
=head2 as_search_action PARAMHASH
-Returns the L<Jifty::Action::Record::Search> action for the model associated with this collection.
+Returns the L<Jifty::Action::Record::Search> action for the model
+associated with this collection.
-The PARAMHASH allows you to add additional parameters to pass to L<Jifty::Web/new_action>.
+The PARAMHASH allows you to add additional parameters to pass to
+L<Jifty::Web/new_action>.
=cut
@@ -68,15 +71,16 @@
=head2 add_record
-If L</results_are_readable> is false, only add records to the collection that
-we can read (by checking L<Jifty::Record/check_read_rights>). Otherwise, make
-sure all records added are readable.
+If L</results_are_readable> is false, only add records to the
+collection that we can read (by checking
+L<Jifty::Record/check_read_rights>). Otherwise, make sure all records
+added are readable.
=cut
sub add_record {
my $self = shift;
- my($record) = (@_);
+ my ($record) = (@_);
# If results_are_readable is set, guarantee that they are
$record->_is_readable(1)
@@ -98,24 +102,24 @@
sub _init {
my $self = shift;
my %args = (
- record_class => undef,
- current_user => undef,
+ record_class => undef,
+ current_user => undef,
results_are_readable => undef,
@_
);
# Setup the current user, record class, results_are_readable
$self->_get_current_user(%args);
- $self->record_class($args{record_class}) if defined $args{record_class};
- $self->results_are_readable($args{results_are_readable});
+ $self->record_class( $args{record_class} ) if defined $args{record_class};
+ $self->results_are_readable( $args{results_are_readable} );
# Bad stuff, we really need one of these
- unless ($self->current_user) {
+ unless ( $self->current_user ) {
Carp::confess("Collection created without a current user");
}
# Setup the table and call the super-implementation
- $self->table($self->new_item->table());
+ $self->table( $self->new_item->table() );
$self->SUPER::_init(%args);
}
@@ -127,22 +131,17 @@
sub implicit_clauses {
my $self = shift;
- $self->order_by( column => 'id',order => 'asc');
+ $self->order_by( column => 'id', order => 'asc' );
}
-=head2 new_item
-
-Overrides L<Jifty::DBI::Collection>'s new_item to pass in the current
-user.
-
-=cut
-
-sub new_item {
+sub _new_record_args {
my $self = shift;
- my $class =$self->record_class();
+ return ( current_user => $self->current_user );
+}
- # We do this as a performance optimization, so we don't need to do the stackwalking to find it
- return $class->new(current_user => $self->current_user);
+sub _new_collection_args {
+ my $self = shift;
+ return ( current_user => $self->current_user );
}
=head1 SEE ALSO
Modified: jifty/branches/prototype-1.6/lib/Jifty/Everything.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/Everything.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/Everything.pm Mon Nov 19 11:53:17 2007
@@ -7,6 +7,14 @@
Jifty::Everything - Load all of the important Jifty modules at once.
+=head1 DESCRIPTION
+
+This package is loaded very early in the processof loading Jifty to bring in all of the wonderful goodies that make up Jifty. If you use L<JIfty>:
+
+ use Jifty;
+
+you use this package, so you should not need to use it yourself in most circumstances.
+
=cut
use Cwd ();
@@ -81,4 +89,15 @@
#Jifty::Module::Pluggable->import(search_path => ['Jifty::Web::Form::Field'], require => 1, except => qr/\.#/);
#__PACKAGE__->plugins;
+=head1 SEE ALSO
+
+L<Jifty>
+
+=head1 LICENSE
+
+Jifty is Copyright 2005-2007 Best Practical Solutions, LLC.
+Jifty is distributed under the same terms as Perl itself.
+
+=cut
+
1;
Modified: jifty/branches/prototype-1.6/lib/Jifty/Filter/DateTime.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/Filter/DateTime.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/Filter/DateTime.pm Mon Nov 19 11:53:17 2007
@@ -6,6 +6,15 @@
Jifty::Filter::DateTime -- A Jifty::DBI filter to work with
Jifty::DateTime objects
+=head1 SYNOPSIS
+
+ # use it with Jifty::DBI::Filter::Date or J::D::F::DateTime
+ column created =>
+ type is 'timestamp',
+ filters are qw( Jifty::Filter::DateTime Jifty::DBI::Filter::DateTime),
+ label is 'Created',
+ is immutable;
+
=head1 DESCRIPTION
Jifty::Filter::DateTime promotes DateTime objects to Jifty::DateTime
@@ -62,6 +71,11 @@
L<Jifty::DBI::Filter::Date>, L<Jifty::DBI::Filter::DateTime>,
L<Jifty::DateTime>
+=head1 LICENSE
+
+Jifty is Copyright 2005-2007 Best Practical Solutions, LLC.
+Jifty is distributed under the same terms as Perl itself.
+
=cut
1;
Modified: jifty/branches/prototype-1.6/lib/Jifty/JSON.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/JSON.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/JSON.pm Mon Nov 19 11:53:17 2007
@@ -7,6 +7,14 @@
Jifty::JSON -- Wrapper around L<JSON>
+=head1 SYNOPSIS
+
+ use Jifty::JSON;
+
+ # Even though you might be using JSON::Syck, use the original JSON names
+ my $obj = jsonToObj(q! { 'x': 1, 'y': 2, 'z': 3 } !);
+ my $json = objToJson($obj);
+
=head1 DESCRIPTION
Provides a wrapper around the L<JSON> library.
@@ -26,14 +34,21 @@
=cut
BEGIN {
+ # Errors that happen here, stay here.
local $@;
+
+ # We're hacking, so tell the nannies to leave for a minute
no strict 'refs';
no warnings 'once';
+
+ # If a good version of JSON::Syck is available use that...
if (eval { require JSON::Syck; JSON::Syck->VERSION(0.05) }) {
*jsonToObj = *_jsonToObj_syck;
*objToJson = *_objToJson_syck;
$JSON::Syck::ImplicitUnicode = 1;
}
+
+ # Bummer, fallback to the pure Perl implementation
else {
require JSON;
*jsonToObj = *_jsonToObj_pp;
@@ -113,4 +128,11 @@
return JSON::objToJson($obj, $args);
}
+=head1 LICENSE
+
+Jifty is Copyright 2005-2006 Best Practical Solutions, LLC.
+Jifty is distributed under the same terms as Perl itself.
+
+=cut
+
1;
Modified: jifty/branches/prototype-1.6/lib/Jifty/Plugin/Chart/Renderer/XMLSWF.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/Plugin/Chart/Renderer/XMLSWF.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/Plugin/Chart/Renderer/XMLSWF.pm Mon Nov 19 11:53:17 2007
@@ -126,7 +126,7 @@
$html .= "<embed";
$html .= qq[ $_="@{[$tags->{embed}{$_}]}"]
for keys %{ $tags->{embed} };
- $html .= "></embed>\n";
+ $html .= " />\n";
$html .= "</object>\n";
$html .= "</div>\n";
Modified: jifty/branches/prototype-1.6/lib/Jifty/Plugin/CompressedCSSandJS.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/Plugin/CompressedCSSandJS.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/Plugin/CompressedCSSandJS.pm Mon Nov 19 11:53:17 2007
@@ -145,20 +145,17 @@
=cut
-
sub generate_css {
my $self = shift;
if (not defined $self->cached_css_digest or Jifty->config->framework('DevelMode')) {
Jifty->log->debug("Generating CSS...");
-
- my @roots = map { Jifty::Util->absolute_path( File::Spec->catdir( $_, 'css' ) ) }
- Jifty->handler->view('Jifty::View::Static::Handler')->roots;
+
+ my @roots = map { Jifty::Util->absolute_path( $_ ) }
+ Jifty->handler->view('Jifty::View::Static::Handler')->roots;
- CSS::Squish->roots( @roots );
-
- my $css = CSS::Squish->concatenate(
- map { CSS::Squish->_resolve_file( $_, @roots ) }
+ my $css = CSS::Squish->new( roots => \@roots )->concatenate(
+ map { File::Spec->catfile('css', $_ ) }
@{ Jifty->web->css_files }
);
Modified: jifty/branches/prototype-1.6/lib/Jifty/Plugin/Feedback/Action/SendFeedback.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/Plugin/Feedback/Action/SendFeedback.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/Plugin/Feedback/Action/SendFeedback.pm Mon Nov 19 11:53:17 2007
@@ -58,13 +58,19 @@
# Fall back to normal email
my $mail = Jifty::Notification->new;
$mail->body($msg);
- $mail->from(
- ( Jifty->web->current_user->id
- && Jifty->web->current_user->user_object->can('email')
- )
- ? Jifty->web->current_user->user_object->email()
- : $plugin->from
- );
+
+ if ( Jifty->web->current_user->id
+ && Jifty->web->current_user->user_object->can('email') ) {
+
+ my $user = Jifty->web->current_user->user_object;
+ my $CurrentUser = Jifty->app_class('CurrentUser');
+ $user->current_user( $CurrentUser->superuser );
+ $mail->from( $user->email() || $plugin->from );
+ }
+ else {
+ $mail->from( $plugin->from );
+ }
+
$mail->recipients( $plugin->to );
$mail->subject( "["
. Jifty->config->framework('ApplicationName')
Modified: jifty/branches/prototype-1.6/lib/Jifty/Record.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/Record.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/Record.pm Mon Nov 19 11:53:17 2007
@@ -24,9 +24,8 @@
my $self = shift;
my %args = (@_);
$self->_get_current_user(%args);
-
- $self->SUPER::_init(@_);
+ $self->SUPER::_init(@_);
}
=head1 METHODS
@@ -37,8 +36,8 @@
C<create> can be called as either a class method or an object method.
-Takes an array of key-value pairs and inserts a new row into the database representing
-this object.
+Takes an array of key-value pairs and inserts a new row into the
+database representing this object.
Override's L<Jifty::DBI::Record> in these ways:
@@ -122,9 +121,8 @@
=cut
-sub _primary_key { 'id' }
-sub id { $_[0]->{'values'}->{'id'} }
-
+sub _primary_key {'id'}
+sub id { $_[0]->{'values'}->{'id'} }
=head2 load_or_create
@@ -137,8 +135,8 @@
sub load_or_create {
my $class = shift;
my $self;
- if (ref($class)) {
- ($self,$class) = ($class,undef);
+ if ( ref($class) ) {
+ ( $self, $class ) = ( $class, undef );
} else {
$self = $class->new();
}
@@ -150,44 +148,47 @@
return $self->create(%args);
}
- return ($id,$msg);
+ return ( $id, $msg );
}
-
=head2 as_create_action PARAMHASH
-Returns the L<Jifty::Action::Record::Create> action for this model class.
+Returns the L<Jifty::Action::Record::Create> action for this model
+class.
-The PARAMHASH allows you to add additional parameters to pass to L<Jifty::Web/new_action>.
+The PARAMHASH allows you to add additional parameters to pass to
+L<Jifty::Web/new_action>.
=cut
sub _action_from_record {
- my $self = shift;
- my $verb = shift;
+ my $self = shift;
+ my $verb = shift;
my $class = ref $self || $self;
$class =~ s/::Model::/::Action::$verb/;
return $class;
}
sub as_create_action {
- my $self = shift;
+ my $self = shift;
my $action_class = $self->_action_from_record('Create');
return Jifty->web->new_action( class => $action_class, @_ );
}
=head2 as_update_action PARAMHASH
-Returns the L<Jifty::Action::Record::Update> action for this model class. The current record is passed to the constructor.
+Returns the L<Jifty::Action::Record::Update> action for this model
+class. The current record is passed to the constructor.
-The PARAMHASH allows you to add additional parameters to pass to L<Jifty::Web/new_action>.
+The PARAMHASH allows you to add additional parameters to pass to
+L<Jifty::Web/new_action>.
=cut
sub as_update_action {
- my $self = shift;
+ my $self = shift;
my $action_class = $self->_action_from_record('Update');
- return Jifty->web->new_action(
+ return Jifty->web->new_action(
class => $action_class,
record => $self,
@_,
@@ -196,14 +197,16 @@
=head2 as_delete_action PARAMHASH
-Returns the L<Jifty::Action::Record::Delete> action for this model class. The current record is passed to the constructor.
+Returns the L<Jifty::Action::Record::Delete> action for this model
+class. The current record is passed to the constructor.
-The PARAMHASH allows you to add additional parameters to pass to L<Jifty::Web/new_action>.
+The PARAMHASH allows you to add additional parameters to pass to
+L<Jifty::Web/new_action>.
=cut
sub as_delete_action {
- my $self = shift;
+ my $self = shift;
my $action_class = $self->_action_from_record('Delete');
return Jifty->web->new_action(
class => $action_class,
@@ -214,35 +217,40 @@
=head2 as_search_action PARAMHASH
-Returns the L<Jifty::Action::Record::Search> action for this model class.
+Returns the L<Jifty::Action::Record::Search> action for this model
+class.
-The PARAMHASH allows you to add additional parameters to pass to L<Jifty::Web/new_action>.
+The PARAMHASH allows you to add additional parameters to pass to
+L<Jifty::Web/new_action>.
=cut
sub as_search_action {
- my $self = shift;
+ my $self = shift;
my $action_class = $self->_action_from_record('Search');
return Jifty->web->new_action(
- class => $action_class,
+ class => $action_class,
@_,
);
}
=head2 _guess_table_name
-Guesses a table name based on the class's last part. In addition to the work performed in L<Jifty::DBI::Record>, this method also prefixes the table name with the plugin table prefix, if the model belongs to a plugin.
+Guesses a table name based on the class's last part. In addition to
+the work performed in L<Jifty::DBI::Record>, this method also prefixes
+the table name with the plugin table prefix, if the model belongs to a
+plugin.
=cut
sub _guess_table_name {
- my $self = shift;
+ my $self = shift;
my $table = $self->SUPER::_guess_table_name;
# Add plugin table prefix if a plugin model
my $class = ref($self) ? ref($self) : $self;
my $app_plugin_root = Jifty->app_class('Plugin');
- if ($class =~ /^(?:Jifty::Plugin::|$app_plugin_root)/) {
+ if ( $class =~ /^(?:Jifty::Plugin::|$app_plugin_root)/ ) {
# Guess the plugin class name
my $plugin_class = $class;
@@ -252,13 +260,14 @@
my ($plugin) = grep { ref $_ eq $plugin_class } Jifty->plugins;
# Add the prefix if found
- if (defined $plugin) {
+ if ( defined $plugin ) {
$table = $plugin->table_prefix . $table;
}
# Uh oh. Warn, but try to keep going.
else {
- warn "Model $class looks like a plugin model, but $plugin_class could not be found.";
+ warn
+ "Model $class looks like a plugin model, but $plugin_class could not be found.";
}
}
@@ -296,7 +305,8 @@
=back
-Models wishing to customize authorization checks should override this method. You can do so like this:
+Models wishing to customize authorization checks should override this
+method. You can do so like this:
sub current_user_can {
my ($self, $right, %args) = @_;
@@ -309,7 +319,9 @@
return $self->SUPER::current_user_can($right, %args);
}
-If you are sure you don't want your model to fallback using the default implementation, you can replace the last line with whatever fallback policy required.
+If you are sure you don't want your model to fallback using the
+default implementation, you can replace the last line with whatever
+fallback policy required.
=head3 Authorization steps
@@ -319,24 +331,25 @@
=item 1.
-If the C<SkipAccessControl> setting is set to a true value in the framework configuration section of F<etc/config.yml>, C<current_user_can> always returns true.
+If the C<SkipAccessControl> setting is set to a true value in the
+framework configuration section of F<etc/config.yml>,
+C<current_user_can> always returns true.
=item 2.
-The method first attempts to call the C<before_access> hooks to check for any
-allow or denial. See L</The before_access hook>.
+The method first attempts to call the C<before_access> hooks to check
+for any allow or denial. See L</The before_access hook>.
=item 3.
Next, the default implementation returns true if the current user is a
-superuser or a boostrap user.
+superuser or a boostrap user.
=item 4.
Then, if the model can perform delegation, usually by using
-L<Jifty::RightsFrom>, the access control decision is deferred to another object
-(via the C<delegate_current_user_can>
-subroutine).
+L<Jifty::RightsFrom>, the access control decision is deferred to
+another object (via the C<delegate_current_user_can> subroutine).
=item 5.
@@ -346,7 +359,9 @@
=head3 The before_access hook
-This implementation may make use of a trigger called C<before_access> to make the decision. A new handler can be added to the trigger point by calling C<add_handler>:
+This implementation may make use of a trigger called C<before_access>
+to make the decision. A new handler can be added to the trigger point
+by calling C<add_handler>:
$record->add_trigger(
name => 'before_access',
@@ -354,15 +369,21 @@
abortable => 1,
);
-The C<before_access> handler will be passed the same arguments that were used to call C<current_user_can>, including the current record object, the operation being checked, and any arguments being passed to the operation.
-
-The C<before_access> handler should return one of three strings: C<'deny'>, C<'allow'>, or C<'ignore'>. The C<current_user_can> implementation reacts as follows to these results:
+The C<before_access> handler will be passed the same arguments that
+were used to call C<current_user_can>, including the current record
+object, the operation being checked, and any arguments being passed to
+the operation.
+
+The C<before_access> handler should return one of three strings:
+C<'deny'>, C<'allow'>, or C<'ignore'>. The C<current_user_can>
+implementation reacts as follows to these results:
=over
=item 1.
-If a handler is abortable and aborts by returning a false value (such as C<undef>), C<current_user_can> returns false.
+If a handler is abortable and aborts by returning a false value (such
+as C<undef>), C<current_user_can> returns false.
=item 2.
@@ -370,11 +391,14 @@
=item 3.
-If any handler returns 'allow' and no handler returns 'deny', C<current_user_can> returns true.
+If any handler returns 'allow' and no handler returns 'deny',
+C<current_user_can> returns true.
=item 4.
-In all other cases, the results of the handlers are ignored and C<current_user_can> proceeds to check using superuser, bootstrap, and delegation.
+In all other cases, the results of the handlers are ignored and
+C<current_user_can> proceeds to check using superuser, bootstrap, and
+delegation.
=back
@@ -383,38 +407,38 @@
sub current_user_can {
my $self = shift;
my $right = shift;
-
+
# Turn off access control for the whole application
- if (Jifty->config->framework('SkipAccessControl')) {
- return 1;
+ if ( Jifty->config->framework('SkipAccessControl') ) {
+ return 1;
}
my $hook_status = $self->call_trigger( before_access => $right, @_ );
# If not aborted...
- if (defined $hook_status) {
+ if ( defined $hook_status ) {
# Compile the handler results
my %results;
- $results{ $_->[0] }++ for (@{ $self->last_trigger_results });
+ $results{ $_->[0] }++ for ( @{ $self->last_trigger_results } );
# Deny always takes precedent
- if ($results{deny}) {
+ if ( $results{deny} ) {
return 0;
}
# Then allow...
- elsif ($results{allow}) {
+ elsif ( $results{allow} ) {
return 1;
}
-
+
# Otherwise, no instruction from the handlers, move along...
}
# Abort! Return false for safety
else {
return 0;
- }
+ }
if ( $self->current_user->is_bootstrap_user
or $self->current_user->is_superuser )
@@ -422,12 +446,11 @@
return (1);
}
-
- if ($self->can('delegate_current_user_can')) {
- return $self->delegate_current_user_can($right, @_);
+ if ( $self->can('delegate_current_user_can') ) {
+ return $self->delegate_current_user_can( $right, @_ );
}
- unless ( $self->current_user->isa( 'Jifty::CurrentUser' ) ) {
+ unless ( $self->current_user->isa('Jifty::CurrentUser') ) {
$self->log->error(
"Hm. called to authenticate without a currentuser - "
. $self->current_user );
@@ -443,8 +466,7 @@
=cut
-sub check_create_rights { return shift->current_user_can('create', @_) }
-
+sub check_create_rights { return shift->current_user_can( 'create', @_ ) }
=head2 check_read_rights
@@ -466,8 +488,7 @@
=cut
-sub check_update_rights { return shift->current_user_can('update', @_) }
-
+sub check_update_rights { return shift->current_user_can( 'update', @_ ) }
=head2 check_delete_rights
@@ -475,24 +496,22 @@
=cut
-sub check_delete_rights { return shift->current_user_can('delete', @_) }
-
+sub check_delete_rights { return shift->current_user_can( 'delete', @_ ) }
sub _set {
my $self = shift;
- unless ($self->check_update_rights(@_)) {
- return (0, _('Permission denied'));
+ unless ( $self->check_update_rights(@_) ) {
+ return ( 0, _('Permission denied') );
}
$self->SUPER::_set(@_);
}
-
sub _value {
- my $self = shift;
+ my $self = shift;
my $column = shift;
- unless ($self->check_read_rights( $column => @_ )) {
+ unless ( $self->check_read_rights( $column => @_ ) ) {
return (undef);
}
my $value = $self->SUPER::_value( $column => @_ );
@@ -502,7 +521,6 @@
$value;
}
-
=head2 as_superuser
Returns a copy of this object with the current_user set to the
@@ -514,43 +532,11 @@
sub as_superuser {
my $self = shift;
- my $clone = $self->new(current_user => $self->current_user->superuser);
- $clone->load($self->id);
+ my $clone = $self->new( current_user => $self->current_user->superuser );
+ $clone->load( $self->id );
return $clone;
}
-
-=head2 _collection_value METHOD
-
-A method ripped from the pages of Jifty::DBI::Record
-so we could change the invocation method of the collection generator to
-add a current_user argument.
-
-=cut
-
-sub _collection_value {
- my $self = shift;
-
- my $method_name = shift;
- return unless defined $method_name;
-
- my $column = $self->column($method_name);
- my $classname = $column->refers_to();
-
- return undef unless $classname;
- return unless $classname->isa( 'Jifty::DBI::Collection' );
-
- if ( my $prefetched_collection = $self->_prefetched_collection($method_name)) {
- return $prefetched_collection;
- }
-
- my $coll = $classname->new( current_user => $self->current_user );
- if ($column->by and $self->id) {
- $coll->limit( column => $column->by(), value => $self->id );
- }
- return $coll;
-}
-
=head2 delete PARAMHASH
Overrides L<Jifty::DBI::Record> to check the delete ACL.
@@ -559,11 +545,11 @@
sub delete {
my $self = shift;
- unless ($self->check_delete_rights(@_)) {
- Jifty->log->logcluck("Permission denied");
- return(0, _('Permission denied'));
- }
- $self->SUPER::delete(@_);
+ unless ( $self->check_delete_rights(@_) ) {
+ Jifty->log->logcluck("Permission denied");
+ return ( 0, _('Permission denied') );
+ }
+ $self->SUPER::delete(@_);
}
=head2 brief_description
@@ -573,48 +559,54 @@
=cut
sub brief_description {
- my $self = shift;
+ my $self = shift;
my $method = $self->_brief_description;
return $self->$method;
}
=head2 _brief_description
-When displaying a list of records, Jifty can display a friendly value
+When displaying a list of records, Jifty can display a friendly value
rather than the column's unique id. Out of the box, Jifty always
-tries to display the 'name' field from the record. You can override this
-method to return the name of a method on your record class which will
-return a nice short human readable description for this record.
+tries to display the 'name' field from the record. You can override
+this method to return the name of a method on your record class which
+will return a nice short human readable description for this record.
=cut
sub _brief_description {'name'}
-=head2 _to_record
+=head2 null_reference
-This is the Jifty::DBI function that is called when you fetch a value which C<REFERENCES> a
-Record class. The only change from the Jifty::DBI code is the arguments to C<new>.
+By default, L<Jifty::DBI::Record> returns C<undef> on non-existant
+related fields; Jifty prefers to get back an object with an undef id.
=cut
-sub _to_record {
- my $self = shift;
- my $column_name = shift;
- my $value = shift;
+sub null_reference { 0 }
+
+=head2 _new_collection_args
+
+Overrides the default arguments which this collection passes to new
+collections, to pass the C<current_user>.
+
+=cut
+
+sub _new_collection_args {
+ my $self = shift;
+ return ( current_user => $self->current_user );
+}
- my $column = $self->column($column_name);
- my $classname = $column->refers_to();
+=head2 _new_record_args
- return undef unless $classname;
- return unless $classname->isa( 'Jifty::Record' );
+Overrides the default arguments which this collection passes to new
+records, to pass the C<current_user>.
- # XXX TODO FIXME we need to figure out the right way to call new here
- # perhaps the handle should have an initiializer for records/collections
- my $object = $classname->new(current_user => $self->current_user);
- $object->load_by_cols(( $column->by || 'id') => $value) if ($value);
- # XXX: an attribute or hook to let model class declare implicit
- # readable refers_to columns. $object->_is_readable(1) if $column->blah;
- return $object;
+=cut
+
+sub _new_record_args {
+ my $self = shift;
+ return ( current_user => $self->current_user );
}
=head2 cache_key_prefix
@@ -624,7 +616,6 @@
=cut
-
sub cache_key_prefix {
Jifty->config->framework('Database')->{'Database'};
}
@@ -636,21 +627,20 @@
}
=head2 since
-
-By default, all models exist since C<undef>, the ur-time when the application was created. Please override it for your model class.
-
-=cut
-
+By default, all models exist since C<undef>, the ur-time when the
+application was created. Please override it for your model class.
+
+=cut
=head2 printable_table_schema
-When called, this method will generate the SQL schema for the current version of this
-class and return it as a scalar, suitable for printing or execution in your database's command line.
+When called, this method will generate the SQL schema for the current
+version of this class and return it as a scalar, suitable for printing
+or execution in your database's command line.
=cut
-
sub printable_table_schema {
my $class = shift;
@@ -660,8 +650,9 @@
=head2 create_table_in_db
-When called, this method will generate the SQL schema for the current version of this
-class and insert it into the application's currently open database.
+When called, this method will generate the SQL schema for the current
+version of this class and insert it into the application's currently
+open database.
=cut
@@ -694,9 +685,10 @@
$ret or die "error removing table $self: " . $ret->error_message;
}
-sub _make_schema {
+sub _make_schema {
my $class = shift;
+ require Jifty::DBI::SchemaGenerator;
my $schema_gen = Jifty::DBI::SchemaGenerator->new( Jifty->handle )
or die "Can't make Jifty::DBI::SchemaGenerator";
my $ret = $schema_gen->add_model( $class->new );
@@ -707,7 +699,8 @@
=head2 add_column_sql column_name
-Returns the SQL statement necessary to add C<column_name> to this class's representation in the database
+Returns the SQL statement necessary to add C<column_name> to this
+class's representation in the database
=cut
@@ -716,11 +709,11 @@
my $column_name = shift;
my $col = $self->column($column_name);
- my $definition = $self->_make_schema()->column_definition_sql($self->table => $col->name);
+ my $definition = $self->_make_schema()
+ ->column_definition_sql( $self->table => $col->name );
return "ALTER TABLE " . $self->table . " ADD COLUMN " . $definition;
}
-
=head2 add_column_in_db column_name
Executes the SQL code generated by add_column_sql. Dies on failure.
@@ -729,14 +722,19 @@
sub add_column_in_db {
my $self = shift;
- my $ret = Jifty->handle->simple_query($self->add_column_sql(@_));
- $ret or die "error adding column ". $_[0] ." to $self: " . $ret->error_message;
+ my $ret = Jifty->handle->simple_query( $self->add_column_sql(@_) );
+ $ret
+ or die "error adding column "
+ . $_[0]
+ . " to $self: "
+ . $ret->error_message;
}
=head2 drop_column_sql column_name
-Returns the SQL statement necessary to remove C<column_name> from this class's representation in the database
+Returns the SQL statement necessary to remove C<column_name> from this
+class's representation in the database
=cut
@@ -748,7 +746,6 @@
return "ALTER TABLE " . $self->table . " DROP COLUMN " . $col->name;
}
-
=head2 drop_column_in_db column_name
Executes the SQL code generated by drop_column_sql. Dies on failure.
@@ -757,14 +754,20 @@
sub drop_column_in_db {
my $self = shift;
- my $ret = Jifty->handle->simple_query($self->drop_column_sql(@_));
- $ret or die "error dropping column ". $_[0] ." to $self: " . $ret->error_message;
+ my $ret = Jifty->handle->simple_query( $self->drop_column_sql(@_) );
+ $ret
+ or die "error dropping column "
+ . $_[0]
+ . " to $self: "
+ . $ret->error_message;
}
=head2 schema_version
-This method is used by L<Jifty::DBI::Record> to determine which schema version is in use. It returns the current database version stored in the configuration.
+This method is used by L<Jifty::DBI::Record> to determine which schema
+version is in use. It returns the current database version stored in
+the configuration.
Jifty's notion of the schema version is currently broken into two:
@@ -772,11 +775,14 @@
=item 1.
-The Jifty version is the first. In the case of models defined by Jifty itself, these use the version found in C<$Jifty::VERSION>.
+The Jifty version is the first. In the case of models defined by Jifty
+itself, these use the version found in C<$Jifty::VERSION>.
=item 2.
-Any model defined by your application use the database version declared in the configuration. In F<etc/config.yml>, this is lcoated at:
+Any model defined by your application use the database version
+declared in the configuration. In F<etc/config.yml>, this is lcoated
+at:
framework:
Database:
@@ -784,15 +790,17 @@
=back
-A model is considered to be defined by Jifty if it the package name starts with "Jifty::". Otherwise, it is assumed to be an application model.
+A model is considered to be defined by Jifty if it the package name
+starts with "Jifty::". Otherwise, it is assumed to be an application
+model.
=cut
sub schema_version {
my $class = shift;
-
+
# Return the Jifty schema version
- if ($class =~ /^Jifty::Model::/) {
+ if ( $class =~ /^Jifty::Model::/ ) {
return $Jifty::VERSION;
}
@@ -806,4 +814,3 @@
}
1;
-
Modified: jifty/branches/prototype-1.6/lib/Jifty/RightsFrom.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/RightsFrom.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/RightsFrom.pm Mon Nov 19 11:53:17 2007
@@ -75,10 +75,10 @@
sub export_curried_sub {
my %args = (
- sub_name => undef,
- export_to => undef,
- as => undef,
- args => undef,
+ sub_name => undef,
+ export_to => undef,
+ as => undef,
+ args => undef,
@_
);
no strict 'refs';
@@ -109,6 +109,7 @@
$right = 'update' if $right ne 'read';
my $obj;
+ $col_name =~ s/_id$//;
my $column = $self->column($col_name);
my $obj_type = $column->refers_to();
Modified: jifty/branches/prototype-1.6/lib/Jifty/Test.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/Test.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/Test.pm Mon Nov 19 11:53:17 2007
@@ -363,7 +363,8 @@
},
Mailer => 'Jifty::Test',
MailerArgs => [],
- LogLevel => 'WARN'
+ LogLevel => 'WARN',
+ TestMode => 1,
}
};
Modified: jifty/branches/prototype-1.6/lib/Jifty/Test/WWW/Selenium.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/Test/WWW/Selenium.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/Test/WWW/Selenium.pm Mon Nov 19 11:53:17 2007
@@ -114,7 +114,7 @@
close *STDOUT;
}
$ENV{LANG} = $args{lang} || 'en_US.UTF-8';
- $ENV{PATH} = "$ENV{PATH}:/usr/lib/firefox:/usr/lib/mozilla-firefox";
+ $ENV{PATH} = "$ENV{PATH}:/usr/lib/firefox";
Test::More::diag "start selenium rc [$$]";
local $SIG{CHLD} = \&_REAPER;
local $SIG{TERM} = sub { exit 0 };
Modified: jifty/branches/prototype-1.6/lib/Jifty/View/Declare.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/View/Declare.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/View/Declare.pm Mon Nov 19 11:53:17 2007
@@ -23,7 +23,7 @@
L<Template::Declare> is a templating system using a declarative syntax built on top of Perl. This provides a templating language built in a similar style to the dispatcher language in L<Jifty::Dispatcher>, the model language in L<Jifty::DBI::Schema>, and the action language in L<Jifty::Param::Schema>.
-To use this view system, you must declare a class named C<MyApp::View> (where I<MyApp> is the name of your Jifyt application). Use this library class to bring in all the details needed to make it work:
+To use this view system, you must declare a class named C<MyApp::View> (where I<MyApp> is the name of your Jifty application). Use this library class to bring in all the details needed to make it work:
package MyApp::View;
use Jifty::View::Declare -base;
Modified: jifty/branches/prototype-1.6/lib/Jifty/View/Declare/Handler.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/View/Declare/Handler.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/View/Declare/Handler.pm Mon Nov 19 11:53:17 2007
@@ -76,7 +76,7 @@
};
my $content = Template::Declare::Tags::show_page( $template, Jifty->web->request->arguments );
- return unless defined $content && length $content;
+ return unless defined $content;
my $r = Jifty->handler->apache;
$r->content_type || $r->content_type('text/html; charset=utf-8'); # Set up a default
Modified: jifty/branches/prototype-1.6/lib/Jifty/View/Declare/Helpers.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/View/Declare/Helpers.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/View/Declare/Helpers.pm Mon Nov 19 11:53:17 2007
@@ -295,7 +295,7 @@
my $wrapper = Jifty->app_class('View')->can('wrapper') || \&wrapper;
my @metadata = $meta ? $meta->() : ();
my $metadata = $#metadata == 0 ? $metadata[0] : {@metadata};
- local *is::title = sub { warn "Can't use 'title is' when mixing mason and TD" };
+ local *is::title = sub { Carp::carp "Can't use 'title is' when mixing mason and TD" };
$wrapper->( sub { $code->( $self, $metadata ) }, $metadata );
}
}
Modified: jifty/branches/prototype-1.6/lib/Jifty/Web/Form/Element.pm
==============================================================================
--- jifty/branches/prototype-1.6/lib/Jifty/Web/Form/Element.pm (original)
+++ jifty/branches/prototype-1.6/lib/Jifty/Web/Form/Element.pm Mon Nov 19 11:53:17 2007
@@ -560,7 +560,7 @@
if ( @fragments or ( !$actions || %$actions ) ) {
my $update = Jifty->web->escape(
- "Jifty.update( "
+ "update( "
. Jifty::JSON::objToJson(
{ actions => $actions,
action_arguments => $action_arguments,
Modified: jifty/branches/prototype-1.6/share/web/static/js/jifty.js
==============================================================================
--- jifty/branches/prototype-1.6/share/web/static/js/jifty.js (original)
+++ jifty/branches/prototype-1.6/share/web/static/js/jifty.js Mon Nov 19 11:53:17 2007
@@ -24,7 +24,7 @@
}
function _get_onclick(action_hash, name, args, path) {
- var onclick = 'if(event.ctrlKey||event.metaKey||event.altKey||event.shiftKey) return true; return Jifty.update('
+ var onclick = 'if(event.ctrlKey||event.metaKey||event.altKey||event.shiftKey) return true; return update('
+ JSON.stringify({'continuation': {},
'actions': action_hash,
'fragments': [{'mode': 'Replace', 'args': args, 'region': name, 'path': path}]})
@@ -519,9 +519,9 @@
getAction: function (element) {
element = $(element);
var moniker = Form.Element.getMoniker(element);
- if (!current_actions.get(moniker))
- current_actions.set(moniker, new Action(moniker));
- return current_actions.get(moniker);
+ if (!current_actions[moniker])
+ current_actions[moniker] = new Action(moniker);
+ return current_actions[moniker];
},
// Returns the name of the field
@@ -609,14 +609,14 @@
var pairs = element.getAttribute("name").split("|");
for (var i = 0; i < pairs.length; i++) {
var bits = pairs[i].split('=',2);
- extras.set(bits[0], bits[1]);
+ extras[bits[0]] = bits[1];
}
return extras;
},
buttonActions: function(element) {
element = $(element);
- var actions = Form.Element.buttonArguments(element).get('J:ACTIONS');
+ var actions = Form.Element.buttonArguments(element)['J:ACTIONS'];
if(actions) {
return actions.split(",");
} else {
@@ -634,7 +634,7 @@
var e = document.createElement("input");
e.setAttribute("type", "hidden");
e.setAttribute("name", keys[i]);
- e.setAttribute("value", args.get(keys[i]));
+ e.setAttribute("value", args[keys[i]]);
e['virtualform'] = Form.Element.getForm(element);
extras.push(e);
}
@@ -737,8 +737,8 @@
this.name = name;
this.args = $H(args);
this.path = path;
- this.parent = parent ? fragments.get(parent) : null;
- if (fragments.get(name)) {
+ this.parent = parent ? fragments[parent] : null;
+ if (fragments[name]) {
// If this fragment already existed, we want to wipe out
// whatever evil lies we might have said earlier; do this
// by clearing out everything that looks relevant
@@ -747,12 +747,12 @@
var k = keys[i];
var parsed = k.match(/^(.*?)\.(.*)/);
if ((parsed != null) && (parsed.length == 3) && (parsed[1] == this.name)) {
- current_args.unset(k);
+ delete current_args[k];
}
}
}
- fragments.set(name, this);
+ fragments[name] = this;
},
setPath: function(supplied) {
@@ -761,7 +761,7 @@
for (var i = 0; i < keys.length; i++) {
var k = keys[i];
if (k == this.name) {
- this.path = current_args.get(k);
+ this.path = current_args[k];
}
}
@@ -771,7 +771,7 @@
}
// Propagate back to current args
- current_args.set(this.name, this.path);
+ current_args[this.name] = this.path;
// Return new value
return this.path;
@@ -785,7 +785,7 @@
var k = keys[i];
var parsed = k.match(/^(.*?)\.(.*)/);
if ((parsed != null) && (parsed.length == 3) && (parsed[1] == this.name)) {
- this.args.set(parsed[2], current_args.get(k));
+ this.args[parsed[2]] = current_args[k];
}
}
@@ -796,7 +796,7 @@
keys = supplied.keys();
for (var i = 0; i < keys.length; i++) {
var k = keys[i];
- current_args.set(this.name+'.'+k, supplied.get(k));
+ current_args[this.name+'.'+k] = supplied[k];
}
// Return new values
@@ -854,12 +854,12 @@
// If we're removing the element, do it now
// XXX TODO: Effects on this?
if (f['mode'] == "Delete") {
- fragments.set(name, null);
+ fragments[name] = null;
Element.remove(element);
return;
}
- f['is_new'] = (fragments.get(name) ? false : true);
+ f['is_new'] = (fragments[name] ? false : true);
// If it's new, we need to create it so we can dump it
if (f['is_new']) {
// Find what region we're inside
@@ -878,14 +878,14 @@
// Make the region (for now)
new Region(name, f['args'], f['path'], f['parent']);
- } else if ((f['path'] != null) && f['toggle'] && (f['path'] == fragments.get(name).path)) {
+ } else if ((f['path'] != null) && f['toggle'] && (f['path'] == fragments[name].path)) {
// If they set the 'toggle' flag, and clicking wouldn't change the path
Element.update(element, '');
- fragments.get(name).path = null;
+ fragments[name].path = null;
return;
} else if (f['path'] == null) {
// If they didn't know the path, fill it in now
- f['path'] == fragments.get(name).path;
+ f['path'] == fragments[name].path;
}
return f;
@@ -931,7 +931,7 @@
// - f: fragment spec
var apply_fragment_updates = function(fragment, f) {
// We found the right fragment
- var dom_fragment = fragments.get(f['region']);
+ var dom_fragment = fragments[f['region']];
var new_dom_args = $H();
var element = f['element'];
@@ -947,7 +947,7 @@
} else if (fragment_bit.firstChild) {
textContent = fragment_bit.firstChild.nodeValue;
}
- new_dom_args.set(fragment_bit.getAttribute("name"), textContent);
+ new_dom_args[fragment_bit.getAttribute("name")] = textContent;
},
content: function(fragment_bit) {
var textContent = '';
@@ -1001,7 +1001,7 @@
// - 'element' is the CSS selector of the element to update, if 'region' isn't supplied
// - 'mode' is one of 'Replace', or the name of a Prototype Insertion
// - 'effect' is the name of a Prototype Effect
-Jifty.update = function () {
+function update() {
// loads
if(!Ajax.getTransport()) return true;
// XXX: prevent default behavior in IE
@@ -1019,7 +1019,7 @@
var disabled_elements = $A();
// Set request base path
- request.set('path', '/__jifty/webservices/xml');
+ request['path'] = '/__jifty/webservices/xml';
// Grab extra arguments (from a button)
var button_args = Form.Element.buttonFormElements(trigger);
@@ -1039,11 +1039,11 @@
optional_fragments = [ prepare_element_for_update({'mode':'Replace','args':{},'region':'__page','path': null}) ];
// Build actions structure
var has_request = 0;
- request.set('actions', $H());
+ request['actions'] = $H();
for (var moniker in named_args['actions']) {
var disable = named_args['actions'][moniker];
var a = new Action(moniker, button_args);
- current_actions.set(moniker, a); // XXX: how do i make this bloody singleton?
+ current_actions[moniker] = a; // XXX: how do i make this bloody singleton?
// Special case for Redirect, allow optional, implicit __page
// from the response to be used.
if (a.actionClass == 'Jifty::Action::Redirect')
@@ -1066,13 +1066,13 @@
fields[argname] = { value: override[argname] };
}
}
- request.get('actions').set(moniker, param);
+ request['actions'][moniker] = param;
++has_request;
}
}
- request.set('fragments', $H());
+ request['fragments'] = $H();
var update_from_cache = new Array;
// Build fragments structure
@@ -1087,7 +1087,7 @@
var content_node = document.createElement('content');
var cached_result;
- Jifty.Web.current_region = fragments.get(f['region']);
+ Jifty.Web.current_region = fragments[f['region']];
try { cached_result = apply_cached_for_action(cached['content'], []) }
catch (e) { alert(e) }
@@ -1107,7 +1107,7 @@
my_fragment.setAttribute('id', f['region']);
update_from_cache.push(function(){
var cached_result;
- Jifty.Web.current_region = fragments.get(f['region']);
+ Jifty.Web.current_region = fragments[f['region']];
try {
cached_result = apply_cached_for_action(cached['content'], Form.getActions(form));
}
@@ -1134,14 +1134,14 @@
// Update with all new values
var name = f['region'];
- var fragment_request = fragments.get(name).data_structure(f['path'], f['args']);
+ var fragment_request = fragments[name].data_structure(f['path'], f['args']);
if (f['is_new'])
// Ask for the wrapper if we are making a new region
fragment_request['wrapper'] = 1;
// Push it onto the request stack
- request.get('fragments').set(name, fragment_request);
+ request['fragments'][name] = fragment_request;
++has_request;
}
@@ -1169,7 +1169,7 @@
var text = error.textContent
? error.textContent
: (error.firstChild ? error.firstChild.nodeValue : '');
- var action = current_actions.get(moniker);
+ var action = current_actions[moniker];
action.result.field_error[field.getAttribute("name")] = text;
}
}});
@@ -1226,15 +1226,15 @@
};
// Build variable structure
- request.set('variables', $H());
+ request['variables'] = $H();
var keys = current_args.keys();
for (var i = 0; i < keys.length; i++) {
var k = keys[i];
- request.get('variables').set('region-'+k, current_args.get(k));
+ request['variables']['region-'+k] = current_args[k];
}
// Build continuation structure
- request.set('continuation', named_args['continuation']);
+ request['continuation'] = named_args['continuation'];
// Push any state variables which we set into the forms
for (var i = 0; i < document.forms.length; i++) {
@@ -1243,20 +1243,20 @@
for (var j = 0; j < keys.length; j++) {
var n = keys[j];
if (form['J:V-region-'+n]) {
- form['J:V-region-'+n].value = current_args.get(n);
+ form['J:V-region-'+n].value = current_args[n];
} else {
var hidden = document.createElement('input');
hidden.setAttribute('type', 'hidden');
hidden.setAttribute('name', 'J:V-region-'+n);
hidden.setAttribute('id', 'J:V-region-'+n);
- hidden.setAttribute('value', current_args.get(n));
+ hidden.setAttribute('value', current_args[n]);
form.appendChild(hidden);
}
}
}
// Set up our options
- var options = { postBody: request.toJSON(), //JSON.stringify(request.toObject),
+ var options = { postBody: JSON.stringify(request),
onSuccess: onSuccess,
onException: onFailure,
onFailure: onFailure,
@@ -1271,11 +1271,6 @@
return false;
}
-function update ( named_args, trigger ) {
- alert( 'please use Jifty.update instead of update.' );
- return Jifty.update( named_args, trigger );
-}
-
function trace( msg ){
if( typeof( jsTrace ) != 'undefined' ){
jsTrace.send( msg );
@@ -1416,10 +1411,10 @@
getUpdatedChoices: function() {
var request = { path: this.url, actions: {} };
- var a = {}; //$H();
+ var a = $H();
a['moniker'] = 'autocomplete';
a['class'] = 'Jifty::Action::Autocomplete';
- a['fields'] = {}; //$H();
+ a['fields'] = $H();
a['fields']['moniker'] = this.action.moniker;
a['fields']['argument'] = Form.Element.getField(this.field);
request['actions']['autocomplete'] = a;
@@ -1520,39 +1515,33 @@
// and then merge them.
var hiddens = $H();
var buttons = $H();
- var inputs = $H();
+ var inputs = $H()
for (var i = 0; i < elements.length; i++) {
var e = elements[i];
var parsed = e.getAttribute("name").match(/^J:V-region-__page\.(.*)/);
var extras = Form.Element.buttonArguments(e);
- if (extras.keys().length > 1) {
+ if (extras.keys().length > 0) {
// Button with values
for (var j = 0; j < extras.keys().length; j++) {
- if ( extras.keys()[j] == 'extend' ) continue;
// Might also have J:V mappings on it
parsed = extras.keys()[j].match(/^J:V-region-__page\.(.*)/);
if ((parsed != null) && (parsed.length == 2)) {
- buttons.set(parsed[1], extras.values()[j]);
+ buttons[parsed[1]] = extras.values()[j];
} else if (extras.keys()[j].length > 0) {
- inputs.set(extras.keys()[j], extras.values()[j]);
+ inputs[extras.keys()[j]] = extras.values()[j];
}
}
} else if ((parsed != null) && (parsed.length == 2)) {
// Hidden default
- hiddens.set(parsed[1], $F(e));
+ hiddens[parsed[1]] = $F(e);
} else if (e.name.length > 0) {
// Straight up values
- inputs.set(e.name, $F(e));
+ inputs[e.name] = $F(e);
}
}
var args = hiddens.merge(buttons.merge(inputs));
-
- /* we want to feed a common object instead of a Hash to Jifty.update */
- var args_object = {};
- args.each( function( pair ) { args_object[pair.key] = pair.value; } );
-
if(event.ctrlKey||event.metaKey||event.altKey||event.shiftKey) return true;
- return Jifty.update( {'continuation':{},'actions':null,'fragments':[{'mode':'Replace','args':args_object,'region':'__page','path': submit_to}]}, elt );
+ return update( {'continuation':{},'actions':null,'fragments':[{'mode':'Replace','args':args,'region':'__page','path': submit_to}]}, elt );
}
Modified: jifty/branches/prototype-1.6/share/web/static/js/prototype.js
==============================================================================
--- jifty/branches/prototype-1.6/share/web/static/js/prototype.js (original)
+++ jifty/branches/prototype-1.6/share/web/static/js/prototype.js Mon Nov 19 11:53:17 2007
@@ -1,290 +1,102 @@
-/* Prototype JavaScript framework, version 1.6.0
- * (c) 2005-2007 Sam Stephenson
+/* Prototype JavaScript framework, version 1.4.0
+ * (c) 2005 Sam Stephenson <sam at conio.net>
+ *
+ * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff
+ * against the source tree, available from the Prototype darcs repository.
*
* Prototype is freely distributable under the terms of an MIT-style license.
- * For details, see the Prototype web site: http://www.prototypejs.org/
*
- *--------------------------------------------------------------------------*/
+ * For details, see the Prototype web site: http://prototype.conio.net/
+ *
+/*--------------------------------------------------------------------------*/
var Prototype = {
- Version: '1.6.0',
-
- Browser: {
- IE: !!(window.attachEvent && !window.opera),
- Opera: !!window.opera,
- WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
- Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
- MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
- },
-
- BrowserFeatures: {
- XPath: !!document.evaluate,
- ElementExtensions: !!window.HTMLElement,
- SpecificElementExtensions:
- document.createElement('div').__proto__ &&
- document.createElement('div').__proto__ !==
- document.createElement('form').__proto__
- },
-
- ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
- JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
-
- emptyFunction: function() { },
- K: function(x) { return x }
-};
+ Version: '1.4.0',
+ ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
-if (Prototype.Browser.MobileSafari)
- Prototype.BrowserFeatures.SpecificElementExtensions = false;
-
-if (Prototype.Browser.WebKit)
- Prototype.BrowserFeatures.XPath = false;
+ emptyFunction: function() {},
+ K: function(x) {return x}
+}
-/* Based on Alex Arnell's inheritance implementation. */
var Class = {
create: function() {
- var parent = null, properties = $A(arguments);
- if (Object.isFunction(properties[0]))
- parent = properties.shift();
-
- function klass() {
+ return function() {
this.initialize.apply(this, arguments);
}
-
- Object.extend(klass, Class.Methods);
- klass.superclass = parent;
- klass.subclasses = [];
-
- if (parent) {
- var subclass = function() { };
- subclass.prototype = parent.prototype;
- klass.prototype = new subclass;
- parent.subclasses.push(klass);
- }
-
- for (var i = 0; i < properties.length; i++)
- klass.addMethods(properties[i]);
-
- if (!klass.prototype.initialize)
- klass.prototype.initialize = Prototype.emptyFunction;
-
- klass.prototype.constructor = klass;
-
- return klass;
- }
-};
-
-Class.Methods = {
- addMethods: function(source) {
- var ancestor = this.superclass && this.superclass.prototype;
- var properties = Object.keys(source);
-
- if (!Object.keys({ toString: true }).length)
- properties.push("toString", "valueOf");
-
- for (var i = 0, length = properties.length; i < length; i++) {
- var property = properties[i], value = source[property];
- if (ancestor && Object.isFunction(value) &&
- value.argumentNames().first() == "$super") {
- var method = value, value = Object.extend((function(m) {
- return function() { return ancestor[m].apply(this, arguments) };
- })(property).wrap(method), {
- valueOf: function() { return method },
- toString: function() { return method.toString() }
- });
- }
- this.prototype[property] = value;
- }
-
- return this;
}
-};
+}
-var Abstract = { };
+var Abstract = new Object();
Object.extend = function(destination, source) {
- for (var property in source)
+ for (property in source) {
destination[property] = source[property];
+ }
return destination;
-};
-
-Object.extend(Object, {
- inspect: function(object) {
- try {
- if (object === undefined) return 'undefined';
- if (object === null) return 'null';
- return object.inspect ? object.inspect() : object.toString();
- } catch (e) {
- if (e instanceof RangeError) return '...';
- throw e;
- }
- },
-
- toJSON: function(object) {
- var type = typeof object;
- switch (type) {
- case 'undefined':
- case 'function':
- case 'unknown': return;
- case 'boolean': return object.toString();
- }
-
- if (object === null) return 'null';
- if (object.toJSON) return object.toJSON();
- if (Object.isElement(object)) return;
-
- var results = [];
- for (var property in object) {
- var value = Object.toJSON(object[property]);
- if (value !== undefined)
- results.push(property.toJSON() + ': ' + value);
- }
-
- return '{' + results.join(', ') + '}';
- },
-
- toQueryString: function(object) {
- return $H(object).toQueryString();
- },
-
- toHTML: function(object) {
- return object && object.toHTML ? object.toHTML() : String.interpret(object);
- },
-
- keys: function(object) {
- var keys = [];
- for (var property in object)
- keys.push(property);
- return keys;
- },
-
- values: function(object) {
- var values = [];
- for (var property in object)
- values.push(object[property]);
- return values;
- },
-
- clone: function(object) {
- return Object.extend({ }, object);
- },
-
- isElement: function(object) {
- return object && object.nodeType == 1;
- },
-
- isArray: function(object) {
- return object && object.constructor === Array;
- },
-
- isHash: function(object) {
- return object instanceof Hash;
- },
-
- isFunction: function(object) {
- return typeof object == "function";
- },
-
- isString: function(object) {
- return typeof object == "string";
- },
-
- isNumber: function(object) {
- return typeof object == "number";
- },
+}
- isUndefined: function(object) {
- return typeof object == "undefined";
+Object.inspect = function(object) {
+ try {
+ if (object == undefined) return 'undefined';
+ if (object == null) return 'null';
+ return object.inspect ? object.inspect() : object.toString();
+ } catch (e) {
+ if (e instanceof RangeError) return '...';
+ throw e;
}
-});
-
-Object.extend(Function.prototype, {
- argumentNames: function() {
- var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
- return names.length == 1 && !names[0] ? [] : names;
- },
-
- bind: function() {
- if (arguments.length < 2 && arguments[0] === undefined) return this;
- var __method = this, args = $A(arguments), object = args.shift();
- return function() {
- return __method.apply(object, args.concat($A(arguments)));
- }
- },
+}
- bindAsEventListener: function() {
- var __method = this, args = $A(arguments), object = args.shift();
- return function(event) {
- return __method.apply(object, [event || window.event].concat(args));
- }
- },
+Function.prototype.bind = function() {
+ var __method = this, args = $A(arguments), object = args.shift();
+ return function() {
+ return __method.apply(object, args.concat($A(arguments)));
+ }
+}
- curry: function() {
- if (!arguments.length) return this;
- var __method = this, args = $A(arguments);
- return function() {
- return __method.apply(this, args.concat($A(arguments)));
- }
- },
+Function.prototype.bindAsEventListener = function(object) {
+ var __method = this;
+ return function(event) {
+ return __method.call(object, event || window.event);
+ }
+}
- delay: function() {
- var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
- return window.setTimeout(function() {
- return __method.apply(__method, args);
- }, timeout);
+Object.extend(Number.prototype, {
+ toColorPart: function() {
+ var digits = this.toString(16);
+ if (this < 16) return '0' + digits;
+ return digits;
},
- wrap: function(wrapper) {
- var __method = this;
- return function() {
- return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
- }
+ succ: function() {
+ return this + 1;
},
- methodize: function() {
- if (this._methodized) return this._methodized;
- var __method = this;
- return this._methodized = function() {
- return __method.apply(null, [this].concat($A(arguments)));
- };
+ times: function(iterator) {
+ $R(0, this, true).each(iterator);
+ return this;
}
});
-Function.prototype.defer = Function.prototype.delay.curry(0.01);
-
-Date.prototype.toJSON = function() {
- return '"' + this.getUTCFullYear() + '-' +
- (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
- this.getUTCDate().toPaddedString(2) + 'T' +
- this.getUTCHours().toPaddedString(2) + ':' +
- this.getUTCMinutes().toPaddedString(2) + ':' +
- this.getUTCSeconds().toPaddedString(2) + 'Z"';
-};
-
var Try = {
these: function() {
var returnValue;
- for (var i = 0, length = arguments.length; i < length; i++) {
+ for (var i = 0; i < arguments.length; i++) {
var lambda = arguments[i];
try {
returnValue = lambda();
break;
- } catch (e) { }
+ } catch (e) {}
}
return returnValue;
}
-};
-
-RegExp.prototype.match = RegExp.prototype.test;
-
-RegExp.escape = function(str) {
- return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
-};
+}
/*--------------------------------------------------------------------------*/
-var PeriodicalExecuter = Class.create({
+var PeriodicalExecuter = Class.create();
+PeriodicalExecuter.prototype = {
initialize: function(callback, frequency) {
this.callback = callback;
this.frequency = frequency;
@@ -294,87 +106,40 @@
},
registerCallback: function() {
- this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- execute: function() {
- this.callback(this);
- },
-
- stop: function() {
- if (!this.timer) return;
- clearInterval(this.timer);
- this.timer = null;
+ setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
},
onTimerEvent: function() {
if (!this.currentlyExecuting) {
try {
this.currentlyExecuting = true;
- this.execute();
+ this.callback();
} finally {
this.currentlyExecuting = false;
}
}
}
-});
-Object.extend(String, {
- interpret: function(value) {
- return value == null ? '' : String(value);
- },
- specialChar: {
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '\\': '\\\\'
- }
-});
+}
-Object.extend(String.prototype, {
- gsub: function(pattern, replacement) {
- var result = '', source = this, match;
- replacement = arguments.callee.prepareReplacement(replacement);
-
- while (source.length > 0) {
- if (match = source.match(pattern)) {
- result += source.slice(0, match.index);
- result += String.interpret(replacement(match));
- source = source.slice(match.index + match[0].length);
- } else {
- result += source, source = '';
- }
- }
- return result;
- },
+/*--------------------------------------------------------------------------*/
- sub: function(pattern, replacement, count) {
- replacement = this.gsub.prepareReplacement(replacement);
- count = count === undefined ? 1 : count;
-
- return this.gsub(pattern, function(match) {
- if (--count < 0) return match[0];
- return replacement(match);
- });
- },
+function $() {
+ var elements = new Array();
- scan: function(pattern, iterator) {
- this.gsub(pattern, iterator);
- return String(this);
- },
+ for (var i = 0; i < arguments.length; i++) {
+ var element = arguments[i];
+ if (typeof element == 'string')
+ element = document.getElementById(element);
- truncate: function(length, truncation) {
- length = length || 30;
- truncation = truncation === undefined ? '...' : truncation;
- return this.length > length ?
- this.slice(0, length - truncation.length) + truncation : String(this);
- },
+ if (arguments.length == 1)
+ return element;
- strip: function() {
- return this.replace(/^\s+/, '').replace(/\s+$/, '');
- },
+ elements.push(element);
+ }
+ return elements;
+}
+Object.extend(String.prototype, {
stripTags: function() {
return this.replace(/<\/?[^>]+>/gi, '');
},
@@ -392,40 +157,28 @@
},
evalScripts: function() {
- return this.extractScripts().map(function(script) { return eval(script) });
+ return this.extractScripts().map(eval);
},
escapeHTML: function() {
- var self = arguments.callee;
- self.text.data = this;
- return self.div.innerHTML;
+ var div = document.createElement('div');
+ var text = document.createTextNode(this);
+ div.appendChild(text);
+ return div.innerHTML;
},
unescapeHTML: function() {
- var div = new Element('div');
+ var div = document.createElement('div');
div.innerHTML = this.stripTags();
- return div.childNodes[0] ? (div.childNodes.length > 1 ?
- $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
- div.childNodes[0].nodeValue) : '';
- },
-
- toQueryParams: function(separator) {
- var match = this.strip().match(/([^?#]*)(#.*)?$/);
- if (!match) return { };
-
- return match[1].split(separator || '&').inject({ }, function(hash, pair) {
- if ((pair = pair.split('='))[0]) {
- var key = decodeURIComponent(pair.shift());
- var value = pair.length > 1 ? pair.join('=') : pair[0];
- if (value != undefined) value = decodeURIComponent(value);
-
- if (key in hash) {
- if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
- hash[key].push(value);
- }
- else hash[key] = value;
- }
- return hash;
+ return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
+ },
+
+ toQueryParams: function() {
+ var pairs = this.match(/^\??(.*)$/)[1].split('&');
+ return pairs.inject({}, function(params, pairString) {
+ var pair = pairString.split('=');
+ params[pair[0]] = pair[1];
+ return params;
});
},
@@ -433,201 +186,67 @@
return this.split('');
},
- succ: function() {
- return this.slice(0, this.length - 1) +
- String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
- },
-
- times: function(count) {
- return count < 1 ? '' : new Array(count + 1).join(this);
- },
-
camelize: function() {
- var parts = this.split('-'), len = parts.length;
- if (len == 1) return parts[0];
-
- var camelized = this.charAt(0) == '-'
- ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
- : parts[0];
-
- for (var i = 1; i < len; i++)
- camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
-
- return camelized;
- },
-
- capitalize: function() {
- return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
- },
-
- underscore: function() {
- return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
- },
-
- dasherize: function() {
- return this.gsub(/_/,'-');
- },
-
- inspect: function(useDoubleQuotes) {
- var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
- var character = String.specialChar[match[0]];
- return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
- });
- if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
- return "'" + escapedString.replace(/'/g, '\\\'') + "'";
- },
-
- toJSON: function() {
- return this.inspect(true);
- },
-
- unfilterJSON: function(filter) {
- return this.sub(filter || Prototype.JSONFilter, '#{1}');
- },
-
- isJSON: function() {
- var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
- return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
- },
-
- evalJSON: function(sanitize) {
- var json = this.unfilterJSON();
- try {
- if (!sanitize || json.isJSON()) return eval('(' + json + ')');
- } catch (e) { }
- throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
- },
-
- include: function(pattern) {
- return this.indexOf(pattern) > -1;
- },
-
- startsWith: function(pattern) {
- return this.indexOf(pattern) === 0;
- },
+ var oStringList = this.split('-');
+ if (oStringList.length == 1) return oStringList[0];
- endsWith: function(pattern) {
- var d = this.length - pattern.length;
- return d >= 0 && this.lastIndexOf(pattern) === d;
- },
+ var camelizedString = this.indexOf('-') == 0
+ ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
+ : oStringList[0];
- empty: function() {
- return this == '';
- },
+ for (var i = 1, len = oStringList.length; i < len; i++) {
+ var s = oStringList[i];
+ camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
+ }
- blank: function() {
- return /^\s*$/.test(this);
+ return camelizedString;
},
- interpolate: function(object, pattern) {
- return new Template(this, pattern).evaluate(object);
- }
-});
-
-if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
- escapeHTML: function() {
- return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
- },
- unescapeHTML: function() {
- return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
+ inspect: function() {
+ return "'" + this.replace('\\', '\\\\').replace("'", '\\\'') + "'";
}
});
-String.prototype.gsub.prepareReplacement = function(replacement) {
- if (Object.isFunction(replacement)) return replacement;
- var template = new Template(replacement);
- return function(match) { return template.evaluate(match) };
-};
-
String.prototype.parseQuery = String.prototype.toQueryParams;
-Object.extend(String.prototype.escapeHTML, {
- div: document.createElement('div'),
- text: document.createTextNode('')
-});
-
-with (String.prototype.escapeHTML) div.appendChild(text);
-
-var Template = Class.create({
- initialize: function(template, pattern) {
- this.template = template.toString();
- this.pattern = pattern || Template.Pattern;
- },
-
- evaluate: function(object) {
- if (Object.isFunction(object.toTemplateReplacements))
- object = object.toTemplateReplacements();
-
- return this.template.gsub(this.pattern, function(match) {
- if (object == null) return '';
-
- var before = match[1] || '';
- if (before == '\\') return match[2];
-
- var ctx = object, expr = match[3];
- var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr);
- if (match == null) return before;
-
- while (match != null) {
- var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
- ctx = ctx[comp];
- if (null == ctx || '' == match[3]) break;
- expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
- match = pattern.exec(expr);
- }
-
- return before + String.interpret(ctx);
- }.bind(this));
- }
-});
-Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
-
-var $break = { };
+var $break = new Object();
+var $continue = new Object();
var Enumerable = {
- each: function(iterator, context) {
+ each: function(iterator) {
var index = 0;
- iterator = iterator.bind(context);
try {
this._each(function(value) {
- iterator(value, index++);
+ try {
+ iterator(value, index++);
+ } catch (e) {
+ if (e != $continue) throw e;
+ }
});
} catch (e) {
if (e != $break) throw e;
}
- return this;
- },
-
- eachSlice: function(number, iterator, context) {
- iterator = iterator ? iterator.bind(context) : Prototype.K;
- var index = -number, slices = [], array = this.toArray();
- while ((index += number) < array.length)
- slices.push(array.slice(index, index+number));
- return slices.collect(iterator, context);
},
- all: function(iterator, context) {
- iterator = iterator ? iterator.bind(context) : Prototype.K;
+ all: function(iterator) {
var result = true;
this.each(function(value, index) {
- result = result && !!iterator(value, index);
+ result = result && !!(iterator || Prototype.K)(value, index);
if (!result) throw $break;
});
return result;
},
- any: function(iterator, context) {
- iterator = iterator ? iterator.bind(context) : Prototype.K;
- var result = false;
+ any: function(iterator) {
+ var result = true;
this.each(function(value, index) {
- if (result = !!iterator(value, index))
+ if (result = !!(iterator || Prototype.K)(value, index))
throw $break;
});
return result;
},
- collect: function(iterator, context) {
- iterator = iterator ? iterator.bind(context) : Prototype.K;
+ collect: function(iterator) {
var results = [];
this.each(function(value, index) {
results.push(iterator(value, index));
@@ -635,8 +254,7 @@
return results;
},
- detect: function(iterator, context) {
- iterator = iterator.bind(context);
+ detect: function (iterator) {
var result;
this.each(function(value, index) {
if (iterator(value, index)) {
@@ -647,8 +265,7 @@
return result;
},
- findAll: function(iterator, context) {
- iterator = iterator.bind(context);
+ findAll: function(iterator) {
var results = [];
this.each(function(value, index) {
if (iterator(value, index))
@@ -657,24 +274,17 @@
return results;
},
- grep: function(filter, iterator, context) {
- iterator = iterator ? iterator.bind(context) : Prototype.K;
+ grep: function(pattern, iterator) {
var results = [];
-
- if (Object.isString(filter))
- filter = new RegExp(filter);
-
this.each(function(value, index) {
- if (filter.match(value))
- results.push(iterator(value, index));
- });
+ var stringValue = value.toString();
+ if (stringValue.match(pattern))
+ results.push((iterator || Prototype.K)(value, index));
+ })
return results;
},
include: function(object) {
- if (Object.isFunction(this.indexOf))
- if (this.indexOf(object) != -1) return true;
-
var found = false;
this.each(function(value) {
if (value == object) {
@@ -685,16 +295,7 @@
return found;
},
- inGroupsOf: function(number, fillWith) {
- fillWith = fillWith === undefined ? null : fillWith;
- return this.eachSlice(number, function(slice) {
- while(slice.length < number) slice.push(fillWith);
- return slice;
- });
- },
-
- inject: function(memo, iterator, context) {
- iterator = iterator.bind(context);
+ inject: function(memo, iterator) {
this.each(function(value, index) {
memo = iterator(memo, value, index);
});
@@ -703,38 +304,35 @@
invoke: function(method) {
var args = $A(arguments).slice(1);
- return this.map(function(value) {
+ return this.collect(function(value) {
return value[method].apply(value, args);
});
},
- max: function(iterator, context) {
- iterator = iterator ? iterator.bind(context) : Prototype.K;
+ max: function(iterator) {
var result;
this.each(function(value, index) {
- value = iterator(value, index);
- if (result == undefined || value >= result)
+ value = (iterator || Prototype.K)(value, index);
+ if (value >= (result || value))
result = value;
});
return result;
},
- min: function(iterator, context) {
- iterator = iterator ? iterator.bind(context) : Prototype.K;
+ min: function(iterator) {
var result;
this.each(function(value, index) {
- value = iterator(value, index);
- if (result == undefined || value < result)
+ value = (iterator || Prototype.K)(value, index);
+ if (value <= (result || value))
result = value;
});
return result;
},
- partition: function(iterator, context) {
- iterator = iterator ? iterator.bind(context) : Prototype.K;
+ partition: function(iterator) {
var trues = [], falses = [];
this.each(function(value, index) {
- (iterator(value, index) ?
+ ((iterator || Prototype.K)(value, index) ?
trues : falses).push(value);
});
return [trues, falses];
@@ -742,14 +340,13 @@
pluck: function(property) {
var results = [];
- this.each(function(value) {
+ this.each(function(value, index) {
results.push(value[property]);
});
return results;
},
- reject: function(iterator, context) {
- iterator = iterator.bind(context);
+ reject: function(iterator) {
var results = [];
this.each(function(value, index) {
if (!iterator(value, index))
@@ -758,9 +355,8 @@
return results;
},
- sortBy: function(iterator, context) {
- iterator = iterator.bind(context);
- return this.map(function(value, index) {
+ sortBy: function(iterator) {
+ return this.collect(function(value, index) {
return {value: value, criteria: iterator(value, index)};
}).sort(function(left, right) {
var a = left.criteria, b = right.criteria;
@@ -769,67 +365,52 @@
},
toArray: function() {
- return this.map();
+ return this.collect(Prototype.K);
},
zip: function() {
var iterator = Prototype.K, args = $A(arguments);
- if (Object.isFunction(args.last()))
+ if (typeof args.last() == 'function')
iterator = args.pop();
var collections = [this].concat(args).map($A);
return this.map(function(value, index) {
- return iterator(collections.pluck(index));
+ iterator(value = collections.pluck(index));
+ return value;
});
},
- size: function() {
- return this.toArray().length;
- },
-
inspect: function() {
return '#<Enumerable:' + this.toArray().inspect() + '>';
}
-};
+}
Object.extend(Enumerable, {
map: Enumerable.collect,
find: Enumerable.detect,
select: Enumerable.findAll,
- filter: Enumerable.findAll,
member: Enumerable.include,
- entries: Enumerable.toArray,
- every: Enumerable.all,
- some: Enumerable.any
+ entries: Enumerable.toArray
});
-function $A(iterable) {
+var $A = Array.from = function(iterable) {
if (!iterable) return [];
- if (iterable.toArray) return iterable.toArray();
- var length = iterable.length, results = new Array(length);
- while (length--) results[length] = iterable[length];
- return results;
-}
-
-if (Prototype.Browser.WebKit) {
- function $A(iterable) {
- if (!iterable) return [];
- if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
- iterable.toArray) return iterable.toArray();
- var length = iterable.length, results = new Array(length);
- while (length--) results[length] = iterable[length];
+ if (iterable.toArray) {
+ return iterable.toArray();
+ } else {
+ var results = [];
+ for (var i = 0; i < iterable.length; i++)
+ results.push(iterable[i]);
return results;
}
}
-Array.from = $A;
-
Object.extend(Array.prototype, Enumerable);
-if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
+Array.prototype._reverse = Array.prototype.reverse;
Object.extend(Array.prototype, {
_each: function(iterator) {
- for (var i = 0, length = this.length; i < length; i++)
+ for (var i = 0; i < this.length; i++)
iterator(this[i]);
},
@@ -848,13 +429,13 @@
compact: function() {
return this.select(function(value) {
- return value != null;
+ return value != undefined || value != null;
});
},
flatten: function() {
return this.inject([], function(array, value) {
- return array.concat(Object.isArray(value) ?
+ return array.concat(value.constructor == Array ?
value.flatten() : [value]);
});
},
@@ -866,252 +447,90 @@
});
},
- reverse: function(inline) {
- return (inline !== false ? this : this.toArray())._reverse();
- },
-
- reduce: function() {
- return this.length > 1 ? this : this[0];
- },
-
- uniq: function(sorted) {
- return this.inject([], function(array, value, index) {
- if (0 == index || (sorted ? array.last() != value : !array.include(value)))
- array.push(value);
- return array;
- });
- },
-
- intersect: function(array) {
- return this.uniq().findAll(function(item) {
- return array.detect(function(value) { return item === value });
- });
+ indexOf: function(object) {
+ for (var i = 0; i < this.length; i++)
+ if (this[i] == object) return i;
+ return -1;
},
- clone: function() {
- return [].concat(this);
+ reverse: function(inline) {
+ return (inline !== false ? this : this.toArray())._reverse();
},
- size: function() {
- return this.length;
+ shift: function() {
+ var result = this[0];
+ for (var i = 0; i < this.length - 1; i++)
+ this[i] = this[i + 1];
+ this.length--;
+ return result;
},
inspect: function() {
return '[' + this.map(Object.inspect).join(', ') + ']';
- },
-
- toJSON: function() {
- var results = [];
- this.each(function(object) {
- var value = Object.toJSON(object);
- if (value !== undefined) results.push(value);
- });
- return '[' + results.join(', ') + ']';
}
});
+var Hash = {
+ _each: function(iterator) {
+ for (key in this) {
+ var value = this[key];
+ if (typeof value == 'function') continue;
-// use native browser JS 1.6 implementation if available
-if (Object.isFunction(Array.prototype.forEach))
- Array.prototype._each = Array.prototype.forEach;
-
-if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
- i || (i = 0);
- var length = this.length;
- if (i < 0) i = length + i;
- for (; i < length; i++)
- if (this[i] === item) return i;
- return -1;
-};
-
-if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
- i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
- var n = this.slice(0, i).reverse().indexOf(item);
- return (n < 0) ? n : i - n - 1;
-};
-
-Array.prototype.toArray = Array.prototype.clone;
-
-function $w(string) {
- if (!Object.isString(string)) return [];
- string = string.strip();
- return string ? string.split(/\s+/) : [];
-}
-
-if (Prototype.Browser.Opera){
- Array.prototype.concat = function() {
- var array = [];
- for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
- for (var i = 0, length = arguments.length; i < length; i++) {
- if (Object.isArray(arguments[i])) {
- for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
- array.push(arguments[i][j]);
- } else {
- array.push(arguments[i]);
- }
+ var pair = [key, value];
+ pair.key = key;
+ pair.value = value;
+ iterator(pair);
}
- return array;
- };
-}
-Object.extend(Number.prototype, {
- toColorPart: function() {
- return this.toPaddedString(2, 16);
},
- succ: function() {
- return this + 1;
+ keys: function() {
+ return this.pluck('key');
},
- times: function(iterator) {
- $R(0, this, true).each(iterator);
- return this;
+ values: function() {
+ return this.pluck('value');
+ },
+
+ merge: function(hash) {
+ return $H(hash).inject($H(this), function(mergedHash, pair) {
+ mergedHash[pair.key] = pair.value;
+ return mergedHash;
+ });
},
- toPaddedString: function(length, radix) {
- var string = this.toString(radix || 10);
- return '0'.times(length - string.length) + string;
+ toQueryString: function() {
+ return this.map(function(pair) {
+ return pair.map(encodeURIComponent).join('=');
+ }).join('&');
},
- toJSON: function() {
- return isFinite(this) ? this.toString() : 'null';
+ inspect: function() {
+ return '#<Hash:{' + this.map(function(pair) {
+ return pair.map(Object.inspect).join(': ');
+ }).join(', ') + '}>';
}
-});
+}
-$w('abs round ceil floor').each(function(method){
- Number.prototype[method] = Math[method].methodize();
-});
function $H(object) {
- return new Hash(object);
-};
-
-var Hash = Class.create(Enumerable, (function() {
- if (function() {
- var i = 0, Test = function(value) { this.key = value };
- Test.prototype.key = 'foo';
- for (var property in new Test('bar')) i++;
- return i > 1;
- }()) {
- function each(iterator) {
- var cache = [];
- for (var key in this._object) {
- var value = this._object[key];
- if (cache.include(key)) continue;
- cache.push(key);
- var pair = [key, value];
- pair.key = key;
- pair.value = value;
- iterator(pair);
- }
- }
- } else {
- function each(iterator) {
- for (var key in this._object) {
- var value = this._object[key], pair = [key, value];
- pair.key = key;
- pair.value = value;
- iterator(pair);
- }
- }
- }
-
- function toQueryPair(key, value) {
- if (Object.isUndefined(value)) return key;
- return key + '=' + encodeURIComponent(String.interpret(value));
- }
-
- return {
- initialize: function(object) {
- this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
- },
-
- _each: each,
-
- set: function(key, value) {
- return this._object[key] = value;
- },
-
- get: function(key) {
- return this._object[key];
- },
-
- unset: function(key) {
- var value = this._object[key];
- delete this._object[key];
- return value;
- },
-
- toObject: function() {
- return Object.clone(this._object);
- },
-
- keys: function() {
- return this.pluck('key');
- },
-
- values: function() {
- return this.pluck('value');
- },
-
- index: function(value) {
- var match = this.detect(function(pair) {
- return pair.value === value;
- });
- return match && match.key;
- },
-
- merge: function(object) {
- return this.clone().update(object);
- },
-
- update: function(object) {
- return new Hash(object).inject(this, function(result, pair) {
- result.set(pair.key, pair.value);
- return result;
- });
- },
-
- toQueryString: function() {
- return this.map(function(pair) {
- var key = encodeURIComponent(pair.key), values = pair.value;
-
- if (values && typeof values == 'object') {
- if (Object.isArray(values))
- return values.map(toQueryPair.curry(key)).join('&');
- }
- return toQueryPair(key, values);
- }).join('&');
- },
-
- inspect: function() {
- return '#<Hash:{' + this.map(function(pair) {
- return pair.map(Object.inspect).join(': ');
- }).join(', ') + '}>';
- },
-
- toJSON: function() {
- return Object.toJSON(this.toObject());
- },
-
- clone: function() {
- return new Hash(this);
- }
- }
-})());
-
-Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
-Hash.from = $H;
-var ObjectRange = Class.create(Enumerable, {
- initialize: function(start, end, exclusive) {
- this.start = start;
- this.end = end;
- this.exclusive = exclusive;
- },
+ var hash = Object.extend({}, object || {});
+ Object.extend(hash, Enumerable);
+ Object.extend(hash, Hash);
+ return hash;
+}
+ObjectRange = Class.create();
+Object.extend(ObjectRange.prototype, Enumerable);
+Object.extend(ObjectRange.prototype, {
+ initialize: function(start, end, exclusive) {
+ this.start = start;
+ this.end = end;
+ this.exclusive = exclusive;
+ },
_each: function(iterator) {
var value = this.start;
- while (this.include(value)) {
+ do {
iterator(value);
value = value.succ();
- }
+ } while (this.include(value));
},
include: function(value) {
@@ -1125,19 +544,19 @@
var $R = function(start, end, exclusive) {
return new ObjectRange(start, end, exclusive);
-};
+}
var Ajax = {
getTransport: function() {
return Try.these(
- function() {return new XMLHttpRequest()},
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
- function() {return new ActiveXObject('Microsoft.XMLHTTP')}
+ function() {return new ActiveXObject('Microsoft.XMLHTTP')},
+ function() {return new XMLHttpRequest()}
) || false;
},
activeRequestCount: 0
-};
+}
Ajax.Responders = {
responders: [],
@@ -1146,21 +565,21 @@
this.responders._each(iterator);
},
- register: function(responder) {
- if (!this.include(responder))
- this.responders.push(responder);
+ register: function(responderToAdd) {
+ if (!this.include(responderToAdd))
+ this.responders.push(responderToAdd);
},
- unregister: function(responder) {
- this.responders = this.responders.without(responder);
+ unregister: function(responderToRemove) {
+ this.responders = this.responders.without(responderToRemove);
},
dispatch: function(callback, request, transport, json) {
this.each(function(responder) {
- if (Object.isFunction(responder[callback])) {
+ if (responder[callback] && typeof responder[callback] == 'function') {
try {
responder[callback].apply(responder, [request, transport, json]);
- } catch (e) { }
+ } catch (e) {}
}
});
}
@@ -1169,194 +588,159 @@
Object.extend(Ajax.Responders, Enumerable);
Ajax.Responders.register({
- onCreate: function() { Ajax.activeRequestCount++ },
- onComplete: function() { Ajax.activeRequestCount-- }
+ onCreate: function() {
+ Ajax.activeRequestCount++;
+ },
+
+ onComplete: function() {
+ Ajax.activeRequestCount--;
+ }
});
-Ajax.Base = Class.create({
- initialize: function(options) {
+Ajax.Base = function() {};
+Ajax.Base.prototype = {
+ setOptions: function(options) {
this.options = {
method: 'post',
asynchronous: true,
- contentType: 'application/x-www-form-urlencoded',
- encoding: 'UTF-8',
- parameters: '',
- evalJSON: true,
- evalJS: true
- };
- Object.extend(this.options, options || { });
-
- this.options.method = this.options.method.toLowerCase();
- if (Object.isString(this.options.parameters))
- this.options.parameters = this.options.parameters.toQueryParams();
+ parameters: ''
+ }
+ Object.extend(this.options, options || {});
+ },
+
+ responseIsSuccess: function() {
+ return this.transport.status == undefined
+ || this.transport.status == 0
+ || (this.transport.status >= 200 && this.transport.status < 300);
+ },
+
+ responseIsFailure: function() {
+ return !this.responseIsSuccess();
}
-});
+}
-Ajax.Request = Class.create(Ajax.Base, {
- _complete: false,
+Ajax.Request = Class.create();
+Ajax.Request.Events =
+ ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
- initialize: function($super, url, options) {
- $super(options);
+Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
+ initialize: function(url, options) {
this.transport = Ajax.getTransport();
+ this.setOptions(options);
this.request(url);
},
request: function(url) {
- this.url = url;
- this.method = this.options.method;
- var params = Object.clone(this.options.parameters);
-
- if (!['get', 'post'].include(this.method)) {
- // simulate other verbs over post
- params['_method'] = this.method;
- this.method = 'post';
- }
-
- this.parameters = params;
-
- if (params = Object.toQueryString(params)) {
- // when GET, append parameters to URL
- if (this.method == 'get')
- this.url += (this.url.include('?') ? '&' : '?') + params;
- else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
- params += '&_=';
- }
+ var parameters = this.options.parameters || '';
+ if (parameters.length > 0) parameters += '&_=';
try {
- var response = new Ajax.Response(this);
- if (this.options.onCreate) this.options.onCreate(response);
- Ajax.Responders.dispatch('onCreate', this, response);
+ this.url = url;
+ if (this.options.method == 'get' && parameters.length > 0)
+ this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
- this.transport.open(this.method.toUpperCase(), this.url,
- this.options.asynchronous);
+ Ajax.Responders.dispatch('onCreate', this, this.transport);
- if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
+ this.transport.open(this.options.method, this.url,
+ this.options.asynchronous);
+ if (this.options.asynchronous) {
+ setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
+ }
this.transport.onreadystatechange = this.onStateChange.bind(this);
- this.setRequestHeaders();
- this.body = this.method == 'post' ? (this.options.postBody || params) : null;
- this.transport.send(this.body);
+ this.setRequestHeaders();
- /* Force Firefox to handle ready state 4 for synchronous requests */
- if (!this.options.asynchronous && this.transport.overrideMimeType)
- this.onStateChange();
+ var body = this.options.postBody ? this.options.postBody : parameters;
+ this.transport.send(this.options.method == 'post' ? body : null);
- }
- catch (e) {
+ } catch (e) {
this.dispatchException(e);
}
},
- onStateChange: function() {
- var readyState = this.transport.readyState;
- if (readyState > 1 && !((readyState == 4) && this._complete))
- this.respondToReadyState(this.transport.readyState);
- },
-
setRequestHeaders: function() {
- var headers = {
- 'X-Requested-With': 'XMLHttpRequest',
- 'X-Prototype-Version': Prototype.Version,
- 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
- };
-
- var headerNames = [ 'X-Requested-With', 'X-Prototype-Version', 'Accept' ];
-
- if (this.method == 'post') {
- headers['Content-Type'] = this.options.contentType +
- (this.options.encoding ? '; charset=' + this.options.encoding : '');
- headerNames.push('Content-Type');
-
- /* Force "Connection: close" for older Mozilla browsers to work
- * around a bug where XMLHttpRequest sends an incorrect
- * Content-length header. See Mozilla Bugzilla #246651.
+ var requestHeaders =
+ ['X-Requested-With', 'XMLHttpRequest',
+ 'X-Prototype-Version', Prototype.Version];
+
+ if (this.options.method == 'post') {
+ var hasContentType = 0;
+ if (this.options.requestHeaders)
+ for (var i = 0; i < this.options.requestHeaders.length; i += 2)
+ if (this.options.requestHeaders[i] == 'Content-Type')
+ hasContentType = 1;
+ if (hasContentType == 0)
+ requestHeaders.push('Content-Type', 'application/x-www-form-urlencoded');
+
+ /* Force "Connection: close" for Mozilla browsers to work around
+ * a bug where XMLHttpReqeuest sends an incorrect Content-length
+ * header. See Mozilla Bugzilla #246651.
*/
- if (this.transport.overrideMimeType &&
- (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) {
- headers['Connection'] = 'close';
- headerNames.push('Connection');
- }
+ if (this.transport.overrideMimeType)
+ requestHeaders.push('Connection', 'close');
}
- // user-defined headers
- if (typeof this.options.requestHeaders == 'object') {
- var extras = this.options.requestHeaders;
-
- if (Object.isFunction(extras.push))
- for (var i = 0, length = extras.length; i < length; i += 2) {
- headers[extras[i]] = extras[i+1];
- headerNames.push(extras[i]);
- }
- else
- $H(extras).each(function(pair) {
- headers[pair.key] = pair.value
- headerNames.push(pair.key);
- });
- }
+ if (this.options.requestHeaders)
+ requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
- for (var i=0; i<headerNames.length; i++) {
- this.transport.setRequestHeader(headerNames[i], headers[headerNames[i]]);
- }
+ for (var i = 0; i < requestHeaders.length; i += 2)
+ this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
+ },
+
+ onStateChange: function() {
+ var readyState = this.transport.readyState;
+ if (readyState != 1)
+ this.respondToReadyState(this.transport.readyState);
+ },
+ header: function(name) {
+ try {
+ return this.transport.getResponseHeader(name);
+ } catch (e) {}
},
- success: function() {
- var status = this.getStatus();
- return !status || (status >= 200 && status < 300);
+ evalJSON: function() {
+ try {
+ return eval(this.header('X-JSON'));
+ } catch (e) {}
},
- getStatus: function() {
+ evalResponse: function() {
try {
- return this.transport.status || 0;
- } catch (e) { return 0 }
+ return eval(this.transport.responseText);
+ } catch (e) {
+ this.dispatchException(e);
+ }
},
respondToReadyState: function(readyState) {
- var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
+ var event = Ajax.Request.Events[readyState];
+ var transport = this.transport, json = this.evalJSON();
- if (state == 'Complete') {
+ if (event == 'Complete') {
try {
- this._complete = true;
- (this.options['on' + response.status]
- || this.options['on' + (this.success() ? 'Success' : 'Failure')]
- || Prototype.emptyFunction)(response, response.headerJSON);
+ (this.options['on' + this.transport.status]
+ || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
+ || Prototype.emptyFunction)(transport, json);
} catch (e) {
this.dispatchException(e);
}
- var contentType = response.getHeader('Content-type');
- if (this.options.evalJS == 'force'
- || (this.options.evalJS && contentType
- && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
+ if ((this.header('Content-type') || '').match(/^text\/javascript/i))
this.evalResponse();
}
try {
- (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
- Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
+ (this.options['on' + event] || Prototype.emptyFunction)(transport, json);
+ Ajax.Responders.dispatch('on' + event, this, transport, json);
} catch (e) {
this.dispatchException(e);
}
- if (state == 'Complete') {
- // avoid memory leak in MSIE: clean up
+ /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
+ if (event == 'Complete')
this.transport.onreadystatechange = Prototype.emptyFunction;
- }
- },
-
- getHeader: function(name) {
- try {
- return this.transport.getResponseHeader(name);
- } catch (e) { return null }
- },
-
- evalResponse: function() {
- try {
- return eval((this.transport.responseText || '').unfilterJSON());
- } catch (e) {
- this.dispatchException(e);
- }
},
dispatchException: function(exception) {
@@ -1365,129 +749,61 @@
}
});
-Ajax.Request.Events =
- ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
-
-Ajax.Response = Class.create({
- initialize: function(request){
- this.request = request;
- var transport = this.transport = request.transport,
- readyState = this.readyState = transport.readyState;
+Ajax.Updater = Class.create();
- if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
- this.status = this.getStatus();
- this.statusText = this.getStatusText();
- this.responseText = String.interpret(transport.responseText);
- this.headerJSON = this._getHeaderJSON();
+Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
+ initialize: function(container, url, options) {
+ this.containers = {
+ success: container.success ? $(container.success) : $(container),
+ failure: container.failure ? $(container.failure) :
+ (container.success ? null : $(container))
}
- if(readyState == 4) {
- var xml = transport.responseXML;
- this.responseXML = xml === undefined ? null : xml;
- this.responseJSON = this._getResponseJSON();
- }
- },
-
- status: 0,
- statusText: '',
-
- getStatus: Ajax.Request.prototype.getStatus,
-
- getStatusText: function() {
- try {
- return this.transport.statusText || '';
- } catch (e) { return '' }
- },
-
- getHeader: Ajax.Request.prototype.getHeader,
-
- getAllHeaders: function() {
- try {
- return this.getAllResponseHeaders();
- } catch (e) { return null }
- },
-
- getResponseHeader: function(name) {
- return this.transport.getResponseHeader(name);
- },
-
- getAllResponseHeaders: function() {
- return this.transport.getAllResponseHeaders();
- },
-
- _getHeaderJSON: function() {
- var json = this.getHeader('X-JSON');
- if (!json) return null;
- json = decodeURIComponent(escape(json));
- try {
- return json.evalJSON(this.request.options.sanitizeJSON);
- } catch (e) {
- this.request.dispatchException(e);
- }
- },
-
- _getResponseJSON: function() {
- var options = this.request.options;
- if (!options.evalJSON || (options.evalJSON != 'force' &&
- !(this.getHeader('Content-type') || '').include('application/json')))
- return null;
- try {
- return this.transport.responseText.evalJSON(options.sanitizeJSON);
- } catch (e) {
- this.request.dispatchException(e);
- }
- }
-});
+ this.transport = Ajax.getTransport();
+ this.setOptions(options);
-Ajax.Updater = Class.create(Ajax.Request, {
- initialize: function($super, container, url, options) {
- this.container = {
- success: (container.success || container),
- failure: (container.failure || (container.success ? null : container))
- };
-
- options = options || { };
- var onComplete = options.onComplete;
- options.onComplete = (function(response, param) {
- this.updateContent(response.responseText);
- if (Object.isFunction(onComplete)) onComplete(response, param);
+ var onComplete = this.options.onComplete || Prototype.emptyFunction;
+ this.options.onComplete = (function(transport, object) {
+ this.updateContent();
+ onComplete(transport, object);
}).bind(this);
- $super(url, options);
+ this.request(url);
},
- updateContent: function(responseText) {
- var receiver = this.container[this.success() ? 'success' : 'failure'],
- options = this.options;
-
- if (!options.evalScripts) responseText = responseText.stripScripts();
-
- if (receiver = $(receiver)) {
- if (options.insertion) {
- if (Object.isString(options.insertion)) {
- var insertion = { }; insertion[options.insertion] = responseText;
- receiver.insert(insertion);
- }
- else options.insertion(receiver, responseText);
+ updateContent: function() {
+ var receiver = this.responseIsSuccess() ?
+ this.containers.success : this.containers.failure;
+ var response = this.transport.responseText;
+
+ if (!this.options.evalScripts)
+ response = response.stripScripts();
+
+ if (receiver) {
+ if (this.options.insertion) {
+ new this.options.insertion(receiver, response);
+ } else {
+ Element.update(receiver, response);
}
- else receiver.update(responseText);
}
- if (this.success()) {
- if (this.onComplete) this.onComplete.bind(this).defer();
+ if (this.responseIsSuccess()) {
+ if (this.onComplete)
+ setTimeout(this.onComplete.bind(this), 10);
}
}
});
-Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
- initialize: function($super, container, url, options) {
- $super(options);
+Ajax.PeriodicalUpdater = Class.create();
+Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
+ initialize: function(container, url, options) {
+ this.setOptions(options);
this.onComplete = this.options.onComplete;
this.frequency = (this.options.frequency || 2);
this.decay = (this.options.decay || 1);
- this.updater = { };
+ this.updater = {};
this.container = container;
this.url = url;
@@ -1500,334 +816,80 @@
},
stop: function() {
- this.updater.options.onComplete = undefined;
+ this.updater.onComplete = undefined;
clearTimeout(this.timer);
(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
},
- updateComplete: function(response) {
+ updateComplete: function(request) {
if (this.options.decay) {
- this.decay = (response.responseText == this.lastText ?
+ this.decay = (request.responseText == this.lastText ?
this.decay * this.options.decay : 1);
- this.lastText = response.responseText;
+ this.lastText = request.responseText;
}
- this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
+ this.timer = setTimeout(this.onTimerEvent.bind(this),
+ this.decay * this.frequency * 1000);
},
onTimerEvent: function() {
this.updater = new Ajax.Updater(this.container, this.url, this.options);
}
});
-function $(element) {
- if (arguments.length > 1) {
- for (var i = 0, elements = [], length = arguments.length; i < length; i++)
- elements.push($(arguments[i]));
+document.getElementsByClassName = function(className, parentElement) {
+ var children = ($(parentElement) || document.body).getElementsByTagName('*');
+ return $A(children).inject([], function(elements, child) {
+ if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
+ elements.push(child);
return elements;
- }
- if (Object.isString(element))
- element = document.getElementById(element);
- return Element.extend(element);
-}
-
-if (Prototype.BrowserFeatures.XPath) {
- document._getElementsByXPath = function(expression, parentElement) {
- var results = [];
- var query = document.evaluate(expression, $(parentElement) || document,
- null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
- for (var i = 0, length = query.snapshotLength; i < length; i++)
- results.push(Element.extend(query.snapshotItem(i)));
- return results;
- };
+ });
}
/*--------------------------------------------------------------------------*/
-if (!window.Node) var Node = { };
-
-if (!Node.ELEMENT_NODE) {
- // DOM level 2 ECMAScript Language Binding
- Object.extend(Node, {
- ELEMENT_NODE: 1,
- ATTRIBUTE_NODE: 2,
- TEXT_NODE: 3,
- CDATA_SECTION_NODE: 4,
- ENTITY_REFERENCE_NODE: 5,
- ENTITY_NODE: 6,
- PROCESSING_INSTRUCTION_NODE: 7,
- COMMENT_NODE: 8,
- DOCUMENT_NODE: 9,
- DOCUMENT_TYPE_NODE: 10,
- DOCUMENT_FRAGMENT_NODE: 11,
- NOTATION_NODE: 12
- });
+if (!window.Element) {
+ var Element = new Object();
}
-(function() {
- var element = this.Element;
- this.Element = function(tagName, attributes) {
- attributes = attributes || { };
- tagName = tagName.toLowerCase();
- var cache = Element.cache;
- if (Prototype.Browser.IE && attributes.name) {
- tagName = '<' + tagName + ' name="' + attributes.name + '">';
- delete attributes.name;
- return Element.writeAttribute(document.createElement(tagName), attributes);
- }
- if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
- return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
- };
- Object.extend(this.Element, element || { });
-}).call(window);
-
-Element.cache = { };
-
-Element.Methods = {
+Object.extend(Element, {
visible: function(element) {
return $(element).style.display != 'none';
},
- toggle: function(element) {
- element = $(element);
- Element[Element.visible(element) ? 'hide' : 'show'](element);
- return element;
- },
-
- hide: function(element) {
- $(element).style.display = 'none';
- return element;
- },
-
- show: function(element) {
- $(element).style.display = '';
- return element;
- },
-
- remove: function(element) {
- element = $(element);
- element.parentNode.removeChild(element);
- return element;
- },
-
- update: function(element, content) {
- element = $(element);
- if (content && content.toElement) content = content.toElement();
- if (Object.isElement(content)) return element.update().insert(content);
- content = Object.toHTML(content);
- element.innerHTML = content.stripScripts();
- content.evalScripts.bind(content).defer();
- return element;
- },
-
- replace: function(element, content) {
- element = $(element);
- if (content && content.toElement) content = content.toElement();
- else if (!Object.isElement(content)) {
- content = Object.toHTML(content);
- var range = element.ownerDocument.createRange();
- range.selectNode(element);
- content.evalScripts.bind(content).defer();
- content = range.createContextualFragment(content.stripScripts());
+ toggle: function() {
+ for (var i = 0; i < arguments.length; i++) {
+ var element = $(arguments[i]);
+ Element[Element.visible(element) ? 'hide' : 'show'](element);
}
- element.parentNode.replaceChild(content, element);
- return element;
},
- insert: function(element, insertions) {
- element = $(element);
-
- if (Object.isString(insertions) || Object.isNumber(insertions) ||
- Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
- insertions = {bottom:insertions};
-
- var content, t, range;
-
- for (position in insertions) {
- if ( position == 'extend' ) continue;
- content = insertions[position];
- position = position.toLowerCase();
- t = Element._insertionTranslations[position];
-
- if (content && content.toElement) content = content.toElement();
- if (Object.isElement(content)) {
- t.insert(element, content);
- continue;
- }
-
- content = Object.toHTML(content);
-
- range = element.ownerDocument.createRange();
- t.initializeRange(element, range);
- t.insert(element, range.createContextualFragment(content.stripScripts()));
-
- content.evalScripts.bind(content).defer();
+ hide: function() {
+ for (var i = 0; i < arguments.length; i++) {
+ var element = $(arguments[i]);
+ element.style.display = 'none';
}
-
- return element;
- },
-
- wrap: function(element, wrapper, attributes) {
- element = $(element);
- if (Object.isElement(wrapper))
- $(wrapper).writeAttribute(attributes || { });
- else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
- else wrapper = new Element('div', wrapper);
- if (element.parentNode)
- element.parentNode.replaceChild(wrapper, element);
- wrapper.appendChild(element);
- return wrapper;
- },
-
- inspect: function(element) {
- element = $(element);
- var result = '<' + element.tagName.toLowerCase();
- $H({'id': 'id', 'className': 'class'}).each(function(pair) {
- var property = pair.first(), attribute = pair.last();
- var value = (element[property] || '').toString();
- if (value) result += ' ' + attribute + '=' + value.inspect(true);
- });
- return result + '>';
- },
-
- recursivelyCollect: function(element, property) {
- element = $(element);
- var elements = [];
- while (element = element[property])
- if (element.nodeType == 1)
- elements.push(Element.extend(element));
- return elements;
- },
-
- ancestors: function(element) {
- return $(element).recursivelyCollect('parentNode');
- },
-
- descendants: function(element) {
- return $A($(element).getElementsByTagName('*')).each(Element.extend);
- },
-
- firstDescendant: function(element) {
- element = $(element).firstChild;
- while (element && element.nodeType != 1) element = element.nextSibling;
- return $(element);
- },
-
- immediateDescendants: function(element) {
- if (!(element = $(element).firstChild)) return [];
- while (element && element.nodeType != 1) element = element.nextSibling;
- if (element) return [element].concat($(element).nextSiblings());
- return [];
- },
-
- previousSiblings: function(element) {
- return $(element).recursivelyCollect('previousSibling');
- },
-
- nextSiblings: function(element) {
- return $(element).recursivelyCollect('nextSibling');
},
- siblings: function(element) {
- element = $(element);
- return element.previousSiblings().reverse().concat(element.nextSiblings());
- },
-
- match: function(element, selector) {
- if (Object.isString(selector))
- selector = new Selector(selector);
- return selector.match($(element));
- },
-
- up: function(element, expression, index) {
- element = $(element);
- if (arguments.length == 1) return $(element.parentNode);
- var ancestors = element.ancestors();
- return expression ? Selector.findElement(ancestors, expression, index) :
- ancestors[index || 0];
- },
-
- down: function(element, expression, index) {
- element = $(element);
- if (arguments.length == 1) return element.firstDescendant();
- var descendants = element.descendants();
- return expression ? Selector.findElement(descendants, expression, index) :
- descendants[index || 0];
- },
-
- previous: function(element, expression, index) {
- element = $(element);
- if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
- var previousSiblings = element.previousSiblings();
- return expression ? Selector.findElement(previousSiblings, expression, index) :
- previousSiblings[index || 0];
- },
-
- next: function(element, expression, index) {
- element = $(element);
- if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
- var nextSiblings = element.nextSiblings();
- return expression ? Selector.findElement(nextSiblings, expression, index) :
- nextSiblings[index || 0];
- },
-
- select: function() {
- var args = $A(arguments), element = $(args.shift());
- return Selector.findChildElements(element, args);
- },
-
- adjacent: function() {
- var args = $A(arguments), element = $(args.shift());
- return Selector.findChildElements(element.parentNode, args).without(element);
- },
-
- identify: function(element) {
- element = $(element);
- var id = element.readAttribute('id'), self = arguments.callee;
- if (id) return id;
- do { id = 'anonymous_element_' + self.counter++ } while ($(id));
- element.writeAttribute('id', id);
- return id;
- },
-
- readAttribute: function(element, name) {
- element = $(element);
- if (Prototype.Browser.IE) {
- var t = Element._attributeTranslations.read;
- if (t.values[name]) return t.values[name](element, name);
- if (t.names[name]) name = t.names[name];
- if (name.include(':')) {
- return (!element.attributes || !element.attributes[name]) ? null :
- element.attributes[name].value;
- }
+ show: function() {
+ for (var i = 0; i < arguments.length; i++) {
+ var element = $(arguments[i]);
+ element.style.display = '';
}
- return element.getAttribute(name);
},
- writeAttribute: function(element, name, value) {
+ remove: function(element) {
element = $(element);
- var attributes = { }, t = Element._attributeTranslations.write;
-
- if (typeof name == 'object') attributes = name;
- else attributes[name] = value === undefined ? true : value;
-
- for (var attr in attributes) {
- var name = t.names[attr] || attr, value = attributes[attr];
- if (t.values[attr]) name = t.values[attr](element, value);
- if (value === false || value === null)
- element.removeAttribute(name);
- else if (value === true)
- element.setAttribute(name, name);
- else element.setAttribute(name, value);
- }
- return element;
+ element.parentNode.removeChild(element);
},
- getHeight: function(element) {
- return $(element).getDimensions().height;
+ update: function(element, html) {
+ $(element).innerHTML = html.stripScripts();
+ setTimeout(function() {html.evalScripts()}, 10);
},
- getWidth: function(element) {
- return $(element).getDimensions().width;
+ getHeight: function(element) {
+ element = $(element);
+ return element.offsetHeight;
},
classNames: function(element) {
@@ -1836,121 +898,67 @@
hasClassName: function(element, className) {
if (!(element = $(element))) return;
- var elementClassName = element.className;
- return (elementClassName.length > 0 && (elementClassName == className ||
- new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
+ return Element.classNames(element).include(className);
},
addClassName: function(element, className) {
if (!(element = $(element))) return;
- if (!element.hasClassName(className))
- element.className += (element.className ? ' ' : '') + className;
- return element;
+ return Element.classNames(element).add(className);
},
removeClassName: function(element, className) {
if (!(element = $(element))) return;
- element.className = element.className.replace(
- new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
- return element;
- },
-
- toggleClassName: function(element, className) {
- if (!(element = $(element))) return;
- return element[element.hasClassName(className) ?
- 'removeClassName' : 'addClassName'](className);
+ return Element.classNames(element).remove(className);
},
// removes whitespace-only text node children
cleanWhitespace: function(element) {
element = $(element);
- var node = element.firstChild;
- while (node) {
- var nextNode = node.nextSibling;
+ for (var i = 0; i < element.childNodes.length; i++) {
+ var node = element.childNodes[i];
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
- element.removeChild(node);
- node = nextNode;
+ Element.remove(node);
}
- return element;
},
empty: function(element) {
- return $(element).innerHTML.blank();
- },
-
- descendantOf: function(element, ancestor) {
- element = $(element), ancestor = $(ancestor);
-
- if (element.compareDocumentPosition)
- return (element.compareDocumentPosition(ancestor) & 8) === 8;
-
- if (element.sourceIndex && !Prototype.Browser.Opera) {
- var e = element.sourceIndex, a = ancestor.sourceIndex,
- nextAncestor = ancestor.nextSibling;
- if (!nextAncestor) {
- do { ancestor = ancestor.parentNode; }
- while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode);
- }
- if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex);
- }
-
- while (element = element.parentNode)
- if (element == ancestor) return true;
- return false;
+ return $(element).innerHTML.match(/^\s*$/);
},
scrollTo: function(element) {
element = $(element);
- var pos = element.cumulativeOffset();
- window.scrollTo(pos[0], pos[1]);
- return element;
+ var x = element.x ? element.x : element.offsetLeft,
+ y = element.y ? element.y : element.offsetTop;
+ window.scrollTo(x, y);
},
getStyle: function(element, style) {
element = $(element);
- style = style == 'float' ? 'cssFloat' : style.camelize();
- var value = element.style[style];
+ var value = element.style[style.camelize()];
if (!value) {
- var css = document.defaultView.getComputedStyle(element, null);
- value = css ? css[style] : null;
+ if (document.defaultView && document.defaultView.getComputedStyle) {
+ var css = document.defaultView.getComputedStyle(element, null);
+ value = css ? css.getPropertyValue(style) : null;
+ } else if (element.currentStyle) {
+ value = element.currentStyle[style.camelize()];
+ }
}
- if (style == 'opacity') return value ? parseFloat(value) : 1.0;
- return value == 'auto' ? null : value;
- },
-
- getOpacity: function(element) {
- return $(element).getStyle('opacity');
- },
- setStyle: function(element, styles) {
- element = $(element);
- var elementStyle = element.style, match;
- if (Object.isString(styles)) {
- element.style.cssText += ';' + styles;
- return styles.include('opacity') ?
- element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
- }
- for (var property in styles)
- if (property == 'opacity') element.setOpacity(styles[property]);
- else
- elementStyle[(property == 'float' || property == 'cssFloat') ?
- (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
- property] = styles[property];
+ if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
+ if (Element.getStyle(element, 'position') == 'static') value = 'auto';
- return element;
+ return value == 'auto' ? null : value;
},
- setOpacity: function(element, value) {
+ setStyle: function(element, style) {
element = $(element);
- element.style.opacity = (value == 1 || value === '') ? '' :
- (value < 0.00001) ? 0 : value;
- return element;
+ for (name in style)
+ element.style[name.camelize()] = style[name];
},
getDimensions: function(element) {
element = $(element);
- var display = $(element).getStyle('display');
- if (display != 'none' && display != null) // Safari bug
+ if (Element.getStyle(element, 'display') != 'none')
return {width: element.offsetWidth, height: element.offsetHeight};
// All *Width and *Height properties give 0 on elements with display none,
@@ -1958,13 +966,12 @@
var els = element.style;
var originalVisibility = els.visibility;
var originalPosition = els.position;
- var originalDisplay = els.display;
els.visibility = 'hidden';
els.position = 'absolute';
- els.display = 'block';
+ els.display = '';
var originalWidth = element.clientWidth;
var originalHeight = element.clientHeight;
- els.display = originalDisplay;
+ els.display = 'none';
els.position = originalPosition;
els.visibility = originalVisibility;
return {width: originalWidth, height: originalHeight};
@@ -1983,7 +990,6 @@
element.style.left = 0;
}
}
- return element;
},
undoPositioned: function(element) {
@@ -1996,1646 +1002,388 @@
element.style.bottom =
element.style.right = '';
}
- return element;
},
makeClipping: function(element) {
element = $(element);
- if (element._overflow) return element;
- element._overflow = Element.getStyle(element, 'overflow') || 'auto';
- if (element._overflow !== 'hidden')
+ if (element._overflow) return;
+ element._overflow = element.style.overflow;
+ if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
element.style.overflow = 'hidden';
- return element;
},
undoClipping: function(element) {
element = $(element);
- if (!element._overflow) return element;
- element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
- element._overflow = null;
- return element;
- },
-
- cumulativeOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- } while (element);
- return Element._returnOffset(valueL, valueT);
- },
-
- positionedOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- if (element) {
- if (element.tagName == 'BODY') break;
- var p = Element.getStyle(element, 'position');
- if (p == 'relative' || p == 'absolute') break;
- }
- } while (element);
- return Element._returnOffset(valueL, valueT);
- },
-
- absolutize: function(element) {
- element = $(element);
- if (element.getStyle('position') == 'absolute') return;
- // Position.prepare(); // To be done manually by Scripty when it needs it.
-
- var offsets = element.positionedOffset();
- var top = offsets[1];
- var left = offsets[0];
- var width = element.clientWidth;
- var height = element.clientHeight;
-
- element._originalLeft = left - parseFloat(element.style.left || 0);
- element._originalTop = top - parseFloat(element.style.top || 0);
- element._originalWidth = element.style.width;
- element._originalHeight = element.style.height;
-
- element.style.position = 'absolute';
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.width = width + 'px';
- element.style.height = height + 'px';
- return element;
- },
-
- relativize: function(element) {
- element = $(element);
- if (element.getStyle('position') == 'relative') return;
- // Position.prepare(); // To be done manually by Scripty when it needs it.
-
- element.style.position = 'relative';
- var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
- var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.height = element._originalHeight;
- element.style.width = element._originalWidth;
- return element;
- },
-
- cumulativeScrollOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.scrollTop || 0;
- valueL += element.scrollLeft || 0;
- element = element.parentNode;
- } while (element);
- return Element._returnOffset(valueL, valueT);
- },
-
- getOffsetParent: function(element) {
- if (element.offsetParent) return $(element.offsetParent);
- if (element == document.body) return $(element);
-
- while ((element = element.parentNode) && element != document.body)
- if (Element.getStyle(element, 'position') != 'static')
- return $(element);
-
- return $(document.body);
- },
-
- viewportOffset: function(forElement) {
- var valueT = 0, valueL = 0;
-
- var element = forElement;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
-
- // Safari fix
- if (element.offsetParent == document.body &&
- Element.getStyle(element, 'position') == 'absolute') break;
-
- } while (element = element.offsetParent);
-
- element = forElement;
- do {
- if (!Prototype.Browser.Opera || element.tagName == 'BODY') {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
- }
- } while (element = element.parentNode);
-
- return Element._returnOffset(valueL, valueT);
- },
-
- clonePosition: function(element, source) {
- var options = Object.extend({
- setLeft: true,
- setTop: true,
- setWidth: true,
- setHeight: true,
- offsetTop: 0,
- offsetLeft: 0
- }, arguments[2] || { });
-
- // find page position of source
- source = $(source);
- var p = source.viewportOffset();
-
- // find coordinate system to use
- element = $(element);
- var delta = [0, 0];
- var parent = null;
- // delta [0,0] will do fine with position: fixed elements,
- // position:absolute needs offsetParent deltas
- if (Element.getStyle(element, 'position') == 'absolute') {
- parent = element.getOffsetParent();
- delta = parent.viewportOffset();
- }
-
- // correct by body offsets (fixes Safari)
- if (parent == document.body) {
- delta[0] -= document.body.offsetLeft;
- delta[1] -= document.body.offsetTop;
- }
-
- // set position
- if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
- if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
- if (options.setWidth) element.style.width = source.offsetWidth + 'px';
- if (options.setHeight) element.style.height = source.offsetHeight + 'px';
- return element;
+ if (element._overflow) return;
+ element.style.overflow = element._overflow;
+ element._overflow = undefined;
}
-};
-
-Element.Methods.identify.counter = 1;
-
-Object.extend(Element.Methods, {
- getElementsBySelector: Element.Methods.select,
- childElements: Element.Methods.immediateDescendants
});
-Element._attributeTranslations = {
- write: {
- names: {
- className: 'class',
- htmlFor: 'for'
- },
- values: { }
- }
-};
-
-
-if (!document.createRange || Prototype.Browser.Opera) {
- Element.Methods.insert = function(element, insertions) {
- element = $(element);
+var Toggle = new Object();
+Toggle.display = Element.toggle;
- if (Object.isString(insertions) || Object.isNumber(insertions) ||
- Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
- insertions = { bottom: insertions };
-
- var t = Element._insertionTranslations, content, position, pos, tagName;
-
- for (position in insertions) {
- content = insertions[position];
- position = position.toLowerCase();
- pos = t[position];
-
- if (content && content.toElement) content = content.toElement();
- if (Object.isElement(content)) {
- pos.insert(element, content);
- continue;
- }
-
- content = Object.toHTML(content);
- tagName = ((position == 'before' || position == 'after')
- ? element.parentNode : element).tagName.toUpperCase();
-
- if (t.tags[tagName]) {
- var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
- if (position == 'top' || position == 'after') fragments.reverse();
- fragments.each(pos.insert.curry(element));
- }
- else element.insertAdjacentHTML(pos.adjacency, content.stripScripts());
-
- content.evalScripts.bind(content).defer();
- }
-
- return element;
- };
-}
+/*--------------------------------------------------------------------------*/
-if (Prototype.Browser.Opera) {
- Element.Methods._getStyle = Element.Methods.getStyle;
- Element.Methods.getStyle = function(element, style) {
- switch(style) {
- case 'left':
- case 'top':
- case 'right':
- case 'bottom':
- if (Element._getStyle(element, 'position') == 'static') return null;
- default: return Element._getStyle(element, style);
- }
- };
- Element.Methods._readAttribute = Element.Methods.readAttribute;
- Element.Methods.readAttribute = function(element, attribute) {
- if (attribute == 'title') return element.title;
- return Element._readAttribute(element, attribute);
- };
+Abstract.Insertion = function(adjacency) {
+ this.adjacency = adjacency;
}
-else if (Prototype.Browser.IE) {
- $w('positionedOffset getOffsetParent viewportOffset').each(function(method) {
- Element.Methods[method] = Element.Methods[method].wrap(
- function(proceed, element) {
- element = $(element);
- var position = element.getStyle('position');
- if (position != 'static') return proceed(element);
- element.setStyle({ position: 'relative' });
- var value = proceed(element);
- element.setStyle({ position: position });
- return value;
- }
- );
- });
-
- Element.Methods.getStyle = function(element, style) {
- element = $(element);
- style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
- var value = element.style[style];
- if (!value && element.currentStyle) value = element.currentStyle[style];
-
- if (style == 'opacity') {
- if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
- if (value[1]) return parseFloat(value[1]) / 100;
- return 1.0;
- }
-
- if (value == 'auto') {
- if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
- return element['offset' + style.capitalize()] + 'px';
- return null;
- }
- return value;
- };
-
- Element.Methods.setOpacity = function(element, value) {
- function stripAlpha(filter){
- return filter.replace(/alpha\([^\)]*\)/gi,'');
- }
- element = $(element);
- var currentStyle = element.currentStyle;
- if ((currentStyle && !currentStyle.hasLayout) ||
- (!currentStyle && element.style.zoom == 'normal'))
- element.style.zoom = 1;
-
- var filter = element.getStyle('filter'), style = element.style;
- if (value == 1 || value === '') {
- (filter = stripAlpha(filter)) ?
- style.filter = filter : style.removeAttribute('filter');
- return element;
- } else if (value < 0.00001) value = 0;
- style.filter = stripAlpha(filter) +
- 'alpha(opacity=' + (value * 100) + ')';
- return element;
- };
+Abstract.Insertion.prototype = {
+ initialize: function(element, content) {
+ this.element = $(element);
+ this.content = content.stripScripts();
- Element._attributeTranslations = {
- read: {
- names: {
- 'class': 'className',
- 'for': 'htmlFor'
- },
- values: {
- _getAttr: function(element, attribute) {
- return element.getAttribute(attribute, 2);
- },
- _getAttrNode: function(element, attribute) {
- var node = element.getAttributeNode(attribute);
- return node ? node.value : "";
- },
- _getEv: function(element, attribute) {
- var attribute = element.getAttribute(attribute);
- return attribute ? attribute.toString().slice(23, -2) : null;
- },
- _flag: function(element, attribute) {
- return $(element).hasAttribute(attribute) ? attribute : null;
- },
- style: function(element) {
- return element.style.cssText.toLowerCase();
- },
- title: function(element) {
- return element.title;
+ if (this.adjacency && this.element.insertAdjacentHTML) {
+ try {
+ this.element.insertAdjacentHTML(this.adjacency, this.content);
+ } catch (e) {
+ if (this.element.tagName.toLowerCase() == 'tbody') {
+ this.insertContent(this.contentFromAnonymousTable());
+ } else {
+ throw e;
}
}
+ } else {
+ this.range = this.element.ownerDocument.createRange();
+ if (this.initializeRange) this.initializeRange();
+ this.insertContent([this.range.createContextualFragment(this.content)]);
}
- };
-
- Element._attributeTranslations.write = {
- names: Object.clone(Element._attributeTranslations.read.names),
- values: {
- checked: function(element, value) {
- element.checked = !!value;
- },
-
- style: function(element, value) {
- element.style.cssText = value ? value : '';
- }
- }
- };
-
- Element._attributeTranslations.has = {};
-
- $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
- 'encType maxLength readOnly longDesc').each(function(attr) {
- Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
- Element._attributeTranslations.has[attr.toLowerCase()] = attr;
- });
-
- (function(v) {
- Object.extend(v, {
- href: v._getAttr,
- src: v._getAttr,
- type: v._getAttr,
- action: v._getAttrNode,
- disabled: v._flag,
- checked: v._flag,
- readonly: v._flag,
- multiple: v._flag,
- onload: v._getEv,
- onunload: v._getEv,
- onclick: v._getEv,
- ondblclick: v._getEv,
- onmousedown: v._getEv,
- onmouseup: v._getEv,
- onmouseover: v._getEv,
- onmousemove: v._getEv,
- onmouseout: v._getEv,
- onfocus: v._getEv,
- onblur: v._getEv,
- onkeypress: v._getEv,
- onkeydown: v._getEv,
- onkeyup: v._getEv,
- onsubmit: v._getEv,
- onreset: v._getEv,
- onselect: v._getEv,
- onchange: v._getEv
- });
- })(Element._attributeTranslations.read.values);
-}
-
-else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
- Element.Methods.setOpacity = function(element, value) {
- element = $(element);
- element.style.opacity = (value == 1) ? 0.999999 :
- (value === '') ? '' : (value < 0.00001) ? 0 : value;
- return element;
- };
-}
-
-else if (Prototype.Browser.WebKit) {
- Element.Methods.setOpacity = function(element, value) {
- element = $(element);
- element.style.opacity = (value == 1 || value === '') ? '' :
- (value < 0.00001) ? 0 : value;
-
- if (value == 1)
- if(element.tagName == 'IMG' && element.width) {
- element.width++; element.width--;
- } else try {
- var n = document.createTextNode(' ');
- element.appendChild(n);
- element.removeChild(n);
- } catch (e) { }
-
- return element;
- };
-
- // Safari returns margins on body which is incorrect if the child is absolutely
- // positioned. For performance reasons, redefine Position.cumulativeOffset for
- // KHTML/WebKit only.
- Element.Methods.cumulativeOffset = function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- if (element.offsetParent == document.body)
- if (Element.getStyle(element, 'position') == 'absolute') break;
-
- element = element.offsetParent;
- } while (element);
-
- return Element._returnOffset(valueL, valueT);
- };
-}
-
-if (Prototype.Browser.IE || Prototype.Browser.Opera) {
- // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
- Element.Methods.update = function(element, content) {
- element = $(element);
-
- if (content && content.toElement) content = content.toElement();
- if (Object.isElement(content)) return element.update().insert(content);
-
- content = Object.toHTML(content);
- var tagName = element.tagName.toUpperCase();
-
- if (tagName in Element._insertionTranslations.tags) {
- $A(element.childNodes).each(function(node) { element.removeChild(node) });
- Element._getContentFromAnonymousElement(tagName, content.stripScripts())
- .each(function(node) { element.appendChild(node) });
- }
- else element.innerHTML = content.stripScripts();
-
- content.evalScripts.bind(content).defer();
- return element;
- };
-}
-
-if (document.createElement('div').outerHTML) {
- Element.Methods.replace = function(element, content) {
- element = $(element);
-
- if (content && content.toElement) content = content.toElement();
- if (Object.isElement(content)) {
- element.parentNode.replaceChild(content, element);
- return element;
- }
-
- content = Object.toHTML(content);
- var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
- if (Element._insertionTranslations.tags[tagName]) {
- var nextSibling = element.next();
- var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
- parent.removeChild(element);
- if (nextSibling)
- fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
- else
- fragments.each(function(node) { parent.appendChild(node) });
- }
- else element.outerHTML = content.stripScripts();
+ setTimeout(function() {content.evalScripts()}, 10);
+ },
- content.evalScripts.bind(content).defer();
- return element;
- };
+ contentFromAnonymousTable: function() {
+ var div = document.createElement('div');
+ div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
+ return $A(div.childNodes[0].childNodes[0].childNodes);
+ }
}
-Element._returnOffset = function(l, t) {
- var result = [l, t];
- result.left = l;
- result.top = t;
- return result;
-};
+var Insertion = new Object();
-Element._getContentFromAnonymousElement = function(tagName, html) {
- var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
- div.innerHTML = t[0] + html + t[1];
- t[2].times(function() { div = div.firstChild });
- return $A(div.childNodes);
-};
+Insertion.Before = Class.create();
+Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
+ initializeRange: function() {
+ this.range.setStartBefore(this.element);
+ },
-Element._insertionTranslations = {
- before: {
- adjacency: 'beforeBegin',
- insert: function(element, node) {
- element.parentNode.insertBefore(node, element);
- },
- initializeRange: function(element, range) {
- range.setStartBefore(element);
- }
- },
- top: {
- adjacency: 'afterBegin',
- insert: function(element, node) {
- element.insertBefore(node, element.firstChild);
- },
- initializeRange: function(element, range) {
- range.selectNodeContents(element);
- range.collapse(true);
- }
- },
- bottom: {
- adjacency: 'beforeEnd',
- insert: function(element, node) {
- element.appendChild(node);
- }
- },
- after: {
- adjacency: 'afterEnd',
- insert: function(element, node) {
- element.parentNode.insertBefore(node, element.nextSibling);
- },
- initializeRange: function(element, range) {
- range.setStartAfter(element);
- }
- },
- tags: {
- TABLE: ['<table>', '</table>', 1],
- TBODY: ['<table><tbody>', '</tbody></table>', 2],
- TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
- TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
- SELECT: ['<select>', '</select>', 1]
+ insertContent: function(fragments) {
+ fragments.each((function(fragment) {
+ this.element.parentNode.insertBefore(fragment, this.element);
+ }).bind(this));
}
-};
+});
-(function() {
- this.bottom.initializeRange = this.top.initializeRange;
- Object.extend(this.tags, {
- THEAD: this.tags.TBODY,
- TFOOT: this.tags.TBODY,
- TH: this.tags.TD
- });
-}).call(Element._insertionTranslations);
+Insertion.Top = Class.create();
+Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
+ initializeRange: function() {
+ this.range.selectNodeContents(this.element);
+ this.range.collapse(true);
+ },
-Element.Methods.Simulated = {
- hasAttribute: function(element, attribute) {
- attribute = Element._attributeTranslations.has[attribute] || attribute;
- var node = $(element).getAttributeNode(attribute);
- return node && node.specified;
+ insertContent: function(fragments) {
+ fragments.reverse(false).each((function(fragment) {
+ this.element.insertBefore(fragment, this.element.firstChild);
+ }).bind(this));
}
-};
-
-Element.Methods.ByTag = { };
-
-Object.extend(Element, Element.Methods);
-
-if (!Prototype.BrowserFeatures.ElementExtensions &&
- document.createElement('div').__proto__) {
- window.HTMLElement = { };
- window.HTMLElement.prototype = document.createElement('div').__proto__;
- Prototype.BrowserFeatures.ElementExtensions = true;
-}
-
-Element.extend = (function() {
- if (Prototype.BrowserFeatures.SpecificElementExtensions)
- return Prototype.K;
-
- var Methods = { }, ByTag = Element.Methods.ByTag;
-
- var extend = Object.extend(function(element) {
- if (!element || element._extendedByPrototype ||
- element.nodeType != 1 || element == window) return element;
-
- var methods = Object.clone(Methods),
- tagName = element.tagName, property, value;
-
- // extend methods for specific tags
- if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
-
- for (property in methods) {
- value = methods[property];
- if (Object.isFunction(value) && !(property in element))
- element[property] = value.methodize();
- }
-
- element._extendedByPrototype = Prototype.emptyFunction;
- return element;
-
- }, {
- refresh: function() {
- // extend methods for all tags (Safari doesn't need this)
- if (!Prototype.BrowserFeatures.ElementExtensions) {
- Object.extend(Methods, Element.Methods);
- Object.extend(Methods, Element.Methods.Simulated);
- }
- }
- });
-
- extend.refresh();
- return extend;
-})();
-
-Element.hasAttribute = function(element, attribute) {
- if (element.hasAttribute) return element.hasAttribute(attribute);
- return Element.Methods.Simulated.hasAttribute(element, attribute);
-};
+});
-Element.addMethods = function(methods) {
- var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
+Insertion.Bottom = Class.create();
+Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
+ initializeRange: function() {
+ this.range.selectNodeContents(this.element);
+ this.range.collapse(this.element);
+ },
- if (!methods) {
- Object.extend(Form, Form.Methods);
- Object.extend(Form.Element, Form.Element.Methods);
- Object.extend(Element.Methods.ByTag, {
- "FORM": Object.clone(Form.Methods),
- "INPUT": Object.clone(Form.Element.Methods),
- "SELECT": Object.clone(Form.Element.Methods),
- "TEXTAREA": Object.clone(Form.Element.Methods)
- });
+ insertContent: function(fragments) {
+ fragments.each((function(fragment) {
+ this.element.appendChild(fragment);
+ }).bind(this));
}
+});
- if (arguments.length == 2) {
- var tagName = methods;
- methods = arguments[1];
- }
-
- if (!tagName) Object.extend(Element.Methods, methods || { });
- else {
- if (Object.isArray(tagName)) tagName.each(extend);
- else extend(tagName);
- }
-
- function extend(tagName) {
- tagName = tagName.toUpperCase();
- if (!Element.Methods.ByTag[tagName])
- Element.Methods.ByTag[tagName] = { };
- Object.extend(Element.Methods.ByTag[tagName], methods);
- }
-
- function copy(methods, destination, onlyIfAbsent) {
- onlyIfAbsent = onlyIfAbsent || false;
- for (var property in methods) {
- var value = methods[property];
- // don't copy update, temporarily
- if (!Object.isFunction(value) || property == 'update') continue;
- if (!onlyIfAbsent || !(property in destination))
- destination[property] = value.methodize();
- }
- }
-
- function findDOMClass(tagName) {
- var klass;
- var trans = {
- "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
- "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
- "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
- "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
- "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
- "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
- "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
- "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
- "FrameSet", "IFRAME": "IFrame"
- };
- if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
- if (window[klass]) return window[klass];
- klass = 'HTML' + tagName + 'Element';
- if (window[klass]) return window[klass];
- klass = 'HTML' + tagName.capitalize() + 'Element';
- if (window[klass]) return window[klass];
-
- window[klass] = { };
- window[klass].prototype = document.createElement(tagName).__proto__;
- return window[klass];
- }
-
- if (F.ElementExtensions) {
- copy(Element.Methods, HTMLElement.prototype);
- copy(Element.Methods.Simulated, HTMLElement.prototype, true);
- }
-
- if (F.SpecificElementExtensions) {
- for (var tag in Element.Methods.ByTag) {
- var klass = findDOMClass(tag);
- if (Object.isUndefined(klass)) continue;
- copy(T[tag], klass.prototype);
- }
- }
+Insertion.After = Class.create();
+Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
+ initializeRange: function() {
+ this.range.setStartAfter(this.element);
+ },
- Object.extend(Element, Element.Methods);
- delete Element.ByTag;
+ insertContent: function(fragments) {
+ fragments.each((function(fragment) {
+ this.element.parentNode.insertBefore(fragment,
+ this.element.nextSibling);
+ }).bind(this));
+ }
+});
- if (Element.extend.refresh) Element.extend.refresh();
- Element.cache = { };
-};
+/*--------------------------------------------------------------------------*/
-document.viewport = {
- getDimensions: function() {
- var dimensions = { };
- $w('width height').each(function(d) {
- var D = d.capitalize();
- dimensions[d] = self['inner' + D] ||
- (document.documentElement['client' + D] || document.body['client' + D]);
- });
- return dimensions;
+Element.ClassNames = Class.create();
+Element.ClassNames.prototype = {
+ initialize: function(element) {
+ this.element = $(element);
},
- getWidth: function() {
- return this.getDimensions().width;
+ _each: function(iterator) {
+ this.element.className.split(/\s+/).select(function(name) {
+ return name.length > 0;
+ })._each(iterator);
},
- getHeight: function() {
- return this.getDimensions().height;
+ set: function(className) {
+ this.element.className = className;
},
- getScrollOffsets: function() {
- return Element._returnOffset(
- window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
- window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
- }
-};
-/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
- * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
- * license. Please see http://www.yui-ext.com/ for more information. */
-
-var Selector = Class.create({
- initialize: function(expression) {
- this.expression = expression.strip();
- this.compileMatcher();
- },
-
- compileMatcher: function() {
- // Selectors with namespaced attributes can't use the XPath version
- if (Prototype.BrowserFeatures.XPath && !(/(\[[\w-]*?:|:checked)/).test(this.expression))
- return this.compileXPathMatcher();
-
- var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
- c = Selector.criteria, le, p, m;
-
- if (Selector._cache[e]) {
- this.matcher = Selector._cache[e];
- return;
- }
-
- this.matcher = ["this.matcher = function(root) {",
- "var r = root, h = Selector.handlers, c = false, n;"];
-
- while (e && le != e && (/\S/).test(e)) {
- le = e;
- for (var i in ps) {
- p = ps[i];
- if (m = e.match(p)) {
- this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
- new Template(c[i]).evaluate(m));
- e = e.replace(m[0], '');
- break;
- }
- }
- }
-
- this.matcher.push("return h.unique(n);\n}");
- eval(this.matcher.join('\n'));
- Selector._cache[this.expression] = this.matcher;
- },
-
- compileXPathMatcher: function() {
- var e = this.expression, ps = Selector.patterns,
- x = Selector.xpath, le, m;
-
- if (Selector._cache[e]) {
- this.xpath = Selector._cache[e]; return;
- }
-
- this.matcher = ['.//*'];
- while (e && le != e && (/\S/).test(e)) {
- le = e;
- for (var i in ps) {
- if (m = e.match(ps[i])) {
- this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
- new Template(x[i]).evaluate(m));
- e = e.replace(m[0], '');
- break;
- }
- }
- }
-
- this.xpath = this.matcher.join('');
- Selector._cache[this.expression] = this.xpath;
+ add: function(classNameToAdd) {
+ if (this.include(classNameToAdd)) return;
+ this.set(this.toArray().concat(classNameToAdd).join(' '));
},
- findElements: function(root) {
- root = root || document;
- if (this.xpath) return document._getElementsByXPath(this.xpath, root);
- return this.matcher(root);
- },
-
- match: function(element) {
- this.tokens = [];
-
- var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
- var le, p, m;
-
- while (e && le !== e && (/\S/).test(e)) {
- le = e;
- for (var i in ps) {
- p = ps[i];
- if (m = e.match(p)) {
- // use the Selector.assertions methods unless the selector
- // is too complex.
- if (as[i]) {
- this.tokens.push([i, Object.clone(m)]);
- e = e.replace(m[0], '');
- } else {
- // reluctantly do a document-wide search
- // and look for a match in the array
- return this.findElements(document).include(element);
- }
- }
- }
- }
-
- var match = true, name, matches;
- for (var i = 0, token; token = this.tokens[i]; i++) {
- name = token[0], matches = token[1];
- if (!Selector.assertions[name](element, matches)) {
- match = false; break;
- }
- }
-
- return match;
+ remove: function(classNameToRemove) {
+ if (!this.include(classNameToRemove)) return;
+ this.set(this.select(function(className) {
+ return className != classNameToRemove;
+ }).join(' '));
},
toString: function() {
- return this.expression;
- },
-
- inspect: function() {
- return "#<Selector:" + this.expression.inspect() + ">";
+ return this.toArray().join(' ');
}
-});
-
-Object.extend(Selector, {
- _cache: { },
-
- xpath: {
- descendant: "//*",
- child: "/*",
- adjacent: "/following-sibling::*[1]",
- laterSibling: '/following-sibling::*',
- tagName: function(m) {
- if (m[1] == '*') return '';
- return "[local-name()='" + m[1].toLowerCase() +
- "' or local-name()='" + m[1].toUpperCase() + "']";
- },
- className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
- id: "[@id='#{1}']",
- attrPresence: "[@#{1}]",
- attr: function(m) {
- m[3] = m[5] || m[6];
- return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
- },
- pseudo: function(m) {
- var h = Selector.xpath.pseudos[m[1]];
- if (!h) return '';
- if (Object.isFunction(h)) return h(m);
- return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
- },
- operators: {
- '=': "[@#{1}='#{3}']",
- '!=': "[@#{1}!='#{3}']",
- '^=': "[starts-with(@#{1}, '#{3}')]",
- '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
- '*=': "[contains(@#{1}, '#{3}')]",
- '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
- '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
- },
- pseudos: {
- 'first-child': '[not(preceding-sibling::*)]',
- 'last-child': '[not(following-sibling::*)]',
- 'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
- 'empty': "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
- 'checked': "[@checked]",
- 'disabled': "[@disabled]",
- 'enabled': "[not(@disabled)]",
- 'not': function(m) {
- var e = m[6], p = Selector.patterns,
- x = Selector.xpath, le, m, v;
-
- var exclusion = [];
- while (e && le != e && (/\S/).test(e)) {
- le = e;
- for (var i in p) {
- if (m = e.match(p[i])) {
- v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
- exclusion.push("(" + v.substring(1, v.length - 1) + ")");
- e = e.replace(m[0], '');
- break;
- }
- }
- }
- return "[not(" + exclusion.join(" and ") + ")]";
- },
- 'nth-child': function(m) {
- return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
- },
- 'nth-last-child': function(m) {
- return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
- },
- 'nth-of-type': function(m) {
- return Selector.xpath.pseudos.nth("position() ", m);
- },
- 'nth-last-of-type': function(m) {
- return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
- },
- 'first-of-type': function(m) {
- m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
- },
- 'last-of-type': function(m) {
- m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
- },
- 'only-of-type': function(m) {
- var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
- },
- nth: function(fragment, m) {
- var mm, formula = m[6], predicate;
- if (formula == 'even') formula = '2n+0';
- if (formula == 'odd') formula = '2n+1';
- if (mm = formula.match(/^(\d+)$/)) // digit only
- return '[' + fragment + "= " + mm[1] + ']';
- if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
- if (mm[1] == "-") mm[1] = -1;
- var a = mm[1] ? Number(mm[1]) : 1;
- var b = mm[2] ? Number(mm[2]) : 0;
- predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
- "((#{fragment} - #{b}) div #{a} >= 0)]";
- return new Template(predicate).evaluate({
- fragment: fragment, a: a, b: b });
- }
- }
- }
- },
-
- criteria: {
- tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
- className: 'n = h.className(n, r, "#{1}", c); c = false;',
- id: 'n = h.id(n, r, "#{1}", c); c = false;',
- attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;',
- attr: function(m) {
- m[3] = (m[5] || m[6]);
- return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m);
- },
- pseudo: function(m) {
- if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
- return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
- },
- descendant: 'c = "descendant";',
- child: 'c = "child";',
- adjacent: 'c = "adjacent";',
- laterSibling: 'c = "laterSibling";'
- },
-
- patterns: {
- // combinators must be listed first
- // (and descendant needs to be last combinator)
- laterSibling: /^\s*~\s*/,
- child: /^\s*>\s*/,
- adjacent: /^\s*\+\s*/,
- descendant: /^\s/,
-
- // selectors follow
- tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
- id: /^#([\w\-\*]+)(\b|$)/,
- className: /^\.([\w\-\*]+)(\b|$)/,
- pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/,
- attrPresence: /^\[([\w]+)\]/,
- attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
- },
-
- // for Selector.match and Element#match
- assertions: {
- tagName: function(element, matches) {
- return matches[1].toUpperCase() == element.tagName.toUpperCase();
- },
-
- className: function(element, matches) {
- return Element.hasClassName(element, matches[1]);
- },
-
- id: function(element, matches) {
- return element.id === matches[1];
- },
-
- attrPresence: function(element, matches) {
- return Element.hasAttribute(element, matches[1]);
- },
-
- attr: function(element, matches) {
- var nodeValue = Element.readAttribute(element, matches[1]);
- return Selector.operators[matches[2]](nodeValue, matches[3]);
- }
- },
-
- handlers: {
- // UTILITY FUNCTIONS
- // joins two collections
- concat: function(a, b) {
- for (var i = 0, node; node = b[i]; i++)
- a.push(node);
- return a;
- },
-
- // marks an array of nodes for counting
- mark: function(nodes) {
- for (var i = 0, node; node = nodes[i]; i++)
- node._counted = true;
- return nodes;
- },
-
- unmark: function(nodes) {
- for (var i = 0, node; node = nodes[i]; i++)
- node._counted = undefined;
- return nodes;
- },
-
- // mark each child node with its position (for nth calls)
- // "ofType" flag indicates whether we're indexing for nth-of-type
- // rather than nth-child
- index: function(parentNode, reverse, ofType) {
- parentNode._counted = true;
- if (reverse) {
- for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
- var node = nodes[i];
- if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
- }
- } else {
- for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
- if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
- }
- },
-
- // filters out duplicates and extends all nodes
- unique: function(nodes) {
- if (nodes.length == 0) return nodes;
- var results = [], n;
- for (var i = 0, l = nodes.length; i < l; i++)
- if (!(n = nodes[i])._counted) {
- n._counted = true;
- results.push(Element.extend(n));
- }
- return Selector.handlers.unmark(results);
- },
-
- // COMBINATOR FUNCTIONS
- descendant: function(nodes) {
- var h = Selector.handlers;
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- h.concat(results, node.getElementsByTagName('*'));
- return results;
- },
-
- child: function(nodes) {
- var h = Selector.handlers;
- for (var i = 0, results = [], node; node = nodes[i]; i++) {
- for (var j = 0, children = [], child; child = node.childNodes[j]; j++)
- if (child.nodeType == 1 && child.tagName != '!') results.push(child);
- }
- return results;
- },
-
- adjacent: function(nodes) {
- for (var i = 0, results = [], node; node = nodes[i]; i++) {
- var next = this.nextElementSibling(node);
- if (next) results.push(next);
- }
- return results;
- },
-
- laterSibling: function(nodes) {
- var h = Selector.handlers;
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- h.concat(results, Element.nextSiblings(node));
- return results;
- },
-
- nextElementSibling: function(node) {
- while (node = node.nextSibling)
- if (node.nodeType == 1) return node;
- return null;
- },
-
- previousElementSibling: function(node) {
- while (node = node.previousSibling)
- if (node.nodeType == 1) return node;
- return null;
- },
-
- // TOKEN FUNCTIONS
- tagName: function(nodes, root, tagName, combinator) {
- tagName = tagName.toUpperCase();
- var results = [], h = Selector.handlers;
- if (nodes) {
- if (combinator) {
- // fastlane for ordinary descendant combinators
- if (combinator == "descendant") {
- for (var i = 0, node; node = nodes[i]; i++)
- h.concat(results, node.getElementsByTagName(tagName));
- return results;
- } else nodes = this[combinator](nodes);
- if (tagName == "*") return nodes;
- }
- for (var i = 0, node; node = nodes[i]; i++)
- if (node.tagName.toUpperCase() == tagName) results.push(node);
- return results;
- } else return root.getElementsByTagName(tagName);
- },
-
- id: function(nodes, root, id, combinator) {
- var targetNode = $(id), h = Selector.handlers;
- if (!targetNode) return [];
- if (!nodes && root == document) return [targetNode];
- if (nodes) {
- if (combinator) {
- if (combinator == 'child') {
- for (var i = 0, node; node = nodes[i]; i++)
- if (targetNode.parentNode == node) return [targetNode];
- } else if (combinator == 'descendant') {
- for (var i = 0, node; node = nodes[i]; i++)
- if (Element.descendantOf(targetNode, node)) return [targetNode];
- } else if (combinator == 'adjacent') {
- for (var i = 0, node; node = nodes[i]; i++)
- if (Selector.handlers.previousElementSibling(targetNode) == node)
- return [targetNode];
- } else nodes = h[combinator](nodes);
- }
- for (var i = 0, node; node = nodes[i]; i++)
- if (node == targetNode) return [targetNode];
- return [];
- }
- return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
- },
-
- className: function(nodes, root, className, combinator) {
- if (nodes && combinator) nodes = this[combinator](nodes);
- return Selector.handlers.byClassName(nodes, root, className);
- },
-
- byClassName: function(nodes, root, className) {
- if (!nodes) nodes = Selector.handlers.descendant([root]);
- var needle = ' ' + className + ' ';
- for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
- nodeClassName = node.className;
- if (nodeClassName.length == 0) continue;
- if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
- results.push(node);
- }
- return results;
- },
-
- attrPresence: function(nodes, root, attr) {
- if (!nodes) nodes = root.getElementsByTagName("*");
- var results = [];
- for (var i = 0, node; node = nodes[i]; i++)
- if (Element.hasAttribute(node, attr)) results.push(node);
- return results;
- },
-
- attr: function(nodes, root, attr, value, operator) {
- if (!nodes) nodes = root.getElementsByTagName("*");
- var handler = Selector.operators[operator], results = [];
- for (var i = 0, node; node = nodes[i]; i++) {
- var nodeValue = Element.readAttribute(node, attr);
- if (nodeValue === null) continue;
- if (handler(nodeValue, value)) results.push(node);
- }
- return results;
- },
+}
- pseudo: function(nodes, name, value, root, combinator) {
- if (nodes && combinator) nodes = this[combinator](nodes);
- if (!nodes) nodes = root.getElementsByTagName("*");
- return Selector.pseudos[name](nodes, value, root);
- }
+Object.extend(Element.ClassNames.prototype, Enumerable);
+var Field = {
+ clear: function() {
+ for (var i = 0; i < arguments.length; i++)
+ $(arguments[i]).value = '';
},
- pseudos: {
- 'first-child': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++) {
- if (Selector.handlers.previousElementSibling(node)) continue;
- results.push(node);
- }
- return results;
- },
- 'last-child': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++) {
- if (Selector.handlers.nextElementSibling(node)) continue;
- results.push(node);
- }
- return results;
- },
- 'only-child': function(nodes, value, root) {
- var h = Selector.handlers;
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
- results.push(node);
- return results;
- },
- 'nth-child': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, formula, root);
- },
- 'nth-last-child': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, formula, root, true);
- },
- 'nth-of-type': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, formula, root, false, true);
- },
- 'nth-last-of-type': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, formula, root, true, true);
- },
- 'first-of-type': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, "1", root, false, true);
- },
- 'last-of-type': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, "1", root, true, true);
- },
- 'only-of-type': function(nodes, formula, root) {
- var p = Selector.pseudos;
- return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
- },
-
- // handles the an+b logic
- getIndices: function(a, b, total) {
- if (a == 0) return b > 0 ? [b] : [];
- return $R(1, total).inject([], function(memo, i) {
- if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
- return memo;
- });
- },
-
- // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
- nth: function(nodes, formula, root, reverse, ofType) {
- if (nodes.length == 0) return [];
- if (formula == 'even') formula = '2n+0';
- if (formula == 'odd') formula = '2n+1';
- var h = Selector.handlers, results = [], indexed = [], m;
- h.mark(nodes);
- for (var i = 0, node; node = nodes[i]; i++) {
- if (!node.parentNode._counted) {
- h.index(node.parentNode, reverse, ofType);
- indexed.push(node.parentNode);
- }
- }
- if (formula.match(/^\d+$/)) { // just a number
- formula = Number(formula);
- for (var i = 0, node; node = nodes[i]; i++)
- if (node.nodeIndex == formula) results.push(node);
- } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
- if (m[1] == "-") m[1] = -1;
- var a = m[1] ? Number(m[1]) : 1;
- var b = m[2] ? Number(m[2]) : 0;
- var indices = Selector.pseudos.getIndices(a, b, nodes.length);
- for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
- for (var j = 0; j < l; j++)
- if (node.nodeIndex == indices[j]) results.push(node);
- }
- }
- h.unmark(nodes);
- h.unmark(indexed);
- return results;
- },
-
- 'empty': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++) {
- // IE treats comments as element nodes
- if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
- results.push(node);
- }
- return results;
- },
-
- 'not': function(nodes, selector, root) {
- var h = Selector.handlers, selectorType, m;
- var exclusions = new Selector(selector).findElements(root);
- h.mark(exclusions);
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- if (!node._counted) results.push(node);
- h.unmark(exclusions);
- return results;
- },
-
- 'enabled': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- if (!node.disabled) results.push(node);
- return results;
- },
-
- 'disabled': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- if (node.disabled) results.push(node);
- return results;
- },
-
- 'checked': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- if (node.checked) results.push(node);
- return results;
- }
+ focus: function(element) {
+ $(element).focus();
},
- operators: {
- '=': function(nv, v) { return nv == v; },
- '!=': function(nv, v) { return nv != v; },
- '^=': function(nv, v) { return nv.startsWith(v); },
- '$=': function(nv, v) { return nv.endsWith(v); },
- '*=': function(nv, v) { return nv.include(v); },
- '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
- '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
- },
-
- matchElements: function(elements, expression) {
- var matches = new Selector(expression).findElements(), h = Selector.handlers;
- h.mark(matches);
- for (var i = 0, results = [], element; element = elements[i]; i++)
- if (element._counted) results.push(element);
- h.unmark(matches);
- return results;
+ present: function() {
+ for (var i = 0; i < arguments.length; i++)
+ if ($(arguments[i]).value == '') return false;
+ return true;
},
- findElement: function(elements, expression, index) {
- if (Object.isNumber(expression)) {
- index = expression; expression = false;
- }
- return Selector.matchElements(elements, expression || '*')[index || 0];
+ select: function(element) {
+ $(element).select();
},
- findChildElements: function(element, expressions) {
- var exprs = expressions.join(','), expressions = [];
- exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
- expressions.push(m[1].strip());
- });
- var results = [], h = Selector.handlers;
- for (var i = 0, l = expressions.length, selector; i < l; i++) {
- selector = new Selector(expressions[i].strip());
- h.concat(results, selector.findElements(element));
- }
- return (l > 1) ? h.unique(results) : results;
+ activate: function(element) {
+ element = $(element);
+ element.focus();
+ if (element.select)
+ element.select();
}
-});
-
-function $$() {
- return Selector.findChildElements(document, $A(arguments));
}
-var Form = {
- reset: function(form) {
- $(form).reset();
- return form;
- },
- serializeElements: function(elements, options) {
- if (typeof options != 'object') options = { hash: !!options };
- else if (options.hash === undefined) options.hash = true;
- var key, value, submitted = false, submit = options.submit;
-
- var data = elements.inject({ }, function(result, element) {
- if (!element.disabled && element.name) {
- key = element.name; value = $(element).getValue();
- if (value != null && (element.type != 'submit' || (!submitted &&
- submit !== false && (!submit || key == submit) && (submitted = true)))) {
- if (key in result) {
- // a key is already present; construct an array of values
- if (!Object.isArray(result[key])) result[key] = [result[key]];
- result[key].push(value);
- }
- else result[key] = value;
- }
- }
- return result;
- });
+/*--------------------------------------------------------------------------*/
- return options.hash ? data : Object.toQueryString(data);
- }
-};
+var Form = {
+ serialize: function(form) {
+ var elements = Form.getElements($(form));
+ var queryComponents = new Array();
-Form.Methods = {
- serialize: function(form, options) {
- return Form.serializeElements(Form.getElements(form), options);
+ for (var i = 0; i < elements.length; i++) {
+ var queryComponent = Form.Element.serialize(elements[i]);
+ if (queryComponent)
+ queryComponents.push(queryComponent);
+ }
+
+ return queryComponents.join('&');
},
getElements: function(form) {
- return $A($(form).getElementsByTagName('*')).inject([],
- function(elements, child) {
- if (Form.Element.Serializers[child.tagName.toLowerCase()])
- elements.push(Element.extend(child));
- return elements;
- }
- );
+ form = $(form);
+ var elements = new Array();
+
+ for (tagName in Form.Element.Serializers) {
+ var tagElements = form.getElementsByTagName(tagName);
+ for (var j = 0; j < tagElements.length; j++)
+ elements.push(tagElements[j]);
+ }
+ return elements;
},
getInputs: function(form, typeName, name) {
form = $(form);
var inputs = form.getElementsByTagName('input');
- if (!typeName && !name) return $A(inputs).map(Element.extend);
+ if (!typeName && !name)
+ return inputs;
- for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
+ var matchingInputs = new Array();
+ for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
- if ((typeName && input.type != typeName) || (name && input.name != name))
+ if ((typeName && input.type != typeName) ||
+ (name && input.name != name))
continue;
- matchingInputs.push(Element.extend(input));
+ matchingInputs.push(input);
}
return matchingInputs;
},
disable: function(form) {
- form = $(form);
- Form.getElements(form).invoke('disable');
- return form;
+ var elements = Form.getElements(form);
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i];
+ element.blur();
+ element.disabled = 'true';
+ }
},
enable: function(form) {
- form = $(form);
- Form.getElements(form).invoke('enable');
- return form;
+ var elements = Form.getElements(form);
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i];
+ element.disabled = '';
+ }
},
findFirstElement: function(form) {
- var elements = $(form).getElements().findAll(function(element) {
- return 'hidden' != element.type && !element.disabled;
- });
- var firstByIndex = elements.findAll(function(element) {
- return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
- }).sortBy(function(element) { return element.tabIndex }).first();
-
- return firstByIndex ? firstByIndex : elements.find(function(element) {
- return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
+ return Form.getElements(form).find(function(element) {
+ return element.type != 'hidden' && !element.disabled &&
+ ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
});
},
focusFirstElement: function(form) {
- form = $(form);
- form.findFirstElement().activate();
- return form;
+ Field.activate(Form.findFirstElement(form));
},
- request: function(form, options) {
- form = $(form), options = Object.clone(options || { });
-
- var params = options.parameters, action = form.readAttribute('action') || '';
- if (action.blank()) action = window.location.href;
- options.parameters = form.serialize(true);
-
- if (params) {
- if (Object.isString(params)) params = params.toQueryParams();
- Object.extend(options.parameters, params);
- }
-
- if (form.hasAttribute('method') && !options.method)
- options.method = form.method;
-
- return new Ajax.Request(action, options);
+ reset: function(form) {
+ $(form).reset();
}
-};
-
-/*--------------------------------------------------------------------------*/
+}
Form.Element = {
- focus: function(element) {
- $(element).focus();
- return element;
- },
-
- select: function(element) {
- $(element).select();
- return element;
- }
-};
-
-Form.Element.Methods = {
serialize: function(element) {
element = $(element);
- if (!element.disabled && element.name) {
- var value = element.getValue();
- if (value != undefined) {
- var pair = { };
- pair[element.name] = value;
- return Object.toQueryString(pair);
- }
- }
- return '';
- },
-
- getValue: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- return Form.Element.Serializers[method](element);
- },
-
- setValue: function(element, value) {
- element = $(element);
var method = element.tagName.toLowerCase();
- Form.Element.Serializers[method](element, value);
- return element;
- },
+ var parameter = Form.Element.Serializers[method](element);
- clear: function(element) {
- $(element).value = '';
- return element;
- },
+ if (parameter) {
+ var key = encodeURIComponent(parameter[0]);
+ if (key.length == 0) return;
- present: function(element) {
- return $(element).value != '';
- },
+ if (parameter[1].constructor != Array)
+ parameter[1] = [parameter[1]];
- activate: function(element) {
- element = $(element);
- try {
- element.focus();
- if (element.select && (element.tagName.toLowerCase() != 'input' ||
- !['button', 'reset', 'submit'].include(element.type)))
- element.select();
- } catch (e) { }
- return element;
+ return parameter[1].map(function(value) {
+ return key + '=' + encodeURIComponent(value);
+ }).join('&');
+ }
},
- disable: function(element) {
+ getValue: function(element) {
element = $(element);
- element.blur();
- element.disabled = true;
- return element;
- },
+ var method = element.tagName.toLowerCase();
+ var parameter = Form.Element.Serializers[method](element);
- enable: function(element) {
- element = $(element);
- element.disabled = false;
- return element;
+ if (parameter)
+ return parameter[1];
}
-};
-
-/*--------------------------------------------------------------------------*/
-
-var Field = Form.Element;
-var $F = Form.Element.Methods.getValue;
-
-/*--------------------------------------------------------------------------*/
+}
Form.Element.Serializers = {
- input: function(element, value) {
+ input: function(element) {
switch (element.type.toLowerCase()) {
+ case 'submit':
+ case 'hidden':
+ case 'password':
+ case 'text':
+ return Form.Element.Serializers.textarea(element);
case 'checkbox':
case 'radio':
- return Form.Element.Serializers.inputSelector(element, value);
- default:
- return Form.Element.Serializers.textarea(element, value);
+ return Form.Element.Serializers.inputSelector(element);
}
+ return false;
+ },
+
+ inputSelector: function(element) {
+ if (element.checked)
+ return [element.name, element.value];
},
- inputSelector: function(element, value) {
- if (value === undefined) return element.checked ? element.value : null;
- else element.checked = !!value;
- },
-
- textarea: function(element, value) {
- if (value === undefined) return element.value;
- else element.value = value;
- },
-
- select: function(element, index) {
- if (index === undefined)
- return this[element.type == 'select-one' ?
- 'selectOne' : 'selectMany'](element);
- else {
- var opt, value, single = !Object.isArray(index);
- for (var i = 0, length = element.length; i < length; i++) {
- opt = element.options[i];
- value = this.optionValue(opt);
- if (single) {
- if (value == index) {
- opt.selected = true;
- return;
- }
- }
- else opt.selected = index.include(value);
- }
- }
+ textarea: function(element) {
+ return [element.name, element.value];
+ },
+
+ select: function(element) {
+ return Form.Element.Serializers[element.type == 'select-one' ?
+ 'selectOne' : 'selectMany'](element);
},
selectOne: function(element) {
- var index = element.selectedIndex;
- return index >= 0 ? this.optionValue(element.options[index]) : null;
+ var value = '', opt, index = element.selectedIndex;
+ if (index >= 0) {
+ opt = element.options[index];
+ value = opt.value;
+ if (!value && !('value' in opt))
+ value = opt.text;
+ }
+ return [element.name, value];
},
selectMany: function(element) {
- var values, length = element.length;
- if (!length) return null;
-
- for (var i = 0, values = []; i < length; i++) {
+ var value = new Array();
+ for (var i = 0; i < element.length; i++) {
var opt = element.options[i];
- if (opt.selected) values.push(this.optionValue(opt));
+ if (opt.selected) {
+ var optValue = opt.value;
+ if (!optValue && !('value' in opt))
+ optValue = opt.text;
+ value.push(optValue);
+ }
}
- return values;
- },
-
- optionValue: function(opt) {
- // extend element because hasAttribute may not be native
- return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
+ return [element.name, value];
}
-};
+}
+
+/*--------------------------------------------------------------------------*/
+
+var $F = Form.Element.getValue;
/*--------------------------------------------------------------------------*/
-Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
- initialize: function($super, element, frequency, callback) {
- $super(callback, frequency);
+Abstract.TimedObserver = function() {}
+Abstract.TimedObserver.prototype = {
+ initialize: function(element, frequency, callback) {
+ this.frequency = frequency;
this.element = $(element);
+ this.callback = callback;
+
this.lastValue = this.getValue();
+ this.registerCallback();
},
- execute: function() {
+ registerCallback: function() {
+ setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+ },
+
+ onTimerEvent: function() {
var value = this.getValue();
- if (Object.isString(this.lastValue) && Object.isString(value) ?
- this.lastValue != value : String(this.lastValue) != String(value)) {
+ if (this.lastValue != value) {
this.callback(this.element, value);
this.lastValue = value;
}
}
-});
+}
-Form.Element.Observer = Class.create(Abstract.TimedObserver, {
+Form.Element.Observer = Class.create();
+Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
getValue: function() {
return Form.Element.getValue(this.element);
}
});
-Form.Observer = Class.create(Abstract.TimedObserver, {
+Form.Observer = Class.create();
+Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
getValue: function() {
return Form.serialize(this.element);
}
@@ -3643,7 +1391,8 @@
/*--------------------------------------------------------------------------*/
-Abstract.EventObserver = Class.create({
+Abstract.EventObserver = function() {}
+Abstract.EventObserver.prototype = {
initialize: function(element, callback) {
this.element = $(element);
this.callback = callback;
@@ -3664,7 +1413,9 @@
},
registerFormCallbacks: function() {
- Form.getElements(this.element).each(this.registerCallback, this);
+ var elements = Form.getElements(this.element);
+ for (var i = 0; i < elements.length; i++)
+ this.registerCallback(elements[i]);
},
registerCallback: function(element) {
@@ -3674,26 +1425,34 @@
case 'radio':
Event.observe(element, 'click', this.onElementEvent.bind(this));
break;
- default:
+ case 'password':
+ case 'text':
+ case 'textarea':
+ case 'select-one':
+ case 'select-multiple':
Event.observe(element, 'change', this.onElementEvent.bind(this));
break;
}
}
}
-});
+}
-Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
+Form.Element.EventObserver = Class.create();
+Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
getValue: function() {
return Form.Element.getValue(this.element);
}
});
-Form.EventObserver = Class.create(Abstract.EventObserver, {
+Form.EventObserver = Class.create();
+Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
getValue: function() {
return Form.serialize(this.element);
}
});
-if (!window.Event) var Event = { };
+if (!window.Event) {
+ var Event = new Object();
+}
Object.extend(Event, {
KEY_BACKSPACE: 8,
@@ -3705,339 +1464,99 @@
KEY_RIGHT: 39,
KEY_DOWN: 40,
KEY_DELETE: 46,
- KEY_HOME: 36,
- KEY_END: 35,
- KEY_PAGEUP: 33,
- KEY_PAGEDOWN: 34,
- KEY_INSERT: 45,
-
- cache: { },
-
- relatedTarget: function(event) {
- var element;
- switch(event.type) {
- case 'mouseover': element = event.fromElement; break;
- case 'mouseout': element = event.toElement; break;
- default: return null;
- }
- return Element.extend(element);
- }
-});
-Event.Methods = (function() {
- var isButton;
+ element: function(event) {
+ return event.target || event.srcElement;
+ },
- if (Prototype.Browser.IE) {
- var buttonMap = { 0: 1, 1: 4, 2: 2 };
- isButton = function(event, code) {
- return event.button == buttonMap[code];
- };
-
- } else if (Prototype.Browser.WebKit) {
- isButton = function(event, code) {
- switch (code) {
- case 0: return event.which == 1 && !event.metaKey;
- case 1: return event.which == 1 && event.metaKey;
- default: return false;
- }
- };
+ isLeftClick: function(event) {
+ return (((event.which) && (event.which == 1)) ||
+ ((event.button) && (event.button == 1)));
+ },
- } else {
- isButton = function(event, code) {
- return event.which ? (event.which === code + 1) : (event.button === code);
- };
- }
-
- return {
- isLeftClick: function(event) { return isButton(event, 0) },
- isMiddleClick: function(event) { return isButton(event, 1) },
- isRightClick: function(event) { return isButton(event, 2) },
-
- element: function(event) {
- var node = Event.extend(event).target;
- return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
- },
-
- findElement: function(event, expression) {
- var element = Event.element(event);
- return element.match(expression) ? element : element.up(expression);
- },
-
- pointer: function(event) {
- return {
- x: event.pageX || (event.clientX +
- (document.documentElement.scrollLeft || document.body.scrollLeft)),
- y: event.pageY || (event.clientY +
- (document.documentElement.scrollTop || document.body.scrollTop))
- };
- },
+ pointerX: function(event) {
+ return event.pageX || (event.clientX +
+ (document.documentElement.scrollLeft || document.body.scrollLeft));
+ },
- pointerX: function(event) { return Event.pointer(event).x },
- pointerY: function(event) { return Event.pointer(event).y },
+ pointerY: function(event) {
+ return event.pageY || (event.clientY +
+ (document.documentElement.scrollTop || document.body.scrollTop));
+ },
- stop: function(event) {
- Event.extend(event);
+ stop: function(event) {
+ if (event.preventDefault) {
event.preventDefault();
event.stopPropagation();
- event.stopped = true;
+ } else {
+ event.returnValue = false;
+ event.cancelBubble = true;
}
- };
-})();
-
-Event.extend = (function() {
- var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
- m[name] = Event.Methods[name].methodize();
- return m;
- });
-
- if (Prototype.Browser.IE) {
- Object.extend(methods, {
- stopPropagation: function() { this.cancelBubble = true },
- preventDefault: function() { this.returnValue = false },
- inspect: function() { return "[object Event]" }
- });
-
- return function(event) {
- if (!event) return false;
- if (event._extendedByPrototype) return event;
-
- event._extendedByPrototype = Prototype.emptyFunction;
- var pointer = Event.pointer(event);
- Object.extend(event, {
- target: event.srcElement,
- relatedTarget: Event.relatedTarget(event),
- pageX: pointer.x,
- pageY: pointer.y
- });
- return Object.extend(event, methods);
- };
-
- } else {
- Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__;
- Object.extend(Event.prototype, methods);
- return Prototype.K;
- }
-})();
-
-Object.extend(Event, (function() {
- var cache = Event.cache;
-
- function getEventID(element) {
- if (element._eventID) return element._eventID;
- arguments.callee.id = arguments.callee.id || 1;
- return element._eventID = ++arguments.callee.id;
- }
-
- function getDOMEventName(eventName) {
- if (eventName && eventName.include(':')) return "dataavailable";
- return eventName;
- }
-
- function getCacheForID(id) {
- return cache[id] = cache[id] || { };
- }
-
- function getWrappersForEventName(id, eventName) {
- var c = getCacheForID(id);
- return c[eventName] = c[eventName] || [];
- }
-
- function createWrapper(element, eventName, handler) {
- var id = getEventID(element);
- var c = getWrappersForEventName(id, eventName);
- if (c.pluck("handler").include(handler)) return false;
-
- var wrapper = function(event) {
- if (!Event || !Event.extend ||
- (event.eventName && event.eventName != eventName))
- return false;
-
- Event.extend(event);
- handler.call(element, event)
- };
-
- wrapper.handler = handler;
- c.push(wrapper);
- return wrapper;
- }
-
- function findWrapper(id, eventName, handler) {
- var c = getWrappersForEventName(id, eventName);
- return c.find(function(wrapper) { return wrapper.handler == handler });
- }
-
- function destroyWrapper(id, eventName, handler) {
- var c = getCacheForID(id);
- if (!c[eventName]) return false;
- c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
- }
-
- function destroyCache() {
- for (var id in cache)
- for (var eventName in cache[id])
- cache[id][eventName] = null;
- }
-
- if (window.attachEvent) {
- window.attachEvent("onunload", destroyCache);
- }
-
- return {
- observe: function(element, eventName, handler) {
- element = $(element);
- var name = getDOMEventName(eventName);
-
- var wrapper = createWrapper(element, eventName, handler);
- if (!wrapper) return element;
-
- if (element.addEventListener) {
- element.addEventListener(name, wrapper, false);
- } else {
- element.attachEvent("on" + name, wrapper);
- }
-
- return element;
- },
-
- stopObserving: function(element, eventName, handler) {
- element = $(element);
- var id = getEventID(element), name = getDOMEventName(eventName);
-
- if (!handler && eventName) {
- getWrappersForEventName(id, eventName).each(function(wrapper) {
- element.stopObserving(eventName, wrapper.handler);
- });
- return element;
-
- } else if (!eventName) {
- Object.keys(getCacheForID(id)).each(function(eventName) {
- element.stopObserving(eventName);
- });
- return element;
- }
-
- var wrapper = findWrapper(id, eventName, handler);
- if (!wrapper) return element;
-
- if (element.removeEventListener) {
- element.removeEventListener(name, wrapper, false);
- } else {
- element.detachEvent("on" + name, wrapper);
- }
-
- destroyWrapper(id, eventName, handler);
-
- return element;
- },
-
- fire: function(element, eventName, memo) {
- element = $(element);
- if (element == document && document.createEvent && !element.dispatchEvent)
- element = document.documentElement;
-
- if (document.createEvent) {
- var event = document.createEvent("HTMLEvents");
- event.initEvent("dataavailable", true, true);
- } else {
- var event = document.createEventObject();
- event.eventType = "ondataavailable";
- }
+ },
- event.eventName = eventName;
- event.memo = memo || { };
+ // find the first node with the given tagName, starting from the
+ // node the event was triggered on; traverses the DOM upwards
+ findElement: function(event, tagName) {
+ var element = Event.element(event);
+ while (element.parentNode && (!element.tagName ||
+ (element.tagName.toUpperCase() != tagName.toUpperCase())))
+ element = element.parentNode;
+ return element;
+ },
- if (document.createEvent) {
- element.dispatchEvent(event);
- } else {
- element.fireEvent(event.eventType, event);
- }
+ observers: false,
- return event;
+ _observeAndCache: function(element, name, observer, useCapture) {
+ if (!this.observers) this.observers = [];
+ if (element.addEventListener) {
+ this.observers.push([element, name, observer, useCapture]);
+ element.addEventListener(name, observer, useCapture);
+ } else if (element.attachEvent) {
+ this.observers.push([element, name, observer, useCapture]);
+ element.attachEvent('on' + name, observer);
}
- };
-})());
-
-Object.extend(Event, Event.Methods);
-
-Element.addMethods({
- fire: Event.fire,
- observe: Event.observe,
- stopObserving: Event.stopObserving
-});
-
-Object.extend(document, {
- fire: Element.Methods.fire.methodize(),
- observe: Element.Methods.observe.methodize(),
- stopObserving: Element.Methods.stopObserving.methodize()
-});
-
-(function() {
- /* Support for the DOMContentLoaded event is based on work by Dan Webb,
- Matthias Miller, Dean Edwards and John Resig. */
-
- var timer, fired = false;
-
- function fireContentLoadedEvent() {
- if (fired) return;
- if (timer) window.clearInterval(timer);
- document.fire("dom:loaded");
- fired = true;
- }
-
- if (document.addEventListener) {
- if (Prototype.Browser.WebKit) {
- timer = window.setInterval(function() {
- if (/loaded|complete/.test(document.readyState))
- fireContentLoadedEvent();
- }, 0);
-
- Event.observe(window, "load", fireContentLoadedEvent);
+ },
- } else {
- document.addEventListener("DOMContentLoaded",
- fireContentLoadedEvent, false);
+ unloadCache: function() {
+ if (!Event.observers) return;
+ for (var i = 0; i < Event.observers.length; i++) {
+ Event.stopObserving.apply(this, Event.observers[i]);
+ Event.observers[i][0] = null;
}
+ Event.observers = false;
+ },
- } else {
- document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
- $("__onDOMContentLoaded").onreadystatechange = function() {
- if (this.readyState == "complete") {
- this.onreadystatechange = null;
- fireContentLoadedEvent();
- }
- };
- }
-})();
-/*------------------------------- DEPRECATED -------------------------------*/
-
-Hash.toQueryString = Object.toQueryString;
-
-var Toggle = { display: Element.toggle };
+ observe: function(element, name, observer, useCapture) {
+ var element = $(element);
+ useCapture = useCapture || false;
-Element.Methods.childOf = Element.Methods.descendantOf;
+ if (name == 'keypress' &&
+ (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
+ || element.attachEvent))
+ name = 'keydown';
-var Insertion = {
- Before: function(element, content) {
- return Element.insert(element, {before:content});
+ this._observeAndCache(element, name, observer, useCapture);
},
- Top: function(element, content) {
- return Element.insert(element, {top:content});
- },
+ stopObserving: function(element, name, observer, useCapture) {
+ var element = $(element);
+ useCapture = useCapture || false;
- Bottom: function(element, content) {
- return Element.insert(element, {bottom:content});
- },
+ if (name == 'keypress' &&
+ (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
+ || element.detachEvent))
+ name = 'keydown';
- After: function(element, content) {
- return Element.insert(element, {after:content});
+ if (element.removeEventListener) {
+ element.removeEventListener(name, observer, useCapture);
+ } else if (element.detachEvent) {
+ element.detachEvent('on' + name, observer);
+ }
}
-};
-
-var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
+});
-// This should be moved to script.aculo.us; notice the deprecated methods
-// further below, that map to the newer Element methods.
+/* prevent memory leaks in IE */
+Event.observe(window, 'unload', Event.unloadCache, false);
var Position = {
// set to true if needed, warning: firefox performance problems
// NOT neeeded for page scrolling, only if draggable contained in
@@ -4057,13 +1576,58 @@
|| 0;
},
+ realOffset: function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.scrollTop || 0;
+ valueL += element.scrollLeft || 0;
+ element = element.parentNode;
+ } while (element);
+ return [valueL, valueT];
+ },
+
+ cumulativeOffset: function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ } while (element);
+ return [valueL, valueT];
+ },
+
+ positionedOffset: function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ if (element) {
+ p = Element.getStyle(element, 'position');
+ if (p == 'relative' || p == 'absolute') break;
+ }
+ } while (element);
+ return [valueL, valueT];
+ },
+
+ offsetParent: function(element) {
+ if (element.offsetParent) return element.offsetParent;
+ if (element == document.body) return element;
+
+ while ((element = element.parentNode) && element != document.body)
+ if (Element.getStyle(element, 'position') != 'static')
+ return element;
+
+ return document.body;
+ },
+
// caches x/y coordinate pair to use with overlap
within: function(element, x, y) {
if (this.includeScrollOffsets)
return this.withinIncludingScrolloffsets(element, x, y);
this.xcomp = x;
this.ycomp = y;
- this.offset = Element.cumulativeOffset(element);
+ this.offset = this.cumulativeOffset(element);
return (y >= this.offset[1] &&
y < this.offset[1] + element.offsetHeight &&
@@ -4072,11 +1636,11 @@
},
withinIncludingScrolloffsets: function(element, x, y) {
- var offsetcache = Element.cumulativeScrollOffset(element);
+ var offsetcache = this.realOffset(element);
this.xcomp = x + offsetcache[0] - this.deltaX;
this.ycomp = y + offsetcache[1] - this.deltaY;
- this.offset = Element.cumulativeOffset(element);
+ this.offset = this.cumulativeOffset(element);
return (this.ycomp >= this.offset[1] &&
this.ycomp < this.offset[1] + element.offsetHeight &&
@@ -4095,104 +1659,132 @@
element.offsetWidth;
},
- // Deprecation layer -- use newer Element methods now (1.5.2).
+ clone: function(source, target) {
+ source = $(source);
+ target = $(target);
+ target.style.position = 'absolute';
+ var offsets = this.cumulativeOffset(source);
+ target.style.top = offsets[1] + 'px';
+ target.style.left = offsets[0] + 'px';
+ target.style.width = source.offsetWidth + 'px';
+ target.style.height = source.offsetHeight + 'px';
+ },
- cumulativeOffset: Element.Methods.cumulativeOffset,
+ page: function(forElement) {
+ var valueT = 0, valueL = 0;
- positionedOffset: Element.Methods.positionedOffset,
+ var element = forElement;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
- absolutize: function(element) {
- Position.prepare();
- return Element.absolutize(element);
- },
+ // Safari fix
+ if (element.offsetParent==document.body)
+ if (Element.getStyle(element,'position')=='absolute') break;
- relativize: function(element) {
- Position.prepare();
- return Element.relativize(element);
- },
+ } while (element = element.offsetParent);
- realOffset: Element.Methods.cumulativeScrollOffset,
+ element = forElement;
+ do {
+ valueT -= element.scrollTop || 0;
+ valueL -= element.scrollLeft || 0;
+ } while (element = element.parentNode);
- offsetParent: Element.Methods.getOffsetParent,
+ return [valueL, valueT];
+ },
- page: Element.Methods.viewportOffset,
+ clone: function(source, target) {
+ var options = Object.extend({
+ setLeft: true,
+ setTop: true,
+ setWidth: true,
+ setHeight: true,
+ offsetTop: 0,
+ offsetLeft: 0
+ }, arguments[2] || {})
- clone: function(source, target, options) {
- options = options || { };
- return Element.clonePosition(target, source, options);
- }
-};
+ // find page position of source
+ source = $(source);
+ var p = Position.page(source);
-/*--------------------------------------------------------------------------*/
+ // find coordinate system to use
+ target = $(target);
+ var delta = [0, 0];
+ var parent = null;
+ // delta [0,0] will do fine with position: fixed elements,
+ // position:absolute needs offsetParent deltas
+ if (Element.getStyle(target,'position') == 'absolute') {
+ parent = Position.offsetParent(target);
+ delta = Position.page(parent);
+ }
-if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
- function iter(name) {
- return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
- }
-
- instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
- function(element, className) {
- className = className.toString().strip();
- var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
- return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
- } : function(element, className) {
- className = className.toString().strip();
- var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
- if (!classNames && !className) return elements;
-
- var nodes = $(element).getElementsByTagName('*');
- className = ' ' + className + ' ';
-
- for (var i = 0, child, cn; child = nodes[i]; i++) {
- if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
- (classNames && classNames.all(function(name) {
- return !name.toString().blank() && cn.include(' ' + name + ' ');
- }))))
- elements.push(Element.extend(child));
+ // correct by body offsets (fixes Safari)
+ if (parent == document.body) {
+ delta[0] -= document.body.offsetLeft;
+ delta[1] -= document.body.offsetTop;
}
- return elements;
- };
- return function(className, parentElement) {
- return $(parentElement || document.body).getElementsByClassName(className);
- };
-}(Element.Methods);
+ // set position
+ if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
+ if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
+ if(options.setWidth) target.style.width = source.offsetWidth + 'px';
+ if(options.setHeight) target.style.height = source.offsetHeight + 'px';
+ },
-/*--------------------------------------------------------------------------*/
+ absolutize: function(element) {
+ element = $(element);
+ if (element.style.position == 'absolute') return;
+ Position.prepare();
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
- initialize: function(element) {
- this.element = $(element);
- },
+ var offsets = Position.positionedOffset(element);
+ var top = offsets[1];
+ var left = offsets[0];
+ var width = element.clientWidth;
+ var height = element.clientHeight;
- _each: function(iterator) {
- this.element.className.split(/\s+/).select(function(name) {
- return name.length > 0;
- })._each(iterator);
- },
+ element._originalLeft = left - parseFloat(element.style.left || 0);
+ element._originalTop = top - parseFloat(element.style.top || 0);
+ element._originalWidth = element.style.width;
+ element._originalHeight = element.style.height;
- set: function(className) {
- this.element.className = className;
+ element.style.position = 'absolute';
+ element.style.top = top + 'px';;
+ element.style.left = left + 'px';;
+ element.style.width = width + 'px';;
+ element.style.height = height + 'px';;
},
- add: function(classNameToAdd) {
- if (this.include(classNameToAdd)) return;
- this.set($A(this).concat(classNameToAdd).join(' '));
- },
+ relativize: function(element) {
+ element = $(element);
+ if (element.style.position == 'relative') return;
+ Position.prepare();
- remove: function(classNameToRemove) {
- if (!this.include(classNameToRemove)) return;
- this.set($A(this).without(classNameToRemove).join(' '));
- },
+ element.style.position = 'relative';
+ var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
+ var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
- toString: function() {
- return $A(this).join(' ');
+ element.style.top = top + 'px';
+ element.style.left = left + 'px';
+ element.style.height = element._originalHeight;
+ element.style.width = element._originalWidth;
}
-};
+}
-Object.extend(Element.ClassNames.prototype, Enumerable);
+// Safari returns margins on body which is incorrect if the child is absolutely
+// positioned. For performance reasons, redefine Position.cumulativeOffset for
+// KHTML/WebKit only.
+if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
+ Position.cumulativeOffset = function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ if (element.offsetParent == document.body)
+ if (Element.getStyle(element, 'position') == 'absolute') break;
-/*--------------------------------------------------------------------------*/
+ element = element.offsetParent;
+ } while (element);
-Element.addMethods();
+ return [valueL, valueT];
+ }
+}
Modified: jifty/branches/prototype-1.6/share/web/static/js/scriptaculous/effects.js
==============================================================================
--- jifty/branches/prototype-1.6/share/web/static/js/scriptaculous/effects.js (original)
+++ jifty/branches/prototype-1.6/share/web/static/js/scriptaculous/effects.js Mon Nov 19 11:53:17 2007
@@ -231,10 +231,10 @@
get: function(queueName) {
if(typeof queueName != 'string') return queueName;
- if(!this.instances.get(queueName))
- this.instances.set(queueName, new Effect.ScopedQueue());
+ if(!this.instances[queueName])
+ this.instances[queueName] = new Effect.ScopedQueue();
- return this.instances.get(queueName);
+ return this.instances[queueName];
}
}
Effect.Queue = Effect.Queues.get('global');
Modified: jifty/branches/prototype-1.6/t/01-dependencies.t
==============================================================================
--- jifty/branches/prototype-1.6/t/01-dependencies.t (original)
+++ jifty/branches/prototype-1.6/t/01-dependencies.t Mon Nov 19 11:53:17 2007
@@ -21,7 +21,6 @@
return unless -f $_;
return if $File::Find::dir =~ m!/.svn($|/)!;
return if $File::Find::name =~ /~$/;
- return if $File::Find::name =~ /generate-changelog/;
return if $File::Find::name =~ /\.(pod|html)$/;
# read in the file from disk
Modified: jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/share/web/templates/content.html
==============================================================================
--- jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/share/web/templates/content.html (original)
+++ jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/share/web/templates/content.html Mon Nov 19 11:53:17 2007
@@ -1 +1 @@
-original content
+content
Modified: jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/share/web/templates/onclick.html
==============================================================================
--- jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/share/web/templates/onclick.html (original)
+++ jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/share/web/templates/onclick.html Mon Nov 19 11:53:17 2007
@@ -3,7 +3,7 @@
args:<% Jifty->web->request->arguments->{'J:V-region-content'} || ''%>
<% Jifty->web->link(
- label => 'replace content',
+ label => 'content',
id => 'replace_content',
onclick => {
replace_with => '/content1.html',
@@ -17,10 +17,4 @@
) %>
-<a id="original_content"
-href="/onclick.html?J:V-region-content=%2Fcontent.html"
-onclick="return update(
-{'continuation':{},'actions':{},'fragments':[{'mode':'Replace','args':{},'region':'content','path':'/content.html'}],'action_arguments':{}},
-this );">revert content</a>
-
</&>
Modified: jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/t/onclick.t
==============================================================================
--- jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/t/onclick.t (original)
+++ jifty/branches/prototype-1.6/t/TestApp-Plugin-OnClick/t/onclick.t Mon Nov 19 11:53:17 2007
@@ -2,33 +2,21 @@
use warnings;
use lib 't/lib';
use Jifty::SubTest;
-use Jifty::Test tests => 10;
+use Jifty::Test tests => 6;
use Jifty::Test::WWW::Selenium;
use utf8;
-my $server = Jifty::Test->make_server;
-my $sel = Jifty::Test::WWW::Selenium->rc_ok($server);
-my $URL = $server->started_ok;
+my $server = Jifty::Test->make_server;
+my $sel = Jifty::Test::WWW::Selenium->rc_ok( $server );
+my $URL = $server->started_ok;
$sel->open_ok("/onclick.html");
$sel->click_ok("//a[\@id='replace_content']");
-sleep 2; # in case the click returning slowly
-
my $html = $sel->get_html_source;
-
like( $html, qr/yatta/, 'replace content correctly' );
unlike( $html, qr{args:/content1\.html}, 'replaced by javascript' );
-$sel->click_ok("//a[\@id='original_content']");
-is( $sel->get_alert,
- 'please use Jifty.update instead of update.',
- 'bare update is deprecated'
-);
-$html = $sel->get_html_source;
-like( $html, qr/original content/, 'replace content correctly' );
-unlike( $html, qr{args:/content\.html}, 'replaced by javascript' );
-
$sel->stop;
Added: jifty/branches/prototype-1.6/t/TestApp/lib/TestApp/Model/OtherThingy.pm
==============================================================================
--- (empty file)
+++ jifty/branches/prototype-1.6/t/TestApp/lib/TestApp/Model/OtherThingy.pm Mon Nov 19 11:53:17 2007
@@ -0,0 +1,17 @@
+use strict;
+use warnings;
+
+package TestApp::Model::OtherThingy;
+use Jifty::DBI::Schema;
+
+use TestApp::Record schema {
+
+ column value => type is 'text', is mandatory;
+ column user_id => refers_to TestApp::Model::User;
+
+};
+
+use Jifty::RightsFrom column => 'user_id';
+
+1;
+
Added: jifty/branches/prototype-1.6/t/TestApp/lib/TestApp/Model/Thingy.pm
==============================================================================
--- (empty file)
+++ jifty/branches/prototype-1.6/t/TestApp/lib/TestApp/Model/Thingy.pm Mon Nov 19 11:53:17 2007
@@ -0,0 +1,17 @@
+use strict;
+use warnings;
+
+package TestApp::Model::Thingy;
+use Jifty::DBI::Schema;
+
+use TestApp::Record schema {
+
+ column value => type is 'text', is mandatory;
+ column user_id => refers_to TestApp::Model::User;
+
+};
+
+use Jifty::RightsFrom column => 'user';
+
+1;
+
Modified: jifty/branches/prototype-1.6/t/TestApp/lib/TestApp/Model/User.pm
==============================================================================
--- jifty/branches/prototype-1.6/t/TestApp/lib/TestApp/Model/User.pm (original)
+++ jifty/branches/prototype-1.6/t/TestApp/lib/TestApp/Model/User.pm Mon Nov 19 11:53:17 2007
@@ -50,5 +50,17 @@
'America/Anchorage'
}
+sub current_user_can {
+ my $self = shift;
+ my $right = shift;
+ my %args = @_;
+
+ return 1 if $self->SUPER::current_user_can($right => %args);
+
+ return 1 if $self->current_user->id and $self->id and $self->current_user->id == $self->id;
+
+ return 0;
+}
+
1;
Modified: jifty/branches/prototype-1.6/t/TestApp/t/11-current_user.t
==============================================================================
--- jifty/branches/prototype-1.6/t/TestApp/t/11-current_user.t (original)
+++ jifty/branches/prototype-1.6/t/TestApp/t/11-current_user.t Mon Nov 19 11:53:17 2007
@@ -23,6 +23,7 @@
# Make it so that all users have full access
TestApp::Model::User->add_trigger( before_access => sub { 'allow' } );
+TestApp::Model::User->finalize_triggers if TestApp::Model::User->can('finalize_triggers');
# Create two users
my $o = TestApp::Model::User->new(current_user => $system_user);
Added: jifty/branches/prototype-1.6/t/TestApp/t/19-rightsfrom.t
==============================================================================
--- (empty file)
+++ jifty/branches/prototype-1.6/t/TestApp/t/19-rightsfrom.t Mon Nov 19 11:53:17 2007
@@ -0,0 +1,88 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+
+=head1 DESCRIPTION
+
+Test the RightsFrom mixin.
+
+=cut
+
+use lib 't/lib';
+use Jifty::SubTest;
+
+use Jifty::Test no_plan => 1;;
+
+use_ok('TestApp::Model::User');
+use_ok('TestApp::Model::Thingy');
+use_ok('TestApp::Model::OtherThingy');
+use_ok('TestApp::CurrentUser');
+
+# Get a system user
+my $system_user = TestApp::CurrentUser->superuser;
+ok($system_user, "Found a system user");
+
+# Create users
+my $one = TestApp::Model::User->new(current_user => $system_user);
+$one->create( name => 'A User', email => 'auser at example.com',
+ password => 'secret', tasty => 0 );
+ok($one->id, "New user has valid id set");
+is($one->name, "A User", "Has the right name");
+my $two = TestApp::Model::User->new(current_user => $system_user);
+$two->create( name => 'Bob', email => 'bob at example.com',
+ password => 'secret2', tasty => 0 );
+ok($two->id, "New user has valid id set");
+
+# Create a CurrentUser
+my $one_user = TestApp::CurrentUser->new( id => $one->id );
+ok($one_user->id, "Loaded the current user");
+is($one_user->id, $one->id, "Has the right id");
+is($one_user->user_object->id, $one->id, "User object is right");
+is($one_user->user_object->name, $one->name, "Name is consistent");
+
+my $two_by_one = TestApp::Model::User->new( current_user => $one_user );
+$two_by_one->load( $two->id );
+ok($two_by_one->id, "Has an id");
+is($two_by_one->id, $two->id, "Has the right id");
+ok(!$two_by_one->current_user_can("read"), "Can read the remote user");
+ok(!$two_by_one->name, "Can't read their name");
+
+# And a thingy and otherthingy, one from each user; thingy has
+# rights_from 'user', otherthingy has rights from 'user_id';
+for my $class (qw/TestApp::Model::Thingy TestApp::Model::OtherThingy/) {
+ my $mine = $class->new(current_user => $system_user);
+ $mine->create( user_id => $one->id, value => "Whee" );
+ ok( $mine->id, "New object has a valid id");
+ is( $mine->user_id, $one->id, "Has right user" );
+ my $theirs = $class->new(current_user => $system_user);
+ $theirs->create( user_id => $two->id, value => "Not whee" );
+ ok( $theirs->id, "New object has a valid id");
+ is( $theirs->user_id, $two->id, "Has right user" );
+
+ my $access = $class->new( current_user => $one_user );
+ $access->load( $mine->id );
+ ok( $access->id, "Object has an id" );
+ is( $access->id, $mine->id, "Has the right id" );
+ ok( $access->current_user_can("read"), "I can read it");
+ ok( $access->value, "Has a value" );
+ is( $access->value, "Whee", "Can read the value" );
+ isa_ok( $access->user, "TestApp::Model::User", "Has a user" );
+ ok( $access->user_id, "Can read the user_id" );
+ ok( $access->user->id, "Can read the user->id" );
+ is( $access->user->id, $one->id, "Has the right user" );
+
+ $access->load( $theirs->id );
+ ok( $access->id, "Object has an id" );
+ is( $access->id, $theirs->id, "Has the right id" );
+ ok( !$access->current_user_can("read"), "I can't read it");
+ ok( !$access->value, "Can't read the value" );
+ isa_ok( $access->user, "TestApp::Model::User", "Has a user" );
+ ok( !$access->user_id, "Can't read the user_id" );
+ TODO:
+ {
+ local $TODO = "ACLs should apply to object refs, but can't";
+ # Except the problem is that Jifty current_user_can's often
+ # call their object refs, which would cause recursion.
+ ok( !$access->user->id, "Can't read the user->id" );
+ }
+}
Modified: jifty/branches/prototype-1.6/t/TestApp/t/before_access.t
==============================================================================
--- jifty/branches/prototype-1.6/t/TestApp/t/before_access.t (original)
+++ jifty/branches/prototype-1.6/t/TestApp/t/before_access.t Mon Nov 19 11:53:17 2007
@@ -22,6 +22,7 @@
}
return 'ignore';
});
+TestApp::Model::User->finalize_triggers if TestApp::Model::User->can('finalize_triggers');
# Try creating non-bob, which will be denied
my $o = TestApp::Model::User->new(current_user => $system_user);
More information about the Jifty-commit
mailing list