55 |
|
|
56 |
$site_dbh->{$site} = $dbh; |
$site_dbh->{$site} = $dbh; |
57 |
|
|
58 |
warn "## site_dbh = ",dump( $site_dbh ); |
warn "## site_dbh = ",dump( $site_dbh ) if $debug; |
59 |
|
|
60 |
return $dbh; |
return $dbh; |
61 |
} |
} |
116 |
}); |
}); |
117 |
$sth->execute( $category->{template_id} ); |
$sth->execute( $category->{template_id} ); |
118 |
|
|
119 |
|
sub module_args { |
120 |
|
my $row = shift; |
121 |
|
return undef unless $row->{module_args}; |
122 |
|
my $args; |
123 |
|
foreach my $a ( split(/\&/, $row->{module_args} ) ) { |
124 |
|
$args->{$1} = $2 if $a =~ m/^(.+)=(.+)$/; |
125 |
|
} |
126 |
|
return $args; |
127 |
|
} |
128 |
|
|
129 |
while (my $row = $sth->fetchrow_hashref() ) { |
while (my $row = $sth->fetchrow_hashref() ) { |
130 |
warn dump( $row ) if $debug; |
warn dump( $row ) if $debug; |
131 |
push @{ $page->{free} }, { $row->{name} => $row->{module_args} }; |
push @{ $page->{free} }, { $row->{name} => module_args( $row ) }; |
132 |
} |
} |
133 |
|
|
134 |
warn "### pre layout...\n" if $debug; |
warn "### pre layout...\n" if $debug; |
148 |
|
|
149 |
while (my $row = $sth->fetchrow_hashref() ) { |
while (my $row = $sth->fetchrow_hashref() ) { |
150 |
warn dump( $row ) if $debug; |
warn dump( $row ) if $debug; |
151 |
push @{ $page->{pre}->{ $row->{pos} } }, { $row->{name} => $row->{module_args} }; |
push @{ $page->{pre}->{ $row->{pos} } }, { $row->{name} => module_args( $row ) }; |
152 |
} |
} |
153 |
|
|
154 |
warn "### post layout...\n" if $debug; |
warn "### post layout...\n" if $debug; |
163 |
|
|
164 |
while (my $row = $sth->fetchrow_hashref() ) { |
while (my $row = $sth->fetchrow_hashref() ) { |
165 |
warn dump( $row ) if $debug; |
warn dump( $row ) if $debug; |
166 |
push @{ $page->{post}->{ $row->{pozicija} } }, { $row->{name} => $row->{module_args} }; |
push @{ $page->{post}->{ $row->{pozicija} } }, { $row->{name} => module_args( $row ) }; |
167 |
} |
} |
168 |
|
|
169 |
return $page; |
return $page; |
238 |
@pos = splice( @pos, 0, $depth ); |
@pos = splice( @pos, 0, $depth ); |
239 |
$pos[ $depth - 1 ]++; |
$pos[ $depth - 1 ]++; |
240 |
|
|
241 |
warn "## category depth = $depth pos = ",dump( @pos ); |
warn "## category depth = $depth pos = ",dump( @pos ) if $debug; |
242 |
|
|
243 |
my $code = '$navigation'; |
my $code = '$navigation'; |
244 |
map { $code .= '->[' . ( $_ - 1 ) . ']->{children}' } @pos; |
map { $code .= '->[' . ( $_ - 1 ) . ']->{children}' } @pos; |
245 |
$code =~ s/->{children}$//; |
$code =~ s/->{children}$//; |
246 |
warn "## category code: $code\n"; |
warn "## category code: $code\n" if $debug; |
247 |
eval $code . '= $node'; |
eval $code . '= $node'; |
248 |
if ( $@ ) { |
if ( $@ ) { |
249 |
warn "SKIPPED CATEGORY: $@ ",dump( $kat ); |
warn "SKIPPED CATEGORY: $@ ",dump( $kat ); |
277 |
|
|
278 |
my $ms_depth = $ms->{depth} + $depth; |
my $ms_depth = $ms->{depth} + $depth; |
279 |
my $p = $pos[ $ms_depth - 1 ]++; |
my $p = $pos[ $ms_depth - 1 ]++; |
280 |
warn "## multistatic depth = $ms_depth pos = ",dump( @pos ); |
warn "## multistatic depth = $ms_depth pos = ",dump( @pos ) if $debug; |
281 |
|
|
282 |
my $ms_code = $code . '->{children}->[ ' . $p . '] = $node'; |
my $ms_code = $code . '->{children}->[ ' . $p . '] = $node'; |
283 |
warn "## multistatic code: $ms_code\n"; |
warn "## multistatic code: $ms_code\n" if $debug; |
284 |
eval $ms_code; |
eval $ms_code; |
285 |
if ( $@ ) { |
if ( $@ ) { |
286 |
warn "SKIPPED MULTISTATIC: $@ ",dump( $ms ); |
warn "SKIPPED MULTISTATIC: $@ ",dump( $ms ); |