%#============================================================================ %# ePortal - WEB Based daily organizer %# Author - S.Rusakov %# %# Copyright (c) 2000-2003 Sergey Rusakov. All rights reserved. %# This program is free software; you can redistribute it %# and/or modify it under the same terms as Perl itself. %# %# %#---------------------------------------------------------------------------- %# Parameters: %# msg_id - start of topic or any message inside the topic %# start - [0..xxx] number of first reply to show (pages) %# days - get topics for days on newer %#---------------------------------------------------------------------------- <& navigator.mc, forum => $forum, message => $message &> <% pick_lang(rus => "Тема обсуждения", eng => "The subject") %> <% $message->Title |h %> %# %# Форма поиска %#
<% CGI::hidden({-name => 'msg_id', -value => $message->id}) %> <% pick_lang(rus => 'Показать сообщения за последние', eng => 'Show messages for last') %> <% CGI::textfield({-name => "days", -value => $ARGS{days} || 30, -size => 3}) %> <% pick_lang(rus => 'дней', eng => 'days') %> <% CGI::submit({-value => '>>'}) %>
%# %# Сообщения %# <% empty_tr( black=>1, height => 1, colspan => 2) %> %# %# Инициатор топика %# <& SELF:message, topic => 1, message => $message, bgcolor => '#FDEEFF' &> %# %# Если надо, то предыдущие сообщения %# % if ($ARGS{start} > 0) { <& SELF:show_next_prev, prev => 1, start => $ARGS{start} - $messages_per_page &> % } %# %# Ответы %# % my $messages=0; % while(++$messages <= $messages_per_page and $replies->restore_next) { <& SELF:message, message => $replies &> % } %# %# Следующие сообщения %# % if ($replies->restore_next) { <& SELF:show_next_prev, next => 1, start => $ARGS{start} + $messages_per_page &> % }
%# %# Форма ответа %# % if ( $forum->xacl_check('xacl_reply') ) {

<& /message.mc &> <% $dlg->dialog_start( width => 500, title => pick_lang( rus => "Ответ на сообщение", eng => "Reply to message")) %> % foreach (qw/msg_id days start/) { <% CGI::hidden({-name => $_, -value => $ARGS{$_}}) %> % } <% $dlg->field("forum_id", hidden => 1) %> <% $dlg->field("prev_id", hidden => 1) %> <% $dlg->field("title", RO => 1) %> <% $dlg->row(pick_lang({rus => 'Иконка', eng => 'Icon'}), $m->scomp('compose.htm:icons', obj => $dlg->{obj})) %> <% $dlg->row('


') %> <% $dlg->field("body", vertical => 1) %> <% $dlg->row($m->scomp('compose.htm:smiles')) %> <% $dlg->buttons(cancel_button => 0) %> % $dlg->{focus} = undef; <% $dlg->dialog_end %> <& compose.htm:javascript &>

% } %#=== @metags init ========================================================= <%method onStartRequest><%perl> $ARGS{start} = 0 if $ARGS{start} <= 0; $msg_id = $ARGS{msg_id}; $forum = new ePortal::App::MsgForum::MsgForum; $message = new ePortal::App::MsgForum::MsgItem; $replies = new ePortal::App::MsgForum::MsgItem; $app = $ePortal->Application('MsgForum'); while(1) { if (!$message->restore($msg_id)) { return "message_not_found.htm"; } if ( $message->prev_id) { $msg_id = $message->prev_id; next; } last; } if (!$forum->restore( $message->forum_id )) { return "forum_not_found.htm"; } # # Dialog for new reply # if ( $forum->xacl_check('xacl_reply') ) { my $newmessage = new ePortal::App::MsgForum::MsgItem; $newmessage->forum_id( $forum->id ); $newmessage->prev_id( $message->id); $newmessage->Title( $message->Title ); $dlg = new ePortal::HTML::Dialog( obj => $newmessage, method => 'GET' ); my $location = try { $dlg->handle_request( ); } catch ePortal::Exception::DataNotValid with { my $E = shift; $session{ErrorMessage} = $E->text; ''; }; } # Get new topics my $days_where; if ( $ARGS{days} > 0) { $ARGS{days} *= 1; $days_where = "(msgdate >= subdate(current_date, interval $ARGS{days} day))"; } # # restore replies # $replies->restore_where( where => $days_where, limit_rows => $messages_per_page +1, limit_offset => $ARGS{start}*1, prev_id => $message->id, order_by => "msgdate desc"); %#=== @METAGS Title ==================================================== <%method Title><%perl> return $message->Title; %#=== @metags once ========================================================= <%once> my $messages_per_page = 20; my ($app, $list, $obj, $search_object, $dlg); my ($forum, $message, $replies, $msg_id); %#=== @metags cleanup ========================================================= <%cleanup> ($app, $list, $obj, $search_object, $dlg) = (); ($forum, $message, $replies, $msg_id)=(); %#=== @METAGS message ==================================================== <%method message><%perl> my $msg = $ARGS{message}; my $topic = $ARGS{topic}; my $bgcolor = $ARGS{bgcolor} || $topic ? '#FDEEFF' : '#FDFFDD'; % if ($msg->picture) { <% img(src=> '/images/MsgForum/msg/'. $msg->picture . '.gif') %> % } else { <% img(src=> "/images/MsgForum/msg.gif") %> % } Написал:
<% $msg->htmlValue('FromUser') %>
<% $msg->msgdate %>
% if ( $ePortal->isAdmin ) { [<% $msg->useraddress %>]
% } % if ($topic and $msg->TitleURL) { % }
<& /htmlify.mc, content => $msg->Body, highlightreply => 1, allowsmiles => 1, allowphtml => 1, class=> 'smallfont' &>
<% plink({rus => "Ссылка по теме", eng => "Link"}, -href => $msg->titleurl) %>
<%perl> my $att = $msg->Attachment; if ( $att ) { <% plink(pick_lang(rus => "Загрузить ", eng => "Download ").$att->filename, -href => $att->download_href(download => 1)) %> <%perl> } % if ($forum->xacl_check('xacl_reply')) { <% plink(pick_lang(rus => "Ответить", eng => "Reply"), -href => href("compose.htm", prev_id => $message->id, reply_to=> $msg->id)) %> % } % if ($forum->xacl_check('xacl_edit')) { <% plink(pick_lang(rus => "Правка", eng => "Edit"), -href => href("compose.htm", objid => $msg->id)) %> % } % if ($forum->xacl_check('xacl_delete')) { <% plink(pick_lang(rus => "Удалить", eng => "Delete"), -href => href("/delete.htm", objid => $msg->id, objtype => ref($msg), done => $msg->prev_id? undef : href("/forum/topics.htm", forum_id => $forum->id))) %> % }
% if ($topic) { <% pick_lang(rus => "Ответы на данную тему (более свежие ответы идут первыми):", eng => "Replies to this topic (newest are going first):") %> % } <% empty_tr( black=>1, height => 1, colspan => 2) %> %#=== @metags show_next_prev ==================================================== <%method show_next_prev> % $ARGS{start} = 0 if $ARGS{start} <= 0; % if ($ARGS{prev}) { <% '<<<' |h %> $message->id, start => $ARGS{start}) %>"> <% pick_lang(rus => 'Показать предыдущие сообщения', eng => 'Show prev messages') %> <% '<<<' |h %> % } % if ($ARGS{next}) { <% '>>>' |h %> $message->id, start => $ARGS{start}) %>"> <% pick_lang(rus => 'Показать следующие сообщения', eng => 'Show next messages') %> <% '>>>' |h %> % }