cvs: pearweb /include pear-category.php /public_html category-manager.php

From: Date: Wed, 26 Dec 2001 19:29:26 +0000
Subject: cvs: pearweb /include pear-category.php /public_html category-manager.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1702@lists.php.net to get a copy of this message
cox Wed Dec 26 14:29:26 2001 EDT Modified files: /pearweb/include pear-category.php /pearweb/public_html category-manager.php Log: beautify the category manager Index: pearweb/include/pear-category.php diff -u pearweb/include/pear-category.php:1.4 pearweb/include/pear-category.php:1.5 --- pearweb/include/pear-category.php:1.4 Mon Sep 10 09:33:59 2001 +++ pearweb/include/pear-category.php Wed Dec 26 14:29:25 2001 @@ -30,13 +30,18 @@ $dbh = DB::connect('mysql://pear:pear@localhost/pear'); } - $sth = $dbh->query('SELECT id, name, parent FROM categories ORDER BY id'); + $sth = $dbh->query('SELECT id, name, parent, cat_left, cat_right + FROM categories ORDER BY name'); while ($sth->fetchInto($row, DB_FETCHMODE_ASSOC)) { extract($row); settype($parent, 'integer'); $tree[$parent]['children'][] = $id; $tree[$id]['parent'] = $parent; + $subcats = ($cat_right - $cat_left - 1) / 2; + if ($subcats > 0) { + $name = "$name ($subcats)"; + } $tree[$id]['name'] = $name; } $tree[0]['name'] = 'Categories'; Index: pearweb/public_html/category-manager.php diff -u pearweb/public_html/category-manager.php:1.4 pearweb/public_html/category-manager.php:1.5 --- pearweb/public_html/category-manager.php:1.4 Fri Oct 26 17:00:22 2001 +++ pearweb/public_html/category-manager.php Wed Dec 26 14:29:26 2001 @@ -2,7 +2,7 @@ // manage categories auth_require(true); -response_header("PEAR :: Packages"); +response_header("PEAR :: Category Manager"); include_once '../include/pear-category.php'; // expected url vars: catid (category id) @@ -12,7 +12,6 @@ if (empty($catid)) { $name = 'Top Level'; $parent = 0; - $category_title = "Package Browser: Top Level Categories"; } else { if (isset($insert)) { $data = array( @@ -23,12 +22,12 @@ } elseif (isset($remove)) { // XXXX TODO: implement remove categories } - // XXXX TODO extract the full category path with visitations $row = $dbh->getRow("SELECT name, parent FROM categories WHERE id = $catid", DB_FETCHMODE_ASSOC); extract($row); } ?> +<form action="<?php echo $GLOBALS['PHP_SELF'] . "?catid=$catid&insert=1"; ?>" method="post"> <table border="0" cellpadding="2" cellspacing="1" width="100%"> <tr> <td rowspan="3" width="30%"><?php print get_categories_menu('tree');?></td> @@ -36,14 +35,22 @@ </td> </tr> </tr> - <td><b>Insert a new sub-category in: <?php print $name; ?></b><br/><br/> - <form action="<?php echo $GLOBALS['PHP_SELF'] . "?catid=$catid&insert=1"; ?>" method="post"> - Name: <input type="text" name="catname" size="20"><br> - Summary: <input type="text" name="catdesc" size="30"> - <input type="submit" name="action" value="Insert"> - </form> - <p> - </p> + <td><b>Insert a new sub-category under: <?php print $name; ?></b><br/><br/> + + <table border="0" width="100%"> + <tr> + <td>Name:</td> + <td><input type="text" name="catname" size="15"></td> + </tr> + <tr> + <td>Summary:</td> + <td><input type="text" name="catdesc" size="40"></td> + </tr> + <tr> + <td align="center" colspan="2"><input type="submit" name="action" value="Insert"></td> + </tr> + </table> + </td> </tr> </tr> @@ -52,6 +59,7 @@ </td> </tr> </table> +</form> <?php response_footer(); ?>

« previous php.pear.cvs (#1702) next »