5 * Copyright 2010 (c) FusionForge Team
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.
26 // FORM TO COPY Choices configured by admin for extra_field BOXES
28 $id = getIntFromRequest('id');
29 $fb= new ArtifactExtraField($ath,$id);
31 // Get a list of all extra fields in trackers and groups that you have perms to admin
33 $project_ids = array () ;
34 foreach (session_get_user()->getGroups() as $p) {
35 if (forge_check_perm ('tracker_admin', $p->getID())) {
36 $project_ids[] = $p->getID() ;
40 $res = db_query_params ('SELECT g.unix_group_name, agl.name AS tracker_name, aefl.field_name, aefl.extra_field_id
42 artifact_group_list agl,
43 artifact_extra_field_list aefl
44 WHERE g.group_id=ANY($1)
45 AND g.group_id=agl.group_id
46 AND aefl.group_artifact_id=agl.group_artifact_id
47 AND aefl.extra_field_id != $2
48 AND aefl.field_type IN (1,2,3,5,7)',
49 array (db_int_array_to_any_clause ($project_ids),
51 if (db_numrows($res) < 1) {
52 exit_error(_('Cannot find a destination tracker where you have administration rights.'),'tracker');
55 $title = sprintf(_('Copy choices from custom field %1$s'), $fb->getName());
56 $ath->adminHeader(array ('title'=>$title));
58 $efearr = $ath->getExtraFieldElements($id);
59 for ($i=0; $i<count($efearr); $i++) {
60 $field_id_arr[] = $efearr[$i]['element_id'];
61 $field_arr[] = $efearr[$i]['element_name'];
64 <form action="<?php echo getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID(); ?>" method="post" >
68 <?php echo _('Copy From') ?>
69 <?php echo $fb->getName() ?>
71 <?php echo _('Into trackers and custom fields') ?>
75 <input type="hidden" name="copy_opt" value="copy" />
76 <input type="hidden" name="id" value="<?php echo $id; ?>" />
78 echo html_build_multiple_select_box_from_arrays($field_id_arr,$field_arr,'copyid[]',array(),10,false);
81 while($arr =db_fetch_array($res)) {
82 $name_arr[]=$arr['unix_group_name']. '::'. $arr['tracker_name'] . '::'. $arr['field_name'];
83 $id_arr[]=$arr['extra_field_id'];
86 echo '<td class="top">';
88 echo html_build_select_box_from_arrays($id_arr,$name_arr,'selectid',$selectid,false);
93 <input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" />
94 </td></tr></table></form>
97 $ath->footer(array());
101 // c-file-style: "bsd"