]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Merge commit 'f8880cb670b0d1169559d04602fc543b1a6a061e' into sipb
authorAnders Kaseorg <andersk@mit.edu>
Fri, 31 Jan 2014 05:42:15 +0000 (00:42 -0500)
committerAnders Kaseorg <andersk@mit.edu>
Fri, 31 Jan 2014 05:42:15 +0000 (00:42 -0500)
Conflicts:
templates/page.tmpl

14 files changed:
IkiWiki/CGI.pm
IkiWiki/Plugin/git.pm
IkiWiki/Plugin/httpauth.pm
IkiWiki/Plugin/mdwn.pm
IkiWiki/Plugin/parentlinks.pm
IkiWiki/Plugin/toc.pm
IkiWiki/UserInfo.pm
IkiWiki/Wrapper.pm
README.SIPB [new file with mode: 0644]
TODO.SIPB [new file with mode: 0644]
doc/favicon.ico
po/Makefile
templates/editpage.tmpl
templates/page.tmpl

index 07369ac1076e748f8cd95e1aab5c2354a33877c8..d7c85ecb88c93b286cabe23ddb218c4f3fb48b68 100644 (file)
@@ -110,10 +110,14 @@ sub cgi_signin ($$) {
                template => {type => 'div'},
                stylesheet => baseurl()."style.css",
        );
-       my $buttons=["Login"];
-       
+       # MITLOGIN: These should be restored when logins are allowed again.
+       #my $buttons=["Login"];
+       my $buttons=[];
+
        if ($q->param("do") ne "signin" && !$form->submitted) {
-               $form->text(gettext("You need to log in first."));
+           #$form->text(gettext("You need to log in first."));
+               $form->text(
+                 "You must have an MIT personal certificate to edit");
        }
        $form->field(name => "do", type => "hidden", value => "signin",
                force => 1);
@@ -207,13 +211,16 @@ sub cgi_prefs ($$) {
                force => 1);
        $form->field(name => "sid", type => "hidden", value => $session->id,
                force => 1);
-       $form->field(name => "email", size => 50, fieldset => "preferences");
+            #$form->field(name => "email", size => 50, fieldset => "preferences");
+       $form->field(name => "realname", size => 50, fieldset => "preferences");
        
        my $user_name=$session->param("name");
 
        if (! $form->submitted) {
-               $form->field(name => "email", force => 1,
-                       value => userinfo_get($user_name, "email"));
+            #$form->field(name => "email", force => 1,
+            #value => userinfo_get($user_name, "email"));
+               $form->field(name => "realname", force => 1,
+                       value => userinfo_get($user_name, "realname"));
        }
        
        if ($form->submitted eq 'Logout') {
@@ -230,7 +237,10 @@ sub cgi_prefs ($$) {
                        userinfo_set($user_name, 'email', $form->field('email')) ||
                                error("failed to set email");
                }
-
+               if (defined $form->field('realname')) {
+                       userinfo_set($user_name, 'realname', $form->field('realname')) ||
+                               error("failed to set realname");
+                }
                $form->text(gettext("Preferences saved."));
        }
        
index aa402c04f4e461b9450a0192313de1dda8726f49..79162d14105f58c19a2490f88feba84a12fc56f0 100644 (file)
@@ -4,6 +4,7 @@ package IkiWiki::Plugin::git;
 use warnings;
 use strict;
 use IkiWiki;
+use IkiWiki::UserInfo;
 use Encode;
 use open qw{:utf8 :std};
 
@@ -477,8 +478,9 @@ sub rcs_commit_staged ($$$) {
        my %env=%ENV;
        if (defined $user || defined $ipaddr) {
                my $u=encode_utf8(defined $user ? $user : $ipaddr);
-               $ENV{GIT_AUTHOR_NAME}=$u;
-               $ENV{GIT_AUTHOR_EMAIL}="$u\@web";
+               # MITLOGIN This algorithm could be improved
+               $ENV{GIT_AUTHOR_NAME}=IkiWiki::userinfo_get($u, "realname");
+               $ENV{GIT_AUTHOR_EMAIL}="$u\@mit.edu";
        }
 
        $message = IkiWiki::possibly_foolish_untaint($message);
index 478f6744656f5bdbd4baa00f79cadb9a74ebd255..0bdc4a75423a4156f1312d2d20c3872c738d7514 100644 (file)
@@ -5,6 +5,7 @@ package IkiWiki::Plugin::httpauth;
 use warnings;
 use strict;
 use IkiWiki 3.00;
+use Data::Dumper;
 
 sub import {
        hook(type => "getsetup", id => "httpauth", call => \&getsetup);
@@ -53,7 +54,14 @@ sub auth ($$) {
        my $session=shift;
 
        if (defined $cgi->remote_user()) {
-               $session->param("name", $cgi->remote_user());
+               my $user = $cgi->remote_user();
+               $session->param("name", $user);
+               eval IkiWiki::possibly_foolish_untaint($ENV{SSL_CLIENT_S_DN_CN});
+               my $realname = IkiWiki::userinfo_get($user, "realname");
+               if ((!defined $realname || $realname eq "") &&
+                   defined $ENV{SSL_CLIENT_S_DN_CN}) {
+               IkiWiki::userinfo_set($user, "realname", $ENV{SSL_CLIENT_S_DN_CN});
+               }
        }
 }
 
index b892eabee29be50387fa493baafd5dbd6d1024a8..68765c6b8c0c71fb4a1d75992a51290522134d90 100644 (file)
@@ -52,7 +52,7 @@ sub htmlize (@) {
                }
                if (! defined $markdown_sub) {
                        eval q{use Text::Markdown};
-                       if (! $@) {
+                       if (1) {#! $@) {  # Text::Markdown throws this but works.  Shrug.
                                if (Text::Markdown->can('markdown')) {
                                        $markdown_sub=\&Text::Markdown::markdown;
                                }
index 432613ddfe92ff1b25d2069db246e49ed72a2222..d06954a4f344b00a6b9b7341d2ad214515a8e600 100644 (file)
@@ -40,10 +40,17 @@ sub parentlinks ($) {
 
        my @pagepath=(split("/", $page));
        my $pagedepth=@pagepath;
+
+       # The last element in @pagepath is the page itself, so punt that
+       # (These are /parent/ links, after all.)
+       pop @pagepath;
+
        foreach my $dir (@pagepath) {
                next if $dir eq 'index';
                $depth=$i;
                $height=($pagedepth - $depth);
+               $path.="/".$dir;
+               $title=pagetitle($dir);
                push @ret, {
                        url => urlto(bestlink($page, $path), $page),
                        page => $title,
@@ -52,8 +59,6 @@ sub parentlinks ($) {
                        "depth_$depth" => 1,
                        "height_$height" => 1,
                };
-               $path.="/".$dir;
-               $title=pagetitle($dir);
                $i++;
        }
        return @ret;
index ac07b9af6b860f0e5a36909197b4d98d0388fa41..1e888a82d0222a5814bdfe0aa86f75dc4a94c2f8 100644 (file)
@@ -29,6 +29,7 @@ sub preprocess (@) {
 
        if ($params{page} eq $params{destpage}) {
                $params{levels}=1 unless exists $params{levels};
+               $params{startlevel}=2 unless exists $params{startlevel};
 
   &