foo
[ikiwiki.git] / ikiwiki
diff --git a/ikiwiki b/ikiwiki
index a9f76d3fe6e7e7b64124064399cd41ce8d177707..00e204b97f698dd46d6efb18ed8fe28cc9667ee1 100755 (executable)
--- a/ikiwiki
+++ b/ikiwiki
@@ -597,7 +597,6 @@ sub cgi () {
                }
 
                my @page_locs;
-               my $default_loc="";
                my ($from)=$q->param('from')=~/$wiki_file_regexp/;
                if (! defined $from || ! length $from ||
                    $from ne $q->param('from') ||
@@ -605,14 +604,14 @@ sub cgi () {
                        @page_locs=$page;
                }
                else {
-                       @page_locs="$from/$page";
-                       $from=dirname($from);
-                       $default_loc="$from/$page";
-                       while (length $from) {
-                               push @page_locs, "$from/$page";
-                               $from=dirname($from);
+                       my $dir=$from."/";
+                       $dir=~s![^/]+/$!!;
+                       push @page_locs, $dir.$page;
+                       push @page_locs, "$from/$page";
+                       while (length $dir) {
+                               $dir=~s![^/]+/$!!;
+                               push @page_locs, $dir.$page;
                        }
-                       push @page_locs, $page;
                }
                
                $q->param("do", "save");
@@ -621,8 +620,8 @@ sub cgi () {
                      $q->h1("$wikiname: Creating $page"),
                      $q->start_form(-action => $action),
                      $q->hidden('do'),
-                     "Select page location: ($default_loc)",
-                     $q->popup_menu('page', \@page_locs, $default_loc),
+                     "Select page location:",
+                     $q->popup_menu('page', \@page_locs),
                      $q->textarea(-name => 'content',
                               -default => "",
                               -rows => 20,