--- lib/A3C/View/Strix.pm 2008/06/16 22:17:06 185 +++ lib/A3C/View/Strix.pm 2008/06/16 22:56:14 186 @@ -115,7 +115,7 @@ }; sub strix { - my $instance = get('instance') || shift || 'new'; + my $instance = get('instance'); return Strix->new({ instance => $instance }); } @@ -125,7 +125,7 @@ template 'sitemap' => page { - title is _('Sitemap'); + title is _('Sitemap %1', get('instance')); render_region( name => 'selected-instances', @@ -146,7 +146,8 @@ outs_raw(' '); hyperlink( url => '/strix/layout?url=' . $p->{url}, - label => '[layout]', + label => _('layout'), + class => 'layout', ); } } @@ -193,6 +194,11 @@ $category->{naziv}, ); + render_region( + name => 'selected-instances', + path => '/strix/selected-instances' + ); + hyperlink( url => 'http://' . $category->{sitename} . '/' . $category->{url}, label => $category->{naziv}, @@ -293,11 +299,11 @@ template 'selected-instances' => sub { my $self = shift; - warn "## IN selected-instances ",dump( @_ ); +# warn "## IN selected-instances ",dump( @_ ); if ( my $op = get 'op' ) { - my $instance = get 'instance' or die "no instance?"; - warn "# selected-instances $op on $instance"; + my $op_instance = get 'op_instance' or die "no op_instance?"; + warn "# selected-instances $op on $op_instance"; my $a; @@ -307,7 +313,7 @@ class => $op . 'StrixInstanceSelection', moniker => $op, arguments => { - instance => $instance, + instance => $op_instance, by_user => $self->current_user->id, }, ); @@ -315,14 +321,22 @@ } elsif ( $op eq 'Delete' ) { my $strix = A3C::Model::StrixInstanceSelection->new; - $strix->load_by_cols( instance => $instance, by_user => $self->current_user->id ); - die "can't find instance $instance" unless $strix->id; + $strix->load_by_cols( instance => $op_instance, by_user => $self->current_user->id ); + warn "can't find instance $op_instance" unless $strix->id; $a = $strix->as_delete_action; } - warn "# argument_values = ",dump( $a->argument_values ); +# warn "# argument_values = ",dump( $a->argument_values ); $a->run; - warn "can't $op instance $instance" unless $a->result->success; + + if ( $a->result->error ) { + div { + { class is 'note error' } + $a->result->error; + } + } + + set( op => '' ); } my $selected = A3C::Model::StrixInstanceSelectionCollection->new; @@ -330,15 +344,21 @@ if ( $selected->count > 0 ) { + my $instance = get('instance'); + div { _('%1 instances selected', $selected->count ) }; table { while (my $s = $selected->next) { row { - cell { tt { - hyperlink( - url => '?instance=' . $s->instance->instance, - label => $s->instance->instance - ) + cell { tt { + if ( $s->instance->instance eq $instance ) { + b { $instance } + } else { + hyperlink( + url => '?instance=' . $s->instance->instance, + label => $s->instance->instance + ) + } } } cell { $s->instance->_site_name } cell { show( 'instance-op', 'Delete', '-', $s->instance->instance ) } @@ -361,7 +381,7 @@ template 'instance-op' => sub { my $self = shift; - warn "# instance-op = ",dump( @_ ); +# warn "# instance-op = ",dump( @_ ); my ( $op, $label, $instance ) = @_; @@ -372,7 +392,7 @@ refresh => 'selected-instances', path => '/strix/selected-instances', args => { - instance => $instance, + op_instance => $instance, op => $op, } },