package Wlnews::top_mente; use strict; my $VERSION=1.00; =head1 NAME Wlnews::top_mente - トップページ(編集用)を表示 =head1 Property Property: proc - プロセス管理オブジェクト cfg - 環境設定オブジェクト imode - 携帯端末用テンプレートファイルの添え字 =head1 Methods =head2 new() モード実行用オブジェクトを作成 =cut sub new{ my $class=shift; my $proc=shift; my $self={ proc=>$proc, cfg=>$proc->{cfg}, imode=>undef, }; bless $self,$class; $self->{imode}=$self->{proc}->{ua}?'_i':undef;#携帯端末用 return $self; } =head2 run 実行処理 =cut sub run{ my $self=shift; #管理者権限の確認(ユーザ権限) $self->{proc}->mes(mes=>'ユーザ権限がありません。',title=>'エラー') unless ($self->{proc}->{admin} eq "user"); #環境設定をロード my $path=$self->{proc}->{path}; #テンプレートオブジェクトを作成 my $tmpl=Dtmpl->new( tmplfile=>$path->{tmpl}."top_mente$self->{imode}.html", codefile=>$path->{tmpl}."top_mente$self->{imode}.pl", global_vars=>['F_id'],#ユーザID ); #初期化設定 $self->{proc}->tmpl_ini($tmpl); #フォームデータを"F_"付きでテンプレートにセットする #フォーム値の修正 $self->{proc}->{FORM}->{method}="" if($self->{proc}->{FORM}->{method} ne "AND" && $self->{proc}->{FORM}->{method} ne "OR"); $tmpl->head_insert_param("F_",$self->{proc}->{FORM}); #ログ管理オブジェクトの作成 my $Log=YLog->new( file=>$self->{proc}->{path}->{log}."d_$self->{proc}->{FORM}->{id}.cgi", param=>$self->{cfg}->get('format'), page=>$self->{proc}->{FORM}->{page} || 1, hyouji=>$self->{proc}->{hyouji}, ); #検索処理 my $search_method=[]; #グループ検索 if($self->{proc}->{FORM}->{group}){ push(@{$search_method},$Log->kt(',',param=>'group',word=>$self->{proc}->{FORM}->{group})); } #ワード検索 if($self->{proc}->{FORM}->{word}){ my @words=split(/ /,$self->{proc}->{FORM}->{word}); push(@{$search_method},$Log->word($self->{proc}->{FORM}->{method},@words)); } #テンプレートにログ表示と目次表示を設定 my $autolink=$self->{cfg}->get('base','autolink')?['mes']:undef; my $sort=$self->{cfg}->get('hyouji','sort')?"new":"old"; $Log->set_tmpl( tmpl=>$tmpl, search=>$search_method, form=>$self->{proc}->{FORM}, type=>'form', sort=>$sort, ); #タグと自動リンクの処理 my $tag=$self->{cfg}->get('base','tag'); my $autolink=$self->{cfg}->get('base','autolink'); my $regex=$self->{proc}->get_regex; if($tag || $autolink){ my $log_ref=$tmpl->get_param('log'); foreach my $i(0 .. $#{$log_ref}){ if($tag){ $log_ref->[$i]->{mes}=~s/>/>/g; $log_ref->[$i]->{mes}=~s/</[$i]->{mes}=~s/"/"/g; $log_ref->[$i]->{mes}=~s/&/&/g; } if($autolink){ $log_ref->[$i]->{mes}=~s{$regex->{url}}{$1$2}go; $log_ref->[$i]->{mes}=~s{$regex->{mail}}{$1}go; } } } #グループリストを作成 my $group_list=[]; foreach my $name(@{$self->{cfg}->get('group')}){ push(@{$group_list},{name=>$name}); } $tmpl->param(group_list=>$group_list); #ページを表示する $self->{proc}->print_header; print $tmpl->output; return 1; } 1; #EOF