]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Merge branch 'master' into cvs
authorAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>
Fri, 16 Mar 2012 15:19:28 +0000 (11:19 -0400)
committerAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>
Fri, 16 Mar 2012 15:19:28 +0000 (11:19 -0400)
51 files changed:
Bundle/IkiWiki/Extras.pm
IkiWiki/Plugin/inline.pm
IkiWiki/Plugin/osm.pm [new file with mode: 0644]
IkiWiki/Plugin/shortcut.pm
debian/changelog
debian/control
debian/copyright
doc/bugs/jquery-ui.min.css_missing_some_image_files.mdwn [new file with mode: 0644]
doc/forum/How_to_change_registration_page/comment_2_8176ef231cf901802fc60b6d414018e6._comment [new file with mode: 0644]
doc/forum/How_to_show_recent_changes_for_individual_pages__63__/comment_1_cd34affc6883f4e4bc5e7e7b711cc8ba._comment [new file with mode: 0644]
doc/forum/OpenID_not_working___47___where_to_define_wiki__39__s_ID__63__/comment_4_b0d39d30852bca1525ab9612a7532670._comment [new file with mode: 0644]
doc/forum/Problem_with_gitweb/comment_1_c505be6a13651c397fb803dd4117acce._comment [new file with mode: 0644]
doc/forum/Problem_with_gitweb/comment_2_23cc0d87448d3cbdac20a005e9191589._comment [new file with mode: 0644]
doc/forum/Problem_with_gitweb/comment_3_697c6038009249e6a49d9e458a5ba271._comment [new file with mode: 0644]
doc/forum/attachments_fail_to_upload.mdwn [new file with mode: 0644]
doc/forum/attachments_fail_to_upload/comment_1_577adde1dfa49463dfa8e169c462fc42._comment [new file with mode: 0644]
doc/forum/attachments_fail_to_upload/comment_2_473f38c6d523496fac8dad13ac6d20c3._comment [new file with mode: 0644]
doc/forum/attachments_fail_to_upload/comment_3_799a2f1b7b259157e97fd31ec76fb845._comment [new file with mode: 0644]
doc/forum/attachments_fail_to_upload/comment_4_e37d1497acafd3fda547462f000636e3._comment [new file with mode: 0644]
doc/forum/attachments_fail_to_upload/comment_5_da03f9c4917cb1ef52de984b8ba86b68._comment [new file with mode: 0644]
doc/forum/attachments_fail_to_upload/comment_6_04498946a300ddb652dec73c2950f48f._comment [new file with mode: 0644]
doc/git.mdwn
doc/ikiwiki/directive/osm.mdwn [new file with mode: 0644]
doc/ikiwiki/directive/waypoint.mdwn [new file with mode: 0644]
doc/ikiwikiusers.mdwn
doc/plugins/comments/discussion.mdwn
doc/plugins/contrib/osm.mdwn [deleted file]
doc/plugins/osm.mdwn [new file with mode: 0644]
doc/plugins/po.mdwn
doc/plugins/recentchangesdiff/Discussion.mdwn [deleted file]
doc/sandbox.mdwn
doc/sandbox/Nyus_of_se_däi.mdwn [new file with mode: 0644]
doc/shortcuts.mdwn
doc/todo/Javascript_calendar.mdwn [new file with mode: 0644]
doc/todo/do_not_make_links_backwards.mdwn [new file with mode: 0644]
doc/todo/provide_inline_diffs_in_recentchanges.mdwn
doc/usage.mdwn
doc/users/acathur.mdwn [new file with mode: 0644]
doc/users/iustin.mdwn [new file with mode: 0644]
doc/users/ttw.mdwn [new file with mode: 0644]
templates/atompage.tmpl
underlays/attachment/ikiwiki/images/ui-bg_flat_0_aaaaaa_40x100.png [new file with mode: 0644]
underlays/attachment/ikiwiki/images/ui-bg_glass_55_fbf9ee_1x400.png [new file with mode: 0644]
underlays/attachment/ikiwiki/images/ui-bg_glass_65_ffffff_1x400.png [new file with mode: 0644]
underlays/attachment/ikiwiki/images/ui-bg_glass_75_dadada_1x400.png [new file with mode: 0644]
underlays/attachment/ikiwiki/images/ui-bg_glass_95_fef1ec_1x400.png [new file with mode: 0644]
underlays/attachment/ikiwiki/images/ui-icons_2e83ff_256x240.png [new file with mode: 0644]
underlays/attachment/ikiwiki/images/ui-icons_454545_256x240.png [new file with mode: 0644]
underlays/attachment/ikiwiki/images/ui-icons_cd0a0a_256x240.png [new file with mode: 0644]
underlays/osm/ikiwiki/images/osm.png [new file with mode: 0644]
underlays/osm/ikiwiki/osm.js [new file with mode: 0644]

index d01d52e5bafaa3e3319731fb52ba500a96c6544c..0a7cd3ae3713aa4128775b8ae1006eb56dbcfe59 100644 (file)
@@ -35,6 +35,7 @@ HTML::Tree
 Sort::Naturally
 Gravatar::URL
 Net::INET6Glue
+XML::Writer
 
 =head1 AUTHOR
 
index 159cc5def01d59aaa3f532cbb4fea14ab52f6435..bdab5793b7c8a611ebb4bbfb7c1ff0951218712c 100644 (file)
@@ -677,7 +677,6 @@ sub genfeed ($$$$$@) {
                guid => $guid,
                feeddate => date_3339($lasttime),
                feedurl => $feedurl,
-               version => $IkiWiki::version,
        );
        run_hooks(pagetemplate => sub {
                shift->(page => $page, destpage => $page,
diff --git a/IkiWiki/Plugin/osm.pm b/IkiWiki/Plugin/osm.pm
new file mode 100644 (file)
index 0000000..2b5d0d5
--- /dev/null
@@ -0,0 +1,569 @@
+#!/usr/bin/perl
+# Copyright 2011 Blars Blarson
+# Released under GPL version 2
+
+package IkiWiki::Plugin::osm;
+use utf8;
+use strict;
+use warnings;
+use IkiWiki 3.0;
+
+sub import {
+       add_underlay("osm");
+       hook(type => "getsetup", id => "osm", call => \&getsetup);
+       hook(type => "format", id => "osm", call => \&format);
+       hook(type => "preprocess", id => "osm", call => \&preprocess);
+       hook(type => "preprocess", id => "waypoint", call => \&process_waypoint);
+       hook(type => "savestate", id => "waypoint", call => \&savestate);
+       hook(type => "cgi", id => "osm", call => \&cgi);
+}
+
+sub getsetup () {
+       return
+               plugin => {
+                       safe => 1,
+                       rebuild => 1,
+                       section => "special-purpose",
+               },
+               osm_default_zoom => {
+                       type => "integer",
+                       example => "15",
+                       description => "the default zoom when you click on the map link",
+                       safe => 1,
+                       rebuild => 1,
+               },
+               osm_default_icon => {
+                       type => "string",
+                       example => "/ikiwiki/images/osm.png",
+                       description => "the icon shon on links and on the main map",
+                       safe => 0,
+                       rebuild => 1,
+               },
+               osm_alt => {
+                       type => "string",
+                       example => "",
+                       description => "the alt tag of links, defaults to empty",
+                       safe => 0,
+                       rebuild => 1,
+               },
+               osm_format => {
+                       type => "string",
+                       example => "KML",
+                       description => "the output format for waypoints, can be KML, GeoJSON or CSV (one or many, comma-separated)",
+                       safe => 1,
+                       rebuild => 1,
+               },
+               osm_tag_default_icon => {
+                       type => "string",
+                       example => "icon.png",
+                       description => "the icon attached to a tag so that pages tagged with that tag will have that icon on the map",
+                       safe => 0,
+                       rebuild => 1,
+               },
+               osm_tag_icons => {
+                       type => "string",
+                       example => {
+                               'test' => '/img/test.png',
+                               'trailer' => '/img/trailer.png'
+                       },
+                       description => "tag to icon mapping, leading slash is important!",
+                       safe => 0,
+                       rebuild => 1,
+               },
+}
+
+sub preprocess {
+       my %params=@_;
+       my $page = $params{'page'};
+       my $dest = $params{'destpage'};
+       my $loc = $params{'loc'}; # sanitized below
+       my $lat = $params{'lat'}; # sanitized below
+       my $lon = $params{'lon'}; # sanitized below
+       my $href = $params{'href'};
+
+       my $fullscreen = defined($params{'fullscreen'}); # sanitized here
+       my ($width, $height, $float);
+       if ($fullscreen) {
+               $height = '100%';
+               $width = '100%';
+               $float = 0;
+       }
+       else {
+               $height = scrub($params{'height'} || "300px", $page, $dest); # sanitized here
+               $width = scrub($params{'width'} || "500px", $page, $dest); # sanitized here
+               $float = (defined($params{'right'}) && 'right') || (defined($params{'left'}) && 'left'); # sanitized here
+       }
+       my $zoom = scrub($params{'zoom'} // $config{'osm_default_zoom'} // 15, $page, $dest); # sanitized below
+       my $map;
+       if ($fullscreen) {
+               $map = $params{'map'} || $page;
+       }
+       else {
+               $map = $params{'map'} || 'map';
+       }
+       $map = scrub($map, $page, $dest); # sanitized here
+       my $name = scrub($params{'name'} || $map, $page, $dest);
+
+       if (defined($lon) || defined($lat) || defined($loc)) {
+               ($lon, $lat) = scrub_lonlat($loc, $lon, $lat);
+       }
+
+       if ($zoom !~ /^\d\d?$/ || $zoom < 2 || $zoom > 18) {
+               error("Bad zoom");
+       }
+       $pagestate{$page}{'osm'}{$map}{'displays'}{$name} = {
+               height => $height,
+               width => $width,
+               float => $float,
+               zoom => $zoom,
+               fullscreen => $fullscreen,
+               editable => defined($params{'editable'}),
+               lat => $lat,
+               lon => $lon,
+               href => $href,
+       };
+       return "<div id=\"mapdiv-$name\"></div>";
+}
+
+sub process_waypoint {
+       my %params=@_;
+       my $loc = $params{'loc'}; # sanitized below
+       my $lat = $params{'lat'}; # sanitized below
+       my $lon = $params{'lon'}; # sanitized below
+       my $page = $params{'page'}; # not sanitized?
+       my $dest = $params{'destpage'}; # not sanitized?
+       my $hidden = defined($params{'hidden'}); # sanitized here
+       my ($p) = $page =~ /(?:^|\/)([^\/]+)\/?$/; # shorter page name
+       my $name = scrub($params{'name'} || $p, $page, $dest); # sanitized here
+       my $desc = scrub($params{'desc'} || '', $page, $dest); # sanitized here
+       my $zoom = scrub($params{'zoom'} // $config{'osm_default_zoom'} // 15, $page, $dest); # sanitized below
+       my $icon = $config{'osm__default_icon'} || "/ikiwiki/images/osm.png"; # sanitized: we trust $config
+       my $map = scrub($params{'map'} || 'map', $page, $dest); # sanitized here
+       my $alt = $config{'osm_alt'} ? "alt=\"$config{'osm_alt'}\"" : ''; # sanitized: we trust $config
+       if ($zoom !~ /^\d\d?$/ || $zoom < 2 || $zoom > 18) {
+               error("Bad zoom");
+       }
+
+       ($lon, $lat) = scrub_lonlat($loc, $lon, $lat);
+       if (!defined($lat) || !defined($lon)) {
+               error("Must specify lat and lon");
+       }
+
+       my $tag = $params{'tag'};
+       if ($tag) {
+               if (!defined($config{'osm_tag_icons'}->{$tag})) {
+                       error("invalid tag specified, see osm_tag_icons configuration or don't specify any");
+               }
+               $icon = $config{'osm_tag_icons'}->{$tag};
+       }
+       else {
+               foreach my $t (keys %{$typedlinks{$page}{'tag'}}) {
+                       if ($icon = get_tag_icon($t)) {
+                               $tag = $t;
+                               last;
+                       }
+                       $t =~ s!/$config{'tagbase'}/!!;
+                       if ($icon = get_tag_icon($t)) {
+                               $tag = $t;
+                               last;
+                       }
+               }
+       }
+       $icon = "/ikiwiki/images/osm.png" unless $icon;
+       $tag = '' unless $tag;
+       if ($page eq $dest) {
+               if (!defined($config{'osm_format'}) || !$config{'osm_format'}) {
+                       $config{'osm_format'} = 'KML';
+               }
+               my %formats = map { $_ => 1 } split(/, */, $config{'osm_format'});
+               if ($formats{'GeoJSON'}) {
+                       will_render($page,$config{destdir} . "/$map/pois.json");
+               }
+               if ($formats{'CSV'}) {
+                       will_render($page,$config{destdir} . "/$map/pois.txt");
+               }
+               if ($formats{'KML'}) {
+                       will_render($page,$config{destdir} . "/$map/pois.kml");
+               }
+       }
+       my $href = "/ikiwiki.cgi?do=osm&map=$map&lat=$lat&lon=$lon&zoom=$zoom";
+       if (defined($destsources{htmlpage($map)})) {
+               $href = urlto($map,$page) . "?lat=$lat&lon=$lon&zoom=$zoom";
+       }
+       $pagestate{$page}{'osm'}{$map}{'waypoints'}{$name} = {
+               page => $page,
+               desc => $desc,
+               icon => $icon,
+               tag => $tag,
+               lat => $lat,
+               lon => $lon,
+               # how to link back to the page from the map, not to be
+               # confused with the URL of the map itself sent to the
+               # embeded map below
+               href => urlto($page,$map),
+       };
+       my $output = '';
+       if (defined($params{'embed'})) {
+               $params{'href'} = $href; # propagate down to embeded
+               $output .= preprocess(%params);
+       }
+       if (!$hidden) {
+               $href =~ s!&!&amp;!g;
+               $output .= "<a href=\"$href\"><img class=\"img\" src=\"$icon\" $alt /></a>";
+       }
+       return $output;
+}
+
+# get the icon from the given tag
+sub get_tag_icon($) {
+       my $tag = shift;
+       # look for an icon attached to the tag
+       my $attached = $tag . '/' . $config{'osm_tag_default_icon'};
+       if (srcfile($attached)) {
+               return $attached;
+       }
+       # look for the old way: mappings
+       if ($config{'osm_tag_icons'}->{$tag}) {
+               return $config{'osm_tag_icons'}->{$tag};
+       }
+       else {
+               return undef;
+       }
+}
+
+sub scrub_lonlat($$$) {
+       my ($loc, $lon, $lat) = @_;
+       if ($loc) {
+               if ($loc =~ /^\s*(\-?\d+(?:\.\d*°?|(?:°?|\s)\s*\d+(?:\.\d*\'?|(?:\'|\s)\s*\d+(?:\.\d*)?\"?|\'?)°?)[NS]?)\s*\,?\;?\s*(\-?\d+(?:\.\d*°?|(?:°?|\s)\s*\d+(?:\.\d*\'?|(?:\'|\s)\s*\d+(?:\.\d*)?\"?|\'?)°?)[EW]?)\s*$/) {
+                       $lat = $1;
+                       $lon = $2;
+               }
+               else {
+                       error("Bad loc");
+               }
+       }
+       if (defined($lat)) {
+               if ($lat =~ /^(\-?)(\d+)(?:(\.\d*)°?|(?:°|\s)\s*(\d+)(?:(\.\d*)\'?|(?:\'|\s)\s*(\d+(?:\.\d*)?\"?)|\'?)|°?)\s*([NS])?\s*$/) {
+                       $lat = $2 + ($3//0) + ((($4//0) + (($5//0) + (($6//0)/60.)))/60.);
+                       if (($1 eq '-') || (($7//'') eq 'S')) {
+                               $lat = - $lat;
+                       }
+               }
+               else {
+                       error("Bad lat");
+               }
+       }
+       if (defined($lon)) {
+               if ($lon =~ /^(\-?)(\d+)(?:(\.\d*)°?|(?:°|\s)\s*(\d+)(?:(\.\d*)\'?|(?:\'|\s)\s*(\d+(?:\.\d*)?\"?)|\'?)|°?)\s*([EW])?$/) {
+                       $lon = $2 + ($3//0) + ((($4//0) + (($5//0) + (($6//0)/60.)))/60.);
+                       if (($1 eq '-') || (($7//'') eq 'W')) {
+                               $lon = - $lon;
+                       }
+               }
+               else {
+                       error("Bad lon");
+               }
+       }
+       if ($lat < -90 || $lat > 90 || $lon < -180 || $lon > 180) {
+               error("Location out of range");
+       }
+       return ($lon, $lat);
+}
+
+sub savestate {
+       my %waypoints = ();
+       my %linestrings = ();
+
+       foreach my $page (keys %pagestate) {
+               if (exists $pagestate{$page}{'osm'}) {
+                       foreach my $map (keys %{$pagestate{$page}{'osm'}}) {
+                               foreach my $name (keys %{$pagestate{$page}{'osm'}{$map}{'waypoints'}}) {
+                                       debug("found waypoint $name");
+                                       $waypoints{$map}{$name} = $pagestate{$page}{'osm'}{$map}{'waypoints'}{$name};
+                               }
+                       }
+               }
+       }
+
+       foreach my $page (keys %pagestate) {
+               if (exists $pagestate{$page}{'osm'}) {
+                       foreach my $map (keys %{$pagestate{$page}{'osm'}}) {
+                               # examine the links on this page
+                               foreach my $name (keys %{$pagestate{$page}{'osm'}{$map}{'waypoints'}}) {
+                                       if (exists $links{$page}) {
+                                               foreach my $otherpage (@{$links{$page}}) {
+                                                       if (exists $waypoints{$map}{$otherpage}) {
+                                                               push(@{$linestrings{$map}}, [
+                                                                       [ $waypoints{$map}{$name}{'lon'}, $waypoints{$map}{$name}{'lat'} ],
+                                                                       [ $waypoints{$map}{$otherpage}{'lon'}, $waypoints{$map}{$otherpage}{'lat'} ]
+                                                               ]);
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       # clear the state, it will be regenerated on the next parse
+                       # the idea here is to clear up removed waypoints...
+                       $pagestate{$page}{'osm'} = ();
+               }
+       }
+
+       if (!defined($config{'osm_format'}) || !$config{'osm_format'}) {
+               $config{'osm_format'} = 'KML';
+       }
+       my %formats = map { $_ => 1 } split(/, */, $config{'osm_format'});
+       if ($formats{'GeoJSON'}) {
+               writejson(\%waypoints, \%linestrings);
+       }
+       if ($formats{'CSV'}) {
+               writecsvs(\%waypoints, \%linestrings);
+       }
+       if ($formats{'KML'}) {
+               writekml(\%waypoints, \%linestrings);
+       }
+}
+
+sub writejson($;$) {
+       my %waypoints = %{$_[0]};
+       my %linestrings = %{$_[1]};
+       eval q{use JSON};
+       error $@ if $@;
+       foreach my $map (keys %waypoints) {
+               my %geojson = ( "type" => "FeatureCollection", "features" => []);
+               foreach my $name (keys %{$waypoints{$map}}) {
+                       my %marker = ( "type" => "Feature",
+                               "geometry" => { "type" => "Point", "coordinates" => [ $waypoints{$map}{$name}{'lon'}, $waypoints{$map}{$name}{'lat'} ] },
+                               "properties" => $waypoints{$map}{$name} );
+                       push @{$geojson{'features'}}, \%marker;
+               }
+               foreach my $linestring (@{$linestrings{$map}}) {
+                       my %json  = ( "type" => "Feature",
+                               "geometry" => { "type" => "LineString", "coordinates" => $linestring });
+                       push @{$geojson{'features'}}, \%json;
+               }
+               debug('writing pois file pois.json in ' . $config{destdir} . "/$map");
+               writefile("pois.json",$config{destdir} . "/$map",to_json(\%geojson));
+       }
+}
+
+sub writekml($;$) {
+       my %waypoints = %{$_[0]};
+       my %linestrings = %{$_[1]};
+       eval q{use XML::Writer};
+       error $@ if $@;
+       foreach my $map (keys %waypoints) {
+               debug("writing pois file pois.kml in " . $config{destdir} . "/$map");
+
+=pod
+Sample placemark:
+
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+  <Placemark>
+    <name>Simple placemark</name>
+    <description>Attached to the ground. Intelligently places itself 
+       at the height of the underlying terrain.</description>
+    <Point>
+      <coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
+    </Point>
+  </Placemark>
+</kml>
+
+Sample style:
+
+
+        <Style id="sh_sunny_copy69">
+                <IconStyle>
+                        <scale>1.4</scale>
+                        <Icon>
+                                <href>http://waypoints.google.com/mapfiles/kml/shapes/sunny.png</href>
+                        </Icon>
+                        <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
+                </IconStyle>
+                <LabelStyle>
+                        <color>ff00aaff</color>
+                </LabelStyle>
+        </Style>
+
+
+=cut
+
+               use IO::File;
+               my $output = IO::File->new(">".$config{destdir} . "/$map/pois.kml");
+
+               my $writer = XML::Writer->new( OUTPUT => $output, DATA_MODE => 1, ENCODING => 'UTF-8');
+               $writer->xmlDecl();
+               $writer->startTag("kml", "xmlns" => "http://www.opengis.net/kml/2.2");
+
+               # first pass: get the icons
+               foreach my $name (keys %{$waypoints{$map}}) {
+                       my %options = %{$waypoints{$map}{$name}};
+                       $writer->startTag("Style", id => $options{tag});
+                       $writer->startTag("IconStyle");
+                       $writer->startTag("Icon");
+                       $writer->startTag("href");
+                       $writer->characters($options{icon});
+                       $writer->endTag();
+                       $writer->endTag();
+                       $writer->endTag();
+                       $writer->endTag();
+               }
+       
+               foreach my $name (keys %{$waypoints{$map}}) {
+                       my %options = %{$waypoints{$map}{$name}};
+                       $writer->startTag("Placemark");
+                       $writer->startTag("name");
+                       $writer->characters($name);
+                       $writer->endTag();
+                       $writer->startTag("styleUrl");
+                       $writer->characters('#' . $options{tag});
+                       $writer->endTag();
+                       #$writer->emptyTag('atom:link', href => $options{href});
+                       # to make it easier for us as the atom:link parameter is
+                       # hard to access from javascript
+                       $writer->startTag('href');
+                       $writer->characters($options{href});
+                       $writer->endTag();
+                       $writer->startTag("description");
+                       $writer->characters($options{desc});
+                       $writer->endTag();
+                       $writer->startTag("Point");
+                       $writer->startTag("coordinates");
+                       $writer->characters($options{lon} . "," . $options{lat});
+                       $writer->endTag();
+                       $writer->endTag();
+                       $writer->endTag();
+               }
+               
+               my $i = 0;
+               foreach my $linestring (@{$linestrings{$map}}) {
+                       $writer->startTag("Placemark");
+                       $writer->startTag("name");
+                       $writer->characters("linestring " . $i++);
+                       $writer->endTag();
+                       $writer->startTag("LineString");
+                       $writer->startTag("coordinates");
+                       my $str = '';
+                       foreach my $coord (@{$linestring}) {
+                               $str .= join(',', @{$coord}) . " \n";
+                       }
+                       $writer->characters($str);
+                       $writer->endTag();
+                       $writer->endTag();
+                       $writer->endTag();
+               }
+               $writer->endTag();
+               $writer->end();
+               $output->close();
+       }
+}
+
+sub writecsvs($;$) {
+       my %waypoints = %{$_[0]};
+       foreach my $map (keys %waypoints) {
+               my $poisf = "lat\tlon\ttitle\tdescription\ticon\ticonSize\ticonOffset\n";
+               foreach my $name (keys %{$waypoints{$map}}) {
+                       my %options = %{$waypoints{$map}{$name}};
+                       my $line = 
+                               $options{'lat'} . "\t" .
+                               $options{'lon'} . "\t" .
+                               $name . "\t" .
+                               $options{'desc'} . '<br /><a href="' . $options{'page'} . '">' . $name . "</a>\t" .
+                               $options{'icon'} . "\n";
+                       $poisf .= $line;
+               }
+               debug("writing pois file pois.txt in " . $config{destdir} . "/$map");
+               writefile("pois.txt",$config{destdir} . "/$map",$poisf);
+       }
+}
+
+# pipe some data through the HTML scrubber
+#
+# code taken from the meta.pm plugin
+sub scrub($$$) {
+       if (IkiWiki::Plugin::htmlscrubber->can("sanitize")) {
+               return IkiWiki::Plugin::htmlscrubber::sanitize(
+                       content => shift, page => shift, destpage => shift);
+       }
+       else {
+               return shift;
+       }
+}
+
+# taken from toggle.pm
+sub format (@) {
+       my %params=@_;
+
+       if ($params{content}=~m!<div[^>]*id="mapdiv-[^"]*"[^>]*>!g) {
+               if (! ($params{content}=~s!</body>!include_javascript($params{page})."</body>"!em)) {
+                       # no <body> tag, probably in preview mode
+                       $params{content}=$params{content} . include_javascript($params{page});
+               }
+       }
+       return $params{content};
+}
+
+sub prefered_format() {
+       if (!defined($config{'osm_format'}) || !$config{'osm_format'}) {
+               $config{'osm_format'} = 'KML';
+       }
+       my @spl = split(/, */, $config{'osm_format'});
+       return shift @spl;
+}
+
+sub include_javascript ($) {
+       my $page=shift;
+       my $loader;
+
+       eval q{use JSON};
+       error $@ if $@;
+       if (exists $pagestate{$page}{'osm'}) {
+               foreach my $map (keys %{$pagestate{$page}{'osm'}}) {
+                       foreach my $name (keys %{$pagestate{$page}{'osm'}{$map}{'displays'}}) {
+                               my %options = %{$pagestate{$page}{'osm'}{$map}{'displays'}{$name}};
+                               $options{'map'} = $map;
+                               $options{'format'} = prefered_format();
+                               $loader .= "mapsetup(\"mapdiv-$name\", " . to_json(\%options) . ");\n";
+                       }
+               }
+       }
+       if ($loader) {
+               return embed_map_code($page) . "<script type=\"text/javascript\" charset=\"utf-8\">$loader</script>";
+       }
+       else {
+               return '';
+       }
+}
+
+sub cgi($) {
+       my $cgi=shift;
+
+       return unless defined $cgi->param('do') &&
+               $cgi->param("do") eq "osm";
+
+       IkiWiki::decode_cgi_utf8($cgi);
+
+       my $map = $cgi->param('map');
+       if (!defined $map || $map !~ /^[a-z]*$/) {
+               error("invalid map parameter");
+       }
+
+       print "Content-Type: text/html\r\n";
+       print ("\r\n");
+       print "<html><body>";
+       print "<div id=\"mapdiv-$map\"></div>";
+       print embed_map_code();
+       print "<script type=\"text/javascript\" charset=\"utf-8\">mapsetup( 'mapdiv-$map', { 'map': '$map', 'lat': urlParams['lat'], 'lon': urlParams['lon'], 'zoom': urlParams['zoom'], 'fullscreen': 1, 'editable': 1, 'format': '" . prefered_format() . "'});</script>";
+       print "</body></html>";
+
+       exit 0;
+}
+
+sub embed_map_code(;$) {
+       my $page=shift;
+       return '<script src="http://www.openlayers.org/api/OpenLayers.js" type="text/javascript" charset="utf-8"></script>'.
+               '<script src="'.urlto("ikiwiki/osm.js", $page).
+               '" type="text/javascript" charset="utf-8"></script>'."\n";
+}
+
+1;
index 0cedbe447480f7f7e01a24476c1cc40e856bccc5..98df143ab27e34506217f770d40c03e554dcd386 100644 (file)
@@ -73,11 +73,21 @@ sub shortcut_expand ($$@) {
        add_depends($params{destpage}, "shortcuts");
 
        my $text=join(" ", @params);
-       my $encoded_text=$text;
-       $encoded_text=~s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
        
-       $url=~s{\%([sS])}{
-               $1 eq 's' ? $encoded_text : $text
+       $url=~s{\%([sSW])}{
+               if ($1 eq 's') {
+                       my $t=$text;
+                       $t=~s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
+                       $t;
+               }
+               elsif ($1 eq 'S') {
+                       $text;
+               }
+               elsif ($1 eq 'W') {
+                       my $t=Encode::encode_utf8($text);
+                       $t=~s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
+                       $t;
+               }
        }eg;
 
        $text=~s/_/ /g;
index 2d9ffdb858177b3ad3269e3e4f5f7ac1d7a3e72e..ceefb64e3d27af9482fa2cbeaff2d9d3010ec6b4 100644 (file)
@@ -2,6 +2,16 @@ ikiwiki (3.20120203) UNRELEASED; urgency=low
 
   * Fix a snail mail address. Closes: #659158
   * openid-jquery.js: Update URL of Wordpress favicon. Closes: #660549
+  * Drop the version attribute on the generator tag in Atom feeds
+    to make builds more reproducible. Closes: #661569 (Paul Wise)
+  * shortcut: Support Wikipedia's form of url-encoding for unicode
+    characters, which involves mojibake. Closes: #661198
+  * osm: New plugin to embed an OpenStreetMap into a wiki page.
+    Supports waypoints, tags, and can even draw paths matching
+    wikilinks between pages containing waypoints.
+    Thanks to Blars Blarson and Antoine Beaupré, as well as the worldwide
+    OpenStreetMap community for this utter awesomeness.
+  * Add a few missing jquery UI icons to attachment upload widget underlay.
 
  -- Joey Hess <joeyh@debian.org>  Wed, 08 Feb 2012 16:07:00 -0400
 
index 9403dfb442fdd5a45d5aeaebaad21fb87e9497f6..54cbd0f7bef122ec7185295989b4513eb8c56f7e 100644 (file)
@@ -38,7 +38,7 @@ Suggests: viewvc | gitweb | viewcvs, libsearch-xapian-perl,
   libsparkline-php, texlive, dvipng, libtext-wikicreole-perl,
   libsort-naturally-perl, libtext-textile-perl, libhighlight-perl,
   po4a (>= 0.35-1), gettext, libnet-inet6glue-perl,
-  libtext-multimarkdown-perl
+  libtext-multimarkdown-perl, libxml-writer-perl
 Conflicts: ikiwiki-plugin-table
 Replaces: ikiwiki-plugin-table
 Provides: ikiwiki-plugin-table
index 74418281dcf813c5686990c3b784cfdfdc28143b..8fddb682b74d6bee7d721d60ee2b2b6b8af5c2ea 100644 (file)
@@ -1,4 +1,4 @@
-Format: http://dep.debian.net/deps/dep5/
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Source: native package
 
 Files: *
@@ -153,6 +153,10 @@ Files: IkiWiki/Plugin/rsync.pm
 Copyright: © 2009 Amitai Schlair
 License: BSD-2-clause
 
+Files: IkiWiki/Plugin/osm.pm
+Copyright: © 2011 Blars Blarson, Antoine Beaupré
+License: GPL-2
+
 Files: doc/logo/*
 Copyright: © 2006 Recai Oktaş <roktas@debian.org>
 License: GPL-2+
diff --git a/doc/bugs/jquery-ui.min.css_missing_some_image_files.mdwn b/doc/bugs/jquery-ui.min.css_missing_some_image_files.mdwn
new file mode 100644 (file)
index 0000000..dd026f4
--- /dev/null
@@ -0,0 +1,14 @@
+This is very minor. Noticed in nginx's logs that jquery-ui.min.css (the attachment plugin uses this) keeps referencing some png files that are not available in public_html/mywiki/ikiwiki/images/  These should be included in underlays/attachment/ikiwiki/images/ in the source repo and seem to be copied from /usr/local/share/ikiwiki/attachment/ikiwiki/images/  when I compile a new wiki.  The complete list of images jquery-ui.min.css is looking for can be found here. https://github.com/jquery/jquery-ui/tree/1.8.14/themes/base/images
+
+> Do you have a list of files that are *actually* used when ikiwiki is
+> running? I don't want to include a lot of files that jquery only 
+> uses in other situations. The currently included files are exactly those
+> that I see it try to use. --[[Joey]] 
+
+Fair enough. These 3 files are the only ones that appear consistently in nginx error logs.
+ui-bg_glass_75_dadada_1x400.png
+ui-icons_454545_256x240.png
+ui-bg_glass_95_fef1ec_1x400.png
+
+> Hmm, that's most of the missing ones. I just added them all. [[done]]
+> --[[Joey]] 
diff --git a/doc/forum/How_to_change_registration_page/comment_2_8176ef231cf901802fc60b6d414018e6._comment b/doc/forum/How_to_change_registration_page/comment_2_8176ef231cf901802fc60b6d414018e6._comment
new file mode 100644 (file)
index 0000000..8e67162
--- /dev/null
@@ -0,0 +1,8 @@
+[[!comment format=mdwn
+ username="https://www.google.com/accounts/o8/id?id=AItOawndsaC4GaIBw49WNdbk2Faqfm_mrtQgul8"
+ nickname="Christian"
+ subject="comment 2"
+ date="2012-02-29T06:58:26Z"
+ content="""
+thanks! 
+"""]]
diff --git a/doc/forum/How_to_show_recent_changes_for_individual_pages__63__/comment_1_cd34affc6883f4e4bc5e7e7b711cc8ba._comment b/doc/forum/How_to_show_recent_changes_for_individual_pages__63__/comment_1_cd34affc6883f4e4bc5e7e7b711cc8ba._comment
new file mode 100644 (file)
index 0000000..8ed341c
--- /dev/null
@@ -0,0 +1,10 @@
+[[!comment format=mdwn
+ username="http://joey.kitenet.net/"
+ nickname="joey"
+ subject="comment 1"
+ date="2012-03-03T15:01:34Z"
+ content="""
+The RecentChanges page is a wiki page like any other, containing a special inline directive. You can copy that, and modify the inline's [[ikiwiki/PageSpec]] to match pages changed by a specific author, or with a specific title. 
+
+If you want separate change logs for *every* page, install gitweb and configure historyurl. There will then be a \"History\" link going to the gitweb for each page.
+"""]]
diff --git a/doc/forum/OpenID_not_working___47___where_to_define_wiki__39__s_ID__63__/comment_4_b0d39d30852bca1525ab9612a7532670._comment b/doc/forum/OpenID_not_working___47___where_to_define_wiki__39__s_ID__63__/comment_4_b0d39d30852bca1525ab9612a7532670._comment
new file mode 100644 (file)
index 0000000..ce3cf21
--- /dev/null
@@ -0,0 +1,8 @@
+[[!comment format=mdwn
+ username="https://www.google.com/accounts/o8/id?id=AItOawndsaC4GaIBw49WNdbk2Faqfm_mrtQgul8"
+ nickname="Christian"
+ subject="comment 4"
+ date="2012-02-29T06:59:21Z"
+ content="""
+I had the error with squeeze, too. Have now moved to passwordauth, at least for now...
+"""]]
diff --git a/doc/forum/Problem_with_gitweb/comment_1_c505be6a13651c397fb803dd4117acce._comment b/doc/forum/Problem_with_gitweb/comment_1_c505be6a13651c397fb803dd4117acce._comment
new file mode 100644 (file)
index 0000000..0a492fa
--- /dev/null
@@ -0,0 +1,8 @@
+[[!comment format=mdwn
+ username="https://www.google.com/accounts/o8/id?id=AItOawk_MMtLPS7osC5MjX00q2ATjvvXPWqm0ik"
+ nickname="micheal"
+ subject="comment 1"
+ date="2012-03-05T18:44:36Z"
+ content="""
+Any Ideas what I could do?
+"""]]
diff --git a/doc/forum/Problem_with_gitweb/comment_2_23cc0d87448d3cbdac20a005e9191589._comment b/doc/forum/Problem_with_gitweb/comment_2_23cc0d87448d3cbdac20a005e9191589._comment
new file mode 100644 (file)
index 0000000..f80bd38
--- /dev/null
@@ -0,0 +1,10 @@
+[[!comment format=mdwn
+ username="http://joey.kitenet.net/"
+ nickname="joey"
+ subject="comment 2"
+ date="2012-03-05T21:08:45Z"
+ content="""
+This seems entirely a gitweb configuration problem, so look at `/etc/gitweb.conf`
+
+Or, if you are able to navigate to a gitweb url that does show your wiki's source, fix up ikiwiki's `historyurl` to use the url that works.
+"""]]
diff --git a/doc/forum/Problem_with_gitweb/comment_3_697c6038009249e6a49d9e458a5ba271._comment b/doc/forum/Problem_with_gitweb/comment_3_697c6038009249e6a49d9e458a5ba271._comment
new file mode 100644 (file)
index 0000000..72eeda1
--- /dev/null
@@ -0,0 +1,47 @@
+[[!comment format=mdwn
+ username="https://www.google.com/accounts/o8/id?id=AItOawk_MMtLPS7osC5MjX00q2ATjvvXPWqm0ik"
+ nickname="micheal"
+ subject="comment 3"
+ date="2012-03-06T09:50:53Z"
+ content="""
+I don't know how to navigate to a gitweb url that does show my wiki's source.
+
+My gitweb.conf looks like this:
+
+    cat /etc/gitweb.conf
+    # path to git projects (<project>.git)
+    #$projectroot = \"/var/cache/git\";
+    $projectroot = \"/home/myuser/myiki\";
+
+    # directory to use for temp files
+    $git_temp = \"/tmp\";
+   
+    # Change This
+    $site_name = \"myiki\";
+
+    # target of the home link on top of all pages
+    #$home_link = $my_uri || \"/\";
+
+    # html text to include at home page
+    #$home_text = \"indextext.html\";
+
+    # file with project list; by default, simply scan the projectroot dir.
+    #$projects_list = $projectroot;
+
+    # stylesheet to use
+    #@stylesheets = (\"static/gitweb.css\");
+    # javascript code for gitweb
+    #$javascript = \"static/gitweb.js\";
+
+    # logo to use
+    #$logo = \"static/git-logo.png\";
+
+    # the 'favicon'  
+    #$favicon = \"static/git-favicon.png\";
+
+    # git-diff-tree(1) options to use for generated patches
+    #@diff_opts = (\"-M\");
+    @diff_opts = ();
+
+"""]]
diff --git a/doc/forum/attachments_fail_to_upload.mdwn b/doc/forum/attachments_fail_to_upload.mdwn
new file mode 100644 (file)
index 0000000..62e363a
--- /dev/null
@@ -0,0 +1,8 @@
+I am having a problem with ikiwiki on an armel processor based machine running 32 bit debian squeeze.
+I first installed the ikiwiki deb from the repos and realized there was a problem uploading images.
+I downloaded the latest version of ikiwiki from the git repo and made sure I had all of the necessary dependencies and libraries. 
+Make doesn't seem to complain about anything being missing and make test passes fine. I can create a new wiki and edit pages but anytime I try to upload an image it fails.
+I have the attachment plugin activated.And I added mimetype(image/*) and maxsize(5000kb) to the PageSpec field but that made no difference.
+I am able to successully add images to the appropriate folders manually via the command line and the commit them to git but I'd liekt o make it work through the web interface. Is there anything that I may have missed?
+
+Edit: I just noticed that if I save the page anyway after the the javascript ui reports that the upload has failed, the file has in fact uploaded.
diff --git a/doc/forum/attachments_fail_to_upload/comment_1_577adde1dfa49463dfa8e169c462fc42._comment b/doc/forum/attachments_fail_to_upload/comment_1_577adde1dfa49463dfa8e169c462fc42._comment
new file mode 100644 (file)
index 0000000..7d2d66c
--- /dev/null
@@ -0,0 +1,10 @@
+[[!comment format=mdwn
+ username="http://joey.kitenet.net/"
+ nickname="joey"
+ subject="comment 1"
+ date="2012-03-01T16:11:09Z"
+ content="""
+Saying \"it fails\" is not going to get the best help. If you can look in your web server's error.log file, or get a error message from somewhere else, you might get somewhere.
+
+You might also check if the machine is running out of memory. It's quite likely that a POSTed attachment is all buffered in the web server's memory before ikiwiki gets ahold of it.
+"""]]
diff --git a/doc/forum/attachments_fail_to_upload/comment_2_473f38c6d523496fac8dad13ac6d20c3._comment b/doc/forum/attachments_fail_to_upload/comment_2_473f38c6d523496fac8dad13ac6d20c3._comment
new file mode 100644 (file)
index 0000000..f491a9b
--- /dev/null
@@ -0,0 +1,12 @@
+[[!comment format=mdwn
+ username="jaime"
+ ip="201.141.41.68"
+ subject="comment 2"
+ date="2012-03-01T20:08:47Z"
+ content="""
+Sorry, \"failed\" is just the message ikwiki's web interface returns. Nginx's error logs don't seem to register anything when the \"failure\" occurs. I am not sure how to properly monitor what is happening with the web server's memory at the time of uploading but just watching htop I can see that the ikiwiki begins to use 100% if the cpu until the process stops but there doesn't seem to be much impact on the overall memory usage, seems to remain about half of available memory.
+I'm sorry if that is not helpful. If you can give me some pointers on where to look for more detailed information I can follow instructions.
+
+
+
+"""]]
diff --git a/doc/forum/attachments_fail_to_upload/comment_3_799a2f1b7b259157e97fd31ec76fb845._comment b/doc/forum/attachments_fail_to_upload/comment_3_799a2f1b7b259157e97fd31ec76fb845._comment
new file mode 100644 (file)
index 0000000..ebf2756
--- /dev/null
@@ -0,0 +1,10 @@
+[[!comment format=mdwn
+ username="http://joey.kitenet.net/"
+ nickname="joey"
+ subject="comment 3"
+ date="2012-03-03T14:54:10Z"
+ content="""
+What version are you running on squeeze? The version shipped with Debian stable does not have the javascript uploader.
+
+There was a recent problem involving filenames with unicode characters that broke the javascript uploader as you describe, which was fixed in a recent release.
+"""]]
diff --git a/doc/forum/attachments_fail_to_upload/comment_4_e37d1497acafd3fda547462f000636e3._comment b/doc/forum/attachments_fail_to_upload/comment_4_e37d1497acafd3fda547462f000636e3._comment
new file mode 100644 (file)
index 0000000..148c7b7
--- /dev/null
@@ -0,0 +1,8 @@
+[[!comment format=mdwn
+ username="jaime"
+ ip="201.141.91.196"
+ subject="ikiwiki version 3.20120203"
+ date="2012-03-05T19:52:02Z"
+ content="""
+I installed ikiwiki version 3.20120203 from source. Should I pull more recent changes from the repo?
+"""]]
diff --git a/doc/forum/attachments_fail_to_upload/comment_5_da03f9c4917cb1ef52de984b8ba86b68._comment b/doc/forum/attachments_fail_to_upload/comment_5_da03f9c4917cb1ef52de984b8ba86b68._comment
new file mode 100644 (file)
index 0000000..dbe0d65
--- /dev/null
@@ -0,0 +1,11 @@
+[[!comment format=mdwn
+ username="http://joey.kitenet.net/"
+ nickname="joey"
+ subject="comment 5"
+ date="2012-03-05T20:48:50Z"
+ content="""
+Your version already contains the unicode fix, which was commit 1572c3c376df36ea09e27a1ea437e3a75cdf0f84.
+
+I think it's possible that the javascript file upload widget is timing out waiting for a response from ikiwiki when uploading the file. Since this is a slow CPU, it might exceed some limit in that code. At this point all I know is that the javascript file upload widget is setting an error flag, which is displayed as \"failed!\" in red. The next step is probably to get a http protocol analizer like firebug and see what if anything is being returned by the ikiwiki.cgi when the attachment is uploaded to it -- it should return some JSON with a `stored_msg` field.
+
+"""]]
diff --git a/doc/forum/attachments_fail_to_upload/comment_6_04498946a300ddb652dec73c2950f48f._comment b/doc/forum/attachments_fail_to_upload/comment_6_04498946a300ddb652dec73c2950f48f._comment
new file mode 100644 (file)
index 0000000..877050e
--- /dev/null
@@ -0,0 +1,19 @@
+[[!comment format=mdwn
+ username="jaime"
+ ip="201.141.54.196"
+ subject="comment 6"
+ date="2012-03-08T01:34:57Z"
+ content="""
+Ok... figured out how to use firebug, started the profile, and tried uploading an image. POST http://myserver/ikiwiki.cgi immediately turns red with a little X as I get the javascript \"failed\" message in the ui. In the post tab of firebug, halfway through the binary content of the png I can see the message  \"... Firebug request size limit has been reached by Firebug. ... \"
+
+So next I try uploading a tiny 3k image.  This time the post completes and I can see \"Error: Can't locate JSON.pm in @INC\" in the output. A bit of googling tells me I need to install the libjson-perl package.  Done.
+
+I try and upload the tiny 3k image again. This time it works. :)
+I try and upload a 9k image and the POST just dies just like before with the \"... Firebug request size limit has been reached by Firebug. ... \" in the post tab. 
+
+So I tried changing the extensions.firebug.netDisplayedPostBodyLimit variable in firefox to see if that would me to get more info. Now the I don't get the request size limit message but the post still doesn't get anything back.
+
+I decided to try some other http protocal analyzers. Firefox 10 internal webdeveloper tools don't give me any more info.
+Next I tried HttpFox and the only thing I get back is this...
+Error loading content (NS_ERROR_DOCUMENT_NOT_CACHED)
+"""]]
index b8bf501c6aad688282c4efc64caa3166699b964a..1da9fbfbd8926b1e6e0a9b0f41fed84b08e2998e 100644 (file)
@@ -75,8 +75,9 @@ think about merging them. This is recommended. :-)
 * [[yds]] `git://github.com/yds/ikiwiki.git`
 * [[pelle]] `git://github.com/hemmop/ikiwiki.git`
 * [[chrismgray]] `git://github.com/chrismgray/ikiwiki.git`
+* [[ttw]] `git://github.com/ttw/ikiwiki.git`
+* [[anarcat]] `git://src.anarcat.ath.cx/ikiwiki`
 
 ## branches
 
 Current branches of ikiwiki are listed on [[branches]].
-
diff --git a/doc/ikiwiki/directive/osm.mdwn b/doc/ikiwiki/directive/osm.mdwn
new file mode 100644 (file)
index 0000000..a2cdd66
--- /dev/null
@@ -0,0 +1,71 @@
+The `osm` directive is supplied by the [[!iki plugins/osm desc=osm]] plugin.
+
+This directive inserts an OpenStreetMap map onto a page.
+It is typically combined with the [[waypoint]] directive
+to add points to the map.
+
+## examples
+
+    \[[!osm]]
+    \[[!waypoint lat="45°30N" lon="73°40W" name="My city" tag="city"]]
+
+The osm directive will display the actual map, while the waypoint
+directive adds waypoints to the map.
+
+The above can also be shortened as:
+
+    \[[!waypoint lat="45°30N" lon="73°40W" name="My city" tag="city" embed]]
+
+The tag is also taken from the tags elsewhere in the page, so the
+above is equivalent to:
+
+    \[[!waypoint lat="45°30N" lon="73°40W" name="My city" embed]]
+    \[[!tag city]]
+
+The icon is also taken from the tag if attached to the tag page as
+icon.png (default, modifiable)..
+
+## map display
+
+ * `map` - map to display, defaults to the current page
+    name in fullscreen mode, "map" otherwise
+ * `zoom` - the level to zoom to on the OSM map
+ * `loc` - lattitude and longitude of the map center
+ * `lat` - lattitude
+ * `lon` - longitude
+ * `fullscreen` - make the map take the whole screen through CSS
+ * `editable` - add edit controls in a separate layer
+ * `right` - float the map right, ignored for fullscreen
+ * `left` - float the map left (default unless fullscreen)
+ * `width` - width of the map, ignored for fullscreen
+ * `height` - height of the map, ignored for fullscreen
+
+## waypoints
+
+Waypoints can be added to any page. By default the waypoint takes the
+name of the page, which allows you to easily tag pages and make them
+appear on the central map.
+
+Waypoints, by default, show up as a image (the `icon` parameter) link
+to the main map (or the `map` parameter provided). That markup can be
+hidden with the `hidden` parameter.
+
+ * `name` - the name of this point, defaults to the page name (!) must
+   be unique, otherwise later incantation will overwrite previous
+   ones.
+ * `map` - the map to add the point to (defaults to "map")
+ * `desc` - description to embed in the map
+ * `loc` - lattitude and longitude
+ * `lat` - lattitude
+ * `lon` - longitude
+ * `tag` - the type of points, maps to an icon in the osm_types array
+ * `hidden` - do not display the link to the map (will not affect `embed`)
+ * `icon` - URL to the icon to show in the link to the map and within
+   the map
+ * `embed` - embed the map display alongside the point, in which case
+   the regular arguments to the map display can be used
+
+## Links
+
+If two pages with waypoints have a link between them, that link will
+magically show up on the map. Now how awesome is that?
diff --git a/doc/ikiwiki/directive/waypoint.mdwn b/doc/ikiwiki/directive/waypoint.mdwn
new file mode 100644 (file)
index 0000000..e301f85
--- /dev/null
@@ -0,0 +1,6 @@
+The `waypoint` directive is supplied by the [[!iki plugins/osm desc=osm]] plugin.
+
+This directive adds a waypoint ot an OpenStreetMap map displayed
+by the [[osm]] directive. See the [[osm]] directive for examples
+and options.
+
index 4695514d98c8e408b8e723a06b7498cbffbf9af9..7ede47e998ea494050ca8fbe911c7ca8f94e3c2d 100644 (file)
@@ -79,6 +79,7 @@ Projects & Organizations
 * [Oxford Computer Society](http://www.ox.compsoc.net/)
 * [Russian OpenBSD Community wiki](http://wiki.openbsd.ru/)
 * [Arcada Project](http://arcadaproject.org/)
+* [*BSD UNIX user group in Denmark](http://www.bsd-dk.dk/)
 
 Personal sites and blogs
 ========================
@@ -174,3 +175,5 @@ Personal sites and blogs
 * [Paul Elms](http://paul.elms.pro) Personal site and blog in russian.
 * [James' Tech Notes](http://jamestechnotes.com) My technical notes, blog, wiki, personal site.
 * [Salient Dream](http://www.salientdream.com/) - All Things Strange. 
+* [Kafe-in.net](https://www.kafe-in.net/) Ugly personnal blog.
+* [Anton Berezin's blog](http://blog.tobez.org/)
index 3043b0106dd68f4df048c0457682d058d1f01c1b..227890bdd621e446417cb03054bf53cd7b9ecec3 100644 (file)
@@ -203,3 +203,16 @@ wake of this:
    correction follow-ups are common.
 
 -- [[Jon]]
+
+
+---
+
+## Comment threads
+
+Any thoughts about implementing some simple threading in the comments?
+
+Or at least a reply functionality that quotes the subject/contents?
+
+-- [[iustin]]
+
+---
diff --git a/doc/plugins/contrib/osm.mdwn b/doc/plugins/contrib/osm.mdwn
deleted file mode 100644 (file)
index a4ddbcb..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-[[!template id=plugin name=osm author="Blars Blarson, Antoine Beaupré"]]
-[[!tag type/special-purpose todo/geotagging]]
-
-Openstreetmap/Openlayers support for ikiwiki
---------------------------------------------
-
-This plugin provides simple Openstreetmap/Openlayers support for ikiwiki. It can embed Openstreetmap viewports within a page or link to a bigger map that will have multiple markers, generated with a KML (or CSV, or GeoJSON) datafile of markers based on the different calling pages. Multiple distinct maps on a single wiki are supported.
-
-Plugin was originally written by [[the techno-viking|http://techno-viking.com/posts/ikiwiki-maps/]] and fixed up by [[anarcat]]. Code is available at `git://src.anarcat.ath.cx/ikiwiki-osm.git`. See [[this page|http://anarcat.ath.cx/software/ikiwiki-osm/README]] for a more complete description and [[the Mtl-mesh wiki|http://mesh.openisp.ca/nodes/anarcat]] for a sample of what this plugin can do.
-
-See also [[plugins/contrib/googlemaps]].
-
-This plugin would be greatly improved by [[todo/internal_definition_list_support]].
diff --git a/doc/plugins/osm.mdwn b/doc/plugins/osm.mdwn
new file mode 100644 (file)
index 0000000..040d175
--- /dev/null
@@ -0,0 +1,31 @@
+[[!template id=plugin name=osm author="Blars Blarson, Antoine Beaupré"]]
+[[!tag type/special-purpose todo/geotagging]]
+
+## Openstreetmap/Openlayers support for ikiwiki
+
+This plugin provides simple Openstreetmap/Openlayers support for ikiwiki.
+It can embed Openstreetmap viewports within a page or link to a bigger map
+that will have multiple markers, generated with a KML (or CSV, or GeoJSON)
+datafile of markers based on the different calling pages. Multiple distinct
+maps on a single wiki are supported.
+
+You will need the [[!cpan XML::Writer]] perl module to write KML files,
+which is the default mode of operation. GeoJSON files can also be generated
+if the [[!cpan JSON]] perl module is installed.
+
+This provides the [[ikiwiki/directive/waypoint]] and [[ikiwiki/directive/osm]] directives.
+
+---
+
+The plugin was originally written by
+[[the techno-viking|http://techno-viking.com/posts/ikiwiki-maps/]] and fixed up
+by [[anarcat]]. 
+
+See [[the Mtl-mesh
+wiki|http://mesh.openisp.ca/nodes/anarcat]] for a sample of what this
+plugin can do
+
+See also [[plugins/contrib/googlemaps]].
+
+This plugin would be greatly improved by
+[[todo/internal_definition_list_support]].
index b701d3662e16e2ecb4f45f379169bf2cab2a2123..703244947b9a99aabc7c285685cce4eeebb3f1b2 100644 (file)
@@ -49,15 +49,15 @@ Supported languages
 `po_master_language` is used to set the "master" language in
 `ikiwiki.setup`, such as:
 
-        po_master_language => 'en|English'
+        po_master_language: en|English
 
 `po_slave_languages` is used to set the list of supported "slave"
 languages, such as:
 
-        po_slave_languages => [ 'fr|Français',
-                                'es|Español',
-                                'de|Deutsch',
-        ]
+        po_slave_languages:
+         - fr|Français
+         - es|Español
+         - de|Deutsch
 
 Decide which pages are translatable
 -----------------------------------
diff --git a/doc/plugins/recentchangesdiff/Discussion.mdwn b/doc/plugins/recentchangesdiff/Discussion.mdwn
deleted file mode 100644 (file)
index 55bb542..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-couldn't the diff be displayed as a popup? right now it's too bad because the diff is actually in the page, generated and downloaded, but the user can't see it. I have tried to address the issue by adding stuff to the change.tmpl template, but I may be missing something - and it doesn't quite look right:
-
-    --- /usr/share/ikiwiki/templates/change.tmpl    2011-09-05 15:14:19.000000000 -0400
-    +++ templates/change.tmpl       2011-10-11 13:04:37.704346964 -0400
-    @@ -39,6 +39,7 @@
-     </TMPL_LOOP>
-     </div>
-     <TMPL_IF DIFF>
-    +<a href="#" onClick="document.getElementByClass('diff').style = 'block'">[[show diff|wikiicons/diff.png]]</a>
-     <div class="diff">
-     <pre>
-     <TMPL_VAR DIFF>
-
-There are a few things wrong with this:
-
- 1. I don't like the hardcoded javascript in there, we should use [[plugins/toggle]] or something, but i am not sure how to make the this plugin depend on toggle, or if it is desirable. 
- 2. it doesn't work at all: first it doesn't actually "toggle" and second the javascript somehow gets filtered out of the resulting HTML so we don't even see it
- 3. if the diffurl parameter is set in the template, we'd actually see two sets of glasses, which is silly. i tried moving the diff button upwards into the PAGES loop, but there the diffurls are file-specific, which also seem quite silly
-
-I am looking for guidance on how to improve and fix this now. --[[anarcat]] 2011-10-11
index d6e44cbe21c0f359b911c15392fbc967b8e0eb6e..502bc4feca5d4d46a41452feb4eef70d4d973085 100644 (file)
@@ -9,6 +9,9 @@ This is my custom sidebar for this page.
 \[[!calendar pages="posts/*"]]
 """]]
 
+
+asdfasdf asdfasldkfj asdf
+
 [[!sidebar ]]
 
 
diff --git a/doc/sandbox/Nyus_of_se_däi.mdwn b/doc/sandbox/Nyus_of_se_däi.mdwn
new file mode 100644 (file)
index 0000000..6205f18
--- /dev/null
@@ -0,0 +1 @@
+Sies ahr se nyus of se däi...... säi ahr väri interesting, for schur.
index 07210f9bfe88092cdcfd5a09c66f37923653cbcb..722c6b141b06aee390b82cf10e216f5dfdbfbb4b 100644 (file)
@@ -15,7 +15,7 @@ This page controls what shortcut links the wiki supports.
 * [[!shortcut name=archive url="http://web.archive.org/*/%S"]]
 * [[!shortcut name=gmap url="https://maps.google.com/maps?q=%s"]]
 * [[!shortcut name=gmsg url="https://groups.google.com/groups?selm=%s"]]
-* [[!shortcut name=wikipedia url="https://en.wikipedia.org/wiki/%s"]]
+* [[!shortcut name=wikipedia url="https://en.wikipedia.org/wiki/%W"]]
 * [[!shortcut name=wikitravel url="https://wikitravel.org/en/%s"]]
 * [[!shortcut name=wiktionary url="https://en.wiktionary.org/wiki/%s"]]
 * [[!shortcut name=debbug url="http://bugs.debian.org/%S" desc="Debian bug #%s"]]
@@ -69,8 +69,10 @@ This page controls what shortcut links the wiki supports.
 To add a new shortcut, use the `shortcut`
 [[ikiwiki/directive]]. In the url, "%s" is replaced with the
 text passed to the named shortcut, after [[!wikipedia url_encoding]]
-it, and '%S' is replaced with the raw, non-encoded text. The optional
-`desc` parameter controls the description of the link.
+it, and '%S' is replaced with the raw, non-encoded text. 
+Additionally, `%W` is replaced with the text encoded just right for
+Wikipedia. The optional `desc` parameter controls the description of
+the link.
 
 Remember that the `name` you give the shortcut will become a new
 [[ikiwiki/directive]].  Avoid using a `name` that conflicts
diff --git a/doc/todo/Javascript_calendar.mdwn b/doc/todo/Javascript_calendar.mdwn
new file mode 100644 (file)
index 0000000..1b6eee4
--- /dev/null
@@ -0,0 +1,28 @@
+[[!meta title="Javascript equivalent of plugin 'calendar'"]]
+[[!tag patch]]
+
+Hello,
+we ([[Grésille|http://www.gresille.org]]) have a calendar (built using the [[calendar|plugins/calendar]] plugin) in the sidebar of our website. This caused the whole website to be rebuilded each night, and we did not like it. So I wrote a javascript equivalent of the calendar plugin.
+
+Here are the differences compared to the [[calendar|plugins/calendar]] plugin.
+
+* Pros
+  * No need to rebuild the page containing the calendar each time day changes, or
+    a page (indexed by the calendar) is added, changed or deleted. This is
+    particularly useful if you want to have this calendar in the sidebar.
+  * Handles the case where several pages appear the same day: a popup appear to let user choose the day he wants.
+  * Smooth navigation among months.
+* Neutral
+  * Most of options are defined in Ikiwiki's setup files instead of the options
+    of the directive.
+* Cons
+  * As a consequence, every calendar of the wiki must index the same set of pages.
+  * Javascript :( .
+
+You can see this plugin in action on [[our website|http://www.gresille.org]]. To see what happens when several pages happens on the same day, check the 15th of March 2012.
+
+I do not know how contributions are processed, but if you want to include this plugin in Ikiwiki, I made a copy of Ikiwiki repository, with this new plugin (as well as the documentation for the plugin and the directive).
+
+    git clone http://spalax.homedns.org/git/ikiwiki
+
+-- Spalax
diff --git a/doc/todo/do_not_make_links_backwards.mdwn b/doc/todo/do_not_make_links_backwards.mdwn
new file mode 100644 (file)
index 0000000..55db32b
--- /dev/null
@@ -0,0 +1,88 @@
+[[!template  id=gitbranch branch=anarcat/backwards_links author="[[anarcat]]"]]
+
+I understand this may be a bit provocative, but I strongly feel that ikiwiki linking rules are backwards. I come from the world of wikis like MoinMoin and [[plugins/contrib/mediawiki]], where you use `\[[link|description]]`. The defacto wiki markup "[[plugins/creole]]" also uses that convention, as does raw HTML (href comes first!). Ikiwiki doesn't: here we need to use `\[[description|link]]`.
+
+Everytime i come back to ikiwiki, i need to bend my mind backwards to create *proper* links. I understand that `\[[description|link]]` is more inline with Markdown's `[description](link)` approach, but in my mind it is too much of a problem for third part plugins to be a proper justification. For example, the [[plugins/creole]] plugin works pretty much as expected *expect* for links, because it can't override ikiwiki's internal link parser. For me that's a huge inconsistency that should be fixed.
+
+If there is an agreement within the community that we can change that, I am ready to work on a migration script or even a configuration variable... -- [[anarcat]]
+
+Dev notes
+---------
+
+I started looking into this, after encouraging words from Joey ("very long term roadmap", AKA "if someone does it"). It turns out it is less deeply rooted than i thought in the core of ikiwiki; everything being a plugin and all, this is also a plugin ([[plugins/link]]).
+
+The following needs to be done:
+
+ 1. the `link_regexp` variable needs to be turned backwards (or frontwards, if you like :P) (./) added an option for this, working!
+ 2. a config setting need to be added to the `link` plugin so that we can choose if we want backwards links or not (./) `links_direction`, how does that sound? I have changed that from `backwards_links` to be more neutral. 'rtl' means `\[[link|text]]` and 'ltr' means `\[[text|link]]`
+ 3. a (solid!) parser needs to be written for [[ikiwiki-transition]] to change the actual links (if necessary) (./) done!
+ 4. rewrite tests to take into account the two syntaxes (!) would be done when we migrate to the syntax
+ 5. deal with underlays (./) i wrote a script to convert it to markdown
+
+Discussion
+----------
+
+> It's not at all obvious to me that `rtl` should mean "link before description"
+> and not the other way round. Perhaps `wikilink_text_first` => `1` for the historical
+> IkiWiki syntax or `0` for the Creole/Mediawiki syntax? --[[smcv]]
+>
+> > A friend made the argument that it is more natural for a human to read the `text` then `link`, as the link is less important. Since we (occidental languages) read left to right, I felt this was appropriate. I also blindly assumed that it would "feel" also appropriate for right to left languages (arabic, hebrew, etc) to have those links backwards, and those languages are generally named "right to left".
+> > 
+> > Originally, I named that parameter `backwards_links`, but then it wouldn't make sense in the long term, and isn't exactly neutral: it assume the current way is backwards! Your suggestion is interesting however, but I don't think the rtl/ltr nomenclature is problematic, with proper documentation of course... --[[anarcat]]
+
+There's a caveat: we can't have a per-wiki backwards_links option, because of the underlay, common to all wikis, which needs to be converted. So the option doesn't make much sense. Not sure how to deal with this... Maybe this needs to be at the package level? --[[anarcat]]
+
+> I've thought about adding a direction-neutral `\[[!link]]` directive -
+> see [[link plugin perhaps too general?]] for details. The basewiki
+> could use `\[[!link to=b desc=a]]` whenever it needs `\[[a|b]]`-style
+> links, maybe? --[[smcv]]
+
+>> It could, but it would be a pain to remember to do that.
+>> 
+>> I feel that this should probably be a flag day transition because
+>> otherwise there will be a lot of variation between how different
+>> ikiwikis handle links, which is even worse than the current variation
+>> between ikiwiki and other wikis!
+>>
+>> There are quite likely ikiwiki page generators that build wikilinks
+>> too. One that's part of ikiwiki itself is `change.tmpl`. There may be
+>> others... --[[Joey]]
+
+>>> Agreed that it would be cleaner to just change everything, even though the transition might be painful.
+
+>>> Another interim option might be to change the basewiki links to be just \[[link to whatever]] without having a description.
+>>> That style of link would work whether the link style was "backwards" or "forwards".  Unfortunately it could make some links less readable; after all, there is a reason why one wants to be able to change the link text!  But I don't know what proportion of the links are like that.  It's a thought, anyway.
+>>> --[[KathrynAndersen]]
+
+>>> Another option for internal links is to just use the regular markdown links instead of `\[[text|link]]` markup, that way it works regardless. Then the documentation for the link plugin just has to state both syntaxes in a safe manner.
+>>> I also agree that we should just switch in one shot, although I am worried this means this could be postponed indefinitely.--[[anarcat]]
+
+>>>> I have done just that in my branch: now the underlay only uses wikilinks in the wikilink page, elsewhere regular markdown links are used. I haven't converted the whole of the doc/ directory however, that would be left to the migration. I have written a ikiwik-transition tool to migrate from wikilink to markdown while i was there. --[[anarcat]]
+
+----
+
+FWIW, I think this change may well be painful, but is a good idea. I can never remember which way around it should be.
+Rather like USB plugs, I invariably have to try both ways. — [[Jon]]
+
+The bikeshed color should be ...
+--------------------------------
+
+...[blue](http://blue.bikeshed.org/) of course. :) Just to make things clear here, the "bikeshedding" potential is absolutely huge here. right to left? left to right? who's right? how could we even decide this?
+
+I think we can approach this rationnally:
+
+ 1. left to right (text then link) can be considered more natural, and should therefore be supported
+ 2. it is supported in markdown using regular markdown links. in the proposed branch, the underlay wikilinks are converted to use regular markdown links
+ 3. ikiwiki links break other markup plugins, like mediawiki and creole, as those work right to left.
+ 4. those are recognized "standards" used by other popular sites, like Wikipedia, or any wiki supporting the Creole markup, which is [most wikis](http://www.wikicreole.org/wiki/Engines)
+
+Therefore, to respect interoperability and [POLA](https://en.wikipedia.org/wiki/Principle_of_least_astonishment), ikiwiki should respect that convention and reverse the way links are parsed by the link plugin, or move that functionality into creole/mediawiki modules, and out of the main core, which I do not think can be an option.
+
+So here's a roadmap to deploy this change:
+
+ 1. the code in the backwards_links branch i am working on is tested and proven, then merged in
+ 2. a release of the 3.x branch is published with the possibility for wikis to convert to the new markup, with the notion that the older markup is deprecated
+ 3. this wiki is converted to the new markup
+ 4. 4.0 is released with the new markup enabled by default and runs ikiwiki-transition on your wiki on upgrade
+
+Note that ikiwiki-transition can be ran multiple and will convert your markup to and from rtl/ltr, without issues, so this is pretty sturdy. I think the configuration variable can be kept throughout 4.x, with the notion that it will be completely removed eventually. --[[anarcat]]
index 39a35d0c6088f97c19f62dbc0ba07739321985c2..7e95791c6467127c8095d4da89f50ad6fbd3e03d 100644 (file)
@@ -1,8 +1,23 @@
+[[!template  id=gitbranch branch=anarcat/inline_diffs author="[[anarcat]]"]]
+
 It would rock if I could view diffs from the web without going via feeds. I envision toggle-style buttons on the recentchanges page, or just links to the CGI, which then displays the diff... --[[madduck]]
 
-> The diffs are actually there, enabled by the `recentchangesdiff`
+> The diffs are actually there, enabled by the [[plugins/recentchangesdiff]]
 > plugin, but they are hidden in the XHTML version by the stylesheet.
 > You might try a user stylesheet with `div.diff { display: block }`.
 > --[[JasonBlevins]]
 
-[[!tag wishlist]]
+> > I have implemented this in a branch in my repository (see the side box).
+> > 
+> > Unfortunately it has some issues:
+> > 
+> > 1. it assumes the toggle.js code is loaded somehow
+> > 2. if the toggle code isn't loaded the diffs are displayed (which is arguably better than showing nothing since we ship the diff to the UA anyways...)
+> > 3. <del>it will show only if there's a revert URL, which is backwards, but otherwise the display is weird, with each button on its own line</del> fixed!
+> > 4. if the diffurl parameter is set in the template, we'd actually see two sets of glasses, which is silly. 
+> >
+> > I feel this should nevertheless be implemented because if we're going to compile all this crap in the page anyways and send it to the client, why not allow the user to show it? I also feel that showing it by default is a lesser evil for non-javascript users.
+> >
+> > -- [[anarcat]] 2012-03-03
+
+[[!tag wishlist patch]]
index 44d32a01df6c0be8571117998da37e151b99edc7..427a51f3bac26d42d249a8c3b29419a7c87cc862 100644 (file)
@@ -253,8 +253,10 @@ also be configured using a setup file.
 
   Specifies a username of a user (or, if openid is enabled, an openid) 
   who has the powers of a wiki admin. Currently allows locking of any page,
-  and [[banning|banned_users]] users; other powers may be added later.
-  May be specified multiple times for multiple admins.
+  and [[banning|banned_users]] users, as well as powers granted by
+  enabled plugins (such as [[moderating comments|plugins/moderatedcomments]] 
+  and [[plugins/websetup]]. May be specified multiple times for multiple
+  admins.
 
   For an openid user specify the full URL of the login, including "http://".
 
diff --git a/doc/users/acathur.mdwn b/doc/users/acathur.mdwn
new file mode 100644 (file)
index 0000000..fc3768e
--- /dev/null
@@ -0,0 +1,3 @@
+Today I finally managed to setup and use ikiwiki, the way I intended to, after thinking about it for 3 years or more!  
+This's to celebrate that, and to hopefuly contributing to ikiwiki in any possible way.  
+
diff --git a/doc/users/iustin.mdwn b/doc/users/iustin.mdwn
new file mode 100644 (file)
index 0000000..db8cae2
--- /dev/null
@@ -0,0 +1 @@
+I use ikiwiki to maintain my [personal blog](http://k1024.org/) and also for some private wikis. 
diff --git a/doc/users/ttw.mdwn b/doc/users/ttw.mdwn
new file mode 100644 (file)
index 0000000..03caad6
--- /dev/null
@@ -0,0 +1 @@
+n0gOoi3
index e82b59827c0c68c1ec2a9ce813fce1c367cfb995..3cdd71d1ad2ab62698b3a6285a65b3dc728bd5d9 100644 (file)
@@ -33,7 +33,7 @@
 <id><TMPL_VAR PAGEURL></id>
 </TMPL_IF>
 <subtitle type="html"><TMPL_VAR FEEDDESC ESCAPE=HTML></subtitle>
-<generator uri="http://ikiwiki.info/" version="<TMPL_VAR VERSION>">ikiwiki</generator>
+<generator uri="http://ikiwiki.info/">ikiwiki</generator>
 <updated><TMPL_VAR FEEDDATE></updated>
 <TMPL_VAR CONTENT>
 </feed>
diff --git a/underlays/attachment/ikiwiki/images/ui-bg_flat_0_aaaaaa_40x100.png b/underlays/attachment/ikiwiki/images/ui-bg_flat_0_aaaaaa_40x100.png
new file mode 100644 (file)
index 0000000..5b5dab2
Binary files /dev/null and b/underlays/attachment/ikiwiki/images/ui-bg_flat_0_aaaaaa_40x100.png differ
diff --git a/underlays/attachment/ikiwiki/images/ui-bg_glass_55_fbf9ee_1x400.png b/underlays/attachment/ikiwiki/images/ui-bg_glass_55_fbf9ee_1x400.png
new file mode 100644 (file)
index 0000000..ad3d634
Binary files /dev/null and b/underlays/attachment/ikiwiki/images/ui-bg_glass_55_fbf9ee_1x400.png differ
diff --git a/underlays/attachment/ikiwiki/images/ui-bg_glass_65_ffffff_1x400.png b/underlays/attachment/ikiwiki/images/ui-bg_glass_65_ffffff_1x400.png
new file mode 100644 (file)
index 0000000..42ccba2
Binary files /dev/null and b/underlays/attachment/ikiwiki/images/ui-bg_glass_65_ffffff_1x400.png differ
diff --git a/underlays/attachment/ikiwiki/images/ui-bg_glass_75_dadada_1x400.png b/underlays/attachment/ikiwiki/images/ui-bg_glass_75_dadada_1x400.png
new file mode 100644 (file)
index 0000000..5a46b47
Binary files /dev/null and b/underlays/attachment/ikiwiki/images/ui-bg_glass_75_dadada_1x400.png differ
diff --git a/underlays/attachment/ikiwiki/images/ui-bg_glass_95_fef1ec_1x400.png b/underlays/attachment/ikiwiki/images/ui-bg_glass_95_fef1ec_1x400.png
new file mode 100644 (file)
index 0000000..4443fdc
Binary files /dev/null and b/underlays/attachment/ikiwiki/images/ui-bg_glass_95_fef1ec_1x400.png differ
diff --git a/underlays/attachment/ikiwiki/images/ui-icons_2e83ff_256x240.png b/underlays/attachment/ikiwiki/images/ui-icons_2e83ff_256x240.png
new file mode 100644 (file)
index 0000000..45e8928
Binary files /dev/null and b/underlays/attachment/ikiwiki/images/ui-icons_2e83ff_256x240.png differ
diff --git a/underlays/attachment/ikiwiki/images/ui-icons_454545_256x240.png b/underlays/attachment/ikiwiki/images/ui-icons_454545_256x240.png
new file mode 100644 (file)
index 0000000..7ec70d1
Binary files /dev/null and b/underlays/attachment/ikiwiki/images/ui-icons_454545_256x240.png differ
diff --git a/underlays/attachment/ikiwiki/images/ui-icons_cd0a0a_256x240.png b/underlays/attachment/ikiwiki/images/ui-icons_cd0a0a_256x240.png
new file mode 100644 (file)
index 0000000..7930a55
Binary files /dev/null and b/underlays/attachment/ikiwiki/images/ui-icons_cd0a0a_256x240.png differ
diff --git a/underlays/osm/ikiwiki/images/osm.png b/underlays/osm/ikiwiki/images/osm.png
new file mode 100644 (file)
index 0000000..487bf00
Binary files /dev/null and b/underlays/osm/ikiwiki/images/osm.png differ
diff --git a/underlays/osm/ikiwiki/osm.js b/underlays/osm/ikiwiki/osm.js
new file mode 100644 (file)
index 0000000..7994c62
--- /dev/null
@@ -0,0 +1,128 @@
+// taken from http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
+var urlParams = {};
+(function () {
+       var e,
+       a = /\\+/g,  // Regex for replacing addition symbol with a space
+       r = /([^&=]+)=?([^&]*)/g,
+       d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
+       q = window.location.search.substring(1);
+
+       while (e = r.exec(q))
+       urlParams[d(e[1])] = d(e[2]);
+})();
+
+function mapsetup(divname, options) {
+       div = document.getElementById(divname);
+       if (options.fullscreen) {
+               permalink = 'permalink';
+               div.style.top = 0;
+               div.style.left = 0;
+               div.style.position = 'absolute';
+               div.style.width = '100%';
+               div.style.height = '100%';
+       }
+       else {
+               div.style.height = options.height;
+               div.style.width = options.width;
+               div.style.float = options.float;
+               permalink = {base: options.href, title: "View larger map"};
+       }
+       map = new OpenLayers.Map(divname, {
+               controls: [
+                       new OpenLayers.Control.Navigation(),
+                       new OpenLayers.Control.ScaleLine(),
+                       new OpenLayers.Control.Permalink(permalink)
+               ],
+               displayProjection: new OpenLayers.Projection("EPSG:4326"),
+               numZoomLevels: 18
+       });
+
+
+       map.addLayer(new OpenLayers.Layer.OSM());
+       if (options.format == 'CSV') {
+               pois = new OpenLayers.Layer.Text( "CSV",
+                       { location:"/" + options.map + "/pois.txt",
+                         projection: map.displayProjection
+                       });
+       } else if (options.format == 'GeoJSON') {
+               pois = new OpenLayers.Layer.Vector("GeoJSON", {
+                       protocol: new OpenLayers.Protocol.HTTP({
+                               url: "/" + options.map + "/pois.json",
+                               format: new OpenLayers.Format.GeoJSON()
+                       }),
+                       strategies: [new OpenLayers.Strategy.Fixed()]
+               });
+       } else {
+               pois = new OpenLayers.Layer.Vector("KML", {
+                       protocol: new OpenLayers.Protocol.HTTP({
+                               url: "/" + options.map + "/pois.kml",
+                               format: new OpenLayers.Format.KML({
+                                       extractStyles: true,
+                                       extractAttributes: true
+                               })
+                       }),
+               strategies: [new OpenLayers.Strategy.Fixed()]});
+       }
+       map.addLayer(pois);
+       select = new OpenLayers.Control.SelectFeature(pois);
+       map.addControl(select);
+       select.activate();
+
+       pois.events.on({
+               "featureselected": function (event) {
+                       var feature = event.feature;
+                       var content = '<h2><a href="' + feature.attributes.href + '">' +feature.attributes.name + "</a></h2>" + feature.attributes.description;
+                       popup = new OpenLayers.Popup.FramedCloud("chicken",
+                               feature.geometry.getBounds().getCenterLonLat(),
+                               new OpenLayers.Size(100,100),
+                               content,
+                               null, true, function () {select.unselectAll()});
+                       feature.popup = popup;
+                       map.addPopup(popup);
+               },
+               "featureunselected": function (event) {
+                       var feature = event.feature;
+                       if (feature.popup) {
+                               map.removePopup(feature.popup);
+                               feature.popup.destroy();
+                               delete feature.popup;
+                       }
+               }
+       });
+
+       if (options.editable) {
+               vlayer = new OpenLayers.Layer.Vector( "Editable" );
+               map.addControl(new OpenLayers.Control.EditingToolbar(vlayer));
+               map.addLayer(vlayer);
+       }
+
+       if (options.fullscreen) {
+               map.addControl(new OpenLayers.Control.PanZoomBar());
+               map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
+               map.addControl(new OpenLayers.Control.MousePosition());
+               map.addControl(new OpenLayers.Control.KeyboardDefaults());
+       } else {
+               map.addControl(new OpenLayers.Control.ZoomPanel());
+       }
+
+       //Set start centrepoint and zoom    
+       if (!options.lat || !options.lon) {
+               options.lat = urlParams['lat'];
+               options.lon = urlParams['lon'];
+       }
+       if (!options.zoom) {
+               options.zoom = urlParams['zoom'];
+       }
+       if (options.lat && options.lon) {
+               var lat = options.lat;
+               var lon = options.lon;
+               var zoom= options.zoom || 10;
+               center = new OpenLayers.LonLat( lon, lat ).transform(
+                       new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
+                       map.getProjectionObject() // to Spherical Mercator Projection
+               );
+               map.setCenter (center, zoom);
+       } else {
+               pois.events.register("loadend", this, function () { map.zoomToExtent(pois.getDataExtent()); });
+       }
+}