3 * Site Admin: Trove Admin: add new leaf category
5 * Copyright 1999-2001 (c) VA Linux Systems
9 * This file is part of GForge.
11 * GForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * GForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with GForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 require_once('../../env.inc.php');
27 require_once('pre.php');
28 require_once('www/include/trove.php');
29 require_once('www/admin/admin_utils.php');
31 session_require(array('group'=>'1','admin_flags'=>'A'));
33 // ########################################################
35 if (getStringFromRequest('submit')) {
36 if (!form_key_is_valid(getStringFromRequest("form_key"))) {
37 exit_form_double_submit();
40 $form_parent = getStringFromRequest('form_parent');
41 $form_shortname = getStringFromRequest('form_shortname');
42 $form_fullname = getStringFromRequest('form_fullname');
43 $form_description = getStringFromRequest('form_description');
45 $newroot = trove_getrootcat($form_parent);
47 if ($form_shortname) {
50 (shortname,fullname,description,parent,version,root_parent)
52 '".htmlspecialchars($form_shortname)."',
53 '".htmlspecialchars($form_fullname)."',
54 '".htmlspecialchars($form_description)."',
56 '".date("Ymd",time())."01',
61 if (!$res || db_affected_rows($res)<1) {
62 form_release_key(getStringFromRequest("form_key"));
64 _('Error In Trove Operation'),
70 // update full paths now
71 trove_genfullpaths($newroot,trove_getfullname($newroot),$newroot);
73 session_redirect("/admin/trove/trove_cat_list.php");
76 site_admin_header(array('title'=>_('Site Admin: Trove - Add Node')));
79 <h3><?php echo _('Add New Trove Category'); ?></h3>
81 <form action="trove_cat_add.php" method="post">
82 <input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>">
83 <p><?php echo _('Parent Category'); ?>:<?php echo utils_requiredField(); ?>
84 <br /><select name="form_parent">
88 // generate list of possible parents
89 // <paul@zootweb.com> 4/2/2003 - If we were given a parent trove use it
90 // in the "Parent Category" box otherwise give them the complete list.
91 $parent_trove_cat_id = getIntFromRequest("parent_trove_cat_id", -1);
92 if ($parent_trove_cat_id != -1) {
93 if ($parent_trove_cat_id == 0) {
94 print ('<option value="0">root</option>\n');
96 $res_cat = db_query("SELECT shortname,fullname,trove_cat_id FROM trove_cat WHERE trove_cat_id=$parent_trove_cat_id");
97 while ($row_cat = db_fetch_array($res_cat)) {
98 print ('<option value="'.$row_cat["trove_cat_id"].'">'.$row_cat["fullname"]."</option>\n");
102 print ('<option value="0">root</option>\n');
103 $res_cat = db_query("SELECT shortname,fullname,trove_cat_id FROM trove_cat");
104 while ($row_cat = db_fetch_array($res_cat)) {
105 print ('<option value="'.$row_cat["trove_cat_id"].'">'.$row_cat["fullname"]."</option>\n");
112 <p><?php echo _('New category short name (no spaces, unix-like)'); ?>:<?php echo utils_requiredField(); ?>
113 <br /><input type="text" name="form_shortname" /></p>
114 <p><?php echo _('New category full name (VARCHAR 80)'); ?>:<?php echo utils_requiredField(); ?>
115 <br /><input type="text" name="form_fullname" /></p>
116 <p><?php echo _('New category description (VARCHAR 255)'); ?>:<?php echo utils_requiredField(); ?>
117 <br /><input type="text" size="80" name="form_description" />
118 <br /><input type="submit" name="submit" value="<?php echo _('Add'); ?>" /></p>
123 site_admin_footer(array());