3 * Project Admin page to edit Trove categorization of the project
5 * This page is linked from index.php
7 * Portions Copyright 1999-2001 (c) VA Linux Systems
8 * The rest Copyright 2002-2004 (c) GForge Team
11 * This file is part of GForge.
13 * GForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * GForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with GForge; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 require_once('../../env.inc.php');
29 require_once $gfcommon.'include/pre.php';
30 require_once $gfwww.'include/trove.php';
31 require_once $gfwww.'project/admin/project_admin_utils.php';
33 $group_id = getIntFromRequest('group_id');
34 session_require_perm ('project_admin', $group_id) ;
36 // Check for submission. If so, make changes and redirect
38 if (getStringFromRequest('submit') && getStringFromRequest('root1')) {
39 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
40 exit_form_double_submit('home');
42 group_add_history ('Changed Trove', '', $group_id);
44 // there is at least a $root1[xxx]
46 $allroots = getStringFromRequest('root1');
47 //$eachroot = ;//must make this bypass because it wouldn't compile otherwise
48 while (list($rootnode,$value) = each($allroots)) {
49 // check for array, then clear each root node for group
51 DELETE FROM trove_group_link
58 for ($i=1;$i<=$TROVE_MAXPERROOT;$i++) {
60 // check to see if exists first, then insert into DB
61 //@TODO change this to use the escaping utils
62 $var_aux = getStringFromRequest($varname);
63 $category = $var_aux[$rootnode];
65 trove_setnode($group_id,$category,$rootnode);
69 $feedback = _('Trove Update Success');
70 session_redirect('/project/admin/?group_id='.$group_id.'&feedback='.urlencode($feedback));
73 project_admin_header(array('title'=>_('Edit Trove Categorization'),'group'=>$group_id));
76 <h1><?php echo _('Edit Trove Categorization') ?></h1>
77 <p><?php echo _('Select up to three locations for this project in each of the Trove root categories. If the project does not require any or all of these locations, simply select "None Selected".') ?></p>
78 <p><?php echo _('IMPORTANT: Projects should be categorized in the most specific locations available in the map. Simultaneous categorization in a specific category AND a parent category will result in only the more specific categorization being accepted.') ?></p>
80 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
84 $CATROOTS = trove_getallroots();
85 while (list($catroot,$fullname) = each($CATROOTS)) {
86 print "\n<hr />\n<p><strong>$fullname</strong> ".help_button('trove_cat',$catroot)."</p>\n";
88 $res_grpcat = db_query_params ('
92 AND trove_cat_root=$2',
96 for ($i=1;$i<=$TROVE_MAXPERROOT;$i++) {
97 // each drop down, consisting of all cats in each root
98 $name= "root$i"."[$catroot]";
99 // see if we have one for selection
100 if ($row_grpcat = db_fetch_array($res_grpcat)) {
101 $selected = $row_grpcat["trove_cat_id"];
105 trove_catselectfull($catroot,$selected,$name);
110 <input type="hidden" name="form_key" value="<?php echo form_generate_key();?>"/>
111 <input type="hidden" name="group_id" value="<?php echo $group_id; ?>" />
112 <p><input type="submit" name="submit" value="<?php echo _('Update All Category Changes') ?>" /></p>
117 project_admin_footer(array());
121 // c-file-style: "bsd"