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);
42 $title_arr[]=_('Custom Fields Defined');
43 $title_arr[]=_('Type');
44 $title_arr[]=_('Elements Defined');
45 $title_arr[]=_('Add Options');
46 echo $GLOBALS['HTML']->listTableTop ($title_arr);
48 for ($k=0; $k < $rows; $k++) {
50 $id=str_replace('@','',$efarr[$i]['alias']);
51 echo '<tr id="field-'.$id.'" '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .">\n".
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>\n";
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++) {
73 echo $elearray[$j]['element_name'];
74 echo ' <a href="'.getStringFromServer('PHP_SELF').'?update_opt=1&id='.
75 $elearray[$j]['element_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'&boxid='.
76 $efarr[$i]['extra_field_id'].'">'.
77 '['._('Edit').']</a>';
78 echo ' <a href="'.getStringFromServer('PHP_SELF').'?delete_opt=1&id='.
79 $elearray[$j]['element_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'&boxid='.
80 $efarr[$i]['extra_field_id'].'">'.
81 '['._('Delete').']</a>';
90 if ($efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_SELECT
91 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_RADIO
92 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX
93 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_MULTISELECT
94 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
95 echo '<a href="'.getStringFromServer('PHP_SELF').'?add_opt=1&boxid='.
96 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">['.
97 _('Add/Reorder choices').']</a>';
102 echo $GLOBALS['HTML']->listTableBottom();
104 echo utils_requiredField().' '._('Indicates required fields.');
106 echo "\n<p class=\"warning_msg\">"._('You have not defined any custom fields')."</p>";
109 echo "<h2>"._('Add New Custom Field')."</h2>";
111 <form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&atid='.$ath->getID(); ?>" method="post">
113 <input type="hidden" name="add_extrafield" value="y" />
114 <strong><?php echo _('Custom Field Name') ?>:</strong><br />
115 <input type="text" name="name" value="" size="15" maxlength="30" />
118 <strong><?php echo _('Field alias') ?>:</strong><br />
119 <input type="text" name="alias" value="" size="15" maxlength="30" />
123 <strong><?php echo _('Type of custom field') ?>:</strong><br />
124 <input type="radio" name="field_type" value="1" /> <?php echo _('Select Box'); ?><br />
125 <input type="radio" name="field_type" value="2" /> <?php echo _('Check Box'); ?><br />
126 <input type="radio" name="field_type" value="3" /> <?php echo _('Radio Buttons'); ?><br />
127 <input type="radio" name="field_type" value="4" /> <?php echo _('Text Field'); ?><br />
128 <input type="radio" name="field_type" value="5" /> <?php echo _('Multi-Select Box'); ?><br />
129 <input type="radio" name="field_type" value="6" /> <?php echo _('Text Area'); ?><br />
130 <?php if (!$ath->usesCustomStatuses()) { ?>
131 <input type="radio" name="field_type" value="7" /> <?php echo _('Status'); ?><br />
133 <!--<input type="radio" name="field_type" value="8" /> <?php echo _('Box type technician'); ?><br />-->
134 <input type="radio" name="field_type" value="9" /> <?php echo _('Relation between artifacts'); ?><br />
136 <?php echo _('Text Fields and Text Areas need to have Size/Maxlength and Rows/Cols defined, respectively.'); ?><br />
137 <?php echo _('Text Field Size/Text Area Rows'); ?>
138 <input type="text" name="attribute1" value="20" size="2" maxlength="2" /><br />
139 <?php echo _('Text Field Maxlength/Text Area Columns'); ?>
140 <input type="text" name="attribute2" value="80" size="2" maxlength="2" />
143 <div class="warning"><?php echo _('Warning: this add new custom field') ?></div>
146 <input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" />
151 echo "<h2>"._('Custom Field Rendering Template')."</h2>";
154 echo '<a href="'.getStringFromServer('PHP_SELF').'?edittemplate=1&group_id='.$group_id.'&atid='. $ath->getID() .'">'._('Edit template').'</a><br />';
155 echo '<a href="'.getStringFromServer('PHP_SELF').'?deletetemplate=1&group_id='.$group_id.'&atid='. $ath->getID() .'">'._('Delete template').'</a><br />';
158 $ath->footer(array());
162 // c-file-style: "bsd"