%#============================================================================ %# 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/mostpopular.htm,v 3.2 2003/04/24 05:36:52 ras Exp $ %# %#---------------------------------------------------------------------------- <%perl> my $config = $m->comp('SELF:config_object'); my $d = new ePortal::HTML::Dialog( title => pick_lang( rus => "Популярные ресурсы", eng => "Most popular"), formname => '', width => $config->ctlg_mp_width, edit_button => $ePortal->isAdmin ? 'mostpopular_edit.htm' : undef, ); <% $d->dialog_start %> <% $d->row( $m->scomp('SELF:drawLinks', count => $config->ctlg_mp_count)) %> <% $d->row( ''. pick_lang( rus => "В скобках указано кол-во обращений к ресурсу", eng => "Click count is in brackets"). '', -align => "left") %> <% $d->dialog_end %> %#=== @metags drawLinks ==================================================== <%method drawLinks> <%perl> my $links_count = 0; my $catalog = new ePortal::Catalog; $catalog->restore_where( recordtype => "link", order_by => "clicks DESC", skip_attributes => [qw/text/], limit_rows => $ARGS{count}); 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 drawLink ==================================================== <%method drawLink><%perl> my $link = $ARGS{link}; return if $link->Clicks == 0; my $parent = $link->parent; my $razdel; $razdel = pick_lang(rus => "Раздел:", eng => "Section:") . $parent->Title . "\n" if $parent; <% img(src=> "/images/ePortal/item.gif") %> <% $link->Title %> (<% $link->Clicks %>) %#=== @metags config_object ==================================================== <%method config_object><%perl> my $config = new ePortal::ThePersistent::UserConfig; $config->add_attribute(ctlg_mp_count => { # Number of links to show in most popular dtype => 'Number', label => {rus => 'Кол-во ссылок для показа', eng => 'Number of links to show'}}); $config->add_attribute(ctlg_mp_width => { # Width of the dialog dtype => 'Number', label => {rus => 'Ширина окна,пикс.', eng => 'Width of the window,px'}}); $config->restore; if ( $config->ctlg_mp_count < 5 ) { $config->ctlg_mp_count(10); $config->update; } if ($config->ctlg_mp_width < 50) { $config->ctlg_mp_width(200); $config->update; } return $config;