/
run_profile.coretag
58 lines (49 loc) · 1.66 KB
/
run_profile.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
# Copyright 2002-2009 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 run-profile Order check cgi profile name
UserTag run-profile addAttr
UserTag run-profile Version 1.7
UserTag run-profile Routine <<EOR
sub {
my ($check, $cgi, $profile, $name, $opt) = @_;
#::logDebug("call check $check");
my $ref;
my $pname = $name;
if ($opt->{ref}) {
if (ref($opt->{ref}) eq 'HASH') {
$ref = $opt->{ref};
}
else {
# error message
::logError("Invalid ref parameter provided for profile %s", $pname || $check);
}
}
elsif ($cgi) {
$ref = \%CGI::values;
}
else {
$ref = $::Values;
}
unless ($pname) {
# check scratch for profile if none specified
$profile = $Scratch->{"profile_$check"} unless $profile;
#::logDebug("PROFILE(" . $Tag->var('MV_PAGE',1) . "):***$profile***");
# test passes if no profile exists
return 1 if ! $profile;
$opt->{no_error} = 1 unless defined $opt->{no_error};
$pname = 'tmp_profile.' . $Vend::Session->{id};
#Debug("running check $check, pname=$pname profile=$profile");
$profile .= "\n&fatal=1\n";
$profile = "&noerror=1\n$profile" if $opt->{no_error};
$profile = "&overwrite=1\n$profile" if $opt->{overwrite_error};
$::Scratch->{$pname} = $profile;
}
my ($status) = ::check_order($pname, $ref);
delete $::Scratch->{$pname} unless $name;
return is_yes($opt->{hide}) ? undef : $status;
}
EOR