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 BUILD SELECTION BOXES
29 $title = sprintf(_('Manage Custom Fields for %s'), $ath->getName());
30 $ath->adminHeader(array ('title'=>$title));
33 List of possible user built Selection Boxes for an ArtifactType
35 $efarr = $ath->getExtraFields();
36 $eftypes=ArtifactExtraField::getAvailableTypes();
37 $keys=array_keys($efarr);
43 $title_arr[]=_('Custom Fields Defined');
44 $title_arr[]=_('Type');
45 $title_arr[]=_('Elements Defined');
46 $title_arr[]=_('Add Options');
47 echo $GLOBALS['HTML']->listTableTop ($title_arr);
49 for ($k=0; $k < $rows; $k++) {
51 echo '<tr id="field-'.$efarr[$i]['alias'].'" '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>'.
52 '<td>'.$efarr[$i]['field_name'].(($efarr[$i]['is_required']) ? utils_requiredField() : '').'<a href="'.getStringFromServer('PHP_SELF').'?update_box=1&id='.
53 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">'.
54 ' ['._('Edit').']</a>'.
55 '<a href="'.getStringFromServer('PHP_SELF').'?deleteextrafield=1&id='.
56 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">'.
57 ' ['._('Delete').']</a>'.
58 '<a href="'.getStringFromServer('PHP_SELF').'?copy_opt=1&id='.
59 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">'.
60 ' ['._('Copy').']</a>'.
62 echo '<td>'.$eftypes[$efarr[$i]['field_type']].'</td>';
64 List of possible options for a user built Selection Box
66 $elearray = $ath->getExtraFieldElements($efarr[$i]['extra_field_id']);
68 if (!empty($elearray)) {
69 $optrows=count($elearray);
72 for ($j=0; $j <$optrows; $j++)
74 echo $elearray[$j]['element_name'];
75 echo ' <a href="'.getStringFromServer('PHP_SELF').'?update_opt=1&id='.
76 $elearray[$j]['element_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'&boxid='.
77 $efarr[$i]['extra_field_id'].'">'.
78 '['._('Edit').']</a>';
79 echo ' <a href="'.getStringFromServer('PHP_SELF').'?delete_opt=1&id='.
80 $elearray[$j]['element_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'&boxid='.
81 $efarr[$i]['extra_field_id'].'">'.
82 '['._('Delete').']</a>';
91 if ($efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_SELECT
92 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_RADIO
93 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX
94 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_MULTISELECT
95 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
96 echo '<a href="'.getStringFromServer('PHP_SELF').'?add_opt=1&boxid='.
97 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">['.
98 _('add choices').']</a>';
103 echo $GLOBALS['HTML']->listTableBottom();
105 echo utils_requiredField().' '._('Indicates required fields.');
107 echo "\n<strong>"._('You have not defined any custom fields')."</strong>";
110 echo "<h2>"._('Add New Custom Field')."</h2>";
112 <form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&atid='.$ath->getID(); ?>" method="post">
114 <input type="hidden" name="add_extrafield" value="y" />
115 <strong><?php echo _('Custom Field Name') ?>:</strong><br />
116 <input type="text" name="name" value="" size="15" maxlength="30" />
119 <strong><?php echo _('Field alias') ?>:</strong><br />
120 <input type="text" name="alias" value="" size="15" maxlength="30" />
124 <strong><?php echo _('Type of custom field') ?>:</strong><br />
125 <input type="radio" name="field_type" value="1" /> <?php echo _('Select Box'); ?><br />
126 <input type="radio" name="field_type" value="2" /> <?php echo _('Check Box'); ?><br />
127 <input type="radio" name="field_type" value="3" /> <?php echo _('Radio Buttons'); ?><br />
128 <input type="radio" name="field_type" value="4" /> <?php echo _('Text Field'); ?><br />
129 <input type="radio" name="field_type" value="5" /> <?php echo _('Multi-Select Box'); ?><br />
130 <input type="radio" name="field_type" value="6" /> <?php echo _('Text Area'); ?><br />
131 <?php if (!$ath->usesCustomStatuses()) { ?>
132 <input type="radio" name="field_type" value="7" /> <?php echo _('Status'); ?><br />
134 <!--<input type="radio" name="field_type" value="8" /> <?php echo _('Box type technician'); ?><br />-->
135 <input type="radio" name="field_type" value="9" /> <?php echo _('Relation between artifacts'); ?><br />
137 <?php echo _('Text Fields and Text Areas need to have Size/Maxlength and Rows/Cols defined, respectively.'); ?><br />
138 <?php echo _('Text Field Size/Text Area Rows'); ?>
139 <input type="text" name="attribute1" value="20" size="2" maxlength="2" /><br />
140 <?php echo _('Text Field Maxlength/Text Area Columns'); ?>
141 <input type="text" name="attribute2" value="80" size="2" maxlength="2" />
144 <div class="warning"><?php echo _('Warning: this add new custom field') ?></div>
147 <input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" />
152 echo "<h2>"._('Custom Field Rendering Template')."</h2><p>";
155 echo '<a href="'.getStringFromServer('PHP_SELF').'?downloadtemplate=1&group_id='.$group_id.'&atid='. $ath->getID() .'">'._('Download default template').'</a><br />';
156 echo '<a href="'.getStringFromServer('PHP_SELF').'?uploadtemplate=1&group_id='.$group_id.'&atid='. $ath->getID() .'">'._('Add/Update template').'</a><br />';
157 echo '<a href="'.getStringFromServer('PHP_SELF').'?deletetemplate=1&group_id='.$group_id.'&atid='. $ath->getID() .'">'._('Delete template').'</a><br />';
160 $ath->footer(array());
164 // c-file-style: "bsd"