cvs: pearweb /public_html packages.php

From: Date: Sun, 09 Mar 2008 22:42:30 +0000
Subject: cvs: pearweb /public_html packages.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7327@lists.php.net to get a copy of this message
dufuz Sun Mar 9 22:42:30 2008 UTC Modified files: /pearweb/public_html packages.php Log: Use the jquery toogle/show/hide functions instead of doing it our selfs Means the page does not need to reload for show/hide all Tested on FF2, Opera 9.25, Safari windows and IE7 http://cvs.php.net/viewvc.cgi/pearweb/public_html/packages.php?r1=1.63&r2=1.64&diff_format=u Index: pearweb/public_html/packages.php diff -u pearweb/public_html/packages.php:1.63 pearweb/public_html/packages.php:1.64 --- pearweb/public_html/packages.php:1.63 Fri Feb 29 20:37:09 2008 +++ pearweb/public_html/packages.php Sun Mar 9 22:42:29 2008 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ | Authors: Richard Heyes | +----------------------------------------------------------------------+ - $Id: packages.php,v 1.63 2008/02/29 20:37:09 dufuz Exp $ + $Id: packages.php,v 1.64 2008/03/09 22:42:29 dufuz Exp $ */ /* @@ -229,7 +229,13 @@ } // Package list - $packages = $dbh->getAll("SELECT id, name, summary, license FROM packages WHERE package_type = 'pear' AND approved = 1 AND category = $catpid ORDER BY name"); + $sql = ' + SELECT id, name, summary, license, unmaintained, newpk_id, + (SELECT COUNT(package) FROM releases WHERE package = p.id) as numreleases, + (SELECT state FROM releases WHERE package = p.id ORDER BY id DESC LIMIT 1) as status + FROM packages p + WHERE package_type = ? AND approved = 1 AND category = ? ORDER BY name'; + $packages = $dbh->getAll($sql, array('pear', $catpid)); // Paging $total = count($packages); @@ -259,10 +265,7 @@ foreach ($packages as $key => $pkg) { $extendedInfo = array(); - $extendedInfo['numReleases'] = $dbh->getOne('SELECT COUNT(package) FROM releases WHERE package = ' . $pkg['id']); - $extendedInfo['status'] = $dbh->getOne('SELECT state FROM releases WHERE package = ' . $pkg['id'] . ' ORDER BY id DESC LIMIT 1'); - $p = $dbh->getRow('SELECT license, unmaintained, newpk_id FROM packages WHERE id = ' . $pkg['id'] . ' ORDER BY id DESC LIMIT 1'); - $extendedInfo['license'] = $p['license']; + $extendedInfo['status'] = $pkg['status']; // Make status coloured switch ($extendedInfo['status']) { @@ -279,32 +282,21 @@ break; } - if ($p['unmaintained'] == 0) { + if ($pkg['unmaintained'] == 0) { $m = '<span style="color: #006600">Yes</span>'; } else { $m = '<span style="color: #ff0000">No</span>'; } $extendedInfo['maintained'] = $m; - if (!empty($p['newpk_id'])) { - $d = $dbh->getOne('SELECT name FROM packages WHERE id = ' . $p['newpk_id'] . ' ORDER BY id DESC LIMIT 1'); + if (!empty($pkg['newpk_id'])) { + $d = $dbh->getOne('SELECT name FROM packages WHERE id = ' . $pkg['newpk_id'] . ' ORDER BY id DESC LIMIT 1'); $msg = 'This package has been deprecated in favor of <a href="/package/'. $d .'">' . $d . '</a>'; $extendedInfo['deprecated'] = $msg; } $packages[$key]['eInfo'] = $extendedInfo; } - $defaultMoreInfoVis = $moreinfo ? 'inline' : 'none'; -} - -// Build URLs for hide/show all links -if ($moreinfo) { - $showMoreInfoLink = '#'; - $hideMoreInfoLink = getQueryString($catpid, $catname, $showempty, 0); - -} else { - $showMoreInfoLink = getQueryString($catpid, $catname, $showempty, 1); - $hideMoreInfoLink = '#'; } // Template

« previous php.pear.core (#7327) next »