Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Removed unused bar_link sub
Doesn't work under IC 5.10, would have to be a GlobalSub. Also isn't
called by demo catalog, so opting to remove.
  • Loading branch information
Josh Lavin committed Sep 1, 2016
1 parent 4617fb6 commit b0c0d89
Showing 1 changed file with 0 additions and 125 deletions.
125 changes: 0 additions & 125 deletions dist/catalog_before.cfg
Expand Up @@ -57,128 +57,3 @@ ParseVariables No
## Deprecated, could be removed in IC 5.2
Variable MV_DEFAULT_SEARCH_FILE products
Variable MV_DEFAULT_SEARCH_TABLE products

Sub <<EOR
sub bar_link {
my $base = shift || 'cat';
my $extra;
$base =~ s/(\W.*)//s
and $extra = $1;
my $ref = shift;
my $code = $ref->[0];

my $record = tag_data($base, 'n/a', $code, { hash => 1 });
return $ref->[0] unless $record;

my $url;
my $anchor;
my $highlight;
my $first;
my $expand;

LINK: {
if($record->{link_type} eq 'external') {
$first = $record->{url};
$first =~ s/\s+$//;
$first =~ s/^\s+//;
$url = $first;
}
elsif ($record->{link_type} eq 'internal') {
my ($page, $form) = split /\s+/, $record->{url}, 2;
my $current = $Tag->var('MV_PAGE', 1);
$highlight = 1 if $page eq $current
or
$page eq $CGI->{ui_explode};
$url = $Tag->area( { href => $page, form => $form });
}
elsif ($record->{link_type} eq 'simple') {
my (@items) = split /\s*[\n,]\s*/, $record->{selector};
my @out;
my $fi = $record->{tab};
my $sp = $record->{page};
my %options = (
href => 'scan',
);
push @out, "fi=$fi" if $fi;
push @out, "sp=$sp" if $sp;
push @out, "st=db";
if(! @items) {
push @out, "ra=yes";
$options{arg} = join "\n", @out;
$url = $Tag->area(\%options);
last LINK;
}
push @out, "co=yes";
for(@items) {
my ($col, $string) = split /\s*=\s*/;
push @out, "sf=$col";
push @out, "se=$string";
push @out, "op=eq";
}
push @out, $record->{search}
if $record->{search} =~ /^\s*\w\w=/;

push @out, qq{va=banner_image=$record->{banner_image}} if ($record->{banner_image});
push @out, qq{va=banner_text=$record->{banner_text}} if ($record->{banner_text});
$options{arg} = join "\n", @out;
$url = $Tag->area(\%options);
}
elsif ($record->{link_type} eq 'complex') {
$record->{search} =~ s/[\r\n+]/\n/g;
$record->{search} .= qq{\nva=banner_text=$record->{banner_text}} if ($record->{banner_text});
$record->{search} .= qq{\nva=banner_image=$record->{banner_image}} if ($record->{banner_image});
$url = $Tag->area('scan', $record->{search});
}
else {
$url = "";
}
}

ANCHOR: {
my $display_text = $record->{banner_text} || $record->{name};
$display_text =~ s/"/&quot;/g;
if($record->{display_type} eq 'url') {
$anchor = "";
}
elsif ($record->{display_type} eq 'name') {
$anchor = $display_text;
}
elsif ($record->{display_type} eq 'icon') {
$anchor = qq{<img src="$record->{image}" alt="$display_text"};
$anchor .= " $record->{image_prop}"
if $record->{image_prop};
$anchor .= '>';
$anchor .= $display_text;
}
elsif ($record->{display_type} eq 'image') {
$anchor = qq{<img src="$record->{image}" alt="$display_text"};
$anchor .= " $record->{image_prop}"
if $record->{image_prop};
$anchor .= '>';
}
else {
$anchor = $display_text;
}
}
return $url if ! $anchor;
return $anchor if ! $url;
EXPAND: {
if ($url =~ /\?/) {
$expand = "&expand=$code";
}
else {
$expand = "?expand=$code";
}
}
my $tmpl = $record->{link_template}
|| $extra
|| $Variable->{BAR_LINK_TEMPLATE}
|| q{<A HREF="$URL$" class=barlink>$ANCHOR$</A>};
$record->{ANCHOR} = $anchor;
$record->{EXPAND} = $expand;
$record->{URL} = $url;
$tmpl =~ s!{HIGHLIGHT}(.*?){/HIGHLIGHT}! $highlight ? $1 : '' !gise;
$tmpl =~ s/\$(\w+)\$/$record->{$1}/g;
return $tmpl;
}
EOR

0 comments on commit b0c0d89

Please sign in to comment.