%#============================================================================ %# ePortal - WEB Based daily organizer %# Author - S.Rusakov %# %# Copyright (c) 2001 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. %# %# $Revision: 3.2 $ %# $Date: 2003/04/24 05:36:52 $ %# $Header: /home/cvsroot/ePortal/comp_root/catalog/links.htm,v 3.2 2003/04/24 05:36:52 ras Exp $ %# %#---------------------------------------------------------------------------- %# Parameters: %# group= display this group %# %#---------------------------------------------------------------------------- <%perl> my $html_ring = $m->scomp('SELF:drawRing', group => $ARGS{group}); my $html_links = $m->scomp('SELF:drawLinks', group => $ARGS{group}); # Show Links section if a link exists or user may add new link # $links_count is initialized by drawLinks method if ( $links_count or $ePortal->isAdmin ) { $m->print($html_ring); $m->print($html_links); } %#=== @metags drawRing ==================================================== <%method drawRing>
<% pick_lang(rus => "Ресурсы", eng => "Resources") %> <& SELF:drawAddLink, group => $ARGS{group} &>
%#=== @metags drawLinks ==================================================== <%method drawLinks> % my $group = $ARGS{group}; <%perl> $links_count = 0; my $catalog = new ePortal::Catalog; $catalog->restore_where(parent_id => $group, # skip text column to avoid large traffic from SQL server skip_attributes => ['text'], recordtype => "not in('group')"); while($catalog->restore_next) { $links_count ++; $m->comp("SELF:drawLink", link => $catalog); } undef $catalog;
% if ($links_count == 0) {
<% img(src=> "/images/ePortal/item.gif") %> <% pick_lang( rus => "Нет ни одного ресурса в этом разделе.", eng => 'There is no resources in this group.' ) %>
% }

%#=== @metags drawAddLink ==================================================== <%method drawAddLink><%perl> # Create dummy Catalog object with parent of current group my $dummy = new ePortal::Catalog; $dummy->parent_id( $ARGS{group} ); if ($dummy->xacl_check_insert) { <% plink(pick_lang( rus => "Добавить ресурс", eng => "New resource"), href => href("/catalog/link_edit_type.htm", parent_id => $ARGS{group})) %> % } %#=== @metags drawLink ==================================================== %# drawLink draws a link information inside a %# It recognizes all types of RecordType of Catalog and draws accordingly %# <%method drawLink><%perl> my $link = $ARGS{link}; my $highlight = $ARGS{highlight}; my $link_Title = $link->Title; my $link_URL = $link->URL; my $link_Memo = $link->Memo; my $link_BeforeTitle = undef; if ( $highlight ) { use locale; $link_Title =~ s/($highlight)/$1<\/span>/i; $link_URL =~ s/($highlight)/$1<\/span>/i; $link_Memo =~ s/($highlight)/$1<\/span>/i; } my $linkImage = undef; if ( $link->xacl_read eq 'everyone' ) { $linkImage = '/images/ePortal/item.gif'; } else { $linkImage = '/images/ePortal/private.gif'; } if ( $link->RecordType eq 'group' ) { $linkImage = '/images/icons/icoFolder.gif'; $link_BeforeTitle = pick_lang(rus => 'Раздел: ', eng => 'Group: '); } elsif ( $link->RecordType eq 'file' ) { if ( $link->Filename =~ /\.doc$/i ) { $linkImage = '/images/icons/word.gif'; } elsif ( $link->Filename =~ /\.xl[sw]?$/i ) { $linkImage = '/images/icons/excel.gif'; } elsif ( $link->Filename =~ /\.pdf$/i ) { $linkImage = '/images/icons/areader.gif'; } $link_BeforeTitle = pick_lang(rus => 'Файл: ', eng => 'File: '); $link_URL = $link->Filename; $link_URL = undef if $link_Title eq $link_URL; } elsif ($link->RecordType =~ /^text/) { # $link_URL = pick_lang(rus => 'Текст', eng => 'Text') . ' ' . length($link->Text); } <% img(src=> $linkImage) %> <% $link_BeforeTitle %><% $link_Title %> % if ($link_URL) { - <% $link_URL %> % } % if ($link->RecordType eq 'file') { <% plink(pick_lang(rus => 'Сохранить', eng => 'Download'), -href => href('download.htm/' . $link->Filename, link => $link->id, todisk => 1)) %> % } % if ($link->xacl_check_update) { <% icon_tool('LinkMenu', $link->id) %> % } % if ($link_Memo) {
<% $link_Memo %> % } %#=== @METAGS once ========================================================= <%once> my $links_count = 0;