cvs: pearweb / package.php /public_html package-new.php
| From: | Greg Beaver | Date: | Sat, 10 Feb 2007 21:48:19 +0000 |
| Subject: | cvs: pearweb / package.php /public_html package-new.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-5400@lists.php.net to get a copy of this message | ||
cellog Sat Feb 10 21:48:19 2007 UTC
Modified files:
/pearweb package.php
/pearweb/public_html package-new.php
Log:
* fix Bug #9165: Category dropdown in New Package should indent subcategories
http://cvs.php.net/viewvc.cgi/pearweb/package.php?r1=1.78&r2=1.79&diff_format=u
Index: pearweb/package.php
diff -u pearweb/package.php:1.78 pearweb/package.php:1.79
--- pearweb/package.php:1.78 Sat Feb 10 20:22:09 2007
+++ pearweb/package.php Sat Feb 10 21:48:19 2007
@@ -19,6 +19,7 @@
$a->setReleaseStability('stable');
$a->setAPIStability('stable');
$a->setNotes('
+* fix Bug #9165: Category dropdown in New Package should indent subcategories
* fix implementation of Request #7828 (now Bug #7828): PEAR Bug Summary Report
* implement Request #9543: Change the bug summary, add total
');
http://cvs.php.net/viewvc.cgi/pearweb/public_html/package-new.php?r1=1.36&r2=1.37&diff_format=u
Index: pearweb/public_html/package-new.php
diff -u pearweb/public_html/package-new.php:1.36 pearweb/public_html/package-new.php:1.37
--- pearweb/public_html/package-new.php:1.36 Sat Jan 7 18:26:09 2006
+++ pearweb/public_html/package-new.php Sat Feb 10 21:48:19 2007
@@ -15,7 +15,7 @@
+----------------------------------------------------------------------+
| Authors: |
+----------------------------------------------------------------------+
- $Id: package-new.php,v 1.36 2006/01/07 18:26:09 danielc Exp $
+ $Id: package-new.php,v 1.37 2007/02/10 21:48:19 cellog Exp $
*/
require_once 'HTML/Form.php';
@@ -117,7 +117,40 @@
<?php
- $categories = $dbh->getAssoc("SELECT id,name FROM categories ORDER BY name");
+ // get parent categories
+ $parentcategories = $dbh->getAssoc("SELECT id,name FROM categories
+ WHERE parent IS NULL ORDER BY name");
+ // get child categories
+ $children = $dbh->getAll("SELECT parent,id,name FROM categories
+ WHERE parent IS NOT NULL ORDER BY parent, name");
+ $childcategories = array();
+ foreach ($children as $cinfo) {
+ $id = array_shift($cinfo);
+ $childcategories[$id][] = $cinfo;
+ }
+
+ $categories = array();
+ function recur_categories($childcategories, $parentcategories, $me,
+ &$categories, $indent = '--')
+ {
+ foreach ($childcategories[$me] as $category) {
+ $nid = $category[0];
+ $category = $category[1];
+ $category = $indent . $category;
+ $categories[$nid] = $category;
+ if (isset($childcategories[$nid])) {
+ recur_categories($childcategories, $parentcategories, $nid, $categories,
+ $indent . '--');
+ }
+ }
+ }
+ foreach ($parentcategories as $id => $category) {
+ $categories[$id] = $category;
+ if (isset($childcategories[$id])) {
+ recur_categories($childcategories, $parentcategories, $id, $categories,
+ '--');
+ }
+ }
$form =& new HTML_Form('package-new.php', 'post');
$form->setDefaultFromInput(false);