summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2014-09-18 19:24:23 (GMT)
committerChristian Pointner <equinox@helsinki.at>2014-09-18 19:24:23 (GMT)
commit3b0e5ec6227f1b4ab89a1e7a11a2b6f190ec0a73 (patch)
treef3508179339845fc4ebdacd70ed56b0732938855
parenta1d8f51b589224ad359034254204dae9480fff52 (diff)
first version for list dropboxes
-rwxr-xr-xlistdrobpoxes.cgi23
1 files changed, 19 insertions, 4 deletions
diff --git a/listdrobpoxes.cgi b/listdrobpoxes.cgi
index 9a28f96..a6724d7 100755
--- a/listdrobpoxes.cgi
+++ b/listdrobpoxes.cgi
@@ -9,6 +9,7 @@ use rddb;
my $status = 'ERROR';
my $errorstring = 'unknown';
my $responsecode = 500;
+my @dropboxes = ();
my $q = CGI->new;
@@ -22,6 +23,7 @@ if(defined $dbh) {
($result, $status, $errorstring) = rddb::check_token($dbh, $username, $token);
if($result == 1) {
$responsecode = 200;
+ @dropboxes = rddb::get_dropboxes($dbh, $username);
} elsif($result == 0) {
$responsecode = 403;
} else {
@@ -32,7 +34,20 @@ if(defined $dbh) {
print "Content-type: application/xml\n\n";
-print "<RDWebResult>\n";
-print " <ResponseCode>" . $responsecode . "</ResponseCode>\n";
-print " <ErrorString>" . $errorstring . "</ErrorString>\n";
-print "</RDWebResult>\n";
+if($responsecode != 200) {
+ print "<RDWebResult>\n";
+ print " <ResponseCode>" . $responsecode . "</ResponseCode>\n";
+ print " <ErrorString>" . $errorstring . "</ErrorString>\n";
+ print "</RDWebResult>\n";
+} else {
+ print "<dropboxList>\n";
+ for my $href (@dropboxes) {
+ print " <dropbox>\n";
+ print " <name>" . $href->{'NAME'} . "</name>\n";
+ print " <group>" . $href->{'GROUP'} . "</group>\n";
+ print " <path>" . $href->{'PATH'} . "</path>\n";
+ print " <to_cart>" . $href->{'TO_CART'} . "</to_cart>\n";
+ print " </dropbox>\n";
+ }
+ print "</dropboxList>\n";
+}