summaryrefslogtreecommitdiffstats
path: root/pkgdb-ajax.php
diff options
context:
space:
mode:
authorJohan "Papa" Cwiklinski <trasher@odysseus.(none)>2010-05-29 17:22:42 +0200
committerJohan "Papa" Cwiklinski <trasher@odysseus.(none)>2010-05-29 17:22:42 +0200
commit8aa3adeb74d3aba8f7cd9498870cd63d87aefd75 (patch)
tree6ef3a1b764d54008172c65dcc3d020dffab04653 /pkgdb-ajax.php
parentafcf0d9d405ce6cabeedbc1352fb651ef8eb47e7 (diff)
Use of ajax to load additionnal informations from pkgdb ; closes #45
Diffstat (limited to 'pkgdb-ajax.php')
-rw-r--r--pkgdb-ajax.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/pkgdb-ajax.php b/pkgdb-ajax.php
new file mode 100644
index 0000000..5cff16c
--- /dev/null
+++ b/pkgdb-ajax.php
@@ -0,0 +1,49 @@
+<?php
+header('Content-Type: application/json;charset=utf-8');
+require 'FedoraClient.php';
+
+$name = $_GET['name'];
+if ( !isset($name) || !$name ) {
+ $fedpkg = array('error' => 'No name provided');
+} else {
+ $fedcli = new FedoraPkgdb();
+ $fedpkg = $fedcli->getPackageInfo($name);
+ if ( $fedpkg === false ) {
+ $fedpkg = array('error' => 'Unknown package');
+ } else {
+ //let's clean all little to avoid heavy json
+ foreach ( array_keys($fedpkg) as $k ) {
+ unset($fedpkg[$k]['specfile']);
+ unset($fedpkg[$k]['groups']);
+ unset($fedpkg[$k]['collection']);
+ unset($fedpkg[$k]['collectionid']);
+ unset($fedpkg[$k]['critpath']);
+ unset($fedpkg[$k]['qacontact']);
+ unset($fedpkg[$k]['statuschange']);
+ unset($fedpkg[$k]['statuscode']);
+ unset($fedpkg[$k]['id']);
+ unset($fedpkg[$k]['packageid']);
+ unset($fedpkg[$k]['package']['reviewurl']);
+ unset($fedpkg[$k]['package']['shouldopen']);
+ unset($fedpkg[$k]['package']['id']);
+ unset($fedpkg[$k]['package']['statuscode']);
+ unset($fedpkg[$k]['package']['upstreamurl']);
+ $people = $fedpkg[$k]['people'];
+ $new_people = null;
+ foreach( $people as $p ) {
+ $new_people[] = array(
+ 'username' => $p['username'],
+ 'aclOrder' => array(
+ 'commit' => array(
+ 'statuscode' => $p['aclOrder']['commit']['statuscode']
+ )
+ )
+ );
+ }
+ $fedpkg[$k]['people'] = $new_people;
+ }
+ }
+}
+
+echo json_encode($fedpkg);
+?> \ No newline at end of file