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 |
|
|
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', |
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 |
} |
} |
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}, |
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 |
|
|
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 |
); |
); |
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; |
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 ) } |
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 |
|
|
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 |
}, |
}, |