/
return_to.coretag
101 lines (92 loc) · 2.53 KB
/
return_to.coretag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# 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.
UserTag return_to Order type table_hack
UserTag return_to addAttr
UserTag return_to Version 1.4
UserTag return_to Routine <<EOR
sub {
use vars qw/$Tag/;
my ($type, $tablehack, $opt) = @_;
$type = 'form' unless $type;
my ($page, @args) = split /\0/, $CGI::values{ui_return_to};
if($CGI::values{ui_target}) {
push @args, "ui_target=$CGI::values{ui_target}";
}
my $out = '';
if ($opt->{page}) {
$page = $opt->{page};
}
my $extra;
if($tablehack) {
my $found;
for (@args) {
if(s/^mv_data_table=(.*)//) {
$extra = "mv_return_table=$1\n";
}
elsif (s/^(ui|mv)_return_table=//) {
$found = "mv_return_table=$_\n";
}
}
$extra = $found if $found;
}
if($type eq 'click') {
$out .= qq{mv_nextpage=$page\n} if $page;
for(@args) {
my ($k, $v) = split /\s*=\s*/, $_, 2;
next unless length $k;
next if $k =~ /$opt->{exclude}/;
$v =~ s/__NULL__/\0/g;
$out .= qq{$k=$v\n};
}
if($opt->{stack} or $CGI::values{ui_return_stack}) {
$type = 'formlink';
}
else {
$type = 'done';
$out .= "ui_return_to=\n";
}
}
if($type eq 'formlink') {
$page = $Global::Variable->{MV_PAGE} if ! $page;
$out .= qq{ui_return_to=$page\n};
for(@args) {
tr/\n/\r/;
$out .= qq{ui_return_to=$_\n}
}
}
elsif($type eq 'url') {
$page = $Global::Variable->{MV_PAGE} if ! $page;
$out .= $Tag->area( {
href => $page,
form => join("\n", @args),
});
}
elsif ($type eq 'form') {
$page = $Global::Variable->{MV_PAGE} if ! $page;
$out .= qq{<INPUT TYPE=hidden NAME=ui_return_to VALUE="$page">\n};
for(@args) {
s/"/"/g;
$out .= qq{<INPUT TYPE=hidden NAME=ui_return_to VALUE="$_">\n}
}
}
elsif ($type eq 'regen') {
$page = $Global::Variable->{MV_PAGE} if ! $page;
$out .= qq{<INPUT TYPE=hidden NAME=ui_return_to VALUE="ui_return_to=$page">\n};
for(@args) {
s/"/"/g;
$out .= qq{<INPUT TYPE=hidden NAME=ui_return_to VALUE="ui_return_to=$_">\n}
}
}
$out .= $extra if $extra;
$::Scratch->{ui_location} = $Tag->area({
href => $page,
form => join "\n", @args,
})
if $opt->{scratch};
return $out;
}
EOR