From b547170a965e93a759de1612d4ce64d38eeea59c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 4 Feb 2010 15:07:10 -0500 Subject: Improve display of openid in preferences page. Now that openiduser is in IkiWiki core, it's ok to have passwordauth check for it, and avoid displaying useless password fields when showing preferences for an openid. Also improved the styling of the display of the openid in the preferneces page. --- IkiWiki/Plugin/openid.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index dc0e0f48e..b60740c0e 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -82,13 +82,13 @@ sub formbuilder_setup (@) { } } } - elsif ($form->title eq "preferences") { - if (! defined $form->field(name => "name")) { - $form->field(name => "OpenID", disabled => 1, - value => $session->param("name"), - size => 50, force => 1, - fieldset => "login"); - } + elsif ($form->title eq "preferences" && + IkiWiki::openiduser($session->param("name"))) { + $form->field(name => "openid_url", disabled => 1, + label => htmllink("", "", "ikiwiki/OpenID", noimageinline => 1), + value => $session->param("name"), + size => 50, force => 1, + fieldset => "login"); } } -- cgit v1.2.3 From 046095552ac231366d71a3c7a84bdc6d46662212 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 11 Feb 2010 17:26:09 -0500 Subject: httpauth: When cgiauthurl is configured, httpauth can now be used alongside other authentication methods (like openid or anonok). Rather than always redirect to the cgiauthurl for authentication, there is now a button on the login form to use it. --- IkiWiki/Plugin/httpauth.pm | 35 +++++++++++++++++++++++++++++++---- IkiWiki/Plugin/openid.pm | 2 +- debian/changelog | 4 ++++ doc/bugs/anonok_vs._httpauth.mdwn | 2 ++ doc/plugins/httpauth.mdwn | 9 +++++---- 5 files changed, 43 insertions(+), 9 deletions(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/httpauth.pm b/IkiWiki/Plugin/httpauth.pm index a18f8ca54..d0d4da0b7 100644 --- a/IkiWiki/Plugin/httpauth.pm +++ b/IkiWiki/Plugin/httpauth.pm @@ -11,6 +11,8 @@ sub import { hook(type => "auth", id => "httpauth", call => \&auth); hook(type => "canedit", id => "httpauth", call => \&canedit, last => 1); + hook(type => "formbuilder_setup", id => "httpauth", + call => \&formbuilder_setup); } sub getsetup () { @@ -27,6 +29,14 @@ sub getsetup () { rebuild => 0, }, } + +sub redir_cgiauthurl ($$) { + my $cgi=shift; + my $params=shift; + + IkiWiki::redirect($cgi, $config{cgiauthurl}.'?'.$params); + exit; +} sub auth ($$) { my $cgi=shift; @@ -43,14 +53,31 @@ sub canedit ($$$) { my $session=shift; if (! defined $cgi->remote_user() && defined $config{cgiauthurl}) { - return sub { - IkiWiki::redirect($cgi, $config{cgiauthurl}.'?'.$cgi->query_string()); - exit; - }; + return sub { redir_cgiauthurl($cgi, $cgi->query_string()) }; } else { return undef; } } +sub formbuilder_setup (@) { + my %params=@_; + + my $form=$params{form}; + my $session=$params{session}; + my $cgi=$params{cgi}; + my $buttons=$params{buttons}; + + if ($form->title eq "signin" && + ! defined $cgi->remote_user() && defined $config{cgiauthurl}) { + my $button_text="Login with HTTP auth"; + push @$buttons, $button_text; + + if ($form->submitted && $form->submitted eq $button_text) { + redir_cgiauthurl($cgi, "do=postsignin"); + exit; + } + } +} + 1 diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index b60740c0e..382d8286f 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -56,7 +56,7 @@ sub formbuilder_setup (@) { # OpenID fieldset. $form->fieldsets("OpenID"); - $form->field( + $form->field( name => "openid_url", label => gettext("Log in with")." ".htmllink("", "", "ikiwiki/OpenID", noimageinline => 1), fieldset => "OpenID", diff --git a/debian/changelog b/debian/changelog index 358a5dc5c..3dd68558e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,10 @@ ikiwiki (3.20100123) UNRELEASED; urgency=low * Fix color and format plugins to appear in the websetup interface. * amazon_s3: Fix to support the EU S3 datacenter, which is more picky about attempts to create already existing buckets. + * httpauth: When cgiauthurl is configured, httpauth can now be used + alongside other authentication methods (like openid or anonok). Rather + than always redirect to the cgiauthurl for authentication, there is now + a button on the login form to use it. -- Joey Hess Tue, 26 Jan 2010 22:25:33 -0500 diff --git a/doc/bugs/anonok_vs._httpauth.mdwn b/doc/bugs/anonok_vs._httpauth.mdwn index b738e3b6c..bff37e18b 100644 --- a/doc/bugs/anonok_vs._httpauth.mdwn +++ b/doc/bugs/anonok_vs._httpauth.mdwn @@ -114,3 +114,5 @@ index 127c321..a18f8ca 100644 >> time that httpauth is redirecting to the cgiauthurl. As mentioned above, >> the only way to deal with that would be to add a link to the signin page >> that does the httpauth signin. --[[Joey]] + +>>> That's dealt with in final version. [[done]] --[[Joey]] diff --git a/doc/plugins/httpauth.mdwn b/doc/plugins/httpauth.mdwn index 77796a3d7..a7aac558b 100644 --- a/doc/plugins/httpauth.mdwn +++ b/doc/plugins/httpauth.mdwn @@ -14,10 +14,11 @@ signed into the wiki. This method is suitable only for private wikis. ## separate cgiauthurl To use httpauth for a wiki where the content is public, and where -the `ikiwiki.cgi` needs to be usable without authentication (for searching -and so on), you can configure a separate url that is used for -authentication, via the `cgiauthurl` option in the setup file. This -url will then be redirected to whenever authentication is needed. +the `ikiwiki.cgi` needs to be usable without authentication (for searching, +or logging in using other methods, and so on), you can configure a separate +url that is used for authentication, via the `cgiauthurl` option in the setup +file. This url will then be redirected to when a user chooses to log in using +httpauth. A typical setup is to make an `auth` subdirectory, and symlink `ikiwiki.cgi` into it. Then configure the web server to require authentication only for -- cgit v1.2.3 From a63929f6cc7778ffc4ba57d784cdf2206ec650c7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 11 Feb 2010 22:24:15 -0500 Subject: Group related plugins into sections in the setup file, and drop unused rcs plugins from the setup file. --- IkiWiki/Plugin/anonok.pm | 1 + IkiWiki/Plugin/blogspam.pm | 1 + IkiWiki/Plugin/bzr.pm | 1 + IkiWiki/Plugin/conditional.pm | 1 + IkiWiki/Plugin/cvs.pm | 1 + IkiWiki/Plugin/darcs.pm | 1 + IkiWiki/Plugin/editpage.pm | 1 + IkiWiki/Plugin/git.pm | 1 + IkiWiki/Plugin/htmlscrubber.pm | 1 + IkiWiki/Plugin/httpauth.pm | 1 + IkiWiki/Plugin/inline.pm | 1 + IkiWiki/Plugin/link.pm | 1 + IkiWiki/Plugin/lockedit.pm | 1 + IkiWiki/Plugin/mdwn.pm | 1 + IkiWiki/Plugin/mercurial.pm | 1 + IkiWiki/Plugin/meta.pm | 1 + IkiWiki/Plugin/moderatedcomments.pm | 1 + IkiWiki/Plugin/monotone.pm | 1 + IkiWiki/Plugin/opendiscussion.pm | 1 + IkiWiki/Plugin/openid.pm | 1 + IkiWiki/Plugin/parentlinks.pm | 1 + IkiWiki/Plugin/passwordauth.pm | 1 + IkiWiki/Plugin/recentchanges.pm | 1 + IkiWiki/Plugin/signinedit.pm | 1 + IkiWiki/Plugin/svn.pm | 1 + IkiWiki/Plugin/tla.pm | 1 + IkiWiki/Setup.pm | 32 ++++++++++++++++++++++++++------ IkiWiki/Setup/Standard.pm | 8 ++++++++ debian/changelog | 2 ++ doc/plugins/write.mdwn | 13 ++++++++----- 30 files changed, 70 insertions(+), 11 deletions(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/anonok.pm b/IkiWiki/Plugin/anonok.pm index 243b98920..0e74cbfad 100644 --- a/IkiWiki/Plugin/anonok.pm +++ b/IkiWiki/Plugin/anonok.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "auth", }, anonok_pagespec => { type => "pagespec", diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm index 626c8ec42..c4e5cf390 100644 --- a/IkiWiki/Plugin/blogspam.pm +++ b/IkiWiki/Plugin/blogspam.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "auth", }, blogspam_pagespec => { type => 'pagespec', diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index 883007367..1ffdc2353 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -36,6 +36,7 @@ sub getsetup () { plugin => { safe => 0, # rcs plugin rebuild => undef, + section => "rcs", }, bzr_wrapper => { type => "string", diff --git a/IkiWiki/Plugin/conditional.pm b/IkiWiki/Plugin/conditional.pm index aad617812..beeddc672 100644 --- a/IkiWiki/Plugin/conditional.pm +++ b/IkiWiki/Plugin/conditional.pm @@ -16,6 +16,7 @@ sub getsetup { plugin => { safe => 1, rebuild => undef, + section => "core", }, } diff --git a/IkiWiki/Plugin/cvs.pm b/IkiWiki/Plugin/cvs.pm index f6db8bc98..26a3e9dd2 100644 --- a/IkiWiki/Plugin/cvs.pm +++ b/IkiWiki/Plugin/cvs.pm @@ -85,6 +85,7 @@ sub getsetup () { plugin => { safe => 0, # rcs plugin rebuild => undef, + section => "rcs", }, cvsrepo => { type => "string", diff --git a/IkiWiki/Plugin/darcs.pm b/IkiWiki/Plugin/darcs.pm index 0d68f27e5..1c9538e83 100644 --- a/IkiWiki/Plugin/darcs.pm +++ b/IkiWiki/Plugin/darcs.pm @@ -92,6 +92,7 @@ sub getsetup() { plugin => { safe => 0, # rcs plugin rebuild => undef, + section => "rcs", }, darcs_wrapper => { type => "string", diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 9211cca89..44fe5514a 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -17,6 +17,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "core", }, } diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 1eec6aee6..b02f4a5ed 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -68,6 +68,7 @@ sub getsetup () { plugin => { safe => 0, # rcs plugin rebuild => undef, + section => "rcs", }, git_wrapper => { type => "string", diff --git a/IkiWiki/Plugin/htmlscrubber.pm b/IkiWiki/Plugin/htmlscrubber.pm index a249cdf7a..ee284a45c 100644 --- a/IkiWiki/Plugin/htmlscrubber.pm +++ b/IkiWiki/Plugin/htmlscrubber.pm @@ -40,6 +40,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "core", }, htmlscrubber_skip => { type => "pagespec", diff --git a/IkiWiki/Plugin/httpauth.pm b/IkiWiki/Plugin/httpauth.pm index b2bb2701a..478f67446 100644 --- a/IkiWiki/Plugin/httpauth.pm +++ b/IkiWiki/Plugin/httpauth.pm @@ -20,6 +20,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "auth", }, cgiauthurl => { type => "string", diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 401852513..44919e58c 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -49,6 +49,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "core", }, rss => { type => "boolean", diff --git a/IkiWiki/Plugin/link.pm b/IkiWiki/Plugin/link.pm index 4c1add985..3838aec09 100644 --- a/IkiWiki/Plugin/link.pm +++ b/IkiWiki/Plugin/link.pm @@ -20,6 +20,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "core", }, } diff --git a/IkiWiki/Plugin/lockedit.pm b/IkiWiki/Plugin/lockedit.pm index 74ddbb153..1466e8337 100644 --- a/IkiWiki/Plugin/lockedit.pm +++ b/IkiWiki/Plugin/lockedit.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "auth", }, locked_pages => { type => "pagespec", diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm index 3de59ef3d..4ddf097ba 100644 --- a/IkiWiki/Plugin/mdwn.pm +++ b/IkiWiki/Plugin/mdwn.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, # format plugin + section => "core", }, multimarkdown => { type => "boolean", diff --git a/IkiWiki/Plugin/mercurial.pm b/IkiWiki/Plugin/mercurial.pm index 11fdec529..ea00a3364 100644 --- a/IkiWiki/Plugin/mercurial.pm +++ b/IkiWiki/Plugin/mercurial.pm @@ -36,6 +36,7 @@ sub getsetup () { plugin => { safe => 0, # rcs plugin rebuild => undef, + section => "rcs", }, mercurial_wrapper => { type => "string", diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 55c9ddbd1..5f046cb2a 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -20,6 +20,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "core", }, } diff --git a/IkiWiki/Plugin/moderatedcomments.pm b/IkiWiki/Plugin/moderatedcomments.pm index 2555927b7..afe1ceedf 100644 --- a/IkiWiki/Plugin/moderatedcomments.pm +++ b/IkiWiki/Plugin/moderatedcomments.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "auth", }, moderate_users => { type => 'boolean', diff --git a/IkiWiki/Plugin/monotone.pm b/IkiWiki/Plugin/monotone.pm index 9502804f1..c33cf7e3a 100644 --- a/IkiWiki/Plugin/monotone.pm +++ b/IkiWiki/Plugin/monotone.pm @@ -68,6 +68,7 @@ sub getsetup () { plugin => { safe => 0, # rcs plugin rebuild => undef, + section => "rcs", }, mtn_wrapper => { type => "string", diff --git a/IkiWiki/Plugin/opendiscussion.pm b/IkiWiki/Plugin/opendiscussion.pm index 5a455940b..2805f60ef 100644 --- a/IkiWiki/Plugin/opendiscussion.pm +++ b/IkiWiki/Plugin/opendiscussion.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "auth", }, } diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 382d8286f..bb99446b4 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -26,6 +26,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "auth", }, openidsignup => { type => "string", diff --git a/IkiWiki/Plugin/parentlinks.pm b/IkiWiki/Plugin/parentlinks.pm index e678a057d..728bbc399 100644 --- a/IkiWiki/Plugin/parentlinks.pm +++ b/IkiWiki/Plugin/parentlinks.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "core", }, } diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm index c07065b7d..4848b47bb 100644 --- a/IkiWiki/Plugin/passwordauth.pm +++ b/IkiWiki/Plugin/passwordauth.pm @@ -19,6 +19,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "auth", }, account_creation_password => { type => "string", diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 5c7b71aaa..04219b721 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -22,6 +22,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "core", }, recentchangespage => { type => "string", diff --git a/IkiWiki/Plugin/signinedit.pm b/IkiWiki/Plugin/signinedit.pm index 8b44a68f7..31160c02f 100644 --- a/IkiWiki/Plugin/signinedit.pm +++ b/IkiWiki/Plugin/signinedit.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "auth", }, } diff --git a/IkiWiki/Plugin/svn.pm b/IkiWiki/Plugin/svn.pm index 06b987f51..7d27ec842 100644 --- a/IkiWiki/Plugin/svn.pm +++ b/IkiWiki/Plugin/svn.pm @@ -44,6 +44,7 @@ sub getsetup () { plugin => { safe => 0, # rcs plugin rebuild => undef, + section => "rcs", }, svnrepo => { type => "string", diff --git a/IkiWiki/Plugin/tla.pm b/IkiWiki/Plugin/tla.pm index f4b20a6ec..16d73b136 100644 --- a/IkiWiki/Plugin/tla.pm +++ b/IkiWiki/Plugin/tla.pm @@ -34,6 +34,7 @@ sub getsetup () { plugin => { safe => 0, # rcs plugin rebuild => undef, + section => "rcs", }, tla_wrapper => { type => "string", diff --git a/IkiWiki/Setup.pm b/IkiWiki/Setup.pm index 8a25ecc57..b21bd7bfe 100644 --- a/IkiWiki/Setup.pm +++ b/IkiWiki/Setup.pm @@ -77,7 +77,6 @@ sub merge ($) { sub getsetup () { # Gets all available setup data from all plugins. Returns an # ordered list of [plugin, setup] pairs. - my @ret; # disable logging to syslog while dumping, broken plugins may # whine when loaded @@ -85,27 +84,48 @@ sub getsetup () { $config{syslog}=undef; # Load all plugins, so that all setup options are available. - my @plugins=grep { $_ ne $config{rcs} } sort(IkiWiki::listplugins()); - unshift @plugins, $config{rcs} if $config{rcs}; # rcs plugin 1st + my @plugins=IkiWiki::listplugins(); foreach my $plugin (@plugins) { eval { IkiWiki::loadplugin($plugin) }; if (exists $IkiWiki::hooks{checkconfig}{$plugin}{call}) { my @s=eval { $IkiWiki::hooks{checkconfig}{$plugin}{call}->() }; } } - + + my %sections; foreach my $plugin (@plugins) { if (exists $IkiWiki::hooks{getsetup}{$plugin}{call}) { # use an array rather than a hash, to preserve order my @s=eval { $IkiWiki::hooks{getsetup}{$plugin}{call}->() }; next unless @s; - push @ret, [ $plugin, \@s ], + + # set default section value (note use of shared + # hashref between array and hash) + my %s=@s; + if (! exists $s{plugin} || ! $s{plugin}->{section}) { + $s{plugin}->{section}="misc"; + } + + # only the selected rcs plugin is included + if ($config{rcs} && $plugin eq $config{rcs}) { + $s{plugin}->{section}="core"; + } + elsif ($s{plugin}->{section} eq "rcs") { + next; + } + + push @{$sections{$s{plugin}->{section}}}, [ $plugin, \@s ]; } } $config{syslog}=$syslog; - return @ret; + return map { sort { $a->[0] cmp $b->[0] } @{$sections{$_}} } + sort { # core first, then alphabetical + ($b eq "core") <=> ($a eq "core") + || + $a cmp $b + } keys %sections; } sub dump ($) { diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm index 951bcfc56..c99dbb620 100644 --- a/IkiWiki/Setup/Standard.pm +++ b/IkiWiki/Setup/Standard.pm @@ -90,10 +90,18 @@ sub gendump ($) { # disable logging to syslog while dumping $config{syslog}=undef; + my $curr_section; push @ret, dumpvalues(\%setup, IkiWiki::getsetup()); foreach my $pair (IkiWiki::Setup::getsetup()) { my $plugin=$pair->[0]; my $setup=$pair->[1]; + my %s=@{$setup}; + my $section=$s{plugin}->{section}; + if (! defined $curr_section || $curr_section ne $section) { + $curr_section=$section; + push @ret, "", "\t#", "\t# $section plugins", "\t#"; + } + my @values=dumpvalues(\%setup, @{$setup}); if (@values) { push @ret, "", "\t# $plugin plugin", @values; diff --git a/debian/changelog b/debian/changelog index d74abd0f9..f24a453c8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,8 @@ ikiwiki (3.20100123) UNRELEASED; urgency=low * httpauth: Add httpauth_pagespec setting that can be used to limit pages to only being edited via users authed with httpauth. * Allow globs to be used in user() pagespecs. + * Group related plugins into sections in the setup file, and drop + unused rcs plugins from the setup file. -- Joey Hess Tue, 26 Jan 2010 22:25:33 -0500 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 082f0e38f..68454d56c 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -457,6 +457,12 @@ describing the option. There can also be an item named "plugin", which describes the plugin as a whole. For example: return + plugin => { + description => "description of this plugin", + safe => 1, + rebuild => 1, + section => "misc", + }, option_foo => { type => "boolean", description => "enable foo?", @@ -471,11 +477,6 @@ describes the plugin as a whole. For example: safe => 1, rebuild => 0, }, - plugin => { - description => "description of this plugin", - safe => 1, - rebuild => 1, - }, * `type` can be "boolean", "string", "integer", "pagespec", or "internal" (used for values that are not user-visible). The type is @@ -496,6 +497,8 @@ describes the plugin as a whole. For example: the plugin) will require a wiki rebuild, false if no rebuild is needed, and undef if a rebuild could be needed in some circumstances, but is not strictly required. +* `section` can optionally specify which section in the config file + the plugin fits in. ### genwrapper -- cgit v1.2.3 From a01e0679f4134f849473f8a98cb43f5a4aa8d7d8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 13 Mar 2010 19:08:15 -0500 Subject: openid: Use Openid Simple Registration or OpenID Attribute Exchange to get the user's email address and username. The info is stored in the session database, not the user database. There should be no reason to need it when a user is not logged in. Also, hide the email field in the preferences page for openid users. Note that the email and username are not yet actually used for anything. The email will be useful for gravatar, while the username might be used for a more pretty display of the openid. --- IkiWiki/Plugin/openid.pm | 44 ++++++++++++++++++++++++++++++++++++++++++++ debian/changelog | 2 ++ 2 files changed, 46 insertions(+) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index bb99446b4..9355cd85a 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -90,6 +90,7 @@ sub formbuilder_setup (@) { value => $session->param("name"), size => 50, force => 1, fieldset => "login"); + $form->field(name => "email", type => "hidden"); } } @@ -113,6 +114,26 @@ sub validate ($$$;$) { } } + # Ask for client to provide a name and email, if possible. + # Try sreg and ax + $claimed_identity->set_extension_args( + 'http://openid.net/extensions/sreg/1.1', + { + optional => 'email,fullname,nickname', + }, + ); + $claimed_identity->set_extension_args( + 'http://openid.net/srv/ax/1.0', + { + mode => 'fetch_request', + 'required' => 'email,fullname,nickname,firstname', + 'type.email' => "http://schema.openid.net/contact/email", + 'type.fullname' => "http://axschema.org/namePerson", + 'type.nickname' => "http://axschema.org/namePerson/friendly", + 'type.firstname' => "http://axschema.org/namePerson/first", + }, + ); + my $check_url = $claimed_identity->check_url( return_to => IkiWiki::cgiurl(do => "postsignin"), trust_root => $config{cgiurl}, @@ -139,6 +160,29 @@ sub auth ($$) { } elsif (my $vident = $csr->verified_identity) { $session->param(name => $vident->url); + + my @extensions=grep { defined } ( + $vident->signed_extension_fields('http://openid.net/extensions/sreg/1.1'), + $vident->signed_extension_fields('http://openid.net/srv/ax/1.0'), + ); + foreach my $ext (@extensions) { + foreach my $field (qw{value.email email}) { + if (exists $ext->{$field} && + defined $ext->{$field} && + length $ext->{$field}) { + $session->param(email => $ext->{$field}); + last; + } + } + foreach my $field (qw{value.nickname nickname value.fullname fullname value.firstname}) { + if (exists $ext->{$field} && + defined $ext->{$field} && + length $ext->{$field}) { + $session->param(username => $ext->{$field}); + last; + } + } + } } else { error("OpenID failure: ".$csr->err); diff --git a/debian/changelog b/debian/changelog index 9e779bb18..854d83130 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ ikiwiki (3.20100313) UNRELEASED; urgency=low * websetup: Add websetup_unsafe to allow marking other settings as unsafe. + * openid: Use Openid Simple Registration or OpenID Attribute Exchange + to get the user's email address and username. -- Joey Hess Sat, 13 Mar 2010 14:48:10 -0500 -- cgit v1.2.3 From a76206d4809364eaab288df45b126893887e46f4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 24 Mar 2010 15:32:35 -0400 Subject: fix back-compat with old Net::OpenID Debian stable's Net::OpenID does not support getting extension fields. --- IkiWiki/Plugin/openid.pm | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 9355cd85a..7b1a17831 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -116,23 +116,25 @@ sub validate ($$$;$) { # Ask for client to provide a name and email, if possible. # Try sreg and ax - $claimed_identity->set_extension_args( - 'http://openid.net/extensions/sreg/1.1', - { - optional => 'email,fullname,nickname', - }, - ); - $claimed_identity->set_extension_args( - 'http://openid.net/srv/ax/1.0', - { - mode => 'fetch_request', - 'required' => 'email,fullname,nickname,firstname', - 'type.email' => "http://schema.openid.net/contact/email", - 'type.fullname' => "http://axschema.org/namePerson", - 'type.nickname' => "http://axschema.org/namePerson/friendly", - 'type.firstname' => "http://axschema.org/namePerson/first", - }, - ); + if ($claimed_identity->can("set_extension_args")) { + $claimed_identity->set_extension_args( + 'http://openid.net/extensions/sreg/1.1', + { + optional => 'email,fullname,nickname', + }, + ); + $claimed_identity->set_extension_args( + 'http://openid.net/srv/ax/1.0', + { + mode => 'fetch_request', + 'required' => 'email,fullname,nickname,firstname', + 'type.email' => "http://schema.openid.net/contact/email", + 'type.fullname' => "http://axschema.org/namePerson", + 'type.nickname' => "http://axschema.org/namePerson/friendly", + 'type.firstname' => "http://axschema.org/namePerson/first", + }, + ); + } my $check_url = $claimed_identity->check_url( return_to => IkiWiki::cgiurl(do => "postsignin"), @@ -161,10 +163,13 @@ sub auth ($$) { elsif (my $vident = $csr->verified_identity) { $session->param(name => $vident->url); - my @extensions=grep { defined } ( - $vident->signed_extension_fields('http://openid.net/extensions/sreg/1.1'), - $vident->signed_extension_fields('http://openid.net/srv/ax/1.0'), - ); + my @extensions; + if ($vident->can("signed_extension_fields")) { + @extensions=grep { defined } ( + $vident->signed_extension_fields('http://openid.net/extensions/sreg/1.1'), + $vident->signed_extension_fields('http://openid.net/srv/ax/1.0'), + ); + } foreach my $ext (@extensions) { foreach my $field (qw{value.email email}) { if (exists $ext->{$field} && -- cgit v1.2.3 From 378c64776856ee1313c030375a921e8acb4ff1ef Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 7 May 2010 19:10:50 -0400 Subject: patch hidden field setting code Fixes http://code.google.com/p/openid-selector/issues/detail?id=11#c3 --- IkiWiki/Plugin/openid.pm | 82 ++++++++++++++++++---- debian/changelog | 2 + debian/copyright | 7 ++ doc/templates.mdwn | 4 +- templates/openid-selector.tmpl | 30 ++++++++ .../ikiwiki/openid-selector/openid-jquery.js | 8 +-- 6 files changed, 114 insertions(+), 19 deletions(-) create mode 100644 templates/openid-selector.tmpl (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 7b1a17831..0ad8697d8 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -7,6 +7,7 @@ use strict; use IkiWiki 3.00; sub import { + hook(type => "checkconfig", id => "openid", call => \&checkconfig); hook(type => "getopt", id => "openid", call => \&getopt); hook(type => "getsetup", id => "openid", call => \&getsetup); hook(type => "auth", id => "openid", call => \&auth); @@ -14,6 +15,18 @@ sub import { call => \&formbuilder_setup, last => 1); } +sub checkconfig () { + if ($config{cgi}) { + # Intercept normal signin form, so the openid selector + # can be displayed. + require IkiWiki::CGI; + my $real_cgi_signin=\&IkiWiki::cgi_signin; + inject(name => "IkiWiki::cgi_signin", call => sub ($$) { + openid_selector($real_cgi_signin, @_); + }); + } +} + sub getopt () { eval q{use Getopt::Long}; error($@) if $@; @@ -37,6 +50,39 @@ sub getsetup () { }, } +sub openid_selector { + my $real_cgi_signin=shift; + my $q=shift; + my $session=shift; + + my $openid_url=$q->param('openid_url'); + my $openid_error; + + if (defined $q->param("action") && $q->param("action") eq "verify") { + validate($q, $session, $openid_url, sub { + $openid_error=shift; + }); + } + elsif ($q->param("do") eq "signin" || ! load_openid_module()) { + $real_cgi_signin->($q, $session); + exit; + } + + my $template=IkiWiki::template("openid-selector.tmpl"); + $template->param( + cgiurl => $config{cgiurl}, + (defined $openid_error ? (openid_error => $openid_error) : ()), + (defined $openid_url ? (openid_url => $openid_url) : ()), + # TODO only if other auth methods are available + nonopenidurl => IkiWiki::cgiurl(do => "signin"), + loginlabel => loginlabel(), + ); + + IkiWiki::printheader($session); + print IkiWiki::misctemplate("signin", $template->output); + exit; +} + sub formbuilder_setup (@) { my %params=@_; @@ -45,13 +91,7 @@ sub formbuilder_setup (@) { my $cgi=$params{cgi}; if ($form->title eq "signin") { - # Give up if module is unavailable to avoid - # needing to depend on it. - eval q{use Net::OpenID::Consumer}; - if ($@) { - debug("unable to load Net::OpenID::Consumer, not enabling OpenID login ($@)"); - return; - } + return unless load_openid_module(); # This avoids it displaying a redundant label for the # OpenID fieldset. @@ -59,7 +99,7 @@ sub formbuilder_setup (@) { $form->field( name => "openid_url", - label => gettext("Log in with")." ".htmllink("", "", "ikiwiki/OpenID", noimageinline => 1), + label => loginlabel(), fieldset => "OpenID", size => 30, comment => ($config{openidsignup} ? " | ".gettext("Get an OpenID")."" : "") @@ -72,7 +112,10 @@ sub formbuilder_setup (@) { $form->field( name => "openid_url", validate => sub { - validate($cgi, $session, shift, $form); + validate($cgi, $session, shift, sub { + # Display error in the form. + $form->field(name => "openid_url", comment => shift); + }); }, ); # Skip all other required fields in this case. @@ -98,15 +141,14 @@ sub validate ($$$;$) { my $q=shift; my $session=shift; my $openid_url=shift; - my $form=shift; + my $errhandler=shift; my $csr=getobj($q, $session); my $claimed_identity = $csr->claimed_identity($openid_url); if (! $claimed_identity) { - if ($form) { - # Put the error in the form and fail validation. - $form->field(name => "openid_url", comment => $csr->err); + if ($errhandler) { + $errhandler->($csr->err); return 0; } else { @@ -230,4 +272,18 @@ sub getobj ($$) { ); } +sub load_openid_module { + # Give up if module is unavailable to avoid needing to depend on it. + eval q{use Net::OpenID::Consumer}; + if ($@) { + debug("unable to load Net::OpenID::Consumer, not enabling OpenID login ($@)"); + return; + } + return 1; +} + +sub loginlabel { + return gettext("Log in with")." ".htmllink("", "", "ikiwiki/OpenID", noimageinline => 1); +} + 1 diff --git a/debian/changelog b/debian/changelog index 31d64e237..c335030ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,8 @@ ikiwiki (3.20100505) UNRELEASED; urgency=low * inline: Call indexhtml when inlining internal pages, so their text can be indexed for searching. * Delete hooks are passed deleted internal pages. + * openid: Incorporated a fancy openid-selector signin form + (http://code.google.com/p/openid-selector/). -- Joey Hess Wed, 05 May 2010 18:07:29 -0400 diff --git a/debian/copyright b/debian/copyright index d4bb1009f..b6dd3782b 100644 --- a/debian/copyright +++ b/debian/copyright @@ -191,6 +191,13 @@ License: GPL-2+ Files: cvs.pm Copyright: © 2009 Amitai Schlair +License: BSD-C2 + +Files: underlays/javascript/ikiwiki/openid-selector/* +Copyright: © 2008-2010 andyjm, david.j.boden +License: BSD-C2 + From http://code.google.com/p/openid-selector/ + License: BSD-C2 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/doc/templates.mdwn b/doc/templates.mdwn index 8f6561fcf..22b9345ef 100644 --- a/doc/templates.mdwn +++ b/doc/templates.mdwn @@ -71,7 +71,7 @@ html out of ikiwiki and in the templates. * `editpage.tmpl`, `editconflict.tmpl`, `editcreationconflict.tmpl`, `editfailedsave.tmpl`, `editpagegone.tmpl`, `pocreatepage.tmpl`, `editcomment.tmpl` `commentmoderation.tmpl`, `renamesummary.tmpl`, - `passwordmail.tmpl` - Parts of ikiwiki's user interface; do not - normally need to be customised. + `passwordmail.tmpl`, `openid-selector.tmpl` - Parts of ikiwiki's user + interface; do not normally need to be customised. [[!meta robots="noindex, follow"]] diff --git a/templates/openid-selector.tmpl b/templates/openid-selector.tmpl new file mode 100644 index 000000000..76c4051ed --- /dev/null +++ b/templates/openid-selector.tmpl @@ -0,0 +1,30 @@ + + + + + +
+ +
+ +
+ + +
+

:

+
+
+ + local account + +
+ + + + + +
diff --git a/underlays/javascript/ikiwiki/openid-selector/openid-jquery.js b/underlays/javascript/ikiwiki/openid-selector/openid-jquery.js index 3b60827b6..f39fff842 100644 --- a/underlays/javascript/ikiwiki/openid-selector/openid-jquery.js +++ b/underlays/javascript/ikiwiki/openid-selector/openid-jquery.js @@ -170,11 +170,11 @@ var openid = { }, setOpenIdUrl: function (url) { - var hidden = document.getElementById(this.input_id); - if (hidden != null) { - hidden.value = url; + var hidden = $('#'+this.input_id); + if (hidden.length > 0) { + hidden.value = url; } else { - $('#openid_form').append(''); + $('#openid_form').append(''); } }, highlight: function (box_id) { -- cgit v1.2.3 From f8c2a67b3cdbce81bbb661e05411a129b07414ce Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 7 May 2010 20:14:25 -0400 Subject: pretty openid login * openid: Incorporated a fancy openid-selector signin form. (http://code.google.com/p/openid-selector/) * openid: Use "openid_identifier" as the form field, as required by OpenID Authentication v2.0 spec. --- IkiWiki/Plugin/openid.pm | 68 ++---- debian/changelog | 6 +- debian/copyright | 6 +- doc/style.css | 57 +++-- t/openiduser.t | 2 +- t/permalink.t | 2 +- templates/openid-selector.tmpl | 37 ++-- .../javascript/ikiwiki/openid-selector/jquery.js | 32 --- .../ikiwiki/openid-selector/openid-jquery.js | 240 --------------------- underlays/openid-selector/ikiwiki/openid/jquery.js | 32 +++ .../ikiwiki/openid/openid-jquery.js | 240 +++++++++++++++++++++ 11 files changed, 363 insertions(+), 359 deletions(-) delete mode 100644 underlays/javascript/ikiwiki/openid-selector/jquery.js delete mode 100644 underlays/javascript/ikiwiki/openid-selector/openid-jquery.js create mode 100644 underlays/openid-selector/ikiwiki/openid/jquery.js create mode 100644 underlays/openid-selector/ikiwiki/openid/openid-jquery.js (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 0ad8697d8..e722c68ba 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -7,6 +7,7 @@ use strict; use IkiWiki 3.00; sub import { + add_underlay("openid-selector"); hook(type => "checkconfig", id => "openid", call => \&checkconfig); hook(type => "getopt", id => "openid", call => \&getopt); hook(type => "getsetup", id => "openid", call => \&getsetup); @@ -19,10 +20,16 @@ sub checkconfig () { if ($config{cgi}) { # Intercept normal signin form, so the openid selector # can be displayed. - require IkiWiki::CGI; - my $real_cgi_signin=\&IkiWiki::cgi_signin; + # + # When other auth hooks are registered, give the selector + # a reference to the normal signin form. + my $real_cgi_signin; + if (keys %{$IkiWiki::hooks{auth}} > 1) { + require IkiWiki::CGI; + $real_cgi_signin=\&IkiWiki::cgi_signin; + } inject(name => "IkiWiki::cgi_signin", call => sub ($$) { - openid_selector($real_cgi_signin, @_); + openid_selector($real_cgi_signin, @_); }); } } @@ -55,15 +62,21 @@ sub openid_selector { my $q=shift; my $session=shift; - my $openid_url=$q->param('openid_url'); + my $openid_url=$q->param('openid_identifier'); my $openid_error; - if (defined $q->param("action") && $q->param("action") eq "verify") { + if (! load_openid_module()) { + if ($real_cgi_signin) { + $real_cgi_signin->($q, $session); + } + error(sprintf(gettext("failed to load openid module: "), @_)); + } + elsif (defined $q->param("action") && $q->param("action") eq "verify") { validate($q, $session, $openid_url, sub { $openid_error=shift; }); } - elsif ($q->param("do") eq "signin" || ! load_openid_module()) { + elsif ($q->param("do") eq "signin" && $real_cgi_signin) { $real_cgi_signin->($q, $session); exit; } @@ -73,8 +86,7 @@ sub openid_selector { cgiurl => $config{cgiurl}, (defined $openid_error ? (openid_error => $openid_error) : ()), (defined $openid_url ? (openid_url => $openid_url) : ()), - # TODO only if other auth methods are available - nonopenidurl => IkiWiki::cgiurl(do => "signin"), + ($real_cgi_signin ? (nonopenidurl => IkiWiki::cgiurl(do => "signin")) : ()), loginlabel => loginlabel(), ); @@ -90,45 +102,9 @@ sub formbuilder_setup (@) { my $session=$params{session}; my $cgi=$params{cgi}; - if ($form->title eq "signin") { - return unless load_openid_module(); - - # This avoids it displaying a redundant label for the - # OpenID fieldset. - $form->fieldsets("OpenID"); - - $form->field( - name => "openid_url", - label => loginlabel(), - fieldset => "OpenID", - size => 30, - comment => ($config{openidsignup} ? " | ".gettext("Get an OpenID")."" : "") - ); - - # Handle submission of an OpenID as validation. - if ($form->submitted && $form->submitted eq "Login" && - defined $form->field("openid_url") && - length $form->field("openid_url")) { - $form->field( - name => "openid_url", - validate => sub { - validate($cgi, $session, shift, sub { - # Display error in the form. - $form->field(name => "openid_url", comment => shift); - }); - }, - ); - # Skip all other required fields in this case. - foreach my $field ($form->field) { - next if $field eq "openid_url"; - $form->field(name => $field, required => 0, - validate => '/.*/'); - } - } - } - elsif ($form->title eq "preferences" && + if ($form->title eq "preferences" && IkiWiki::openiduser($session->param("name"))) { - $form->field(name => "openid_url", disabled => 1, + $form->field(name => "openid_identifier", disabled => 1, label => htmllink("", "", "ikiwiki/OpenID", noimageinline => 1), value => $session->param("name"), size => 50, force => 1, diff --git a/debian/changelog b/debian/changelog index c335030ed..3f20aec1a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,8 +10,10 @@ ikiwiki (3.20100505) UNRELEASED; urgency=low * inline: Call indexhtml when inlining internal pages, so their text can be indexed for searching. * Delete hooks are passed deleted internal pages. - * openid: Incorporated a fancy openid-selector signin form - (http://code.google.com/p/openid-selector/). + * openid: Incorporated a fancy openid-selector signin form. + (http://code.google.com/p/openid-selector/) + * openid: Use "openid_identifier" as the form field, as required + by OpenID Authentication v2.0 spec. -- Joey Hess Wed, 05 May 2010 18:07:29 -0400 diff --git a/debian/copyright b/debian/copyright index b6dd3782b..7ef266151 100644 --- a/debian/copyright +++ b/debian/copyright @@ -193,11 +193,15 @@ Files: cvs.pm Copyright: © 2009 Amitai Schlair License: BSD-C2 -Files: underlays/javascript/ikiwiki/openid-selector/* +Files: underlays/openid-selector/ikiwiki/openid/* Copyright: © 2008-2010 andyjm, david.j.boden License: BSD-C2 From http://code.google.com/p/openid-selector/ +Files: underlays/openid-selector/ikiwiki/openid/jquery.js +Copyright: © 2005-2008 by John Resig, Branden Aaron & Jörn Zaefferer +License: GPL-2 + License: BSD-C2 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/doc/style.css b/doc/style.css index 5f77037e4..75aa28407 100644 --- a/doc/style.css +++ b/doc/style.css @@ -319,16 +319,6 @@ legend { float: left; margin: 2px 0; } -#signin_openid_url_label { - float: left; - margin-right: 1ex; -} -#signin_openid { - padding: 10px 10px; - border: 1px solid #aaa; - background: #eee; - color: black !important; -} label.block { display: block; } @@ -342,13 +332,6 @@ ol.form { li.form { padding-bottom: 1em; } -input#openid_url { - background: url(wikiicons/openidlogin-bg.gif) no-repeat; - background-color: #fff; - background-position: 0 50%; - color: #000; - padding-left: 18px; -} input#searchbox { background: url(wikiicons/search-bg.gif) no-repeat; background-color: #fff; @@ -440,3 +423,43 @@ li.L8 { list-style: upper-alpha; } color: white !important; background: #ff9900; } + +/* openid selector */ +#openid_choice { + display: none; +} +#openid_input_area { + clear: both; + padding: 10px; +} +#openid_btns, #openid_btns br { + clear: both; +} +#openid_highlight { + padding: 3px; + background-color: #FFFCC9; + float: left; +} +.openid_large_btn { + width: 100px; + height: 60px; + border: 1px solid #DDD; + margin: 3px; + float: left; +} +.openid_small_btn { + width: 24px; + height: 24px; + border: 1px solid #DDD; + margin: 3px; + float: left; +} +a.openid_large_btn:focus { + outline: none; +} +a.openid_large_btn:focus { + -moz-outline-style: none; +} +.openid_selected { + border: 4px solid #DDD; +} diff --git a/t/openiduser.t b/t/openiduser.t index caabbcefc..746090103 100755 --- a/t/openiduser.t +++ b/t/openiduser.t @@ -12,7 +12,7 @@ BEGIN { else { eval q{use Test::More tests => 11}; } - use_ok("IkiWiki::Plugin::openid"); + use_ok("IkiWiki"); } # Some typical examples: diff --git a/t/permalink.t b/t/permalink.t index b49b98338..adb8648b4 100755 --- a/t/permalink.t +++ b/t/permalink.t @@ -5,7 +5,7 @@ use Test::More 'no_plan'; ok(! system("mkdir t/tmp")); ok(! system("make -s ikiwiki.out")); -ok(! system("perl -I. ./ikiwiki.out -plugin inline -url=http://example.com -cgiurl=http://example.com/ikiwiki.cgi -rss -atom -underlaydir=underlays/basewiki -templatedir=templates t/tinyblog t/tmp/out")); +ok(! system("perl -I. ./ikiwiki.out -plugin inline -url=http://example.com -cgiurl=http://example.com/ikiwiki.cgi -rss -atom -underlaydir=underlays/basewiki -set underlaydirbase=underlays -templatedir=templates t/tinyblog t/tmp/out")); # This guid should never, ever change, for any reason whatsoever! my $guid="http://example.com/post/"; ok(length `grep '$guid' t/tmp/out/index.rss`); diff --git a/templates/openid-selector.tmpl b/templates/openid-selector.tmpl index 76c4051ed..393479865 100644 --- a/templates/openid-selector.tmpl +++ b/templates/openid-selector.tmpl @@ -1,30 +1,29 @@ - - + + - -
- -
-
-
-

:

-
+
+ +
+
+
+ + local account +
- - local account +
+ + +
+ +
-
- - - - - + diff --git a/underlays/javascript/ikiwiki/openid-selector/jquery.js b/underlays/javascript/ikiwiki/openid-selector/jquery.js deleted file mode 100644 index 82b98e1d7..000000000 --- a/underlays/javascript/ikiwiki/openid-selector/jquery.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * jQuery 1.2.6 - New Wave Javascript - * - * Copyright (c) 2008 John Resig (jquery.com) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ - * $Rev: 5685 $ - */ -(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else -return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else -return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else -selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else -this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else -return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else -jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else -jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("",""]||!tags.indexOf("",""]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!tags.indexOf("",""]||(!tags.indexOf("",""]||!tags.indexOf("",""]||jQuery.browser.msie&&[1,"div
","
"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf(""&&tags.indexOf("=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else -ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else -while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return im[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else -for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("
").append(res.responseText.replace(//g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else -xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else -jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else -for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else -s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else -e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;ithis.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); \ No newline at end of file diff --git a/underlays/javascript/ikiwiki/openid-selector/openid-jquery.js b/underlays/javascript/ikiwiki/openid-selector/openid-jquery.js deleted file mode 100644 index f39fff842..000000000 --- a/underlays/javascript/ikiwiki/openid-selector/openid-jquery.js +++ /dev/null @@ -1,240 +0,0 @@ -/* -Simple OpenID Plugin -http://code.google.com/p/openid-selector/ - -This code is licenced under the New BSD License. -*/ - -var providers_large = { - google: { - name: 'Google', - url: 'https://www.google.com/accounts/o8/id' - }, - yahoo: { - name: 'Yahoo', - url: 'http://me.yahoo.com/' - }, - aol: { - name: 'AOL', - label: 'Enter your AOL screenname.', - url: 'http://openid.aol.com/{username}' - }, - verisign: { - name: 'Verisign', - label: 'Your Verisign username', - url: 'http://{username}.pip.verisignlabs.com/' - }, - openid: { - name: 'OpenID', - label: 'Enter your OpenID.', - url: null - } -}; -var providers_small = { - myopenid: { - name: 'MyOpenID', - label: 'Enter your MyOpenID username.', - url: 'http://{username}.myopenid.com/' - }, - livejournal: { - name: 'LiveJournal', - label: 'Enter your Livejournal username.', - url: 'http://{username}.livejournal.com/' - }, - flickr: { - name: 'Flickr', - label: 'Enter your Flickr username.', - url: 'http://flickr.com/{username}/' - }, - technorati: { - name: 'Technorati', - label: 'Enter your Technorati username.', - url: 'http://technorati.com/people/technorati/{username}/' - }, - wordpress: { - name: 'Wordpress', - label: 'Enter your Wordpress.com username.', - url: 'http://{username}.wordpress.com/' - }, - blogger: { - name: 'Blogger', - label: 'Your Blogger account', - url: 'http://{username}.blogspot.com/' - }, - vidoop: { - name: 'Vidoop', - label: 'Your Vidoop username', - url: 'http://{username}.myvidoop.com/' - }, - claimid: { - name: 'ClaimID', - label: 'Your ClaimID username', - url: 'http://claimid.com/{username}' - } -}; -var providers = $.extend({}, providers_large, providers_small); - -var openid = { - - demo: false, - ajaxHandler: null, - cookie_expires: 6*30, // 6 months. - cookie_name: 'openid_provider', - cookie_path: '/', - - img_path: 'images/', - - input_id: null, - provider_url: null, - provider_id: null, - - init: function(input_id) { - - var openid_btns = $('#openid_btns'); - - this.input_id = input_id; - - $('#openid_choice').show(); - $('#openid_input_area').empty(); - - // add box for each provider - for (id in providers_large) { - - openid_btns.append(this.getBoxHTML(providers_large[id], 'large', '.gif')); - } - if (providers_small) { - openid_btns.append('
'); - - for (id in providers_small) { - - openid_btns.append(this.getBoxHTML(providers_small[id], 'small', '.ico')); - } - } - - $('#openid_form').submit(this.submit); - - var box_id = this.readCookie(); - if (box_id) { - this.signin(box_id, true); - } - }, - getBoxHTML: function(provider, box_size, image_ext) { - - var box_id = provider["name"].toLowerCase(); - return ''; - - }, - /* Provider image click */ - signin: function(box_id, onload) { - - var provider = providers[box_id]; - if (! provider) { - return; - } - - this.highlight(box_id); - this.setCookie(box_id); - - this.provider_id = box_id; - this.provider_url = provider['url']; - - // prompt user for input? - if (provider['label']) { - this.useInputBox(provider); - } else { - $('#openid_input_area').empty(); - if (! onload) { - $('#openid_form').submit(); - } - } - }, - /* Sign-in button click */ - submit: function() { - - var url = openid.provider_url; - if (url) { - url = url.replace('{username}', $('#openid_username').val()); - openid.setOpenIdUrl(url); - } - if(openid.ajaxHandler) { - openid.ajaxHandler(openid.provider_id, document.getElementById(openid.input_id).value); - return false; - } - if(openid.demo) { - alert("In client demo mode. Normally would have submitted OpenID:\r\n" + document.getElementById(openid.input_id).value); - return false; - } - return true; - }, - setOpenIdUrl: function (url) { - - var hidden = $('#'+this.input_id); - if (hidden.length > 0) { - hidden.value = url; - } else { - $('#openid_form').append(''); - } - }, - highlight: function (box_id) { - - // remove previous highlight. - var highlight = $('#openid_highlight'); - if (highlight) { - highlight.replaceWith($('#openid_highlight a')[0]); - } - // add new highlight. - $('.'+box_id).wrap('
'); - }, - setCookie: function (value) { - - var date = new Date(); - date.setTime(date.getTime()+(this.cookie_expires*24*60*60*1000)); - var expires = "; expires="+date.toGMTString(); - - document.cookie = this.cookie_name+"="+value+expires+"; path=" + this.cookie_path; - }, - readCookie: function () { - var nameEQ = this.cookie_name + "="; - var ca = document.cookie.split(';'); - for(var i=0;i < ca.length;i++) { - var c = ca[i]; - while (c.charAt(0)==' ') c = c.substring(1,c.length); - if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); - } - return null; - }, - useInputBox: function (provider) { - - var input_area = $('#openid_input_area'); - - var html = ''; - var id = 'openid_username'; - var value = ''; - var label = provider['label']; - var style = ''; - - if (label) { - html = '

' + label + '

'; - } - if (provider['name'] == 'OpenID') { - id = this.input_id; - value = 'http://'; - style = 'background:#FFF url('+this.img_path+'openid-inputicon.gif) no-repeat scroll 0 50%; padding-left:18px;'; - } - html += '' + - ''; - - input_area.empty(); - input_area.append(html); - - $('#'+id).focus(); - }, - setDemoMode: function (demoMode) { - this.demo = demoMode; - }, - setAjaxHandler: function (ajaxFunction) { - this.ajaxHandler = ajaxFunction; - } -}; diff --git a/underlays/openid-selector/ikiwiki/openid/jquery.js b/underlays/openid-selector/ikiwiki/openid/jquery.js new file mode 100644 index 000000000..82b98e1d7 --- /dev/null +++ b/underlays/openid-selector/ikiwiki/openid/jquery.js @@ -0,0 +1,32 @@ +/* + * jQuery 1.2.6 - New Wave Javascript + * + * Copyright (c) 2008 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ + * $Rev: 5685 $ + */ +(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else +return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else +return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else +selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else +this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else +return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else +jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else +jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("",""]||!tags.indexOf("",""]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!tags.indexOf("",""]||(!tags.indexOf("",""]||!tags.indexOf("",""]||jQuery.browser.msie&&[1,"div
","
"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf(""&&tags.indexOf("=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else +ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else +while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return im[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else +for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("
").append(res.responseText.replace(//g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else +xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else +jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else +for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else +s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else +e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;ithis.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); \ No newline at end of file diff --git a/underlays/openid-selector/ikiwiki/openid/openid-jquery.js b/underlays/openid-selector/ikiwiki/openid/openid-jquery.js new file mode 100644 index 000000000..f39fff842 --- /dev/null +++ b/underlays/openid-selector/ikiwiki/openid/openid-jquery.js @@ -0,0 +1,240 @@ +/* +Simple OpenID Plugin +http://code.google.com/p/openid-selector/ + +This code is licenced under the New BSD License. +*/ + +var providers_large = { + google: { + name: 'Google', + url: 'https://www.google.com/accounts/o8/id' + }, + yahoo: { + name: 'Yahoo', + url: 'http://me.yahoo.com/' + }, + aol: { + name: 'AOL', + label: 'Enter your AOL screenname.', + url: 'http://openid.aol.com/{username}' + }, + verisign: { + name: 'Verisign', + label: 'Your Verisign username', + url: 'http://{username}.pip.verisignlabs.com/' + }, + openid: { + name: 'OpenID', + label: 'Enter your OpenID.', + url: null + } +}; +var providers_small = { + myopenid: { + name: 'MyOpenID', + label: 'Enter your MyOpenID username.', + url: 'http://{username}.myopenid.com/' + }, + livejournal: { + name: 'LiveJournal', + label: 'Enter your Livejournal username.', + url: 'http://{username}.livejournal.com/' + }, + flickr: { + name: 'Flickr', + label: 'Enter your Flickr username.', + url: 'http://flickr.com/{username}/' + }, + technorati: { + name: 'Technorati', + label: 'Enter your Technorati username.', + url: 'http://technorati.com/people/technorati/{username}/' + }, + wordpress: { + name: 'Wordpress', + label: 'Enter your Wordpress.com username.', + url: 'http://{username}.wordpress.com/' + }, + blogger: { + name: 'Blogger', + label: 'Your Blogger account', + url: 'http://{username}.blogspot.com/' + }, + vidoop: { + name: 'Vidoop', + label: 'Your Vidoop username', + url: 'http://{username}.myvidoop.com/' + }, + claimid: { + name: 'ClaimID', + label: 'Your ClaimID username', + url: 'http://claimid.com/{username}' + } +}; +var providers = $.extend({}, providers_large, providers_small); + +var openid = { + + demo: false, + ajaxHandler: null, + cookie_expires: 6*30, // 6 months. + cookie_name: 'openid_provider', + cookie_path: '/', + + img_path: 'images/', + + input_id: null, + provider_url: null, + provider_id: null, + + init: function(input_id) { + + var openid_btns = $('#openid_btns'); + + this.input_id = input_id; + + $('#openid_choice').show(); + $('#openid_input_area').empty(); + + // add box for each provider + for (id in providers_large) { + + openid_btns.append(this.getBoxHTML(providers_large[id], 'large', '.gif')); + } + if (providers_small) { + openid_btns.append('
'); + + for (id in providers_small) { + + openid_btns.append(this.getBoxHTML(providers_small[id], 'small', '.ico')); + } + } + + $('#openid_form').submit(this.submit); + + var box_id = this.readCookie(); + if (box_id) { + this.signin(box_id, true); + } + }, + getBoxHTML: function(provider, box_size, image_ext) { + + var box_id = provider["name"].toLowerCase(); + return ''; + + }, + /* Provider image click */ + signin: function(box_id, onload) { + + var provider = providers[box_id]; + if (! provider) { + return; + } + + this.highlight(box_id); + this.setCookie(box_id); + + this.provider_id = box_id; + this.provider_url = provider['url']; + + // prompt user for input? + if (provider['label']) { + this.useInputBox(provider); + } else { + $('#openid_input_area').empty(); + if (! onload) { + $('#openid_form').submit(); + } + } + }, + /* Sign-in button click */ + submit: function() { + + var url = openid.provider_url; + if (url) { + url = url.replace('{username}', $('#openid_username').val()); + openid.setOpenIdUrl(url); + } + if(openid.ajaxHandler) { + openid.ajaxHandler(openid.provider_id, document.getElementById(openid.input_id).value); + return false; + } + if(openid.demo) { + alert("In client demo mode. Normally would have submitted OpenID:\r\n" + document.getElementById(openid.input_id).value); + return false; + } + return true; + }, + setOpenIdUrl: function (url) { + + var hidden = $('#'+this.input_id); + if (hidden.length > 0) { + hidden.value = url; + } else { + $('#openid_form').append(''); + } + }, + highlight: function (box_id) { + + // remove previous highlight. + var highlight = $('#openid_highlight'); + if (highlight) { + highlight.replaceWith($('#openid_highlight a')[0]); + } + // add new highlight. + $('.'+box_id).wrap('
'); + }, + setCookie: function (value) { + + var date = new Date(); + date.setTime(date.getTime()+(this.cookie_expires*24*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + + document.cookie = this.cookie_name+"="+value+expires+"; path=" + this.cookie_path; + }, + readCookie: function () { + var nameEQ = this.cookie_name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); + } + return null; + }, + useInputBox: function (provider) { + + var input_area = $('#openid_input_area'); + + var html = ''; + var id = 'openid_username'; + var value = ''; + var label = provider['label']; + var style = ''; + + if (label) { + html = '

' + label + '

'; + } + if (provider['name'] == 'OpenID') { + id = this.input_id; + value = 'http://'; + style = 'background:#FFF url('+this.img_path+'openid-inputicon.gif) no-repeat scroll 0 50%; padding-left:18px;'; + } + html += '' + + ''; + + input_area.empty(); + input_area.append(html); + + $('#'+id).focus(); + }, + setDemoMode: function (demoMode) { + this.demo = demoMode; + }, + setAjaxHandler: function (ajaxFunction) { + this.ajaxHandler = ajaxFunction; + } +}; -- cgit v1.2.3 From c1e365abdc8b89acc4d52b2bb3773b16ae722b8b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 7 May 2010 21:20:21 -0400 Subject: remove loginlabel, not used --- IkiWiki/Plugin/openid.pm | 5 ----- 1 file changed, 5 deletions(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index e722c68ba..0454a43fa 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -87,7 +87,6 @@ sub openid_selector { (defined $openid_error ? (openid_error => $openid_error) : ()), (defined $openid_url ? (openid_url => $openid_url) : ()), ($real_cgi_signin ? (nonopenidurl => IkiWiki::cgiurl(do => "signin")) : ()), - loginlabel => loginlabel(), ); IkiWiki::printheader($session); @@ -258,8 +257,4 @@ sub load_openid_module { return 1; } -sub loginlabel { - return gettext("Log in with")." ".htmllink("", "", "ikiwiki/OpenID", noimageinline => 1); -} - 1 -- cgit v1.2.3 From dc0d48459cfc0dc53301b87c2fc98216f4dcca06 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 7 May 2010 21:27:02 -0400 Subject: bugfix --- IkiWiki/Plugin/openid.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 0454a43fa..427d61457 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -68,6 +68,7 @@ sub openid_selector { if (! load_openid_module()) { if ($real_cgi_signin) { $real_cgi_signin->($q, $session); + exit; } error(sprintf(gettext("failed to load openid module: "), @_)); } -- cgit v1.2.3 From 1e75389a856c8ab8e233b81fd3310169cbe8d57e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 7 May 2010 21:28:59 -0400 Subject: bugfix Always load IkiWiki::CGI so its cgi_signin is present, so we replace it. --- IkiWiki/Plugin/openid.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 427d61457..7e4d0844a 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -23,9 +23,9 @@ sub checkconfig () { # # When other auth hooks are registered, give the selector # a reference to the normal signin form. + require IkiWiki::CGI; my $real_cgi_signin; if (keys %{$IkiWiki::hooks{auth}} > 1) { - require IkiWiki::CGI; $real_cgi_signin=\&IkiWiki::cgi_signin; } inject(name => "IkiWiki::cgi_signin", call => sub ($$) { -- cgit v1.2.3 From 8f6cfbfade6018732495addce11f6d5e93e0b723 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 7 May 2010 21:33:27 -0400 Subject: Removed the openidsignup option. --- IkiWiki/Plugin/openid.pm | 15 --------------- debian/changelog | 1 + doc/plugins/openid.mdwn | 12 ------------ 3 files changed, 1 insertion(+), 27 deletions(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 7e4d0844a..36002371a 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -9,7 +9,6 @@ use IkiWiki 3.00; sub import { add_underlay("openid-selector"); hook(type => "checkconfig", id => "openid", call => \&checkconfig); - hook(type => "getopt", id => "openid", call => \&getopt); hook(type => "getsetup", id => "openid", call => \&getsetup); hook(type => "auth", id => "openid", call => \&auth); hook(type => "formbuilder_setup", id => "openid", @@ -34,13 +33,6 @@ sub checkconfig () { } } -sub getopt () { - eval q{use Getopt::Long}; - error($@) if $@; - Getopt::Long::Configure('pass_through'); - GetOptions("openidsignup=s" => \$config{openidsignup}); -} - sub getsetup () { return plugin => { @@ -48,13 +40,6 @@ sub getsetup () { rebuild => 0, section => "auth", }, - openidsignup => { - type => "string", - example => "http://myopenid.com/", - description => "an url where users can signup for an OpenID", - safe => 1, - rebuild => 0, - }, } sub openid_selector { diff --git a/debian/changelog b/debian/changelog index 3f20aec1a..595b8a2b1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,7 @@ ikiwiki (3.20100505) UNRELEASED; urgency=low (http://code.google.com/p/openid-selector/) * openid: Use "openid_identifier" as the form field, as required by OpenID Authentication v2.0 spec. + * Removed the openidsignup option. -- Joey Hess Wed, 05 May 2010 18:07:29 -0400 diff --git a/doc/plugins/openid.mdwn b/doc/plugins/openid.mdwn index cd05bb1ad..7da2f8575 100644 --- a/doc/plugins/openid.mdwn +++ b/doc/plugins/openid.mdwn @@ -11,17 +11,5 @@ The [[!cpan LWPx::ParanoidAgent]] perl module is used if available, for added security. Finally, the [[!cpan Crypt::SSLeay]] perl module is needed to support users entering "https" OpenID urls. -This plugin has a configuration option. You can set `--openidsignup` -to the url of a third-party site where users can sign up for an OpenID. If -it's set, the signin page will link to that site. - -This plugin supports the -[myopenid.com affiliate program](http://myopenid.com/affiliate), -which can be used to help users sign up for an OpenID and log into your -site in a single, unified process. When you create the affiliate, specify a -login url like `http://example.com/ikiwiki.cgi?do=continue`. Once the -affiliate is created, set `openidsignup` to point to the affiliate's signup -url. - This plugin is enabled by default, but can be turned off if you want to only use some other form of authentication, such as [[passwordauth]]. -- cgit v1.2.3 From b8dcaf91d02c1d8754032c60f8d713261dafffe4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 7 May 2010 21:48:50 -0400 Subject: scale display form to match openid size --- IkiWiki/Plugin/openid.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 36002371a..d75099ce9 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -92,7 +92,7 @@ sub formbuilder_setup (@) { $form->field(name => "openid_identifier", disabled => 1, label => htmllink("", "", "ikiwiki/OpenID", noimageinline => 1), value => $session->param("name"), - size => 50, force => 1, + size => length($session->param("name")), force => 1, fieldset => "login"); $form->field(name => "email", type => "hidden"); } -- cgit v1.2.3 From c3e9215e1fcb604c3ee01119fdf7cf13724c3812 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 8 May 2010 15:57:39 -0400 Subject: moved non-openid signin form into same page as openid selector; show/hide as buttons are pressed --- IkiWiki/CGI.pm | 23 ++++++++++++---- IkiWiki/Plugin/openid.pm | 6 +---- templates/openid-selector.tmpl | 31 ++++++++++++---------- .../ikiwiki/openid/openid-jquery.js | 27 ++++++++++++++----- 4 files changed, 57 insertions(+), 30 deletions(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 49a505514..b98e9e0a1 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -22,7 +22,7 @@ sub printheader ($) { } } -sub showform ($$$$;@) { +sub prepform { my $form=shift; my $buttons=shift; my $session=shift; @@ -35,6 +35,16 @@ sub showform ($$$$;@) { }); } + return $form; +} + +sub showform ($$$$;@) { + my $form=prepform(@_); + shift; + my $buttons=shift; + my $session=shift; + my $cgi=shift; + printheader($session); print misctemplate($form->title, $form->render(submit => $buttons), @_); } @@ -90,9 +100,10 @@ sub needsignin ($$) { } } -sub cgi_signin ($$) { +sub cgi_signin ($$;$) { my $q=shift; my $session=shift; + my $returnhtml=shift; decode_cgi_utf8($q); eval q{use CGI::FormBuilder}; @@ -112,9 +123,6 @@ sub cgi_signin ($$) { ); my $buttons=["Login"]; - if ($q->param("do") ne "signin" && !$form->submitted) { - $form->text(gettext("You need to log in first.")); - } $form->field(name => "do", type => "hidden", value => "signin", force => 1); @@ -129,6 +137,11 @@ sub cgi_signin ($$) { $form->validate; } + if ($returnhtml) { + $form=prepform($form, $buttons, $session, $q); + return $form->render(submit => $buttons); + } + showform($form, $buttons, $session, $q); } diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index d75099ce9..e10e21f4d 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -62,17 +62,13 @@ sub openid_selector { $openid_error=shift; }); } - elsif ($q->param("do") eq "signin" && $real_cgi_signin) { - $real_cgi_signin->($q, $session); - exit; - } my $template=IkiWiki::template("openid-selector.tmpl"); $template->param( cgiurl => $config{cgiurl}, (defined $openid_error ? (openid_error => $openid_error) : ()), (defined $openid_url ? (openid_url => $openid_url) : ()), - ($real_cgi_signin ? (nonopenidurl => IkiWiki::cgiurl(do => "signin")) : ()), + ($real_cgi_signin ? (nonopenidform => $real_cgi_signin->($q, $session, 1)) : ()), ); IkiWiki::printheader($session); diff --git a/templates/openid-selector.tmpl b/templates/openid-selector.tmpl index 7e5ae9a01..b4d0e314f 100644 --- a/templates/openid-selector.tmpl +++ b/templates/openid-selector.tmpl @@ -2,21 +2,18 @@ - + + +
Select your account provider - -
- +
@@ -29,9 +26,15 @@ $(document).ready(function() {
- + +
+ +
+ +
+ +
diff --git a/underlays/openid-selector/ikiwiki/openid/openid-jquery.js b/underlays/openid-selector/ikiwiki/openid/openid-jquery.js index 59a59c084..bf14fd3d5 100644 --- a/underlays/openid-selector/ikiwiki/openid/openid-jquery.js +++ b/underlays/openid-selector/ikiwiki/openid/openid-jquery.js @@ -82,8 +82,9 @@ var openid = { input_id: null, provider_url: null, provider_id: null, + localsignin_id: null, - init: function(input_id, localloginurl) { + init: function(input_id, localsignin_id) { var openid_btns = $('#openid_btns'); @@ -105,13 +106,14 @@ var openid = { openid_btns.append(this.getBoxHTML(providers_small[id], 'small')); } } - if (localloginurl != "") { + if (localsignin_id != "") { + this.localsignin_id=localsignin_id; openid_btns.append( - '' + + 'class="localsignin openid_small_btn">' + '' + - ' Local Account' + + ' other' + '' ); } @@ -143,7 +145,20 @@ var openid = { }, /* Provider image click */ signin: function(box_id, onload) { - + + if (box_id == 'localsignin') { + this.highlight(box_id); + $('#openid_input_area').empty(); + $('#'+this.localsignin_id).show(); + this.setCookie(box_id); + return; + } + else { + if (this.localsignin_id) { + $('#'+this.localsignin_id).hide(); + } + } + var provider = providers[box_id]; if (! provider) { return; -- cgit v1.2.3 From 475b4199e1624350b928a002fe83033ee3389b31 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Jun 2010 13:53:56 -0400 Subject: openid: Add openid_realm and openid_cgiurl configuration options, useful in a few edge case setups. --- IkiWiki/Plugin/openid.pm | 27 ++++++++++++++++++++++++--- debian/changelog | 7 +++++++ doc/plugins/openid.mdwn | 16 ++++++++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index e10e21f4d..57cb139ca 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -40,6 +40,18 @@ sub getsetup () { rebuild => 0, section => "auth", }, + openid_realm => { + type => "string", + description => "url of openid realm (default is cgiurl)", + safe => 0, + rebuild => 0, + }, + openid_cgiurl => { + type => "string", + description => "url to ikiwiki cgi to use for openid authentication (default is cgiurl)", + safe => 0, + rebuild => 0, + }, } sub openid_selector { @@ -135,9 +147,15 @@ sub validate ($$$;$) { ); } + my $cgiurl=$config{openid_cgiurl}; + $cgiurl=$config{cgiurl} if ! defined $cgiurl; + + my $trust_root=$config{openid_realm}; + $trust_root=$cgiurl if ! defined $trust_root; + my $check_url = $claimed_identity->check_url( - return_to => IkiWiki::cgiurl(do => "postsignin"), - trust_root => $config{cgiurl}, + return_to => "$cgiurl?do=postsignin", + trust_root => $trust_root, delayed_return => 1, ); # Redirect the user to the OpenID server, which will @@ -220,12 +238,15 @@ sub getobj ($$) { $secret=rand; $session->param(openid_secret => $secret); } + + my $cgiurl=$config{openid_cgiurl}; + $cgiurl=$config{cgiurl} if ! defined $cgiurl; return Net::OpenID::Consumer->new( ua => $ua, args => $q, consumer_secret => sub { return shift()+$secret }, - required_root => $config{cgiurl}, + required_root => $cgiurl, ); } diff --git a/debian/changelog b/debian/changelog index 01307db55..9a6b1361c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ikiwiki (3.20100611) UNRELEASED; urgency=low + + * openid: Add openid_realm and openid_cgiurl configuration options, + useful in a few edge case setups. + + -- Joey Hess Fri, 11 Jun 2010 13:39:15 -0400 + ikiwiki (3.20100610) unstable; urgency=low * creation_day() etc use local time, not gmtime. To match calendars, which diff --git a/doc/plugins/openid.mdwn b/doc/plugins/openid.mdwn index 7da2f8575..3fb4c26b8 100644 --- a/doc/plugins/openid.mdwn +++ b/doc/plugins/openid.mdwn @@ -13,3 +13,19 @@ to support users entering "https" OpenID urls. This plugin is enabled by default, but can be turned off if you want to only use some other form of authentication, such as [[passwordauth]]. + +## options + +These options do not normally need to be set, but can be useful in +certian setups. + +* `openid_realm` can be used to control the scope of the openid request. + It defaults to the `cgiurl` (or `openid_cgiurl` if set); only allowing + ikiwiki's [[CGI]] to authenticate. If you have multiple ikiwiki instances, + or other things using openid on the same site, you may choose to put them + all in the same realm to improve the user's openid experience. + +* `openid_cgiurl` can be used to cause a different than usual `cgiurl` + to be used when doing openid authentication. The `openid_cgiurl` must + point to an ikiwiki [[CGI]], and it will need to match the `openid_realm` + to work. -- cgit v1.2.3 From d5181a197732f1c6bb80fdf8c508568b8c4225c7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Jun 2010 14:14:20 -0400 Subject: realm is an url pattern --- IkiWiki/Plugin/openid.pm | 2 +- doc/plugins/openid.mdwn | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 57cb139ca..f4ba8db18 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -42,7 +42,7 @@ sub getsetup () { }, openid_realm => { type => "string", - description => "url of openid realm (default is cgiurl)", + description => "url pattern of openid realm (default is cgiurl)", safe => 0, rebuild => 0, }, diff --git a/doc/plugins/openid.mdwn b/doc/plugins/openid.mdwn index 3fb4c26b8..f3b3abfbb 100644 --- a/doc/plugins/openid.mdwn +++ b/doc/plugins/openid.mdwn @@ -23,7 +23,8 @@ certian setups. It defaults to the `cgiurl` (or `openid_cgiurl` if set); only allowing ikiwiki's [[CGI]] to authenticate. If you have multiple ikiwiki instances, or other things using openid on the same site, you may choose to put them - all in the same realm to improve the user's openid experience. + all in the same realm to improve the user's openid experience. It is an + url pattern, so can be set to eg "http://*.example.com/" * `openid_cgiurl` can be used to cause a different than usual `cgiurl` to be used when doing openid authentication. The `openid_cgiurl` must -- cgit v1.2.3 From b38b9327a8f11b642e5f51f7ee537043e25ccff9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 23 Jun 2010 19:36:23 -0400 Subject: take username from email address as fallback --- IkiWiki/Plugin/openid.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index f4ba8db18..f19a559a9 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -187,12 +187,17 @@ sub auth ($$) { $vident->signed_extension_fields('http://openid.net/srv/ax/1.0'), ); } + my $username; foreach my $ext (@extensions) { foreach my $field (qw{value.email email}) { if (exists $ext->{$field} && defined $ext->{$field} && length $ext->{$field}) { $session->param(email => $ext->{$field}); + if (! defined $username && + $ext->{$field}=~/(.+)@.+/) { + $username = $1; + } last; } } @@ -200,11 +205,15 @@ sub auth ($$) { if (exists $ext->{$field} && defined $ext->{$field} && length $ext->{$field}) { - $session->param(username => $ext->{$field}); + $username=$ext->{$field}; last; } } } + if (defined $username) { + $username=~s/\s+/_/g; + $session->param(username => $username); + } } else { error("OpenID failure: ".$csr->err); -- cgit v1.2.3 From 9a32451986c710d1f1ce71217c1f7ab3b84f72bf Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 23 Jun 2010 20:12:26 -0400 Subject: finializing openid nickname support Renamed usershort => nickname. Note that this means existing user login sessions will not have the nickname recorded, and so it won't be used for those. --- IkiWiki/Plugin/comments.pm | 8 ++++++-- IkiWiki/Plugin/git.pm | 16 ++++++++++------ IkiWiki/Plugin/openid.pm | 14 +++++++------- IkiWiki/Plugin/recentchanges.pm | 2 +- debian/changelog | 10 +++++++--- doc/ikiwiki/directive/comment.mdwn | 2 ++ doc/plugins/write.mdwn | 2 +- 7 files changed, 34 insertions(+), 20 deletions(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 41c6948e8..d34951570 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -177,7 +177,7 @@ sub preprocess { if (defined $oiduser) { # looks like an OpenID $commentauthorurl = $commentuser; - $commentauthor = $oiduser; + $commentauthor = (defined $params{nickname} && length $params{nickname}) ? $params{nickname} : $oiduser; $commentopenid = $commentuser; } else { @@ -396,12 +396,16 @@ sub editcomment ($$) { my $content = "[[!comment format=$type\n"; - # FIXME: handling of double quotes probably wrong? if (defined $session->param('name')) { my $username = $session->param('name'); $username =~ s/"/"/g; $content .= " username=\"$username\"\n"; } + if (defined $session->param('nickname')) { + my $nickname = $session->param('nickname'); + $nickname =~ s/"/"/g; + $content .= " nickname=\"$nickname\"\n"; + } elsif (defined $session->remote_addr()) { my $ip = $session->remote_addr(); if ($ip =~ m/^([.0-9]+)$/) { diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 3e289e0c3..8d210cb5d 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -606,12 +606,16 @@ sub rcs_recentchanges ($) { push @messages, { line => $line }; } - my $user=$ci->{'author_name'}; - my $usershort=$ci->{'author_username'}; + my $user=$ci->{'author_username'}; my $web_commit = ($ci->{'author'} =~ /\@web>/); - - if ($usershort =~ /:\/\//) { - $usershort=undef; # url; not really short + my $nickname; + + # Set nickname only if a non-url author_username is available, + # and author_name is an url. + if ($user !~ /:\/\// && defined $ci->{'author_name'} && + $ci->{'author_name'} =~ /:\/\//) { + $nickname=$user; + $user=$ci->{'author_name'}; } # compatability code for old web commit messages @@ -626,7 +630,7 @@ sub rcs_recentchanges ($) { push @rets, { rev => $sha1, user => $user, - usershort => $usershort, + nickname => $nickname, committype => $web_commit ? "web" : "git", when => $when, message => [@messages], diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index f19a559a9..d393afd23 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -187,16 +187,16 @@ sub auth ($$) { $vident->signed_extension_fields('http://openid.net/srv/ax/1.0'), ); } - my $username; + my $nickname; foreach my $ext (@extensions) { foreach my $field (qw{value.email email}) { if (exists $ext->{$field} && defined $ext->{$field} && length $ext->{$field}) { $session->param(email => $ext->{$field}); - if (! defined $username && + if (! defined $nickname && $ext->{$field}=~/(.+)@.+/) { - $username = $1; + $nickname = $1; } last; } @@ -205,14 +205,14 @@ sub auth ($$) { if (exists $ext->{$field} && defined $ext->{$field} && length $ext->{$field}) { - $username=$ext->{$field}; + $nickname=$ext->{$field}; last; } } } - if (defined $username) { - $username=~s/\s+/_/g; - $session->param(username => $username); + if (defined $nickname) { + $nickname=~s/\s+/_/g; + $session->param(nickname => $nickname); } } else { diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 9f188cbff..758b98348 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -118,7 +118,7 @@ sub store ($$$) { my $oiduser=eval { IkiWiki::openiduser($change->{user}) }; if (defined $oiduser) { $change->{authorurl}=$change->{user}; - $change->{user}=defined $change->{usershort} ? $change->{usershort} : $oiduser; + $change->{user}=defined $change->{nickname} ? $change->{nickname} : $oiduser; } elsif (length $config{cgiurl}) { $change->{authorurl} = IkiWiki::cgiurl( diff --git a/debian/changelog b/debian/changelog index dfa862e5b..e41de638f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,16 @@ ikiwiki (3.20100624) UNRELEASED; urgency=low - * API: Add new optional field usershort to rcs_recentchanges. + * Changes to avoid display of ugly google openids, by displaying + a username taken from openid. + * API: Add new optional field nickname to rcs_recentchanges. * API: rcs_commit and rcs_commit_staged are now passed named parameters. + * openid: Store nickname based on username or email provided from + openid provider. + * git: Record the nickname from openid in the git author email. + * comment: Record the username from openid in the comment page. * Fixed some confusion and bugginess about whether rcs_getctime/rcs_getmtime were passed absolute or relative filenames. - * git: Record the username from openid in the git author email. - (This avoids display of ugly google openids.) -- Joey Hess Wed, 23 Jun 2010 15:30:04 -0400 diff --git a/doc/ikiwiki/directive/comment.mdwn b/doc/ikiwiki/directive/comment.mdwn index 693a92770..398130e2e 100644 --- a/doc/ikiwiki/directive/comment.mdwn +++ b/doc/ikiwiki/directive/comment.mdwn @@ -29,6 +29,8 @@ metadata of the comment. nearly any format, since it's parsed by [[!cpan TimeDate]] * `username` - Used to record the username (or OpenID) of a logged in commenter. +* `nickname` - Name to display for a logged in commenter. + (Optional; used for OpenIDs.) * `ip` - Can be used to record the IP address of a commenter, if they posted anonymously. * `claimedauthor` - Records the name that the user entered, diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index a2b954bd4..a921b9a02 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -1108,7 +1108,7 @@ The data structure returned for each change is: { rev => # the RCSs id for this commit user => # user who made the change (may be an openid), - usershort => # short name of user (optional; not an openid), + nickname => # short name for user (optional; not an openid), committype => # either "web" or the name of the rcs, when => # time when the change was made, -- cgit v1.2.3 From acde95751260e305da3d8d84b6b09dcd3b2d03b6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Jul 2010 16:12:50 -0400 Subject: further sanitize nickname characters --- IkiWiki/Plugin/openid.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index d393afd23..4727577f3 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -212,6 +212,7 @@ sub auth ($$) { } if (defined $nickname) { $nickname=~s/\s+/_/g; + $nickname=~s/[^-_0-9[:alnum:]]+//g; $session->param(nickname => $nickname); } } -- cgit v1.2.3 From 7fdf1f1d007b5ef9a16f5c6d41200cadb25c1975 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Jul 2010 16:44:38 -0400 Subject: move nickname sanitization out Probably best to store it unsanitized and sanitize as needed on use. And it already was for comments, leaving only the need to sanitize the nickname when git committing, to ensure the email address is legal. --- IkiWiki/Plugin/git.pm | 2 ++ IkiWiki/Plugin/openid.pm | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 0f92476c9..cb3437e18 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -517,6 +517,8 @@ sub rcs_commit_staged (@) { } if (defined $params{session}->param("nickname")) { $u=encode_utf8($params{session}->param("nickname")); + $u=~s/\s+/_/g; + $u=~s/[^-_0-9[:alnum:]]+//g; } if (defined $u) { $ENV{GIT_AUTHOR_EMAIL}="$u\@web"; diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 4727577f3..b1a9a7a15 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -211,8 +211,6 @@ sub auth ($$) { } } if (defined $nickname) { - $nickname=~s/\s+/_/g; - $nickname=~s/[^-_0-9[:alnum:]]+//g; $session->param(nickname => $nickname); } } -- cgit v1.2.3 From dbb63cb7fd60e7ad8fa09ef997724e1e7126b386 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 11 Jul 2010 13:38:37 -0400 Subject: openid: Fix handling of utf-8 nicknames. --- IkiWiki/Plugin/openid.pm | 3 ++- debian/changelog | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin/openid.pm') diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index b1a9a7a15..fae9fb77f 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -211,7 +211,8 @@ sub auth ($$) { } } if (defined $nickname) { - $session->param(nickname => $nickname); + $session->param(nickname => + Encode::decode_utf8($nickname)); } } else { diff --git a/debian/changelog b/debian/changelog index c340f8901..3a581cccb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ ikiwiki (3.20100705) UNRELEASED; urgency=low .ikiwiki/aggregatetime, to allow for more sophisticated cron jobs. * Add --changesetup mode that allows easily changing options in a setup file. + * openid: Fix handling of utf-8 nicknames. -- Joey Hess Mon, 05 Jul 2010 13:59:42 -0400 -- cgit v1.2.3