Permalink
Browse files

Fill up groups

  • Loading branch information...
1 parent 0c8d262 commit afe34ff9760e5b83756ec87d7def2936a502141d leon committed Jan 30, 2005
View
@@ -8,7 +8,7 @@ use XML::Simple;
$| = 1;
-my $xml = XMLin('./perl_mongers.xml', cache => 'storable');
+my $xml = XMLin('./perl_mongers.xml', cache => 'storable', suppressempty => 1);
$xml = $xml->{group};
my $tt = Template->new({
@@ -20,40 +20,81 @@ my $tt = Template->new({
PROCESS => 'layout',
});
-# Array containing all the group names
-my @groups;
+# Array containing all the group names order by continent
+my %groups;
mkdir "html/groups/graphics";
foreach my $name (keys %$xml) {
my $group = $xml->{$name};
- my $continent = $group->{location}->{continent};
my $id = $group->{id};
+ my $status = $group->{status} || 'deactive';
+ print "$status\n";
# print $continent, "\n";
# print "$name\n" if ref($continent);
die "$name has no id\n" unless defined $id;
- next unless $id eq '0';
+ if ($name eq 'MarsNeedsWomen.pm' ||
+ $name eq 'Nomads.pm' ||
+ $name eq 'PerlMonks.pm'
+ ) {
+ $group->{location}->{continent} = 'Non-geographical';
+ $group->{location}->{country} = 'Non-geographical';
+ }
+ if ($name eq 'EU.pm') {
+ $group->{location}->{country} = 'Non-geographical';
+ }
+
+ die "$name has no continent\n" unless $group->{location}->{continent};
+ die "$name has no country\n" unless $group->{location}->{country};
+# next unless $id eq '0';
$group->{name} = $name;
$group->{location}->{all} = join ", ",
grep { defined }
map { $group->{location}->{$_} }
qw(city region state country continent);
- unless (-f "html/groups/$id.png") {
+ if (!-f "html/groups/graphics/$id.png"
+ && $group->{location}->{longitude}
+ && $group->{location}->{latitude}) {
my $map = Image::WorldMap->new("titchy.png");
$map->add($group->{location}->{longitude}, $group->{location}->{latitude});
$map->draw("foo.png");
- system("pngtopnm foo.png | ppmquant 64 | pnmtopng -compression 9 > html/groups/graphics/$id.png");
+ system("pngtopnm foo.png | ppmquant 128 | pnmtopng -compression 9 > html/groups/graphics/$id.png");
+ $group->{image} = "graphics/$id.png";
}
- $group->{image} = "graphics/$id.png";
- $tt->process('src/groups/group.html', $group, "html/groups/$id.html")
- || die $tt->error();
+ my $continent = $group->{location}->{continent};
+ my $country = $group->{location}->{country};
+ push @{$groups{$continent}->{$country}}, $group;
+ if (!-f "html/groups/$id.html") {
+ $tt->process('src/groups/group.html', $group, "html/groups/$id.html")
+ || die $tt->error();
+ }
}
copy("./perl_mongers.xml", "html/groups/perl_mongers.xml");
copy("./perl_mongers.dtd", "html/groups/perl_mongers.dtd");
+#use YAML; die Dump(\%groups);
+foreach my $continent (sort keys %groups) {
+ my $file = lc $continent;
+ $file =~ s/\W/_/g;
+ $file = "html/groups/$file.html";
+ warn "$continent -> $file\n";
+ my $groups;
+ foreach my $country (sort keys %{$groups{$continent}}) {
+ warn " $country\n";
+ $groups->{$country} = [sort { lc $a->{name} cmp lc $b->{name} } @{$groups{$continent}->{$country}}];
+ }
+ my $conf = {
+ groups => $groups,
+ continent => $continent,
+ };
+ $tt->process('src/groups/continent.html', $conf, $file)
+ || die $tt->error();
+#use YAML; die Dump($groups);
+#use Data::Dumper; die Dumper($groups);
+}
__END__
=head1 NAME
@@ -48,12 +48,13 @@
[% INCLUDE sideheader
major = {"User groups" => "/groups/index.html"}
minor = {
- "North America" => "",
- "South America" => "",
- "Europe" => "",
- "Oceania" => "",
- "Asia" => "",
- "Africa" => "",
+ "North America" => "/groups/north_america.html",
+ "South America" => "/groups/south_america.html",
+ "Europe" => "/groups/europe.html",
+ "Non-geographical" => "/groups/non_geographical.html",
+ "Oceania" => "/groups/oceania.html",
+ "Asia" => "/groups/asia.html",
+ "Africa" => "/groups/africa.html",
}
%]
@@ -0,0 +1,11 @@
+[% META title = "Perl Mongers: Continent" %]
+
+The following groups are in [% continent %]:
+<p>
+
+[% FOREACH country = groups.keys.sort %]
+<h2>[% country %]</h2>
+[% FOREACH group = groups.$country %]
+<a href="[% group.id %].html">[% group.name %]</a><br>
+[% END %]
+[% END %]
@@ -1,8 +1,16 @@
[% META title = "Perl Mongers: User groups" %]
-There are lots of Perl Monger around the world. Here is:
-[% link_to('/groups/0.html', 'NY.pm') %].
+There are lots of Perl Monger around the world.
+<p>
+Select a continent:
+[% link_to("/groups/north_america.html", "North America") %],
+[% link_to("/groups/south_america.html", "South America") %],
+[% link_to("/groups/europe.html", "Europe") %],
+[% link_to("/groups/non_geographical.html", "Non-geographical") %],
+[% link_to("/groups/oceania.html", "Oceania") %],
+[% link_to("/groups/asia.html", "Asia") %],
+[% link_to("/groups/africa.html", "Africa") %].
<p>
The canonical source for the Perl Mongers groups is now an
@@ -4,14 +4,12 @@
<p>Latest news items from Perl Monger groups around the world:</p>
-<h2>Perl Monger T-Shirts at YAPC::Europe</h2>
-19th August 2002
+<h2>2002-08-19: Perl Monger T-Shirts at YAPC::Europe</h2>
<p>If you are going to YAPC::Europe and your local Perl Monger group
has its own t-shirt, please consider donating one to the auction
that will happen on the final day.</p>
-<h2>New Chief Perl Monger</h2>
-6th August 2002
+<h2>2002-08-06: New Chief Perl Monger</h2>
<p>Dave Cross has been appointed the new Perl Mongers User Groups
Co-ordinator. Dave will be acting as liason between The Perl
Foundation and the 500 local Perl Monger groups.</p>
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit afe34ff

Please sign in to comment.