new client side Ajax admin user interface
[bse.git] / site / cgi-bin / modules / BSE / UI / API.pm
CommitLineData
f9ac57c9
TC
1package BSE::UI::API;
2use strict;
3use base "BSE::UI::Dispatch";
4
0c3d2fc5 5our $VERSION = "1.001";
cb7fd78d 6
f9ac57c9
TC
7my %actions =
8 (
9 config => 1,
10 fail => 1,
11 );
12
13sub actions {
14 \%actions;
15}
16
17sub default_action {
18 "fail"
19}
20
21sub req_config {
22 my ($self, $req) = @_;
23
24 my $cfg = $req->cfg;
0c3d2fc5 25 my %result =
f9ac57c9
TC
26 (
27 success => 1,
28 perlbal => $cfg->entry("basic", "perlbal", 0),
29 access_control => $cfg->entry("basic", "access_control", 0),
30 tracking_uploads => $req->_tracking_uploads,
31 );
0c3d2fc5
TC
32
33 my %custom = $cfg->entries("extra a_config");
34 for my $key (keys %custom) {
35 exists $result{$key} and next;
36
37 my $section = $custom{$key};
38 $section =~ /\{(level|generator|parentid|template)\}/
39 and next;
40
41 $section eq "db" and die;
42
43 $result{$key} = { $cfg->entries($section) };
44 }
45
46 return $req->json_content(\%result);
f9ac57c9
TC
47}
48
49sub req_fail {
50 my ($self, $req) = @_;
51
52 return $self->error($req, "Not for end-user use");
53}
54
551;