53 |
|
|
54 |
title is _('Strix name differences'); |
title is _('Strix name differences'); |
55 |
|
|
56 |
|
render_region( |
57 |
|
name => 'selected-instances', |
58 |
|
path => '/strix/selected-instances' |
59 |
|
); |
60 |
|
|
61 |
my $name_diff = A3C::SQL->new({ query => qq{ |
my $name_diff = A3C::SQL->new({ query => qq{ |
62 |
select |
select |
63 |
instance,hreduorgurl, |
instance,hreduorgurl, |
71 |
|
|
72 |
table { |
table { |
73 |
row { |
row { |
74 |
|
th {} |
75 |
th { _('Instance') } |
th { _('Instance') } |
76 |
th { _('Strix instance name') } |
th { _('Strix instance name') } |
77 |
th { _('hrEduOrg.o') } |
th { _('hrEduOrg.o') } |
78 |
}; |
}; |
79 |
while ( my $row = $name_diff->next ) { |
while ( my $row = $name_diff->next ) { |
80 |
row { |
row { |
81 |
cell { hyperlink( url => 'http://' . $row->hreduorgurl, label => $row->instance ) } |
cell { show( 'instance-op', 'Create', '+', $row->instance ) } |
82 |
|
cell { $row->instance } |
83 |
cell { $row->_site_name } |
cell { $row->_site_name } |
84 |
cell { $row->o } |
cell { $row->o } |
85 |
} |
} |
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( |
131 |
|
name => 'selected-instances', |
132 |
|
path => '/strix/selected-instances' |
133 |
|
); |
134 |
|
|
135 |
my $site_id = get('site_id') || 1; |
my $site_id = get('site_id') || 1; |
136 |
|
|
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 |
} |
} |
158 |
ul { |
ul { |
159 |
foreach my $p ( @{ $c->{children} } ) { |
foreach my $p ( @{ $c->{children} } ) { |
160 |
li { |
li { |
161 |
|
{ class is $p->{class} }; |
162 |
full_url( $p ); |
full_url( $p ); |
163 |
children( $p ); |
children( $p ); |
164 |
} |
} |
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}, |
228 |
sticky_on_success => 1, |
sticky_on_success => 1, |
229 |
sticky_on_failure => 1, |
sticky_on_failure => 1, |
230 |
arguments => { |
arguments => { |
231 |
strix => get('strix') |
instance => get('instance') |
232 |
} |
} |
233 |
); |
); |
234 |
|
|
235 |
form { |
form { |
236 |
render_action( $action => [ 'strix', 'sql' ] ); |
render_action( $action => [ 'instance', 'sql' ] ); |
237 |
form_submit( label => _('Execute SQL') ); |
form_submit( label => _('Execute SQL') ); |
238 |
}; |
}; |
239 |
|
|
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 |
div { _('%1 instances selected', $selected->count ) } |
my $instance = get('instance'); |
348 |
|
|
349 |
|
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 { $s->strix->instance } } |
cell { tt { |
354 |
cell { $s->strix->_site_name } |
if ( $s->instance->instance eq $instance ) { |
355 |
cell { show( 'instance-op', 'Delete', '-', $s->strix->instance ) } |
b { $instance } |
356 |
|
} else { |
357 |
|
hyperlink( |
358 |
|
url => '?instance=' . $s->instance->instance, |
359 |
|
label => $s->instance->instance |
360 |
|
) |
361 |
|
} |
362 |
|
} } |
363 |
|
cell { $s->instance->_site_name } |
364 |
|
cell { show( 'instance-op', 'Delete', '-', $s->instance->instance ) } |
365 |
} |
} |
366 |
} |
} |
367 |
} |
} |
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 |
}, |
}, |