--- lib/Strix.pm 2008/06/16 13:16:57 171 +++ lib/Strix.pm 2008/06/16 14:43:07 173 @@ -55,7 +55,7 @@ $site_dbh->{$site} = $dbh; - warn "## site_dbh = ",dump( $site_dbh ); + warn "## site_dbh = ",dump( $site_dbh ) if $debug; return $dbh; } @@ -116,9 +116,19 @@ }); $sth->execute( $category->{template_id} ); + sub module_args { + my $row = shift; + return undef unless $row->{module_args}; + my $args; + foreach my $a ( split(/\&/, $row->{module_args} ) ) { + $args->{$1} = $2 if $a =~ m/^(.+)=(.+)$/; + } + return $args; + } + while (my $row = $sth->fetchrow_hashref() ) { warn dump( $row ) if $debug; - push @{ $page->{free} }, { $row->{name} => $row->{module_args} }; + push @{ $page->{free} }, { $row->{name} => module_args( $row ) }; } warn "### pre layout...\n" if $debug; @@ -138,7 +148,7 @@ while (my $row = $sth->fetchrow_hashref() ) { warn dump( $row ) if $debug; - push @{ $page->{pre}->{ $row->{pos} } }, { $row->{name} => $row->{module_args} }; + push @{ $page->{pre}->{ $row->{pos} } }, { $row->{name} => module_args( $row ) }; } warn "### post layout...\n" if $debug; @@ -153,7 +163,7 @@ while (my $row = $sth->fetchrow_hashref() ) { warn dump( $row ) if $debug; - push @{ $page->{post}->{ $row->{pozicija} } }, { $row->{name} => $row->{module_args} }; + push @{ $page->{post}->{ $row->{pozicija} } }, { $row->{name} => module_args( $row ) }; } return $page; @@ -228,12 +238,12 @@ @pos = splice( @pos, 0, $depth ); $pos[ $depth - 1 ]++; - warn "## category depth = $depth pos = ",dump( @pos ); + warn "## category depth = $depth pos = ",dump( @pos ) if $debug; my $code = '$navigation'; map { $code .= '->[' . ( $_ - 1 ) . ']->{children}' } @pos; $code =~ s/->{children}$//; - warn "## category code: $code\n"; + warn "## category code: $code\n" if $debug; eval $code . '= $node'; if ( $@ ) { warn "SKIPPED CATEGORY: $@ ",dump( $kat ); @@ -267,10 +277,10 @@ my $ms_depth = $ms->{depth} + $depth; my $p = $pos[ $ms_depth - 1 ]++; - warn "## multistatic depth = $ms_depth pos = ",dump( @pos ); + warn "## multistatic depth = $ms_depth pos = ",dump( @pos ) if $debug; my $ms_code = $code . '->{children}->[ ' . $p . '] = $node'; - warn "## multistatic code: $ms_code\n"; + warn "## multistatic code: $ms_code\n" if $debug; eval $ms_code; if ( $@ ) { warn "SKIPPED MULTISTATIC: $@ ",dump( $ms );