%#============================================================================ %# 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.3 $ %# $Date: 2003/04/24 05:36:52 $ %# $Header: /home/cvsroot/ePortal/comp_root/catalog/groups.htm,v 3.3 2003/04/24 05:36:52 ras Exp $ %# %#---------------------------------------------------------------------------- <& SELF:drawGroupRing, group => $ARGS{group} &> <& SELF:drawGroupsTable, group => $ARGS{group} &> %#=== @metags drawGroupRing ==================================================== <%method drawGroupRing><%perl> # # Draw current depth of grups # my $group = $ARGS{group}; my $HTML; my $G = new ePortal::Catalog; my $current_group = $group; my $group_memo = undef; while( $G->restore($current_group) ) { if ($HTML) { # second or more item $HTML = CGI::a({-href => href("/catalog/index.htm", group => $G->id)}, $G->Title) . " > " . $HTML; } else { # First group object. Last (rightmost) item in the ring $HTML = '' . $G->Title . ''; $group_memo = $G->Memo; } $current_group = $G->parent_id; } if ($group) { # if some subgroups present $HTML = CGI::a({-href => href("/catalog/index.htm", group => undef)}, "Начало каталога") . " > " . $HTML; } else { $HTML = '' . pick_lang( rus => "Разделы каталога", eng => "Catalog groups") . ''; } # output HTML % if ($group_memo) { % }
<% $HTML %> <%perl> $G->restore($group); if ( $G->xacl_check_insert ) { <% plink(pick_lang( rus => "Создать новый раздел", eng => "New group here"), href => href("/catalog/group_edit.htm", parent_id => $group)) %> % }
<% $group_memo |h %>
%#=== @metags drawGroupsTable ==================================================== <%method drawGroupsTable><%perl> my $group = $ARGS{group}; my $COLUMNS = 3; # Number of columns per page # Prefetch all groups my $catalog = new ePortal::Catalog; $catalog->restore_where(parent_id => $group, recordtype => "group", skip_attributes => [qw/text/]); my @CA = (); while($catalog->restore_next) { my $data = $catalog->data; $data->{xacl_write} = $catalog->xacl_check_update; $data->{private} = $catalog->xacl_read ne 'everyone'; my $records = $catalog->Records; $data->{Records} = $records ? "($records)" : undef; push @CA, $data } undef $catalog; <%perl> # Show groups foreach my $row (0 .. scalar(@CA)) { last if ! $CA[$row*$COLUMNS]; # end of data # Start new row my $row_bgcolor = $row % 2 == 0? '#FFFFFF' : '#eeeeee'; $m->out(""); foreach my $column (0 .. 2) { $catalog = $CA[$row * $COLUMNS + $column]; # No more groups to show. Exit or show "Add new" if (!$catalog) { # just empty cell $m->out(''); next; } # Look for subgroups my $subgroups = new ePortal::Catalog; $subgroups->restore_where(parent_id => $catalog->{id}, recordtype => "group"); # Draw a cell !!! % } # end of foreach my $column %} # end of foreach my $row
  <% $catalog->{private} ? img(src=> "/images/ePortal/private.gif") : undef %> <% $catalog->{title} %> <% $catalog->{Records} %> % if ($catalog->{xacl_write}) { <% icon_tool("GroupMenu", $catalog->{id}) %> % }
<%perl> my $subgroups_found = 0; foreach (1..3) { last if ! $subgroups->restore_next; $subgroups_found ++; <% $subgroups->Title %>, % } % if ($subgroups_found) { $m->print('...') }