foo
[ikiwiki.git] / ikiwiki
diff --git a/ikiwiki b/ikiwiki
index b57611b668c0d939ba4c7d8f64d5d7844677ff77..d64a3417a5fca6827a1c6d7c4eb234dee18d1e23 100755 (executable)
--- a/ikiwiki
+++ b/ikiwiki
@@ -350,10 +350,16 @@ sub rcs_commit ($) {
        }
 }
 
-sub rcs_ad ($) {
+sub rcs_add ($) {
        my $file=shift;
 
        if (-d "$srcdir/.svn") {
+               my $parent=dirname($file);
+               while (! -d "$srcdir/$parent/.svn") {
+                       $file=$parent;
+                       $parent=dirname($file);
+               }
+               
                if (system("svn", "add", "--quiet", $file) != 0) {
                        warn("svn add failed\n");
                }
@@ -597,7 +603,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,13 +610,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";
+                       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,7 +627,7 @@ sub cgi () {
                      $q->start_form(-action => $action),
                      $q->hidden('do'),
                      "Select page location:",
-                     $q->popup_menu('page', \@page_locs, $default_loc),
+                     $q->popup_menu('page', \@page_locs),
                      $q->textarea(-name => 'content',
                               -default => "",
                               -rows => 20,