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);
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') {
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."));
}
use warnings;
use strict;
use IkiWiki;
+use IkiWiki::UserInfo;
use Encode;
use open qw{:utf8 :std};
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);
use warnings;
use strict;
use IkiWiki 3.00;
+use Data::Dumper;
sub import {
hook(type => "getsetup", id => "httpauth", call => \&getsetup);
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});
+ }
}
}
}
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;
}
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,
"depth_$depth" => 1,
"height_$height" => 1,
};
- $path.="/".$dir;
- $title=pagetitle($dir);
$i++;
}
return @ret;
if ($params{page} eq $params{destpage}) {
$params{levels}=1 unless exists $params{levels};
+ $params{startlevel}=2 unless exists $params{startlevel};
# It's too early to generate the toc here, so just record the
# info.
if (! defined $userinfo ||
! exists $userinfo->{$user} || ! ref $userinfo->{$user} ||
! exists $userinfo->{$user}->{$field}) {
+ if ($field eq "realname" && defined $ENV{SSL_CLIENT_S_DN_CN}) {
+ userinfo_set($user, "realname", $ENV{SSL_CLIENT_S_DN_CN});
+ return $ENV{SSL_CLIENT_S_DN_CN};
+ }
return "";
}
+ if ($field eq "realname" && $userinfo->{$user}->{$field} eq "" &&
+ defined $ENV{SSL_CLIENT_S_DN_CN}) {
+ userinfo_set($user, "realname", $ENV{SSL_CLIENT_S_DN_CN});
+ return $ENV{SSL_CLIENT_S_DN_CN};
+ }
return $userinfo->{$user}->{$field};
}
my @envsave;
push @envsave, qw{REMOTE_ADDR QUERY_STRING REQUEST_METHOD REQUEST_URI
CONTENT_TYPE CONTENT_LENGTH GATEWAY_INTERFACE
- HTTP_COOKIE REMOTE_USER HTTPS REDIRECT_STATUS
+ HTTP_COOKIE REMOTE_USER HTTPS SSL_CLIENT_S_DN_CN REDIRECT_STATUS
REDIRECT_URL} if $config{cgi};
my $envsave="";
foreach my $var (@envsave) {
#translators: The parameter is a C filename.
error(sprintf(gettext("failed to compile %s"), "$wrapper.c"));
}
- unlink("$wrapper.c");
if (defined $config{wrappergroup}) {
my $gid=(getgrnam($config{wrappergroup}))[2];
if (! defined $gid) {
--- /dev/null
+README for SIPB maintainers
+
+Basic instructions on scripts of interest. Also,
+How this repository is set up, and how to keep IkiWiki up to date.
+
+
+Setup:
+
+There are three branches of interest: remotes/origin/master, master
+and sipb. remotes/origin/master is the remote branch we are tracking;
+all upstream changes show up in this branch when we `git fetch`.
+
+master is our "awaiting upstream approval" branch, based off of
+remotes/origin/master. Any patches in this branch should be immediately
+suitable for submission to IkiWiki maintainers/. Ideally, this branch
+should be equivalent to remotes/origin/master.
+
+sipb is our live branch. It contains all of the ugly hacks and custom
+modifications that we needed to make our website run. Ideally, this
+branch is equivalent to master. Don't expect it to be without a lot
+of rearchitecting and upstream cooperation.
+
+
+Keeping up to date:
+
+XXX: This is what we'd do in our original clone of upstream.
+ How do we do this now that we have our own internal repo to clone?
+
+This two-tiered setup means that you will need to rebase twice in order
+to propagate changes; possibly once if master == origin/master. Your
+commands will look like this:
+
+$ git checkout master
+$ git pull --rebase
+$ git checkout sipb
+$ git rebase master
+
+TODO: Make a script that does this.
+
+
+Scripts:
+
+The source repository has a hook that automatically deploys changes when
+you push to it. If bad things happen, however, there are two scripts of
+interest:
+
+~/bin/reinstall-ikiwiki
+ This script runs make and make install, reinstalling the source files to
+ make it live.
+
+~/bin/update-ikiwiki
+ This script recompiles the website from its source directory
+ ikiwiki/src into the live wiki directory web_scripts/wiki.
+
+Normally, these don't need to be run.
+
--- /dev/null
+Todo list
+
+* Presently, we only allow certificate'ed logins to edit the wiki. Eventually,
+ we will want to allow for some passworded users. When this happens, several
+ considerations must be taken:
+
+ * Unless user accounts are made on a case-by-case basis manually by
+ SIPB members (which should definitely be considered), there must be
+ anti-spam measures in the registration process.
+
+ * Certain files had hacks added to them. They are marked by MITLOGIN
+
POFILES=$(wildcard *.po)
MOFILES=$(POFILES:.po=.mo)
-# Translated underlays can only be generated if po4a is available.
-TRANSLATED_UNDERLAYS=$(shell if perl -e 'use Locale::Po4a::Common' 2>/dev/null; then echo ../underlays/locale; fi)
-
-all: ikiwiki.pot mo $(TRANSLATED_UNDERLAYS)
+all: ikiwiki.pot mo
mo: $(MOFILES)
install: all
- # Normal mo files for program translation.
for file in $(MOFILES); do \
lang=`echo $$file | sed 's/\.mo//'`; \
install -d $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/; \
install -m 0644 $$file $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/ikiwiki.mo; \
done
-
- # Underlay translation via po files that go in special per-language
- # underlays.
- for file in `cd underlays && find . -type f -name \*.po`; do \
- lang=`echo $$file | sed -e 's/.po$$//' -e 's/.*\\.//'`; \
- dir=`dirname "$(DESTDIR)$(PREFIX)/share/ikiwiki/po/$$lang/$$file"`; \
- install -d $$dir; \
- install -m 0644 underlays/$$file $$dir; \
- done
ikiwiki.pot: $(POTFILES)
@if perl -e '($$ver)=`xgettext -V | head -n 1`=~/.*\s+([0-9]+\.[0-9]+)/; die "gettext $$ver too old, not updating the pot file\n" if $$ver < 0.16'; then \
fi
clean:
- rm -f $(MOFILES) messages messages.mo *_stamp
- rm -rf html underlays/.ikiwiki $(TRANSLATED_UNDERLAYS)
- find underlays -name \*.mdwn -or -name \*.pot | xargs rm -f
+ rm -f $(MOFILES) messages messages.mo
%.mo: %.po
msgfmt -o $@ $<
printf "$$lang: "; \
msgfmt -o /dev/null -c -v --statistics $$lang.po;\
done
-
-underlays_copy_stamp:
- # copy all the files we want to translate into a srcdir
- for file in `cd ..; find underlays -follow -name \*.mdwn`; do \
- install -d $$(dirname $$file); \
- cp -aL ../$$file $$file 2>/dev/null || \
- install -m 644 ../$$file $$file; \
- done
- install -d underlays/directives/ikiwiki/directive
- for file in `cd ..; find doc/ikiwiki/directive/ -maxdepth 1 -type f`; do \
- cp -a ../$$file underlays/directives/ikiwiki/directive || \
- install -m 644 ../$$file underlays/directives/ikiwiki/directive; \
- done
- install -d underlays/empty
- touch $@
-
-underlays: ../ikiwiki.out underlays_copy_stamp
- ../ikiwiki.out -libdir .. -setup underlay.setup -refresh
-
-../ikiwiki.out: ../Makefile
- make -C .. ikiwiki.out
-
-../Makefile: ../Makefile.PL
- cd .. && ./Makefile.PL
-
-$(TRANSLATED_UNDERLAYS): po2wiki_stamp
-po2wiki_stamp: po2wiki underlays_copy_stamp
- PERL5LIB=.. ./po2wiki underlay.setup
- touch $@
-
-.PHONY: underlays
</table>
</div>
</TMPL_IF>
+<div class="license">
+ <p>By submitting content to this wiki, you agree to release your work under
+ the dual license of</p>
+ <ul>
+ <li>the Creative Commons Attribution-Share Alike license, and</li>
+ <li>the GNU Free Documentation License, with no Invariant Sections, no
+ Front-Cover Texts, and no Back-Cover-Texts.</li>
+ </ul>
+</div>
<TMPL_VAR FORM-END>
<TMPL_VAR WMD_PREVIEW>
<TMPL_IF HTML5><!DOCTYPE html>
-<html>
+<html lang="en">
<TMPL_ELSE><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
</TMPL_IF>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-Control" content="must-revalidate" />
<title><TMPL_VAR TITLE></title>
-<TMPL_IF NAME="FAVICON">
-<link rel="icon" href="<TMPL_VAR BASEURL><TMPL_VAR FAVICON>" type="image/x-icon" />
-</TMPL_IF>
-<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
-<TMPL_IF NAME="LOCAL_CSS">
-<link rel="stylesheet" href="<TMPL_VAR BASEURL><TMPL_VAR LOCAL_CSS>" type="text/css" />
-<TMPL_ELSE>
-<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.css" type="text/css" />
-</TMPL_IF>
+<meta http-equiv="Content-Style-Type" content="text/css" />
+<meta name="robots" content="all" />
+<meta name="author" content="SIPB" />
+<meta name="description" content="MIT Student Information Processing Board" />
+<meta name="keywords" content="SIPB, MIT, hackers" />
+<link rel="stylesheet" type="text/css" href="<TMPL_VAR BASEURL>style.css" />
<TMPL_IF NAME="EDITURL">
<link rel="alternate" type="application/x-wiki" title="Edit this page" href="<TMPL_VAR EDITURL>" />
</TMPL_IF>
</head>
<body>
-<div class="pageheader">
-<div class="header">
-<span>
-<span class="parentlinks">
+<div id="content-block">
+
+<div id="logo">
+<a href="<TMPL_VAR BASEURL>./"><img src="<TMPL_VAR BASEURL>images/grumpyfuzzball_half.png" alt="grumpy fuzzball" /></a>
+<a href="<TMPL_VAR BASEURL>./"><img src="<TMPL_VAR BASEURL>images/SIPBlogo.png" alt="MIT Student Information Processing Board" id="sipb-logo" /></a>
+<div id="hidden-title"><h1>SIPB: MIT Student Information Processing Board</h1></div>
+</div>
+
+<ul id="navigation">
+<li class="first-navbox">
+<a href="<TMPL_VAR BASEURL>projects/"><span>Projects</span></a>
+</li>
+<li class="second-navbox">
+<a href="<TMPL_VAR BASEURL>doc/"><span>Docs</span></a>
+</li>
+<li class="third-navbox">
+<a href="<TMPL_VAR BASEURL>office/"><span>Office</span></a>
+</li>
+<li class="fourth-navbox">
+<a href="<TMPL_VAR BASEURL>join/"><span>Join</span></a>
+</li>
+</ul>
+
+<h1><TMPL_VAR TITLE></h1>
+
+<TMPL_IF NAME="PARENTLINKS">
+<div id="breadcrumbs">
+<ul>
<TMPL_LOOP NAME="PARENTLINKS">
-<a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a>/
+<li><a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a>»</li>
</TMPL_LOOP>
-</span>
-<span class="title">
-<TMPL_VAR TITLE>
-<TMPL_IF NAME="ISTRANSLATION">
- (<TMPL_VAR NAME="PERCENTTRANSLATED">%)
-</TMPL_IF>
-</span>
-</span><!--.header-->
-<TMPL_IF NAME="SEARCHFORM">
-<TMPL_VAR SEARCHFORM>
+</ul>
+<br style="clear:both;" />
+</div>
</TMPL_IF>
+
+<div id="featured-block" class="<TMPL_UNLESS NAME="PARENTLINKS">is-top</TMPL_UNLESS>">
+<TMPL_VAR CONTENT>
</div>
+<div id="prefooter"></div>
+
+</div>
+
+<div id="footer">
+
<TMPL_IF NAME="HAVE_ACTIONS">
<div class="actions">
<ul>
</div>
</TMPL_IF>
-<TMPL_IF NAME="OTHERLANGUAGES">
-<div id="otherlanguages">
-<ul>
-<TMPL_LOOP NAME="OTHERLANGUAGES">
-<li>
-<a href="<TMPL_VAR NAME="URL">"><TMPL_VAR NAME="LANGUAGE"></a>
-<TMPL_IF NAME="MASTER">
-(master)
-<TMPL_ELSE>
- (<TMPL_VAR NAME="PERCENT">%)
-</TMPL_IF>
-</li>
-</TMPL_LOOP>
-</ul>
-</div> <!-- #otherlanguages -->
-</TMPL_IF>
-
-</div> <!-- .pageheader -->
-
-<TMPL_IF SIDEBAR>
-<div class="sidebar">
-<TMPL_VAR SIDEBAR>
-</div>
-</TMPL_IF>
-
-<div id="content">
-<TMPL_VAR CONTENT>
-</div>
-
-<TMPL_IF COMMENTS>
-<div id="comments">
-<TMPL_VAR COMMENTS>
-<TMPL_IF ADDCOMMENTURL>
-<div class="addcomment">
-<a href="<TMPL_VAR ADDCOMMENTURL>">Add a comment</a>
-</div>
-<TMPL_ELSE>
-<div class="addcomment">Comments on this page are closed.</div>
-</TMPL_IF>
-</div>
-</TMPL_IF>
-
-<div id="footer" class="pagefooter">
-<div id="pageinfo">
-
-<TMPL_IF NAME="TAGS">
-<div class="tags">
-Tags:
-<TMPL_LOOP NAME="TAGS">
-<TMPL_VAR LINK>
-</TMPL_LOOP>
-</div>
-</TMPL_IF>
-
-<TMPL_IF NAME="BACKLINKS">
-<div id="backlinks">
-Links:
-<TMPL_LOOP NAME="BACKLINKS">
-<a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a>
-</TMPL_LOOP>
-<TMPL_IF NAME="MORE_BACKLINKS">
-<span class="popup">...
-<span class="balloon">
-<TMPL_LOOP NAME="MORE_BACKLINKS">
-<a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a>
-</TMPL_LOOP>
-</span>
-</span>
-</TMPL_IF>
-</div><!-- #backlinks -->
-</TMPL_IF>
-
-<TMPL_IF COPYRIGHT>
-<div class="pagecopyright">
-<a name="pagecopyright"></a>
-<TMPL_VAR COPYRIGHT>
-</div>
-</TMPL_IF>
-
-<TMPL_IF LICENSE>
-<div class="pagelicense">
-<a name="pagelicense"></a>
-License: <TMPL_VAR LICENSE>
-</div>
-</TMPL_IF>
+<p>© 2009 Student Information Processing Board</p>
+<p>Unless otherwise specified, all content on this wiki is released under a dual license of the Creative Commons Attribution-Share Alike license, and the GNU Free Documentation License, with no Invariant Sections, no Front-Cover Texts, and no Back-Cover-Texts.<br />
+ This follows the SIPB Documentation Licensing Recommendation.</p>
-<div class="pagedate">
-Last edited <TMPL_VAR MTIME>
-<!-- Created <TMPL_VAR CTIME> -->
</div>
-</div><!-- #pageinfo -->
-<TMPL_IF EXTRAFOOTER><TMPL_VAR EXTRAFOOTER></TMPL_IF>
-<!-- from <TMPL_VAR WIKINAME> -->
-</div><!-- .pagefooter #footer -->
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try {
+var pageTracker = _gat._getTracker("UA-15235584-1");
+pageTracker._trackPageview();
+} catch(err) {}</script>
</body>
</html>