region —
Attribute | Pos. | Req. | Default | Description |
---|---|---|---|---|
object | ||||
search | ||||
label | ||||
more | ||||
list_prefix | ||||
prefix | ||||
ml | ||||
md | ||||
query | ||||
fm | ||||
sp | ||||
interpolate | 0 | interpolate input? | ||
reparse | 1 | interpolate output? | ||
hide | 0 | Hide the tag return value? |
Interchange 5.9.0:
Source: code/SystemTag/region.coretag
Lines: 17
# 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: region.coretag,v 1.4 2007-03-30 23:40:49 pajamian Exp $ UserTag region addAttr UserTag region attrAlias args arg UserTag region attrAlias params arg UserTag region attrAlias search arg UserTag region hasEndTag UserTag region PosNumber 0 UserTag region Version $Revision: 1.4 $ UserTag region MapRoutine Vend::Interpolate::region
Source: lib/Vend/Interpolate.pm
Lines: 4841
sub region { my($opt,$page) = @_; my $obj; if($opt->{object}) { ### The caller supplies the object, no search to be done $obj = $opt->{object}; } else { ### We need to run a search to get an object my $c; if($CGI::values{mv_more_matches} || $CGI::values{MM}) { ### It is a more function, we need to get the parameters find_search_params(\%CGI::values); delete $CGI::values{mv_more_matches}; } elsif ($opt->{search}) { ### Explicit search in tag parameter, run just like any if($opt->{more} and $::Instance->{SearchObject}{''}) { $obj = $::Instance->{SearchObject}{''}; #::logDebug("cached search"); } else { $c = { mv_search_immediate => 1, mv_search_label => $opt->{label} || 'current', }; my $params = escape_scan($opt->{search}); Vend::Scan::find_search_params($c, $params); $c->{mv_no_more} = ! $opt->{more}; $obj = perform_search($c); } } else { ### See if we have a search already done for this label $obj = $::Instance->{SearchObject}{$opt->{label}}; } # If none of the above happen, we need to perform a search # based on the passed CGI parameters if(! $obj) { $obj = perform_search(); $obj = { mv_results => [], matches => 0, mv_search_error => [ errmsg('No search was found') ], } if ! $obj; } finish_search($obj); # Label it for future reference $::Instance->{SearchObject}{$opt->{label}} = $opt->{object} = $obj; } my $lprefix; my $mprefix; if($opt->{list_prefix}) { $lprefix = $opt->{list_prefix}; $mprefix = "(?:$opt->{list_prefix}-)?"; } elsif ($opt->{prefix}) { $lprefix = "(?:$opt->{prefix}-)?list"; $mprefix = "(?:$opt->{prefix}-)?"; } else { $lprefix = "list"; $mprefix = ""; } #::logDebug("region: opt:\n" . uneval($opt) . "\npage:" . substr($page,0,100)); my $save_more; if($opt->{ml} and ! defined $obj->{mv_matchlimit} ) { $obj->{mv_matchlimit} = $opt->{ml}; $obj->{mv_more_decade} = $opt->{md}; $obj->{matches} = scalar @{$obj->{mv_results}}; $obj->{mv_cache_key} = generate_key($opt->{query} || substr($page,0,100)); $obj->{mv_more_permanent} = $opt->{pm}; $obj->{mv_first_match} = $opt->{fm} if $opt->{fm}; $obj->{mv_search_page} = $opt->{sp} if $opt->{sp}; $obj->{prefix} = $opt->{prefix} if $opt->{prefix}; $save_more = 1; } $opt->{prefix} = $obj->{prefix} if $obj->{prefix}; $Orig_prefix = $Prefix = $opt->{prefix} || 'item'; $B = qr(\[$Prefix)i; $E = qr(\[/$Prefix)i; $IB = qr(\[if[-_]$Prefix)i; $IE = qr(\[/if[-_]$Prefix)i; my $new; $page =~ s! \[ ( $mprefix more[-_]list ) $Optx$Optx$Optx$Optx$Optx \] ($Some) \[/\1\] ! tag_more_list($2,$3,$4,$5,$6,$opt,$7) !xige; $page =~ s! \[ ( $mprefix on[-_]match )\] ($Some) \[/\1\] ! $obj->{matches} > 0 ? opt_region(0,0,1,$2,$opt) : '' !xige; $page =~ s! \[ ( $mprefix no[-_]match )\] ($Some) \[/\1\] ! $obj->{matches} > 0 ? '' : opt_region(0,0,1,$2,$opt) !xige; $page =~ s:\[($lprefix)\]($Some)\[/\1\]:labeled_list($opt,$2,$obj):ige or $page = labeled_list($opt,$page,$obj); #::logDebug("past labeled_list"); if ($save_more) { my $out = delete $obj->{mv_results}; Vend::Search::save_more($obj, $out); $obj->{mv_results} = $out; } return $page; }