[Jifty-commit] r5191 - in jifty/trunk: lib/Jifty lib/Jifty/Web share/web/static/js share/web/templates/__jifty/webservices
Jifty commits
jifty-commit at lists.jifty.org
Mon Mar 3 12:51:04 EST 2008
Author: alexmv
Date: Mon Mar 3 12:51:03 2008
New Revision: 5191
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Request.pm
jifty/trunk/lib/Jifty/Web/Form.pm
jifty/trunk/lib/Jifty/Web/PageRegion.pm
jifty/trunk/share/web/static/js/jifty.js
jifty/trunk/share/web/templates/__jifty/webservices/xml
Log:
r28229 at zoq-fot-pik: chmrr | 2008-03-03 12:50:46 -0500
* Regions need to know if they started with the form open
Modified: jifty/trunk/lib/Jifty/Request.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Request.pm (original)
+++ jifty/trunk/lib/Jifty/Request.pm Mon Mar 3 12:51:03 2008
@@ -218,6 +218,7 @@
path => $f->{path},
arguments => $f->{args},
wrapper => $f->{wrapper} || 0,
+ in_form => $f->{in_form},
);
while ( ref $f->{parent} eq "HASH" and $f = $f->{parent} ) {
$current = $current->parent(
@@ -854,12 +855,13 @@
path => undef,
arguments => undef,
wrapper => undef,
+ in_form => undef,
@_
);
my $fragment = $self->{'fragments'}->{ $args{'name'} } || Jifty::Request::Fragment->new;
- for my $k (qw/name path wrapper/) {
+ for my $k (qw/name path wrapper in_form/) {
$fragment->$k($args{$k}) if defined $args{$k};
}
@@ -992,7 +994,7 @@
package Jifty::Request::Fragment;
use base 'Class::Accessor::Fast';
-__PACKAGE__->mk_accessors( qw/name path wrapper arguments parent/ );
+__PACKAGE__->mk_accessors( qw/name path wrapper in_form arguments parent/ );
=head2 Jifty::Request::Fragment
@@ -1004,6 +1006,8 @@
=head3 wrapper [BOOLEAN]
+=head3 in_form [BOOLEAN]
+
=head3 argument NAME [VALUE]
=head3 arguments
Modified: jifty/trunk/lib/Jifty/Web/Form.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form.pm Mon Mar 3 12:51:03 2008
@@ -194,7 +194,7 @@
if ( $self->can($_) ) {
$self->$_($args{$_});
} else {
- my (undef, $template, $line) = caller;
+ my (undef, $template, $line) = caller;
$self->log->warn("Unknown parameter to Jifty->web->form->start: $_ in $template line $line");
}
}
Modified: jifty/trunk/lib/Jifty/Web/PageRegion.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/PageRegion.pm (original)
+++ jifty/trunk/lib/Jifty/Web/PageRegion.pm Mon Mar 3 12:51:03 2008
@@ -286,6 +286,7 @@
. Jifty::JSON::objToJson( \%arguments, { singlequote => 1 } ) . qq|,|
. qq|'| . $self->path . qq|',|
. ( $self->parent ? qq|'| . $self->parent->qualified_name . qq|'| : q|null|)
+ . qq|,| . (Jifty->web->form->is_open ? '1' : 'null')
. qq|);\n|
. qq|</script>|;
if ($self->lazy) {
Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js (original)
+++ jifty/trunk/share/web/static/js/jifty.js Mon Mar 3 12:51:03 2008
@@ -741,11 +741,12 @@
var fragments = $H();
var Region = Class.create();
Region.prototype = {
- initialize: function(name, args, path, parent) {
+ initialize: function(name, args, path, parent, in_form) {
this.name = name;
this.args = $H(args);
this.path = path;
this.parent = parent ? fragments.get(parent) : null;
+ this.in_form = in_form;
if (fragments.get(name)) {
// If this fragment already existed, we want to wipe out
// whatever evil lies we might have said earlier; do this
@@ -885,7 +886,7 @@
}
// Make the region (for now)
- new Region(name, f['args'], f['path'], f['parent']);
+ new Region(name, f['args'], f['path'], f['parent'], f['parent'] ? f['parent'].in_form : null);
} else if ((f['path'] != null) && f['toggle'] && (f['path'] == fragments.get(name).path)) {
// If they set the 'toggle' flag, and clicking wouldn't change the path
Element.update(element, '');
@@ -1150,6 +1151,9 @@
// Ask for the wrapper if we are making a new region
fragment_request['wrapper'] = 1;
+ if (fragments.get(name).in_form)
+ fragment_request['in_form'] = 1;
+
// Push it onto the request stack
request.get('fragments').set(name, fragment_request);
++has_request;
Modified: jifty/trunk/share/web/templates/__jifty/webservices/xml
==============================================================================
--- jifty/trunk/share/web/templates/__jifty/webservices/xml (original)
+++ jifty/trunk/share/web/templates/__jifty/webservices/xml Mon Mar 3 12:51:03 2008
@@ -15,6 +15,8 @@
FRAGMENT:
for my $f ( Jifty->web->request->fragments ) {
# Set up the region stack
+ Jifty->web->form->is_open(1) if $f->in_form;
+
local Jifty->web->{'region_stack'} = [];
my @regions;
do {
@@ -59,6 +61,8 @@
$writer->endTag();
Jifty->web->current_region->exit while Jifty->web->current_region;
+
+ Jifty->web->form->is_open(0);
}
}
More information about the Jifty-commit
mailing list