Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

92 lines (83 sloc) 2.173 kb
#ifdef @UI
UserDB ui database access
UserDB ui crypt 1
UserDB ui time_field last_login
UserDB ui admin 1
UserDB default admin 0
ParseVariables Yes
ActionMap ui_download <<EOR
sub {
my $deliverable = shift;
my $status;
$CGI->{mv_nextpage} =~ s:^ui_download/::;
$CGI->{mv_nextpage} .= $Session->{extension};
if($Tag->if_mm('files', $CGI->{mv_nextpage}) ) {
$Document->header("Content-type: application/octet-stream");
$Document->hot(1);
HTML ( $Tag->file($CGI->{mv_nextpage}) );
$status = 0;
}
else {
$Scratch->{ui_error} = "Not authorized for file $CGI->{mv_nextpage}";
$CGI->{mv_nextpage} = '__UI_BASE__/error';
$status = 1;
}
return $status;
}
EOR
ActionMap ui_edit <<EOR
sub {
my $deliverable = shift;
my $status;
$CGI->{mv_nextpage} =~ s:^ui_download/::;
$CGI->{mv_nextpage} .= $Session->{extension};
if($Tag->if_mm('files', $CGI->{mv_nextpage}) ) {
$Document->header("Content-type: application/octet-stream");
$Document->hot(1);
HTML ( $Tag->file($CGI->{mv_nextpage}) );
$status = 0;
}
else {
$Scratch->{ui_error} = "Not authorized for file $CGI->{mv_nextpage}";
$CGI->{mv_nextpage} = '__UI_BASE__/error';
$status = 1;
}
return $status;
}
EOR
ActionMap ui_dbdownload <<EOR
sub {
my $deliverable = shift;
my $status;
my ($db, $dbname, @columns, @keys, @values);
$CGI->{mv_nextpage} =~ s:^ui_dbdownload/::;
$dbname = $CGI->{mv_nextpage};
if($Tag->if_mm({function => 'export', table => $dbname})) {
$Document->header("Content-type: application/octet-stream");
$Document->hot(1);
# get a list of accessible columns
@columns = split(/\0/,
$Tag->db_columns({name => $dbname, joiner => "\0"}));
HTML (join ("\t", @columns), "\n");
# get a list of accessible keys
@keys = split(/\n/,
$Tag->list_keys($dbname));
# put out anything
foreach my $key (@keys) {
undef @values;
foreach my $col (@columns) {
push (@values, $Tag->data($dbname, $col, $key));
}
HTML (join("\t", @values), "\n");
}
$status = 0;
}
else {
$Scratch->{ui_error} = "Not authorized for table $dbname";
$CGI->{mv_nextpage} = '__UI_BASE__/error';
$status = 1;
}
return $status;
}
EOR
#endif
Jump to Line
Something went wrong with that request. Please try again.