foo
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 11 Mar 2006 02:14:46 +0000 (02:14 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 11 Mar 2006 02:14:46 +0000 (02:14 +0000)
ikiwiki

diff --git a/ikiwiki b/ikiwiki
index 444d6f4a3c51a8ab916e1deeac9e6c0301d0cabb..9e22d1dbcc34bd8d6d78b3886a65ede79c691b52 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");
@@ -622,9 +621,7 @@ sub cgi () {
                      $q->start_form(-action => $action),
                      $q->hidden('do'),
                      "Select page location:",
-                     $q->popup_menu(-name => 'page',
-                              -values => \@page_locs,
-                              -default => $default_loc),
+                     $q->popup_menu('page', \@page_locs),
                      $q->textarea(-name => 'content',
                               -default => "",
                               -rows => 20,