diff options
author | Remi Collet <fedora@famillecollet.com> | 2010-11-07 12:03:06 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2010-11-07 12:03:06 +0100 |
commit | b72ffbce60aa1d90e09eb7f6153078a406626cee (patch) | |
tree | f30618ef0b8784dc1b6c5da6906f9624137015aa | |
parent | 32c6495e21342fb589b8d617fbe9ac0d99591232 (diff) |
add 'Channel' filter on list
-rw-r--r-- | rpm.php | 29 | ||||
-rw-r--r-- | smarty/templates/rpmphp/rpm.tpl | 7 | ||||
-rw-r--r-- | testdb.php | 6 |
3 files changed, 28 insertions, 14 deletions
@@ -68,8 +68,13 @@ function report($db, $type) $repos = $rpmrepo->getAllRepoHash(); $smarty->assign('repos', $repos); + $crit = array('type'=>$type, 'ORDER'=>'name'); + if (substr($what,0,1)=='#') { + $crit['channel'] = substr($what,1); + $what = '%fedora'; + } $i=0; - foreach ($uptable->request(array('type'=>$type, 'ORDER'=>'name')) as $up) { + foreach ($uptable->request($crit) as $up) { $package = null; $rpmname = $up['name']; @@ -238,27 +243,25 @@ function report($db, $type) try { switch ($type) { case "pecl": - $filter = "WHERE name LIKE 'php-pecl-%' "; + $filter = 'php-pecl-%'; break; case "pear": - $filter = "WHERE name LIKE 'php-%' "; + $filter = 'php-%'; break; case "R": - $filter = "WHERE name LIKE 'R-%' "; + $filter = 'R-%'; break; default: - $filter = ""; + $filter = ''; } $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS); - $sql="SELECT DISTINCT owner FROM acls $filter ORDER BY owner"; - $res=$db->query($sql); - if ( $res ) { - while ( $owner = $res->fetchObject() ) { - $owners[] = $owner; - } - $smarty->assign('owners', $owners); - } + + $acl = new TableAcls($db); + $smarty->assign('owners', $acl->getOwners($filter)); + + $acl = new TableUpstream($db); + $smarty->assign('channels', $acl->getChannels($type)); $rpmrepo = new TableRpmRepo($db); $smarty->assign('repositories_update', date("r", $rpmrepo->getMaxStamp())); diff --git a/smarty/templates/rpmphp/rpm.tpl b/smarty/templates/rpmphp/rpm.tpl index 9f9d94f..742b07d 100644 --- a/smarty/templates/rpmphp/rpm.tpl +++ b/smarty/templates/rpmphp/rpm.tpl @@ -32,9 +32,14 @@ <option value="%stable"{if $what eq '%stable'} selected="selected"{/if}>All stable</option> <option value="%all"{if $what eq '%all'} selected="selected"{/if}>All</option> </optgroup> + <optgroup label="Channel"> +{foreach from=$channels item=o} + <option value="#{$o}"{if $what eq "#$o"} selected="selected"{/if}>{$o}</option> +{/foreach} + </optgroup> <optgroup label="Owner"> {foreach from=$owners item=o} - <option value="{$o->owner}">{$o->owner}</option> + <option value="{$o}"{if $what eq $o} selected="selected"{/if}>{$o}</option> {foreachelse} <option value="remi">remi</option> {/foreach} @@ -99,4 +99,10 @@ echo "Acls number : ".$acl->getCount()."\n"; $res = $acl->optimize(); echo "Acls optimization : ".$res[0]['Msg_type'].'='.$res[0]['Msg_text']."\n"; +echo "PHP owner:"; +print_r($acl->getOwners('php')); +echo "PECL owner:"; +print_r($acl->getOwners('php-pecl-%')); +echo "PEAR channels:"; +print_r($up->getChannels('pear')); ?> |