3 * Trove Admin: add new leaf category
5 * Copyright 1999-2001 (c) VA Linux Systems
6 * http://fusionforge.org/
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once('pre.php');
25 require_once('www/include/trove.php');
26 require_once('www/admin/admin_utils.php');
28 session_require_global_perm ('forge_admin');
30 // ########################################################
32 if ($GLOBALS['submit']) {
33 $newroot = trove_getrootcat($GLOBALS['form_parent']);
35 if ($GLOBALS[form_shortname]) {
36 $res = db_query_params("
38 (shortname,fullname,description,parent,version,root_parent)
39 VALUES ($1, $2, $3, $4, $5, $6)",
40 array(htmlspecialchars($form_shortname),
41 htmlspecialchars($form_fullname),
42 htmlspecialchars($form_description),
44 date("Ymd",time())."01",
48 if (!$res || db_affected_rows($res)<1) {
49 exit_error( _('Error in Trove operation: ').db_error(),'');
53 // update full paths now
54 trove_genfullpaths($newroot,trove_getfullname($newroot),$newroot);
56 session_redirect("/admin/trove/trove_cat_list.php");
59 site_admin_header(array('title'=>_('Site Admin: Trove - Add Node')));
62 <h3><?php echo _('Add New Trove Category'); ?></h3>
64 <form action="trove_cat_add.php" method="post">
65 <p><?php echo _('Parent Category: '); ?><?php echo utils_requiredField(); ?>
66 <br /><select name="form_parent">
70 // generate list of possible parents
71 // <paul@zootweb.com> 4/2/2003 - If we were given a parent trove use it
72 // in the "Parent Category" box otherwise give them the complete list.
73 if (isset($parent_trove_cat_id)) {
74 if ($parent_trove_cat_id == 0) {
75 print ('<option value="0">root</option>\n');
77 $res_cat = db_query_params ('SELECT shortname,fullname,trove_cat_id FROM trove_cat WHERE trove_cat_id=$1',
78 array($parent_trove_cat_id));
79 while ($row_cat = db_fetch_array($res_cat)) {
80 print ('<option value="'.$row_cat["trove_cat_id"].'">'.$row_cat["fullname"]."</option>\n");
84 print ('<option value="0">root</option>\n');
85 $res_cat = db_query_params ('SELECT shortname,fullname,trove_cat_id FROM trove_cat',
87 while ($row_cat = db_fetch_array($res_cat)) {
88 print ('<option value="'.$row_cat["trove_cat_id"].'">'.$row_cat["fullname"]."</option>\n");
95 <p><?php echo _('New category short name (no spaces, Unix-like): '); ?> <?php echo utils_requiredField(); ?>
96 <br /><input type="text" name="form_shortname" /></p>
97 <p><?php echo _('New category full name (80 characters max): '); ?> <?php echo utils_requiredField(); ?>
98 <br /><input type="text" name="form_fullname" /></p>
99 <p><?php echo _('New category description (255 characters max): '); ?> <?php echo utils_requiredField(); ?>
100 <br /><input type="text" size="80" name="form_description" />
101 <br /><input type="submit" name="submit" value="<?php echo _('Add'); ?>" /></p>
106 site_admin_footer(array());