Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

[mv] [history-scan] tag changes



******    message to minivend-users from "Kevin Walsh" <kevin@cursor-software.co.uk>     ******

I have found it useful to have an (optional) secure=1 argument
in the MV4.04 [history-scan] tag.  I thought I'd post my mods
here just in case anyone else wants them.

------------------------------------------------------------
UserTag history-scan Order find exclude default secure
UserTag history-scan addAttr
UserTag history-scan Routine <<EOR
my %var_exclude = ( qw/
        mv_credit_card_number 1
        mv_pc                 1
        mv_session_id         1
/);
sub {
        my ($find, $exclude, $default, $secure) = @_;
        $secure = 0 if not $secure;
        my $ref = $Vend::Session->{History}
                or return $Tag->area($default ||
$Config->{SpecialPage}{catalog}
);
        my ($hist, $href, $cgi);
        $exclude = qr/$exclude/ if $exclude;
        for(my $i = $#$ref; $i >= 0; $i--) {
                #Log("checking $ref->[$i][0] for $exclude");
                if ($exclude and $ref->[$i][0] =~ $exclude) {
                        next;
                }
                if($find) {
                        next unless $ref->[$i][0] =~ /$find/;
                }
                ($href, $cgi) = @{$ref->[$i]};
                last;
        }
        return $Tag->area( { href => $default ||
$Config->{SpecialPage}{catalog},
 secure => $secure } )
                if ! $href;
        my $form = '';
        for(grep !$var_exclude{$_}, keys %$cgi) {
                $form .= "\n$_=";
                $form .= join("\n$_=", split /\0/, $cgi->{$_});
        }
        return $Tag->area( { href => $href, form => $form, secure =>
$secure } )
;
}
EOR
------------------------------------------------------------

I'll leave you to do the diff yourself, but I haven't changed
much, and it works for me.  Just look for any line that has the
$secure variable in it.

I also want to know if anyone has an opinion on the following
modification:

When using the "find" argument with the history scan tag to go
back to a /scan/ page, it is always the first scan page that gets
returned, rather than the last page viewed, this is because of
the way the pages are saved, using "MM=", in the history.  Changing:

    next unless $ref->[$i][0] =~ /$find/;

to:

    next unless ($ref->[$i][0] =~ /$find/
        or $ref->[$i][1]{mv_nextpage} =~ /$find/);

seems to do the trick.  Comments?

--
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/  K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/   kevin@cursor-software.co.uk
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/

-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: