%#============================================================================ %# 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. %# %# %#---------------------------------------------------------------------------- <& /message.mc &>
<% pick_lang( rus => "Подписка на форум даст Вам возможность получать по электронной почте уведомления о новых сообщениях на форуме", eng => "Subscribe to receive by e-mail a notification about new messages on the forum") %>
% if (! $ePortal->username) { <& SELF:not_registered &> % } else { <& SELF:currently_subscribed &>

<& SELF:subscribe, forum_id => $ARGS{forum_id} &> % }

<% plink( pick_lang( rus => "Вернуться к списку форумов", eng => "Back to forums"), href => "index.htm") %>
%#=== @metags onStartRequest ==================================================== <%method onStartRequest><%perl> $app = $ePortal->Application('MsgForum'); if ( $ePortal->username and $ARGS{subscribe_id} ) { my $f = new ePortal::App::MsgForum::MsgForum; if ( $f->restore($ARGS{subscribe_id}) ) { $app->Subscribe($ePortal->username, $f->id ); $session{GoodMessage} = pick_lang( rus => "Вы подписаны на форум: ".$f->Title, eng => "You are subscribed to forum: ".$f->Title); } } if ( $ePortal->username and $ARGS{unsubscribe_id} ) { my $f = new ePortal::App::MsgForum::MsgForum; if ( $f->restore($ARGS{unsubscribe_id}) ) { $app->Unsubscribe($ePortal->username, $f->id ); $session{GoodMessage} = pick_lang( rus => "Вы отписаны от форума: ".$f->Title, eng => "You are unsubscribed from forum: ".$f->Title); } } %#=== @METAGS attr ========================================================= <%attr> Title => {rus => "Подписка на форум", eng => "Subscribe to forum"} %#=== @metags once ========================================================= <%once> my ($app); %#=== @metags cleanup ========================================================= <%cleanup> ($app) = (); %#=== @METAGS not_registered ==================================================== <%method not_registered> <& /message.mc, ErrorMessage => pick_lang( rus => "Для оформления подписки необходимо зарегистрироваться ...", eng => "Subscription is available only for registered users") &> %#=== @METAGS currently_subscribed ==================================================== <%method currently_subscribed> <%perl> my $st = $app->ForumsSubscribed($ePortal->username); $st->restore_where(); % if (! $st->restore_next) { % } % while( $st->forum_id ) { % last if ! $st->restore_next; }
<% pick_lang( rus => 'Текущее состояние подписки', eng => 'Currently subscribed') %>:
<% pick_lang(rus => "Ничего не подписано", eng => "No subscription") %>
<% $st->Title |h %> · · ·  <% plink( pick_lang(rus => "Отписаться", eng => "Unsubscribe"), -href => href('subscribe.htm', unsubscribe_id=> $st->forum_id)) %>
%#=== @metags subscribe ==================================================== <%method subscribe><%perl> my $forum_id = $ARGS{forum_id}; my $forum = new ePortal::App::MsgForum::MsgForum; my ($forums_id, $forums_title) = $forum->restore_all_hash('id', 'title');
<% pick_lang( rus => 'Подписка на форум', eng => 'Subscribe to forum') %>:
<% CGI::popup_menu({ -name => 'subscribe_id', -values => $forums_id, -labels => $forums_title, -default => $forum_id, -class => 'gldfield' }) %> <% CGI::submit( -name => 'subscribe', -class => 'dlgbutton', -value => pick_lang(rus => "Подписаться", eng => "Subscribe")) %>