Show
Ignore:
Timestamp:
06/16/07 20:45:04 (19 months ago)
Author:
ilmari
Message:

List all contributors in RDF version of nodes (fixes #106)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides/RDF.pm

    r1066 r1081  
    8383 
    8484    foreach my $var ( qw( phone fax website opening_hours_text address 
    85                           postcode city country latitude longitude username 
     85                          postcode city country latitude longitude 
    8686                          os_x os_y summary ) ) { 
    8787        my $val = $metadata{$var}[0] || $defaults{$var} || ""; 
     
    134134    } 
    135135 
    136     $tt_vars{user_id} = $tt_vars{username}; 
    137     $tt_vars{user_id} =~ s/\s/_/g; 
    138      
    139136    $tt_vars{node_uri} = $self->{make_node_url}->( $node_name ); 
    140137    $tt_vars{node_uri_with_version} 
     
    158155    } 
    159156 
     157    my @revisions = $wiki->list_node_all_versions( 
     158                                                   name => $node_name, 
     159                                                   with_content => 0, 
     160                                                   with_metadata => 1, 
     161                                                 ); 
     162 
     163    # We want all users who have edited the page listed as contributors, 
     164    # but only once each 
     165    foreach my $rev ( @revisions ) { 
     166        my $username = $rev->{metadata}{username}; 
     167        next unless defined $username && length $username; 
     168 
     169        my $user_id = $username; 
     170        $user_id =~ s/\s+/_/g; 
     171         
     172        $tt_vars{contributors}{$username} ||= 
     173            { 
     174              username => encode_entities_numeric($username), 
     175              user_id  => encode_entities_numeric($user_id), 
     176            }; 
     177    } 
     178 
    160179    # OK, we've set all our template variables; now process the template. 
    161180    my $template_path = $config->template_path;