The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

ePortal::PageView - Custom home page of ePortal.

SYNOPSIS

There are 3 types of PageView:

  • user - personal home page of a registered user

  • default - only one PageView may be default. This is default home page of a site

  • template - There may be many templates. Administrator may restrict access to these pages;

METHODS

ColumnsCount()

Return a number of columns in the current PageView.

ColumnsWidthPercent()

Returns array of numbers with width in percent of PageView's columns. Narrow column counts as 1, wide column - as 2. For two-column PageView (N:W) result would be (33,66).

Note: The percent sign is not included after numbers.

AvailableSections(column_number)

Returns array (\@values, \%labels) with available sections for addition to the column. References returned are ready to pass to CGI::popup_menu(...)

column_number is number of desired column in PageView.

get_UserSection($column)

Does restore_where(for the column) on ePortal::UserSection object.

If $column is undef then all UserSection (for all columns) are selected. This is the same as call to children().

Returns ePortal::UserSection object ready to restore_next().

CopyFrom($template_id)

Copy PageView object from denoted by $template_id to current one. The pvtype attribute is changed to 'user'. Also copies all daughter UserSection objects.

Returns: 1 on success.

ePortal::PageSection object

ePortal::PageSection package is used to implement a single section on a home page with a dialog box around it.

Customization of a PageSection is available with a corresponding HTML::Mason component file. Some predefined method should exists in this component.

Here is a brief description of PageSection's component file:

The content of a section

To produce a content the component is called with one parameter: ePortal::UserSection object. Individual settings are available with setupinfo hash stored in database;

 <%init>
 my $section = $ARGS{section};  # ePortal::UserSection object
 my $setupinfo = $section->setupinfo_hash;
 </%init>
 HTML code is here

initialialization

To initialize PageSection object define some attributes:

 <%attr>
 def_title => { eng => 'Resources catalogue', rus => 'Êàòàëîã ðåñóðñîâ'},
 def_width => 'N',
 def_url => '/catalog/index.htm',
 def_setupinfo_hash => {}
 def_xacl_read => 'everyone'
 </%attr>

setup_dialog method

This method is used to customize a section with a setup dialog. {old_setupinfo} is used for compatibility with old version of ePortal.

 <%method setup_dialog><%perl>
  my $setupinfo = $ARGS{setupinfo};
  if ( $setupinfo->{old_setupinfo} ) {
    $setupinfo->{filename} = $setupinfo->{old_setupinfo};
    delete $setupinfo->{old_setupinfo};
  }
 <&| /dialog.mc:label_value_row, label => pick_lang(rus => "Èìÿ ôàéëà", eng => "File name") &>
 <& /dialog.mc:textfield, id => 'filename', 
                          -size => 40,
                          value => $setupinfo->{filename} &>
 </&>
 </%method>

This dialog may be disabled for ordinary users with special attribute

 <%attr>
 disable_user_setup_dialog => 1
 </%attr>

setup_validate method

This method is used for setupinfo data validation.

 <%method setup_validate><%perl>
  my $setupinfo = $ARGS{setupinfo};
  my $obj = $ARGS{obj};
  if ( $setupinfo->{filename} eq '' ) {
    throw ePortal::Exception::DataNotValid( -text => ...);
  }
 </%perl></%method>

setup_save method

This method is used to save custom data into setupinfo hash.

 <%method setup_save><%perl>
  my $setupinfo = $ARGS{setupinfo};
  my $args = $ARGS{args};

  foreach (qw/ filename /) {
    $setupinfo->{$_} = $args->{$_} if exists $args->{$_};
  }
 </%perl></%method>

AUTHOR

Sergey Rusakov, <rusakov_sa@users.sourceforge.net>

1 POD Error

The following errors were encountered while parsing the POD:

Around line 386:

Non-ASCII character seen before =encoding in ''Êàòàëîã'. Assuming CP1252