[Jifty-commit] r1485 - in jifty/branches/plugin_rewrite: .
lib/Jifty share/web/static/js
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Jul 5 21:40:52 EDT 2006
Author: jpeacock
Date: Wed Jul 5 21:40:43 2006
New Revision: 1485
Added:
jifty/branches/plugin_rewrite/share/web/static/images/silk/error.png (contents, props changed)
Modified:
jifty/branches/plugin_rewrite/ (props changed)
jifty/branches/plugin_rewrite/META.yml
jifty/branches/plugin_rewrite/Makefile.PL
jifty/branches/plugin_rewrite/lib/Jifty/LetMe.pm
jifty/branches/plugin_rewrite/lib/Jifty/Web.pm
jifty/branches/plugin_rewrite/share/web/static/js/context_menu.js
jifty/branches/plugin_rewrite/share/web/static/js/jifty.js
jifty/branches/plugin_rewrite/share/web/static/js/jifty_utils.js
Log:
r1186 at dsl092-168-024 (orig r1475): trs | 2006-07-04 15:09:12 -0400
r13917 at zot: tom | 2006-07-04 15:08:37 -0400
Update for the latest CSS::Squish
r1187 at dsl092-168-024 (orig r1477): jesse | 2006-07-04 16:41:45 -0400
r13449 at pinglin: jesse | 2006-07-04 16:41:13 -0400
* Sean noticed a missing Silk icon.
r1188 at dsl092-168-024 (orig r1478): alexmv | 2006-07-04 17:23:19 -0400
r14841 at zoq-fot-pik: chmrr | 2006-07-04 17:23:11 -0400
* Remove non-useful try { ... } finally{} block
* Add try { ... } cach (e) { ... } around effect creation
r1189 at dsl092-168-024 (orig r1479): trs | 2006-07-04 18:29:21 -0400
r13936 at zot: tom | 2006-07-04 18:28:11 -0400
We need to make sure $app is absolute
r1190 at dsl092-168-024 (orig r1480): trs | 2006-07-05 14:48:04 -0400
r13940 at zot: tom | 2006-07-05 14:47:56 -0400
We need to check to make sure we have an element so we don't blow up if we don't
r1191 at dsl092-168-024 (orig r1481): alexmv | 2006-07-05 16:31:36 -0400
r14930 at zoq-fot-pik: chmrr | 2006-07-05 16:30:45 -0400
* Shift away from using Koremutake strings for the letme checksums.
This is because Koremutake tries to do integer math on integer created
from the 16-character hex string -- which 32-bit machines can't do
with full precision, so it rounds. The difficulty is that it
*doesn't* round on 64-bit machines, leading to different "checksums".
Just using the hex has no such failure mode.
r1192 at dsl092-168-024 (orig r1483): trs | 2006-07-05 20:53:44 -0400
r13989 at zot: tom | 2006-07-05 20:53:27 -0400
The conditional compilation syntax was a little off (but it still worked, I believe)
Modified: jifty/branches/plugin_rewrite/META.yml
==============================================================================
--- jifty/branches/plugin_rewrite/META.yml (original)
+++ jifty/branches/plugin_rewrite/META.yml Wed Jul 5 21:40:43 2006
@@ -14,7 +14,7 @@
- inc
requires:
App::CLI: 0.03
- CSS::Squish: 0.04
+ CSS::Squish: 0.05
Cache::Cache: 0
Calendar::Simple: 0
Class::Accessor: 0
Modified: jifty/branches/plugin_rewrite/Makefile.PL
==============================================================================
--- jifty/branches/plugin_rewrite/Makefile.PL (original)
+++ jifty/branches/plugin_rewrite/Makefile.PL Wed Jul 5 21:40:43 2006
@@ -11,7 +11,7 @@
requires('Class::Container');
requires('Class::Data::Inheritable');
requires('Compress::Zlib');
-requires('CSS::Squish' => 0.04 );
+requires('CSS::Squish' => 0.05 );
requires('DBD::SQLite' => 1.11 );
requires('Data::Page');
requires('DateTime');
Modified: jifty/branches/plugin_rewrite/lib/Jifty/LetMe.pm
==============================================================================
--- jifty/branches/plugin_rewrite/lib/Jifty/LetMe.pm (original)
+++ jifty/branches/plugin_rewrite/lib/Jifty/LetMe.pm Wed Jul 5 21:40:43 2006
@@ -84,44 +84,69 @@
return $currentuser_object_class->new( email => $email );
}
+sub _generate_digest {
+ my $self = shift;
+
+ # get user's generic secret
+ my $user;
+ return undef unless ( $user = $self->_user_from_email($self->email) );
+
+ # build an md5sum of the email token and until and our secret
+ my $digest = Digest::MD5->new();
+ $digest->add( $user->auth_token );
+ $digest->add( $self->path );
+ my %args = %{$self->args};
+ $digest->add( $_, $args{$_}) for sort keys %args;
+ $digest->add( $self->until ) if ($self->until);
+ return $digest->hexdigest();
+}
+
+
=head2 generate_checksum
Returns an auth checksum for the current combination of
user
- token
+ path
+ arguments
until
=cut
-
sub generate_checksum {
my $self = shift;
- # get user's generic secret
- my $user;
- return undef unless ( $user = $self->_user_from_email($self->email) );
+ return substr( $self->_generate_digest, 0, 16 );
+}
- # build an md5sum of the email token and until and our secret
- my $digest = Digest::MD5->new();
- $digest->add( $user->auth_token );
- $digest->add( $self->path );
- my %args = %{$self->args};
- $digest->add( $_, $args{$_}) for sort keys %args;
- $digest->add( $self->until ) if ($self->until);
- # only take the first 16 characters. we're rally just trying to
+=head2 generate_koremutake_checksum
+
+Generate a slightly more pronouncable version of the checksum using
+L<String::Koremutake>. Due to hex -> integer limitations, this is
+imporecise and may vary depending on the platform it is used on; as
+such, it is deprecated.
+
+=cut
+
+sub generate_koremutake_checksum {
+ my $self = shift;
+
+ # Only take the first 16 characters. We're really just trying to
# get something reasonably short, memorable and unguessable. Also,
# don't use Math::BigInt->new directly for simple computation,
# because it insists exporting overload to us, which makes
- # devel::cover and devel::dprof very sad.
+ # devel::cover and devel::dprof very sad. This is deprecated in
+ # favor of generate_checksum, which returns a straight hex digest.
my $integer_digest = Math::BigInt::Calc->_str(
Math::BigInt::Calc->_from_hex(
- substr( $digest->hexdigest(), 0, 16 )
+ substr( $self->_generate_digest, 0, 16 )
)
);
- # koremutake it
+ # koremutake it. This loses precision, since most perls can't
+ # deal with 64 bits with precision. Thus, $integer_digest ends up
+ # being rounded, possibly in unpredicatable ways.
my $k = String::Koremutake->new;
return( $k->integer_to_koremutake($integer_digest));
@@ -267,7 +292,10 @@
sub _correct_checksum_provided {
my $self = shift;
- return undef unless ($self->checksum_provided eq $self->generate_checksum);
+ return undef
+ unless ( $self->checksum_provided eq $self->generate_checksum )
+ or
+ ( $self->checksum_provided eq $self->generate_koremutake_checksum );
}
Modified: jifty/branches/plugin_rewrite/lib/Jifty/Web.pm
==============================================================================
--- jifty/branches/plugin_rewrite/lib/Jifty/Web.pm (original)
+++ jifty/branches/plugin_rewrite/lib/Jifty/Web.pm Wed Jul 5 21:40:43 2006
@@ -911,7 +911,7 @@
);
}
- CSS::Squish->roots( $jifty );
+ CSS::Squish->roots( Jifty::Util->absolute_path( $app ), $jifty );
my $css = CSS::Squish->concatenate( $file );
Added: jifty/branches/plugin_rewrite/share/web/static/images/silk/error.png
==============================================================================
Binary file. No diff available.
Modified: jifty/branches/plugin_rewrite/share/web/static/js/context_menu.js
==============================================================================
--- jifty/branches/plugin_rewrite/share/web/static/js/context_menu.js (original)
+++ jifty/branches/plugin_rewrite/share/web/static/js/context_menu.js Wed Jul 5 21:40:43 2006
@@ -30,16 +30,19 @@
hide: function(id) {
var ul = document.getElementById(id);
- var li = Jifty.ContextMenu.getParentListItem(ul);
- Element.removeClassName(li, "open");
- Element.addClassName(li, "closed");
-
- ul.style.display = "none";
+ if ( ul ) {
+ var li = Jifty.ContextMenu.getParentListItem(ul);
+ Element.removeClassName(li, "open");
+ Element.addClassName(li, "closed");
+
+ ul.style.display = "none";
+ }
Jifty.ContextMenu.currently_open = "";
},
show: function(id) {
var ul = document.getElementById(id);
+ if ( !ul ) return;
if ( Jifty.ContextMenu.currently_open
&& Jifty.ContextMenu.currently_open != ul.id )
Modified: jifty/branches/plugin_rewrite/share/web/static/js/jifty.js
==============================================================================
--- jifty/branches/plugin_rewrite/share/web/static/js/jifty.js (original)
+++ jifty/branches/plugin_rewrite/share/web/static/js/jifty.js Wed Jul 5 21:40:43 2006
@@ -601,92 +601,95 @@
// And when we get the result back..
var onSuccess = function(transport, object) {
- // In case there's no XML in the response, or what have you
- try {
- // Grab the XML response
- var response = transport.responseXML.documentElement;
+ // Grab the XML response
+ var response = transport.responseXML.documentElement;
- // For each fragment we requested
- for (var i = 0; i < named_args['fragments'].length; i++) {
- var f = named_args['fragments'][i];
- var element = f['element'];
-
- // Change insertion mode if need be
- var insertion = null;
- if (f['mode'] && (f['mode'] != 'Replace')) {
- insertion = eval('Insertion.'+f['mode']);
- }
+ // For each fragment we requested
+ for (var i = 0; i < named_args['fragments'].length; i++) {
+ var f = named_args['fragments'][i];
+ var element = f['element'];
+
+ // Change insertion mode if need be
+ var insertion = null;
+ if (f['mode'] && (f['mode'] != 'Replace')) {
+ insertion = eval('Insertion.'+f['mode']);
+ }
+
+ // Loop through the result looking for it
+ for (var response_fragment = response.firstChild;
+ response_fragment != null;
+ response_fragment = response_fragment.nextSibling) {
+ if (response_fragment.nodeName == 'fragment') {
+ if (response_fragment.getAttribute("id") == f['region']) {
+ // We found the right fragment
+ var dom_fragment = fragments[f['region']];
+ var new_dom_args = $H();
+
+ for (var fragment_bit = response_fragment.firstChild;
+ fragment_bit != null;
+ fragment_bit = fragment_bit.nextSibling) {
+ if (fragment_bit.nodeName == 'argument') {
+ // First, update the fragment's arguments
+ // with what the server actually used --
+ // this is needed in case there was
+ // argument mapping going on
+ var textContent = '';
+ if (fragment_bit.textContent) {
+ textContent = fragment_bit.textContent;
+ } else if (fragment_bit.firstChild) {
+ textContent = fragment_bit.firstChild.nodeValue;
+ }
+ new_dom_args[fragment_bit.getAttribute("name")] = textContent;
+ } else if (fragment_bit.nodeName == 'content') {
+ var textContent = '';
+ if (fragment_bit.textContent) {
+ textContent = fragment_bit.textContent;
+ } else if (fragment_bit.firstChild) {
+ textContent = fragment_bit.firstChild.nodeValue;
+ }
- // Loop through the result looking for it
- for (var response_fragment = response.firstChild;
- response_fragment != null;
- response_fragment = response_fragment.nextSibling) {
- if (response_fragment.nodeName == 'fragment') {
- if (response_fragment.getAttribute("id") == f['region']) {
- // We found the right fragment
- var dom_fragment = fragments[f['region']];
- var new_dom_args = $H();
-
- for (var fragment_bit = response_fragment.firstChild;
- fragment_bit != null;
- fragment_bit = fragment_bit.nextSibling) {
- if (fragment_bit.nodeName == 'argument') {
- // First, update the fragment's arguments
- // with what the server actually used --
- // this is needed in case there was
- // argument mapping going on
- var textContent = '';
- if (fragment_bit.textContent) {
- textContent = fragment_bit.textContent;
- } else if (fragment_bit.firstChild) {
- textContent = fragment_bit.firstChild.nodeValue;
- }
- new_dom_args[fragment_bit.getAttribute("name")] = textContent;
- } else if (fragment_bit.nodeName == 'content') {
- var textContent = '';
- if (fragment_bit.textContent) {
- textContent = fragment_bit.textContent;
- } else if (fragment_bit.firstChild) {
- textContent = fragment_bit.firstChild.nodeValue;
- }
-
- // Once we find it, do the insertion
- if (insertion) {
- new insertion(element, textContent.stripScripts());
- } else {
- Element.update(element, textContent.stripScripts());
- }
- // We need to give the browser some "settle" time before we eval scripts in the body
- setTimeout((function() { this.evalScripts() }).bind(textContent), 10);
- Behaviour.apply(f['element']);
+ // Once we find it, do the insertion
+ if (insertion) {
+ new insertion(element, textContent.stripScripts());
+ } else {
+ Element.update(element, textContent.stripScripts());
}
+ // We need to give the browser some "settle" time before we eval scripts in the body
+ setTimeout((function() { this.evalScripts() }).bind(textContent), 10);
+ Behaviour.apply(f['element']);
}
- dom_fragment.setArgs(new_dom_args);
}
+ dom_fragment.setArgs(new_dom_args);
}
}
+ }
- // Also, set us up the effect
- if (f['effect']) {
+ // Also, set us up the effect
+ if (f['effect']) {
+ try {
var effect = eval('Effect.'+f['effect']);
var effect_args = f['effect_args'] || {};
- if (f['is_new'])
- Element.hide($('region-'+f['region']));
- (effect)($('region-'+f['region']), effect_args);
+ if (effect) {
+ if (f['is_new'])
+ Element.hide($('region-'+f['region']));
+ (effect)($('region-'+f['region']), effect_args);
+ }
+ } catch ( e ) {
+ // Don't be sad if the effect doesn't exist
}
}
- for (var result = response.firstChild;
- result != null;
- result = result.nextSibling) {
- if (result.nodeName == 'result') {
- for (var key = result.firstChild;
- key != null;
- key = key.nextSibling) {
- show_action_result(result.getAttribute("moniker"),key);
- }
+ }
+ for (var result = response.firstChild;
+ result != null;
+ result = result.nextSibling) {
+ if (result.nodeName == 'result') {
+ for (var key = result.firstChild;
+ key != null;
+ key = key.nextSibling) {
+ show_action_result(result.getAttribute("moniker"),key);
}
}
- } finally { }
+ }
};
var onFailure = function(transport, object) {
alert('No response from server!');
Modified: jifty/branches/plugin_rewrite/share/web/static/js/jifty_utils.js
==============================================================================
--- jifty/branches/plugin_rewrite/share/web/static/js/jifty_utils.js (original)
+++ jifty/branches/plugin_rewrite/share/web/static/js/jifty_utils.js Wed Jul 5 21:40:43 2006
@@ -65,9 +65,9 @@
};
/* This sets Jifty.Utils.isMSIE to true in IE
- @cc_on@
- if ( @_win32 )
+ @cc_on
+ @if ( @_win32 )
Jifty.Utils.isMSIE = true;
- @end@
+ @end
*/
More information about the Jifty-commit
mailing list