OSDN Git Service

editlogプラグインが有効な場合は履歴に編集したユーザ名を表示するようにした。
authortakezoe <takezoe@users.osdn.me>
Sun, 3 Jul 2011 09:18:40 +0000 (09:18 +0000)
committertakezoe <takezoe@users.osdn.me>
Sun, 3 Jul 2011 09:18:40 +0000 (09:18 +0000)
plugin/core/Diff.pm

index b9aadfc..1f1577e 100644 (file)
@@ -82,6 +82,23 @@ sub show_history {
                return "ÍúÎò¤Ï¤¢¤ê¤Þ¤»¤ó¡£";
        }
        
+       # editlog¥×¥é¥°¥¤¥ó¤Î¥í¥°¤«¤éÊÔ½¸¼Ô¤Î¥æ¡¼¥¶Ì¾¤ò¼èÆÀ
+       my $editlog = {};
+       if($wiki->config('log_dir') ne "" && -e $wiki->config('log_dir')."/useredit.log"){
+               open(DATA,$wiki->config('log_dir')."/useredit.log") or die $!;
+               while(<DATA>){
+                       my($date, $time, $unixtime, $action, $subject, $id) = split(" ",$_);
+                       if($subject eq $pagename){
+                               if($id eq ''){
+                                       $editlog->{$unixtime} = 'anonymous';
+                               } else {
+                                       $editlog->{$unixtime} = $id;
+                               }
+                       }
+               }
+               close(DATA);
+       }
+       
        foreach my $time (@list){
                $buf .= "<li>";
                if($count == 0){
@@ -91,9 +108,14 @@ sub show_history {
                        $buf .= "<input type=\"radio\" name=\"from\" value=\"".($#list-$count+1)."\">".
                                "<input type=\"radio\" name=\"to\" value=\"".($#list-$count+1)."\">";
                }
-               $buf .= "<a href=\"".$wiki->create_url({ action=>"DIFF",page=>$pagename,generation=>($#list-$count) })."\">".&Util::escapeHTML($time).
-                       "</a>¡¡<a href=\"".$wiki->create_url({ action=>"SOURCE",page=>$pagename,generation=>($#list-$count) })."\">¥½¡¼¥¹</a>".
-                       "</li>\n";
+               $buf .= "<a href=\"".$wiki->create_url({ action=>"DIFF",page=>$pagename,generation=>($#list-$count) })."\">".&Util::format_date($time).
+                       "</a> <a href=\"".$wiki->create_url({ action=>"SOURCE",page=>$pagename,generation=>($#list-$count) })."\">¥½¡¼¥¹</a>";
+                       
+               if(defined($editlog->{$time})){
+                       $buf .= " by ".$editlog->{$time};
+               }
+               
+               $buf .=  "</li>\n";
                $count++;
        }
        return $buf."</ul>".