fly-list — display item in a flypage-like fashion
| Attribute | Pos. | Req. | Default | Description |
|---|---|---|---|---|
| code | Yes | item code | ||
| onfly | ||||
| prefix |
item
|
list prefix | ||
| interpolate | 0 | interpolate input? | ||
| reparse | 1 | interpolate output? |
Interchange 5.9.0:
Source: code/SystemTag/fly_list.coretag
Lines: 15
# Copyright 2002-2007 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. # # $Id: fly_list.coretag,v 1.4 2007-03-30 23:40:49 pajamian Exp $ UserTag fly-list Order code UserTag fly-list addAttr UserTag fly-list hasEndTag UserTag fly-list PosNumber 2 UserTag fly-list Version $Revision: 1.4 $ UserTag fly-list MapRoutine Vend::Interpolate::fly_page
Source: lib/Vend/Interpolate.pm
Lines: 5103
sub fly_page {
my($code, $opt, $page) = @_;
my ($selector, $subname, $base, $listref);
return $page if (! $code and $Vend::Flypart eq $Vend::FinalPath);
$code = $Vend::FinalPath
unless $code;
$Vend::Flypart = $code;
if ($subname = $Vend::Cfg->{SpecialSub}{flypage}) {
my $sub = $Vend::Cfg->{Sub}{$subname} || $Global::GlobalSub->{$subname};
$listref = $sub->($code);
return unless defined $listref;
if (ref $listref) {
$base = $listref;
}
else {
$code = $listref;
$listref = { mv_results => [[$listref]] };
$base = product_code_exists_ref($code);
}
}
else {
$listref = {mv_results => [[$code]]};
$base = product_code_exists_ref($code);
}
#::logDebug("fly_page: code=$code base=$base page=" . substr($page, 0, 100));
return undef unless $base || $opt->{onfly};
$base = $Vend::Cfg->{ProductFiles}[0] unless $base;
if($page) {
$selector = 'passed in tag';
}
elsif( $Vend::ForceFlypage ) {
$selector = $Vend::ForceFlypage;
undef $Vend::ForceFlypage;
}
elsif( $selector = $Vend::Cfg->{PageSelectField}
and db_column_exists($base,$selector)
)
{
$selector = database_field($base, $code, $selector)
}
$selector = find_special_page('flypage')
unless $selector;
#::logDebug("fly_page: selector=$selector");
unless (defined $page) {
unless( allowed_file($selector) ) {
log_file_violation($selector, 'fly_page');
return undef;
}
$page = readin($selector);
if (defined $page) {
vars_and_comments(\$page);
} else {
logError("attempt to display code=$code with bad flypage '$selector'");
return undef;
}
}
# This allows access from embedded Perl
$Tmp->{flycode} = $code;
# TRACK
$Vend::Track->view_product($code) if $Vend::Track;
# END TRACK
$opt->{prefix} ||= 'item';
# LEGACY
list_compat($opt->{prefix}, \$page) if $page;
# END LEGACY
return labeled_list( $opt, $page, $listref);
}