[ic] ActionMap example (Was: Re: Bypassing the whole [more] system)

interchange-users@icdevgroup.org interchange-users@icdevgroup.org
Mon Sep 30 15:35:01 2002


Grant writes: 

[..] 

> I looked through the ActionMap docs online and I'm a bit confused.  If
> "category" is in the URL like above, a certain action is executed which is
> usually defined by a Perl subroutine. 

Maybe this example will help you to learn more about ActionMap: 

ActionMap Catalog <<EOR
sub {
	my ($action, $class, $what, $spec) = split ('/', shift);
	
	$CGI->{mv_like_field} = 'category';		 

	$class = 'CDROM' if $class eq 'DVD'; 

	if ($class eq 'CDROM' || $class eq 'Video') {
		if ($what eq 'Producer') {
			$CGI->{mv_like_field} = 'producer';		
		} elsif ($what eq 'Star') {
			$CGI->{mv_like_field} = 'category3';
		}
	} else {
		# other categories have only one level of qualification	
		$spec = $what;
		$CGI->{mv_like_field} = 'category';
		$class = 'Novelty' if $class eq 'Novelties';
	} 

	$CGI->{mv_todo} = 'search';
	$CGI->{mv_nextpage} = $Config->{Special}->{search};
	$CGI->{mv_profile} = 'catalog';
	$CGI->{mv_coordinate} = 1;
	$CGI->{mv_search_field} = 'class';
	$CGI->{mv_searchspec} = "$class"; 

	$CGI->{mv_like_spec} = "%$spec";
	$CGI->{mv_column_op} = "eq";
	$CGI->{banner_title} = $spec;
	
	if ($Variable->{SCOPE}) {
		$CGI->{mv_search_group} = join("\0",0,1,1);
		$CGI->{mv_orsearch} = join("\0",0,1,1);
		$CGI->{mv_search_field} .= "\0scope\0scope";
		$CGI->{mv_searchspec} .= "\0" . $Variable->{SCOPE} . "\0" . '3';
	} 

	$Tag->update('process');
	return 1;
}
EOR 

ActionMap is a really cute feature of Interchange. 

Ciao
      Racke 

-- 
Prolific Interchange Consulting (Excellent German Quality !).
Take a look at Materialboerse (http://www.materialboerse.de/), WITT
(http://www.witt-weiden.de/), Boxmover (http://shop.boxmover.ch/) or
Passionshop (http://www.passionshop.com/racke). Need a shop ? Contact us.