%doc> In a separate window, allow user to modify one of the fields in Ipblock recursively (or not) Uses the 'update_recursive()' method from IPManager. Some restrictions apply regarding which fields can be updated in a recursive way. %doc> % % <%flags> inherit => undef %flags> % % % <%args> $id $field $recursive => 0 $submit => undef $cancel => undef %args> % % <%init> my $bodyargs; my %state; my %reserved = (submit => "", cancel => ""); my $msg; my (@field_headers, @cell_data) = (); my $mtable = $ui->meta->get_table('Ipblock'); my %linksto = $mtable->get_links_to(); my $mcol = $mtable->get_column($field); my $fieldtag = $mcol->tag(); my $o; unless ( $o = Ipblock->retrieve($id) ){ $m->comp('/generic/error.mhtml', error=>"Could not retrieve Ipblock id $id"); } if ( $submit ){ foreach my $arg ( keys %ARGS ){ next if ( exists $reserved{$arg} ); if ($arg =~ /^(\w+)__(\w+)__(\w+)$/){ $state{$3} = $ARGS{$arg}; } } $state{recursive} = $recursive; eval { $o->update(\%state); }; if ( my $e = $@ ){ $m->comp('/generic/error.mhtml', error=>$e); }else{ $msg = "OK."; if ( $recursive ){ $msg .= " All blocks updated successfully"; } $bodyargs = 'onUnload="opener.location.reload()"'; } }else{ push( @field_headers, "$fieldtag:" ); push( @cell_data, $ui->form_field(object=>$o, column=>$field, edit=>1, returnValOnly=>1) ); push( @field_headers, "Options:" ); push( @cell_data, 'Apply to children blocks ' ); } %init>