119 |
return Strix->new({ instance => $instance }); |
return Strix->new({ instance => $instance }); |
120 |
} |
} |
121 |
|
|
|
=head2 navigation |
|
|
|
|
|
=cut |
|
|
|
|
122 |
sub strix_link { |
sub strix_link { |
123 |
my ( $url, $label ) = @_; |
my ( $url, $label ) = @_; |
124 |
hyperlink( |
hyperlink( |
128 |
); |
); |
129 |
} |
} |
130 |
|
|
131 |
|
=head2 navigation |
132 |
|
|
133 |
|
=cut |
134 |
|
|
135 |
template 'navigation' => page { |
template 'navigation' => page { |
136 |
|
|
137 |
title is _('Site navigation'); |
title is _('Site navigation'); |
142 |
); |
); |
143 |
|
|
144 |
render_region( |
render_region( |
145 |
name => 'select-strix-site', |
name => 'strix-site', |
146 |
path => '/strix/select-site' |
path => '/strix/site' |
147 |
); |
); |
148 |
|
|
149 |
}; |
}; |
152 |
|
|
153 |
=cut |
=cut |
154 |
|
|
155 |
template 'layout' => page { |
template 'layout' => sub { |
156 |
|
|
157 |
my $url = get('url') || '/'; |
my $url = get('url') || '/'; |
158 |
|
|
160 |
|
|
161 |
warn dump( $category ); |
warn dump( $category ); |
162 |
|
|
|
title is _('Layout %1 : %2', |
|
|
$category->{sitename}, |
|
|
$category->{naziv}, |
|
|
); |
|
|
|
|
|
render_region( |
|
|
name => 'selected-instances', |
|
|
path => '/strix/selected-instances' |
|
|
); |
|
|
|
|
163 |
strix_link( $category->{url}, $category->{naziv} ); |
strix_link( $category->{url}, $category->{naziv} ); |
164 |
|
|
165 |
my $layout = strix->layout( $url ); |
my $layout = strix->layout( $url ); |
260 |
# warn "## IN selected-instances ",dump( @_ ); |
# warn "## IN selected-instances ",dump( @_ ); |
261 |
|
|
262 |
if ( my $op = get 'op' ) { |
if ( my $op = get 'op' ) { |
263 |
my $op_instance = get 'op_instance' or die "no op_instance?"; |
my $op_instance = get 'op_instance'; |
264 |
|
return unless $op_instance; |
265 |
warn "# selected-instances $op on $op_instance"; |
warn "# selected-instances $op on $op_instance"; |
266 |
|
|
267 |
my $a; |
my $a; |
361 |
|
|
362 |
}; |
}; |
363 |
|
|
364 |
=head2 select-site |
=head2 site |
365 |
|
|
366 |
=cut |
=cut |
367 |
|
|
368 |
template 'select-site' => sub { |
template 'site' => sub { |
369 |
|
|
370 |
my $action = new_action( |
my $action = new_action( |
371 |
class => 'StrixSelectSite', |
class => 'StrixSelectSite', |
387 |
# this is basically a closure |
# this is basically a closure |
388 |
{ refresh => 'selected-instances', path => '/strix/selected-instances', args => { |
{ refresh => 'selected-instances', path => '/strix/selected-instances', args => { |
389 |
instance => { result_of => $action, name => 'instance' } |
instance => { result_of => $action, name => 'instance' } |
390 |
} } |
} }, |
391 |
|
{ refresh => 'strix-site-layout', path => '/__jifty/empty' }, |
392 |
]; |
]; |
393 |
|
|
394 |
form { |
form { |
399 |
|
|
400 |
warn "## select-site action ",dump( $action->result ); |
warn "## select-site action ",dump( $action->result ); |
401 |
|
|
402 |
|
render_region( |
403 |
|
name => 'layout', |
404 |
|
path => '/__jifty/empty', |
405 |
|
); |
406 |
|
|
407 |
if ( my $site_id = $action->result->content('site_id') ) { |
if ( my $site_id = $action->result->content('site_id') ) { |
408 |
show('strix-site-navigation-tree', $action->result->content('instance'), $site_id); |
show('strix-site-navigation-tree', $action->result->content('instance'), $site_id); |
409 |
} |
} |
417 |
|
|
418 |
=cut |
=cut |
419 |
|
|
420 |
|
private template 'select-category' => sub { |
421 |
|
my $self = shift; |
422 |
|
my $p = shift; |
423 |
|
strix_link( $p->{url}, $p->{naziv} ); |
424 |
|
if ( $p->{type} eq 'category' ) { |
425 |
|
outs_raw(' '); |
426 |
|
hyperlink( |
427 |
|
# url => '/strix/layout?url=' . $p->{url} . ';instance=' . get('instance'), |
428 |
|
onclick => { |
429 |
|
region => 'strix-site-layout', # FIXME do we have to hard-code region name here? |
430 |
|
replace_with => '/strix/layout', |
431 |
|
args => { |
432 |
|
url => $p->{url}, |
433 |
|
instance => get('instance'), |
434 |
|
} |
435 |
|
}, |
436 |
|
label => _('layout'), |
437 |
|
class => 'layout', |
438 |
|
); |
439 |
|
} |
440 |
|
}; |
441 |
|
|
442 |
private template 'strix-site-navigation-tree' => sub { |
private template 'strix-site-navigation-tree' => sub { |
443 |
my $self = shift; |
my $self = shift; |
444 |
my ( $instance, $site_id ) = @_; |
my ( $instance, $site_id ) = @_; |
447 |
|
|
448 |
set 'instance' => $instance; |
set 'instance' => $instance; |
449 |
|
|
|
sub full_url { |
|
|
my $p = shift; |
|
|
strix_link( $p->{url}, $p->{naziv} ); |
|
|
if ( $p->{type} eq 'category' ) { |
|
|
outs_raw(' '); |
|
|
hyperlink( |
|
|
url => '/strix/layout?url=' . $p->{url} . ';instance=' . get('instance'), |
|
|
label => _('layout'), |
|
|
class => 'layout', |
|
|
); |
|
|
} |
|
|
} |
|
450 |
|
|
451 |
sub children { |
sub children { |
452 |
my $c = shift; |
my $c = shift; |
455 |
foreach my $p ( @{ $c->{children} } ) { |
foreach my $p ( @{ $c->{children} } ) { |
456 |
li { |
li { |
457 |
{ class is $p->{class} }; |
{ class is $p->{class} }; |
458 |
full_url( $p ); |
show( 'select-category', $p ); |
459 |
children( $p ); |
children( $p ); |
460 |
} |
} |
461 |
} |
} |
469 |
ul { |
ul { |
470 |
foreach my $p ( @navigation ) { |
foreach my $p ( @navigation ) { |
471 |
li { |
li { |
472 |
full_url( $p ); |
show( 'select-category', $p ); |
473 |
children( $p ); |
children( $p ); |
474 |
} |
} |
475 |
} |
} |