foo
[ikiwiki.git] / ikiwiki
diff --git a/ikiwiki b/ikiwiki
index 6cbaf8972a461e68751b75698b4b92b666a74b8f..6ff0b1e8ab90c9ef44244e322c4d2bd6427f446c 100755 (executable)
--- a/ikiwiki
+++ b/ikiwiki
@@ -350,11 +350,17 @@ sub rcs_commit ($) {
        }
 }
 
-sub rcs_ad ($) {
+sub rcs_add ($) {
        my $file=shift;
 
        if (-d "$srcdir/.svn") {
-               if (system("svn", "add", "--quiet", $file) != 0) {
+               my $parent=dirname($file);
+               while (! -d "$srcdir/$parent/.svn") {
+                       $file=$parent;
+                       $parent=dirname($file);
+               }
+               
+               if (system("svn", "add", "--quiet", "$srcdir/$file") != 0) {
                        warn("svn add failed\n");
                }
        }
@@ -585,6 +591,7 @@ sub cgi () {
            $page=~/$wiki_file_prune_regexp/ || $page=~/^\//) {
                error("bad page name");
        }
+       $page=lc($page);
        
        my $action=$q->request_uri;
        $action=~s/\?.*//;
@@ -596,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') ||
@@ -604,13 +610,13 @@ sub cgi () {
                        @page_locs=$page;
                }
                else {
-                       @page_locs="$from/$page";
-                       $from=dirname($from);
+                       my $dir=$from."/";
+                       $dir=~s![^/]+/$!!;
+                       push @page_locs, $dir.$page;
                        push @page_locs, "$from/$page";
-                       $default_loc="$from/$page";
-                       while (length $from) {
-                               $from=dirname($from);
-                               push @page_locs, "$from/$page";
+                       while (length $dir) {
+                               $dir=~s![^/]+/$!!;
+                               push @page_locs, $dir.$page;
                        }
                }
                
@@ -620,13 +626,14 @@ sub cgi () {
                      $q->h1("$wikiname: Creating $page"),
                      $q->start_form(-action => $action),
                      $q->hidden('do'),
-                     $q->popup_menu('page', \@page_locs, $default_loc),
+                     "Select page location:",
+                     $q->popup_menu('page', \@page_locs),
                      $q->textarea(-name => 'content',
                               -default => "",
                               -rows => 20,
                               -columns => 80),
                      $q->br,
-                     "Optional comment about this change",
+                     "Optional comment about this change:",
                      $q->br,
                      $q->textfield(-name => "comments", -size => 80),
                      $q->br,
@@ -652,7 +659,7 @@ sub cgi () {
                               -rows => 20,
                               -columns => 80),
                      $q->br,
-                     "Optional comment about this change",
+                     "Optional comment about this change:",
                      $q->br,
                      $q->textfield(-name => "comments", -size => 80),
                      $q->br,