]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
authorJoey Hess <joey@gnu.kitenet.net>
Sat, 20 Dec 2008 23:07:45 +0000 (18:07 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Sat, 20 Dec 2008 23:07:45 +0000 (18:07 -0500)
IkiWiki/Plugin/comments.pm
doc/tips/using_the_web_interface_with_a_real_text_editor.mdwn
doc/users/weakishjiang.mdwn
doc/wikiicons/anonymous.png [new file with mode: 0644]
doc/wikiicons/openid.png [new file with mode: 0644]
doc/wikiicons/signedin.png [new file with mode: 0644]
templates/comment.tmpl
templates/page.tmpl

index c50729a34cfe431cbac062a57c63174991db4ec5..4f3b76db3dcb09850c607436632b1887af4f19c6 100644 (file)
@@ -151,11 +151,28 @@ sub preprocess {
        my $commentip;
        my $commentauthor;
        my $commentauthorurl;
+       my $commentopenid;
 
        if (defined $params{username}) {
                $commentuser = $params{username};
-               ($commentauthorurl, $commentauthor) =
-                       linkuser($params{username});
+
+               my $oiduser = eval { IkiWiki::openiduser($commentuser) };
+
+               if (defined $oiduser) {
+                       # looks like an OpenID
+                       $commentauthorurl = $commentuser;
+                       $commentauthor = $oiduser;
+                       $commentopenid = $commentuser;
+               }
+               else {
+                       $commentauthorurl = IkiWiki::cgiurl(
+                               do => 'commenter',
+                               page => (length $config{userdir}
+                                       ? "$config{userdir}/$commentuser"
+                                       : "$commentuser"));
+
+                       $commentauthor = $commentuser;
+               }
        }
        else {
                if (defined $params{ip}) {
@@ -165,6 +182,7 @@ sub preprocess {
        }
 
        $pagestate{$page}{comments}{commentuser} = $commentuser;
+       $pagestate{$page}{comments}{commentopenid} = $commentopenid;
        $pagestate{$page}{comments}{commentip} = $commentip;
        $pagestate{$page}{comments}{commentauthor} = $commentauthor;
        $pagestate{$page}{comments}{commentauthorurl} = $commentauthorurl;
@@ -236,27 +254,6 @@ sub linkcgi ($) {
        }
 }
 
-# FIXME: basically the same logic as recentchanges
-# returns (author URL, pretty-printed version)
-sub linkuser ($) {
-       my $user = shift;
-       my $oiduser = eval { IkiWiki::openiduser($user) };
-
-       if (defined $oiduser) {
-               return ($user, $oiduser);
-       }
-       # FIXME: it'd be good to avoid having such a link for anonymous
-       # posts
-       else {
-               return (IkiWiki::cgiurl(
-                               do => 'commenter',
-                               page => (length $config{userdir}
-                                       ? "$config{userdir}/$user"
-                                       : "$user")
-                       ), $user);
-       }
-}
-
 # Mostly cargo-culted from IkiWiki::plugin::editpage
 sub sessioncgi ($$) {
        my $cgi=shift;
@@ -551,9 +548,9 @@ sub pagetemplate (@) {
                }
 
                if ($shown && commentsopen($page)) {
-                       my $commenturl = IkiWiki::cgiurl(do => 'comment',
+                       my $addcommenturl = IkiWiki::cgiurl(do => 'comment',
                                page => $page);
-                       $template->param(commenturl => $commenturl);
+                       $template->param(addcommenturl => $addcommenturl);
                }
        }
 
@@ -576,6 +573,11 @@ sub pagetemplate (@) {
                        $pagestate{$page}{comments}{commentuser});
        }
 
+       if ($template->query(name => 'commentopenid')) {
+               $template->param(commentopenid =>
+                       $pagestate{$page}{comments}{commentopenid});
+       }
+
        if ($template->query(name => 'commentip')) {
                $template->param(commentip =>
                        $pagestate{$page}{comments}{commentip});
index 1c9ecdc8cc56ef0b06157893d4bbeb9b1988b2d4..cf9327395bcde7ab38fea3d02df3b9aa65610e5d 100644 (file)
@@ -5,4 +5,9 @@ areas.  This allows you to edit ikiwiki pages with a real text editor through
 the ikiwiki web interface, rather than only with direct commit 
 access. --[[JoshTriplett]] 
 
-For Firefox or Iceweasel users, the vimperator extension is also a good idea.  You can press Ctrl-I in the insert mode of vimperator and switch to an external editor, e.g. Vim. --[[WeakishJiang]]
+For Firefox or Iceweasel users, the vimperator extension is also a good
+idea.  You can press Ctrl-I in the insert mode of vimperator and switch to
+an external editor, e.g. Vim. --[[WeakishJiang]]
+
+Finally, with wikis configured to allow, [[untrusted_git_push]], you can
+ditch the browser altogether. --[[Joey]] 
index 68296af2b94ad0210007a1ccd9942baacfa434ce..0cafb4653b1069a41be64cca7b1784a7a5633aae 100644 (file)
@@ -1 +1,4 @@
 [My blog](http://millenniumdark.blog.ubuntu.org.cn)
+
+> So, you're learning haskell. You know, I want to add support for haskell
+> external plugins to ikiwiki.. :-) --[[Joey]] 
diff --git a/doc/wikiicons/anonymous.png b/doc/wikiicons/anonymous.png
new file mode 100644 (file)
index 0000000..df22152
Binary files /dev/null and b/doc/wikiicons/anonymous.png differ
diff --git a/doc/wikiicons/openid.png b/doc/wikiicons/openid.png
new file mode 100644 (file)
index 0000000..c5535c3
Binary files /dev/null and b/doc/wikiicons/openid.png differ
diff --git a/doc/wikiicons/signedin.png b/doc/wikiicons/signedin.png
new file mode 100644 (file)
index 0000000..969908d
Binary files /dev/null and b/doc/wikiicons/signedin.png differ
index 19698cd3352c3575b0412cd9c3ae87ed45087108..2fb54fe7d2f1c2d9c26f1d296a6a25101da6b93b 100644 (file)
@@ -2,27 +2,44 @@
 
 <div class="comment-header">
 Posted by
+
 <TMPL_IF NAME="COMMENTUSER">
 <span class="author">
+<TMPL_IF NAME="COMMENTOPENID">
+
+<img src="/wikiicons/openid.png" width="20" height="15" alt="[OpenID]"
+    title="Signed in with OpenID" />
+<a href="<TMPL_VAR NAME=COMMENTOPENID>"><TMPL_VAR NAME=COMMENTAUTHOR></a>
+
+<TMPL_ELSE>
+
+<img src="/wikiicons/signedin.png" width="15" height="15" alt="[Signed in]"
+    title="Signed in directly" />
 <TMPL_IF NAME="COMMENTAUTHORURL">
 <a href="<TMPL_VAR NAME=COMMENTAUTHORURL>"><TMPL_VAR NAME=COMMENTAUTHOR></a>
 <TMPL_ELSE>
-<TMPL_VAR NAME=AUTHOR>
+<TMPL_VAR NAME=COMMENTAUTHOR>
+</TMPL_IF>
+
 </TMPL_IF>
 </span>
-<TMPL_ELSE>
+
+<TMPL_ELSE><!-- !COMMENTUSER -->
+
 <TMPL_IF NAME=COMMENTIP>
-<span class="author">
-<TMPL_VAR NAME=COMMENTIP>
-</span>
+<span class="author" title="Unauthenticated, from <TMPL_VAR NAME=COMMENTIP>">
+<TMPL_ELSE><!-- !COMMENTIP -->
+<span class="author" title="Unauthenticated, from unknown IP address">
+</TMPL_IF>
+<img src="/wikiicons/anonymous.png" width="15" height="15" alt="[Unauthenticated]" />
+<TMPL_IF NAME="AUTHORURL">
+<a href="<TMPL_VAR NAME=AUTHORURL>"><TMPL_VAR NAME=AUTHOR></a>
 <TMPL_ELSE>
-unknown IP address
+<TMPL_VAR NAME=AUTHOR>
 </TMPL_IF>
+</span>
 
-<TMPL_IF NAME=AUTHOR>
-(<span class="claimedauthor"><TMPL_IF NAME="AUTHORURL"><a href="<TMPL_VAR NAME=AUTHORURL>"><TMPL_VAR NAME=AUTHOR></a><TMPL_ELSE><TMPL_VAR NAME=AUTHOR></TMPL_IF></span>)
-</TMPL_IF>
-</TMPL_IF>
+</TMPL_IF><!-- !COMMENTUSER -->
 
 (<TMPL_VAR CTIME>)
 </div>
index 21abc979dc71f66d9ac3aa886a2e2b44e14429b7..f75491127bfd33a921c97bbc1177f48d11874282 100644 (file)
 <TMPL_IF COMMENTS>
 <div id="comments">
 <TMPL_VAR COMMENTS>
-<TMPL_UNLESS COMMENTURL>
-<div class="addcomment">Comments on this page are closed.</div>
-</TMPL_UNLESS>
-<TMPL_IF COMMENTURL>
+<TMPL_IF ADDCOMMENTURL>
 <div class="addcomment">
-<a href="<TMPL_VAR COMMENTURL>">Add a comment</a>
+<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>