/[A3C]/lib/Strix.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/Strix.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 171 by dpavlin, Mon Jun 16 13:16:57 2008 UTC revision 173 by dpavlin, Mon Jun 16 14:43:07 2008 UTC
# Line 55  sub dbh { Line 55  sub dbh {
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  }  }
# Line 116  sub layout { Line 116  sub layout {
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;
# Line 138  sub layout { Line 148  sub layout {
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;
# Line 153  sub layout { Line 163  sub layout {
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;
# Line 228  sub site_navigation { Line 238  sub site_navigation {
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 );
# Line 267  sub site_navigation { Line 277  sub site_navigation {
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 );

Legend:
Removed from v.171  
changed lines
  Added in v.173

  ViewVC Help
Powered by ViewVC 1.1.26