", Dumper(%ARGS), "" if $DEBUG; my $session; my @columns = $table->meta_data->get_columns; my %objs; %init> <%perl> if ( $submit eq 'Edit' ) { if ( $selectall && $selectall_ids ){ @{$objs{$table}} = map { $table->retrieve($_) } split ',', $selectall_ids; }else{ foreach my $arg ( keys %ARGS ){ next unless $arg =~ /__/; my ($table, $id) = split /__/, $arg; push @{$objs{$table}}, $id; } unless ( defined $objs{$table} && scalar(@{$objs{$table}}) ){ $m->comp('/generic/error.mhtml', error=>"No records selected!"); } # Sort foreach my $table ( keys %objs ){ my $lblf = ($table->meta_data->get_labels)[0]; my @objs = map { $table->retrieve($_) } @{$objs{$table}}; my $alpha = 0; foreach my $obj ( @objs ){ if ( $obj->$lblf =~ /D+/ ){ $alpha = 1; } } if ( $alpha ){ @{$objs{$table}} = sort { $a->$lblf cmp $b->$lblf } @objs; }else{ @{$objs{$table}} = sort { $a->$lblf <=> $b->$lblf } @objs; } } } print "
", Dumper(%objs), "" if $DEBUG; # Build a session object to store the list of # records passed to us eval { $session = $ui->mk_session(); }; if ( my $e = $@ ){ $m->comp('error.mhtml', error=>$e); } $session->{objs} = \%objs; my @cells; foreach my $c ( sort { $a->tag cmp $b->tag } @columns ) { next if ( $c->name eq 'id' ); my $html = ''.$c->tag; push(@cells, $html); } %perl> % ##################################################################### % # Show table with possible fields to edit % ##################################################################### <%perl> }elsif ( $submit eq 'Go' && $sid ) { eval { $session = $ui->get_session($sid); }; if ( my $e = $@ ){ $m->comp('error.mhtml', error=>$e); } %objs = %{ $session->{objs} }; print "
", Dumper(%objs), "" if $DEBUG; unless ( defined $objs{$table} && scalar(@{$objs{$table}}) ){ $m->comp('/generic/error.mhtml', error=>"Could not retrieve object list from session data"); } my $numobjs = scalar @{$objs{$table}}; my (@headers, @rows); my $showeditbuttons; if ( @tablefields ) { push(@headers, "Name"); foreach my $field ( @tablefields ) { my $mcol = $table->meta_data->get_column($field); push(@headers, $mcol->tag); } if ( $selectall ) { my $hid = ""; my @row1 = (); push( @row1, 'Apply to all '.$numobjs.' records'.$hid ); foreach my $field ( @tablefields ) { my %tmp = $ui->form_field(table=>$table, column=>$field, edit=>1); push( @row1, $tmp{'value'} ); } push( @rows, \@row1 ); my @row2 = (); push( @row2, '