[ 新規 ] [ 検索 | 一覧 | FrontPage ] [ 履歴 (RSS) | 差分履歴 (RSS) ] [ ログイン ]
【PR】Amazon | SL-C3000 | SL-C1000(3/18発売!) | SL-C860 | SL-6000W | SL-6000L | SL-6000N

WalWiki/カスタマイズ/FrontPageを更新履歴に表示

差分表示


編集前の状態に戻します。
frontpage.txtを使用している場合でもFrontPageを更新履歴に表示できるようにします。

* [add frontpage.txt to recentchanges]

** 関連するカスタマイズ

-[[WalWiki/カスタマイズ/汎用サブルーチン]] の format_time()
-[[WalWiki/カスタマイズ/履歴ページに月毎の見出し表示]]

** グローバル変数定義

$add_frontpage_to_recentchanges = 0;にすると更新履歴に含まれなくなります。

 my $add_frontpage_to_recentchanges = 1;                     # yakty add [add frontpage.txt to recentchanges]

** %page_commandへの追加

 my %page_command = (
     $IndexPage => 'index',
     $SearchPage => 'searchform',
     $CreatePage => 'create',
     $RssPage => 'rss',
     $AdminChangePassword => 'adminchangepasswordform',
     $FrontPage => 'FrontPage',
     $RecentChanges => 'recent',                             # yakty add [modify recentpage]
 );

** %command_doへの追加

 my %command_do = (
     read => \&do_read,
     edit => \&do_edit,
     adminedit => \&do_adminedit,
     adminchangepasswordform => \&do_adminchangepasswordform,
     adminchangepassword => \&do_adminchangepassword,
     write => \&do_write,
     index => \&do_index,
     searchform => \&do_searchform,
     search => \&do_search,
     create => \&do_create,
     createresult => \&do_createresult,
     FrontPage => \&do_FrontPage,
     comment => \&do_comment,
     rss => \&do_rss,
     diff => \&do_diff,
     interwikibox => \&do_interwiki_box, # Walrus add [InterWikiBox]
     recent => \&do_recent,                                  # yakty add [modify recentpage]
 );

** do_recent()追加

 # yakty add [modify recentpage] start
 sub do_recent {
     &update_recent_changes if($add_frontpage_to_recentchanges);       # yakty add [add frontpage.txt to recentchanges]
     &print_header($RecentChanges);
     my $content = $database{$RecentChanges};
     #my %check;
     #$content =~ s/^- (\d\d\d\d-\d\d)/($check{$1}++ ? $& : qq(*$1\n$&))/gme;
     &print_content($content);
     &print_footer($RecentChanges);
 }
 # yakty add [modify recentpage] end

** get_frontpage_update()追加

 # yakty add [add frontpage.txt to recentchanges] start
 sub get_frontpage_update {
     my $update;
     my $ctime = (stat($file_FrontPage))[9];
     if($ctime > &get_info($RecentChanges, $info_LastModified)){
         $update = "- @{[&format_time(gmtime($ctime + $modifier_time_offset))]} @{[&armor_name($FrontPage)]} - frontpage.txt";
     }
     return $update;
 }
 # yakty add [add frontpage.txt to recentchanges] end

** update_recent_changes()内の変更

 sub update_recent_changes {
     # yakty add [add frontpage.txt to recentchanges]
     my $frontpageupdate = ($add_frontpage_to_recentchanges) ? &get_frontpage_update : '';
     return if($form{mypage} eq $RecentChanges and length($frontpageupdate) == 0);
     # yakty add [add frontpage.txt to recentchanges]

-2003-08-08 (Fri) 09:14:44 ちょっと足りなかったので追加

     foreach (@oldupdates) {
         /^\- \d\d\d\d\-\d\d\-\d\d \(...\) \d\d:\d\d:\d\d (\S+)/;    # date format.
         my $name = &unarmor_name($1);
         if (&is_exist_page($name) and ($name ne $form{mypage})) {
             push(@updates, $_);
         #}  # yakty del [add frontpage.txt to recentchanges]
         # yakty add [add frontpage.txt to recentchanges] start
         } elsif($name eq $FrontPage and length($frontpageupdate) == 0){
             push(@updates, $_);
         }
         # yakty add [add frontpage.txt to recentchanges] end
     }
     # yakty add [add frontpage.txt to recentchanges] start
     if($frontpageupdate and $form{mypage} ne $FrontPage){
         unshift(@updates, $frontpageupdate);
     }
     # yakty add [add frontpage.txt to recentchanges] end
     # if (&is_exist_page($form{mypage})) {                                   # yakty del [add frontpage.txt to recentchanges]
     if(&is_exist_page($form{mypage}) and $form{mypage} ne $RecentChanges){   # yakty add [add frontpage.txt to recentchanges]
         unshift(@updates, $update);
     }
     splice(@updates, $maxrecent + 1);

     # Walrus mod [write softly] end
     if ($file_touch) {
         open(FILE, "> $file_touch");
 #       print FILE localtime() . "\n";                                # Walrus del [gmtime offset]
         print FILE gmtime(time + $modifier_time_offset) . "\n";       # Walrus add [gmtime offset]
         close(FILE);
     }
     &set_info($RecentChanges, $info_LastModified, time);              # yakty add [add frontpage.txt to recentchanges]
 }


02529