[interchange-cvs] interchange - ramoore modified code/UserTag/history_scan.tag
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Sun Feb 2 11:29:00 2003
User: ramoore
Date: 2003-02-02 16:28:15 GMT
Modified: code/UserTag history_scan.tag
Log:
Add some documentation for the history_scan tag and new option called
'pageonly' that causes history-scan to return only the name of the
previous page rather than a full "area" link.
Revision Changes Path
1.9 +59 -1 interchange/code/UserTag/history_scan.tag
rev 1.9, prev_rev 1.8
Index: history_scan.tag
===================================================================
RCS file: /var/cvs/interchange/code/UserTag/history_scan.tag,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- history_scan.tag 11 Dec 2002 21:17:57 -0000 1.8
+++ history_scan.tag 2 Feb 2003 16:28:15 -0000 1.9
@@ -1,5 +1,59 @@
UserTag history-scan Order find exclude default
UserTag history-scan addAttr
+
+UserTag history-scan Documentation <<EOF
+
+=pod
+
+=head1 history-scan
+
+This tag returns a complete link (or optionally just the page name of) a previously
+visited page.
+
+Options:
+ default= Page to return if nothing else matches
+ exclude= A RegEx of page names to skip
+ pageonly=1 Return just the name of a page, not a link to it.
+ count=#N Skip the #N most recently visited pages
+ var_exclude A list of parameters that should NOT be included in the
+ links returned.
+
+Examples:
+
+A continue shopping button from an email by Jeff Dafoe
+ [button
+ text="Continue shopping"
+ src="__THEME_IMG_DIR__/continueshopping.gif"
+ hidetext=1
+ extra="class=maincontent"
+ form=basket
+ ]
+ [bounce href='[history-scan exclude="^/ord|^/multi/|^/process|^/login" default=index]']
+ mv_nextpage=nothing
+ [/button]
+
+
+A simple login form that returns to the calling page when login was successful.
+ <FORM ACTION="[process secure=1]" METHOD=POST>
+ <INPUT TYPE=hidden NAME=mv_todo VALUE=return>
+ <INPUT TYPE=hidden NAME=mv_click VALUE=Login>
+ <INPUT TYPE=hidden NAME=mv_failpage VALUE="login">
+ <INPUT TYPE=hidden NAME=mv_successpage
+ VALUE="[history-scan exclude="^/ord|^/multi/|^/process|^/login|^/logout" pageonly=1]">
+ <INPUT TYPE=hidden NAME=mv_nextpage VALUE="index">
+ <INPUT TYPE=hidden NAME=mv_session_id VALUE="[data session id]">
+ <INPUT TYPE=text NAME=mv_username VALUE="[read-cookie MV_USERNAME]">
+ <INPUT TYPE=password NAME=mv_password VALUE="">
+ <INPUT TYPE=submit NAME=submit VALUE="Log In">
+ </FORM>
+
+
+=cut
+
+EOF
+
+
+
UserTag history-scan Routine <<EOR
my %var_exclude = ( qw/
mv_credit_card_number 1
@@ -28,6 +82,11 @@
last;
}
return $Tag->area($default) if ! $href;
+ $href =~ s|/+|/|g;
+ if ($opt->{pageonly}) {
+ $href =~ s|^/||;
+ return $href;
+ }
my $form = '';
if($opt->{var_exclude}) {
for(split /[\s,\0]+/, $opt->{var_exclude}) {
@@ -38,7 +97,6 @@
$form .= "\n$_=";
$form .= join("\n$_=", split /\0/, $cgi->{$_});
}
- $href =~ s|/+|/|g;
return $Tag->area( { href => $href, form => $form} );
}
EOR