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 |
|
|
123 |
|
|
124 |
=cut |
=cut |
125 |
|
|
126 |
|
sub strix_link { |
127 |
|
my ( $url, $label ) = @_; |
128 |
|
hyperlink( |
129 |
|
url => 'http://' . get('instance') . '.cms-qa.skole.hr' . $url, |
130 |
|
label => $label || $url, |
131 |
|
target => 'strix', |
132 |
|
); |
133 |
|
} |
134 |
|
|
135 |
template 'sitemap' => page { |
template 'sitemap' => page { |
136 |
|
|
137 |
title is _('Sitemap'); |
title is _('Sitemap %1', get('instance')); |
138 |
|
|
139 |
render_region( |
render_region( |
140 |
name => 'selected-instances', |
name => 'selected-instances', |
147 |
|
|
148 |
sub full_url { |
sub full_url { |
149 |
my $p = shift; |
my $p = shift; |
150 |
hyperlink( |
strix_link( $p->{url}, $p->{naziv} ); |
|
url => 'http://new.cms-qa.skole.hr' . $p->{url}, |
|
|
label => $p->{naziv}, |
|
|
); |
|
151 |
if ( $p->{type} eq 'category' ) { |
if ( $p->{type} eq 'category' ) { |
152 |
outs_raw(' '); |
outs_raw(' '); |
153 |
hyperlink( |
hyperlink( |
154 |
url => '/strix/layout?url=' . $p->{url}, |
url => '/strix/layout?url=' . $p->{url} . ';instance=' . get('instance'), |
155 |
label => '[layout]', |
label => _('layout'), |
156 |
|
class => 'layout', |
157 |
); |
); |
158 |
} |
} |
159 |
} |
} |
200 |
$category->{naziv}, |
$category->{naziv}, |
201 |
); |
); |
202 |
|
|
203 |
hyperlink( |
render_region( |
204 |
url => 'http://' . $category->{sitename} . '/' . $category->{url}, |
name => 'selected-instances', |
205 |
label => $category->{naziv}, |
path => '/strix/selected-instances' |
206 |
); |
); |
207 |
|
|
208 |
|
strix_link( $category->{url}, $category->{naziv} ); |
209 |
|
|
210 |
my $layout = strix->layout( $url ); |
my $layout = strix->layout( $url ); |
211 |
|
|
212 |
pre { |
pre { |
283 |
table { |
table { |
284 |
while (my $strix = $search->next) { |
while (my $strix = $search->next) { |
285 |
row { |
row { |
286 |
|
cell { show( 'instance-op', 'Create', '+', $strix->instance ) } |
287 |
cell { tt { $strix->instance } } |
cell { tt { $strix->instance } } |
288 |
cell { $strix->_site_name } |
cell { $strix->_site_name } |
|
cell { show( 'instance-op', 'Create', '+', $strix->instance ) } |
|
289 |
} |
} |
290 |
} |
} |
291 |
} |
} |
302 |
template 'selected-instances' => sub { |
template 'selected-instances' => sub { |
303 |
my $self = shift; |
my $self = shift; |
304 |
|
|
305 |
warn "## IN selected-instances ",dump( @_ ); |
# warn "## IN selected-instances ",dump( @_ ); |
306 |
|
|
307 |
if ( my $op = get 'op' ) { |
if ( my $op = get 'op' ) { |
308 |
my $instance = get 'instance' or die "no instance?"; |
my $op_instance = get 'op_instance' or die "no op_instance?"; |
309 |
warn "# selected-instances $op on $instance"; |
warn "# selected-instances $op on $op_instance"; |
310 |
|
|
311 |
my $a; |
my $a; |
312 |
|
|
316 |
class => $op . 'StrixInstanceSelection', |
class => $op . 'StrixInstanceSelection', |
317 |
moniker => $op, |
moniker => $op, |
318 |
arguments => { |
arguments => { |
319 |
instance => $instance, |
instance => $op_instance, |
320 |
by_user => $self->current_user->id, |
by_user => $self->current_user->id, |
321 |
}, |
}, |
322 |
); |
); |
324 |
} elsif ( $op eq 'Delete' ) { |
} elsif ( $op eq 'Delete' ) { |
325 |
|
|
326 |
my $strix = A3C::Model::StrixInstanceSelection->new; |
my $strix = A3C::Model::StrixInstanceSelection->new; |
327 |
$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 ); |
328 |
die "can't find instance $instance" unless $strix->id; |
warn "can't find instance $op_instance" unless $strix->id; |
329 |
$a = $strix->as_delete_action; |
$a = $strix->as_delete_action; |
330 |
|
|
331 |
} |
} |
332 |
warn "# argument_values = ",dump( $a->argument_values ); |
# warn "# argument_values = ",dump( $a->argument_values ); |
333 |
$a->run; |
$a->run; |
334 |
warn "can't $op instance $instance" unless $a->result->success; |
|
335 |
|
if ( $a->result->error ) { |
336 |
|
div { |
337 |
|
{ class is 'note error' } |
338 |
|
$a->result->error; |
339 |
|
} |
340 |
|
} |
341 |
|
|
342 |
|
set( op => '' ); |
343 |
} |
} |
344 |
|
|
345 |
my $selected = A3C::Model::StrixInstanceSelectionCollection->new; |
my $selected = A3C::Model::StrixInstanceSelectionCollection->new; |
347 |
|
|
348 |
if ( $selected->count > 0 ) { |
if ( $selected->count > 0 ) { |
349 |
|
|
350 |
|
my $instance = get('instance'); |
351 |
|
|
352 |
div { _('%1 instances selected', $selected->count ) }; |
div { _('%1 instances selected', $selected->count ) }; |
353 |
table { |
table { |
354 |
while (my $s = $selected->next) { |
while (my $s = $selected->next) { |
355 |
row { |
row { |
356 |
cell { tt { |
cell { tt { |
357 |
hyperlink( |
if ( $s->instance->instance eq $instance ) { |
358 |
url => '?instance=' . $s->instance->instance, |
b { $instance } |
359 |
label => $s->instance->instance |
} else { |
360 |
) |
hyperlink( |
361 |
|
url => '?instance=' . $s->instance->instance, |
362 |
|
label => $s->instance->instance |
363 |
|
) |
364 |
|
} |
365 |
} } |
} } |
366 |
cell { $s->instance->_site_name } |
cell { $s->instance->_site_name } |
367 |
cell { show( 'instance-op', 'Delete', '-', $s->instance->instance ) } |
cell { show( 'instance-op', 'Delete', '-', $s->instance->instance ) } |
384 |
template 'instance-op' => sub { |
template 'instance-op' => sub { |
385 |
my $self = shift; |
my $self = shift; |
386 |
|
|
387 |
warn "# instance-op = ",dump( @_ ); |
# warn "# instance-op = ",dump( @_ ); |
388 |
|
|
389 |
my ( $op, $label, $instance ) = @_; |
my ( $op, $label, $instance ) = @_; |
390 |
|
|
395 |
refresh => 'selected-instances', |
refresh => 'selected-instances', |
396 |
path => '/strix/selected-instances', |
path => '/strix/selected-instances', |
397 |
args => { |
args => { |
398 |
instance => $instance, |
op_instance => $instance, |
399 |
op => $op, |
op => $op, |
400 |
} |
} |
401 |
}, |
}, |