/[A3C]/lib/A3C/View/Strix.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/A3C/View/Strix.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 185 by dpavlin, Mon Jun 16 21:33:59 2008 UTC revision 186 by dpavlin, Mon Jun 16 22:56:14 2008 UTC
# Line 115  template 'sql' => page { Line 115  template 'sql' => page {
115  };  };
116    
117  sub strix {  sub strix {
118          my $instance = get('instance') || shift || 'new';          my $instance = get('instance');
119          return Strix->new({ instance => $instance });          return Strix->new({ instance => $instance });
120  }  }
121    
# Line 125  sub strix { Line 125  sub strix {
125    
126  template 'sitemap' => page {  template 'sitemap' => page {
127    
128          title is _('Sitemap');          title is _('Sitemap %1', get('instance'));
129    
130          render_region(          render_region(
131                  name => 'selected-instances',                  name => 'selected-instances',
# Line 146  template 'sitemap' => page { Line 146  template 'sitemap' => page {
146                          outs_raw(' ');                          outs_raw(' ');
147                          hyperlink(                          hyperlink(
148                                  url => '/strix/layout?url=' . $p->{url},                                  url => '/strix/layout?url=' . $p->{url},
149                                  label => '[layout]',                                  label => _('layout'),
150                                    class => 'layout',
151                          );                          );
152                  }                  }
153          }          }
# Line 193  template 'layout' => page { Line 194  template 'layout' => page {
194                  $category->{naziv},                  $category->{naziv},
195          );          );
196    
197            render_region(
198                    name => 'selected-instances',
199                    path => '/strix/selected-instances'
200            );
201    
202          hyperlink(          hyperlink(
203                  url => 'http://' . $category->{sitename} . '/' . $category->{url},                  url => 'http://' . $category->{sitename} . '/' . $category->{url},
204                  label => $category->{naziv},                  label => $category->{naziv},
# Line 293  Show Selected instances for current user Line 299  Show Selected instances for current user
299  template 'selected-instances' => sub {  template 'selected-instances' => sub {
300          my $self = shift;          my $self = shift;
301    
302          warn "## IN selected-instances ",dump( @_ );  #       warn "## IN selected-instances ",dump( @_ );
303    
304          if ( my $op = get 'op' ) {          if ( my $op = get 'op' ) {
305                  my $instance = get 'instance' or die "no instance?";                  my $op_instance = get 'op_instance' or die "no op_instance?";
306                  warn "# selected-instances $op on $instance";                  warn "# selected-instances $op on $op_instance";
307    
308                  my $a;                  my $a;
309    
# Line 307  template 'selected-instances' => sub { Line 313  template 'selected-instances' => sub {
313                                  class => $op . 'StrixInstanceSelection',                                  class => $op . 'StrixInstanceSelection',
314                                  moniker => $op,                                  moniker => $op,
315                                  arguments => {                                  arguments => {
316                                          instance => $instance,                                          instance => $op_instance,
317                                          by_user => $self->current_user->id,                                          by_user => $self->current_user->id,
318                                  },                                  },
319                          );                          );
# Line 315  template 'selected-instances' => sub { Line 321  template 'selected-instances' => sub {
321                  } elsif ( $op eq 'Delete' ) {                  } elsif ( $op eq 'Delete' ) {
322    
323                          my $strix = A3C::Model::StrixInstanceSelection->new;                          my $strix = A3C::Model::StrixInstanceSelection->new;
324                          $strix->load_by_cols( instance => $instance, by_user => $self->current_user->id );                          $strix->load_by_cols( instance => $op_instance, by_user => $self->current_user->id );
325                          die "can't find instance $instance" unless $strix->id;                          warn "can't find instance $op_instance" unless $strix->id;
326                          $a = $strix->as_delete_action;                          $a = $strix->as_delete_action;
327    
328                  }                  }
329                  warn "# argument_values = ",dump( $a->argument_values );  #               warn "# argument_values = ",dump( $a->argument_values );
330                  $a->run;                  $a->run;
331                  warn "can't $op instance $instance" unless $a->result->success;  
332                    if ( $a->result->error ) {
333                            div {
334                                    { class is 'note error' }
335                                    $a->result->error;
336                            }
337                    }
338    
339                    set( op => '' );
340          }          }
341    
342          my $selected = A3C::Model::StrixInstanceSelectionCollection->new;          my $selected = A3C::Model::StrixInstanceSelectionCollection->new;
# Line 330  template 'selected-instances' => sub { Line 344  template 'selected-instances' => sub {
344    
345          if ( $selected->count > 0 ) {          if ( $selected->count > 0 ) {
346    
347                    my $instance = get('instance');
348    
349                  div { _('%1 instances selected', $selected->count ) };                  div { _('%1 instances selected', $selected->count ) };
350                  table {                  table {
351                          while (my $s = $selected->next) {                          while (my $s = $selected->next) {
352                                  row {                                  row {
353                                          cell { tt {                                          cell { tt {
354                                                  hyperlink(                                                  if ( $s->instance->instance eq $instance ) {
355                                                          url => '?instance=' . $s->instance->instance,                                                          b { $instance }
356                                                          label => $s->instance->instance                                                  } else {
357                                                  )                                                          hyperlink(
358                                                                    url => '?instance=' . $s->instance->instance,
359                                                                    label => $s->instance->instance
360                                                            )
361                                                    }
362                                          } }                                          } }
363                                          cell { $s->instance->_site_name }                                          cell { $s->instance->_site_name }
364                                          cell { show( 'instance-op', 'Delete', '-', $s->instance->instance ) }                                          cell { show( 'instance-op', 'Delete', '-', $s->instance->instance ) }
# Line 361  Display button to add/remove instance fr Line 381  Display button to add/remove instance fr
381  template 'instance-op' => sub {  template 'instance-op' => sub {
382          my $self = shift;          my $self = shift;
383    
384          warn "# instance-op = ",dump( @_ );  #       warn "# instance-op = ",dump( @_ );
385    
386          my ( $op, $label, $instance ) = @_;          my ( $op, $label, $instance ) = @_;
387    
# Line 372  template 'instance-op' => sub { Line 392  template 'instance-op' => sub {
392                                  refresh => 'selected-instances',                                  refresh => 'selected-instances',
393                                  path => '/strix/selected-instances',                                  path => '/strix/selected-instances',
394                                  args => {                                  args => {
395                                          instance => $instance,                                          op_instance => $instance,
396                                          op => $op,                                          op => $op,
397                                  }                                  }
398                          },                          },

Legend:
Removed from v.185  
changed lines
  Added in v.186

  ViewVC Help
Powered by ViewVC 1.1.26