%#============================================================================ %# 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. %# %# %#---------------------------------------------------------------------------- %#=== @METAGS onStartRequest ==================================================== <%method onStartRequest><%perl> $PV = new ePortal::PageView; # # Нам могут передать значение нового PageView по умолчанию. # Если оно правильное и сохранилось успешно, то восстанавливаем этот PV # $PV->SetDefaultPageView($ARGS{pv}) if $ARGS{pv}; $PV->restore(); return $PV->handle_request(); %#=== @METAGS body ==================================================== % my @width = $PV->ColumnsWidthPercent; <& /message.mc &> <& .PageViewList &> <& /pv/admin_section.mc &> % for(my $i=1; $i <= $PV->ColumnsCount; $i++) { % if ($i != $PV->ColumnsCount ) { # Разделитель колонок <% empty_td( width => 5 ) %> % } % } # end of for()
<& .ColumnContent, column => $i &>
<& .SetupSection &> % undef $PV; %# ===== END OF INDEX.HTM ==================================================== %#=== @METAGS PageViewList =================================================== <%def .PageViewList><%perl> my @PVlist; # Сюда будем засовывать все доступные юзеру PageView в виде # (ID, название) . ИД=0 если это текущий PV my $pv = new ePortal::PageView; # Админ может кроме своих страниц также видеть шаблоны и страницу по умолчанию for my $i (1..2) { $pv->restore_all_for_user if $i == 1; $pv->restore_all_templates if $i == 2; my $suffix; while($pv->restore_next) { if ($ePortal->isAdmin) { $suffix = " (U)" if $pv->pvtype eq "user"; $suffix = " (D)" if $pv->pvtype eq "default"; $suffix = " (T)" if $pv->pvtype eq "template"; } if ($PV->id == $pv->id) { push @PVlist, 0, $pv->Title . $suffix; } else { push @PVlist, $pv->id, $pv->Title . $suffix; } } last unless ($ePortal->isAdmin and $ePortal->UserConfig("ShowTemplates")); } return if scalar @PVlist == 0;
<%perl> $m->out(" · "); while (scalar @PVlist) { my $id = shift @PVlist; my $title = shift @PVlist; if ($id == 0) { $m->out("<<$title>> ·"); } else { $m->out(CGI::a( {-href=>href($ENV{SCRIPT_NAME}, pv => $id)}, $title ) . " ·"); } } $m->out("
"); %#=== @METAGS attr ========================================================= <%attr> Title => {rus => "Домашняя страница", eng => "Home page"} FullPage => 1 %#=== @METAGS ColumnContent ==================================================== <%def .ColumnContent><%perl> my $column = $ARGS{column}; my $S = $PV->get_UserSection($column); while($S->restore_next) { $m->comp(".Section", section => $S); } %#=== @METAGS Section ==================================================== <%def .Section><%perl> my $section = $ARGS{section}; my $dlg = new ePortal::HTML::Dialog; my $content = $section->content; return if ! $content; <% $dlg->dialog_start( formname => undef, title => $section->title, title_url => $section->URL, objid => $section->id, $PV->xacl_check_update ? ( $section->minimized ? (max_button => 1) : (min_button => 1), $section->setup_button() ? (edit_button => => href("/pv/setup.htm", us => $section->id)) : (), ) : (), x_button => $section->cancel_button(), ) %> % if ( not $section->minimized ) { <% $dlg->row( $content, -align => "left" ) %> % } <% $dlg->dialog_end %> % undef $dlg; <% empty_table(height => 5) %> %#=== @metags SetupSection ==================================================== <%def .SetupSection><%perl> my @width = $PV->ColumnsWidthPercent; my $dlg = new ePortal::HTML::Dialog; <% $dlg->dialog_start( title => pick_lang(rus => "Настройка домашней страницы", eng => "Home page setup"), title_url => "/pv/pvhelp.htm", q_button => "/pv/pvhelp.htm", formname => undef, x_button => 0, width => "100%" ) %> % if ($PV->xacl_check_update) { <% pick_lang( rus => "Добавление нового раздела на свою домашнюю страницу:", eng => "Add new section to personal home page:") %> %foreach my $column (1 .. $PV->ColumnsCount) { % if ($column != $PV->ColumnsCount ) { <% empty_td( width => 5 ) %> % } %} # end of foreach column
% my ($values, $labels) = $PV->AvailableSections($column); <% CGI::popup_menu( -name => "ps", -labels => $labels, -values => $values) %> <% CGI::submit( -name => "submit", -value => "+", -title => pick_lang(rus => "Добавить раздел", eng => "Add section")) %> <% CGI::hidden( -name => "colnum", -value => $column) %> <% CGI::hidden( -name => "addsection", -value => 1) %>

<% plink({rus => "Изменить название страницы", eng => "Edit home page options"}, href=> href("/pv/pv_edit.htm", objid => $PV->id)) %> <% plink({rus => "Удалить эту страницу", eng => "Delete this home page"}, href => href("/index.htm", deletepv => $PV->id)) %> % if ($ePortal->isAdmin) { <% plink({rus => "Настройка секций", eng => "Sections setup"}, href => "/pv/ps_list.htm") %> % } % } <% $dlg->dialog_end %> % undef $dlg; <% empty_table(height => 10) %> %#=== @metags once ========================================================= <%once> our ($PV);