The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
%#============================================================================
%# ePortal - WEB Based daily organizer
%# Author - S.Rusakov <rusakov_sa@users.sourceforge.net>
%#
%# Copyright (c) 2000-2004 Sergey Rusakov.  All rights reserved.
%# This program is open source software
%#
%#
%#----------------------------------------------------------------------------
%# Parameters:
%#   link - ID of ePortal::Catalog object to download
%#   todisk - true to force "Save as" dialog
%#----------------------------------------------------------------------------
<& /message.mc &>
<% plink(pick_lang(rus => "Âåðíóòüñÿ â êàòàëîã", eng => "Back to Catalogue"),
  -href => href("index.htm", group => $c->parent_id)) %>
<p>
<% $body %>
<p>
<% plink(pick_lang(rus => "Âåðíóòüñÿ â êàòàëîã", eng => "Back to Catalogue"),
  -href => href("index.htm", group => $c->parent_id)) %>
<p>

%#=== @metags onStartRequest ====================================================
<%method onStartRequest><%perl>
  $link = $ARGS{link};
  if ( $link ) {
    $c = new ePortal::Catalog;
    if ( ! $c->restore($link) ) {
      $session{ErrorMessage} = pick_lang(
        rus => "Óêàçàííûé ðåñóðñ íå íàéäåí", eng => "Resource not found");
      return;
    }

    if ( $c->RecordType eq 'textHTML' ) {
      $body = filter_html(' ' . $c->Text);
    } elsif ( $c->RecordType eq 'textpara' ) {
      $body = $c->Text;
      $body =~ s/\r?\n\r?\n/<p>\n/g;
    } elsif ( $c->RecordType eq 'textline' ) {
      $body = $c->Text;
      $body =~ s/\r?\n/<p>\n/g;
    } elsif ( $c->RecordType eq 'text' ) {
      $body = "\n<PRE>\n" . $c->Text . "\n</PRE>\n";
    } else {
      die "Unknown RecordType";
    }

  }
</%perl></%method>

%#=== @METAGS once =========================================================
<%once>
my ($link, $c, $body) = ();
</%once>