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.
25 // FORM TO BUILD SELECTION BOXES
28 $title = sprintf(_('Manage Custom Fields for %s'), $ath->getName());
29 $ath->adminHeader(array('title'=>$title));
32 List of possible user built Selection Boxes for an ArtifactType
34 $efarr = $ath->getExtraFields();
35 $eftypes=ArtifactExtraField::getAvailableTypes();
36 $keys=array_keys($efarr);
41 $title_arr[]=_('Custom Fields Defined');
42 $title_arr[]=_('Type');
43 $title_arr[]=_('Elements Defined');
44 $title_arr[]=_('Add Options');
45 echo $GLOBALS['HTML']->listTableTop ($title_arr);
47 for ($k=0; $k < $rows; $k++) {
49 $id=str_replace('@','',$efarr[$i]['alias']);
50 echo '<tr id="field-'.$id.'" '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .">\n".
51 '<td>'.$efarr[$i]['field_name'].(($efarr[$i]['is_required']) ? utils_requiredField() : '').'<a href="'.getStringFromServer('PHP_SELF').'?update_box=1&id='.
52 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">'.
53 ' ['._('Edit').']</a>'.
54 '<a href="'.getStringFromServer('PHP_SELF').'?deleteextrafield=1&id='.
55 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">'.
56 ' ['._('Delete').']</a>'.
57 '<a href="'.getStringFromServer('PHP_SELF').'?copy_opt=1&id='.
58 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">'.
59 ' ['._('Copy').']</a>'.
61 echo '<td>'.$eftypes[$efarr[$i]['field_type']]."</td>\n";
63 List of possible options for a user built Selection Box
65 $elearray = $ath->getExtraFieldElements($efarr[$i]['extra_field_id']);
67 if (!empty($elearray)) {
68 $optrows=count($elearray);
71 for ($j=0; $j <$optrows; $j++) {
72 echo $elearray[$j]['element_name'];
73 echo ' <a href="'.getStringFromServer('PHP_SELF').'?update_opt=1&id='.
74 $elearray[$j]['element_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'&boxid='.
75 $efarr[$i]['extra_field_id'].'">'.
76 '['._('Edit').']</a>';
77 echo ' <a href="'.getStringFromServer('PHP_SELF').'?delete_opt=1&id='.
78 $elearray[$j]['element_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'&boxid='.
79 $efarr[$i]['extra_field_id'].'">'.
80 '['._('Delete').']</a>';
89 if ($efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_SELECT
90 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_RADIO
91 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX
92 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_MULTISELECT
93 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
94 echo '<a href="'.getStringFromServer('PHP_SELF').'?add_opt=1&boxid='.
95 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">['.
96 _('Add/Reorder choices').']</a>';
101 echo $GLOBALS['HTML']->listTableBottom();
103 echo utils_requiredField().' '._('Indicates required fields.');
105 echo "\n<p class=\"warning_msg\">"._('You have not defined any custom fields')."</p>";
108 echo "<h2>"._('Add New Custom Field')."</h2>";
110 <form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&atid='.$ath->getID(); ?>" method="post">
112 <input type="hidden" name="add_extrafield" value="y" />
113 <strong><?php echo _('Custom Field Name')._(':'); ?></strong><br />
114 <input type="text" name="name" value="" size="15" maxlength="30" required="required" />
117 <strong><?php echo _('Field alias')._(':'); ?></strong><br />
118 <input type="text" name="alias" value="" size="15" maxlength="30" />
122 <strong><?php echo _('Type of custom field')._(':'); ?></strong><br />
123 <input type="radio" name="field_type" value="1" /> <?php echo _('Select Box'); ?><br />
124 <input type="radio" name="field_type" value="2" /> <?php echo _('Check Box'); ?><br />
125 <input type="radio" name="field_type" value="3" /> <?php echo _('Radio Buttons'); ?><br />
126 <input type="radio" name="field_type" value="4" /> <?php echo _('Text Field'); ?><br />
127 <input type="radio" name="field_type" value="5" /> <?php echo _('Multi-Select Box'); ?><br />
128 <input type="radio" name="field_type" value="6" /> <?php echo _('Text Area'); ?><br />
129 <?php if (!$ath->usesCustomStatuses()) { ?>
130 <input type="radio" name="field_type" value="7" /> <?php echo _('Status'); ?><br />
132 <!--<input type="radio" name="field_type" value="8" /> <?php echo _('Box type technician'); ?><br />-->
133 <input type="radio" name="field_type" value="9" /> <?php echo _('Relation between artifacts'); ?><br />
135 <?php echo _('Text Fields and Text Areas need to have Size/Maxlength and Rows/Cols defined, respectively.'); ?><br />
136 <?php echo _('Text Field Size/Text Area Rows'); ?>
137 <input type="text" name="attribute1" value="20" size="2" maxlength="2" /><br />
138 <?php echo _('Text Field Maxlength/Text Area Columns'); ?>
139 <input type="text" name="attribute2" value="80" size="2" maxlength="2" />
142 <div class="warning"><?php echo _('Warning: this add new custom field') ?></div>
145 <input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" />
150 echo "<h2>"._('Custom Field Rendering Template')."</h2>";
153 echo '<a href="'.getStringFromServer('PHP_SELF').'?edittemplate=1&group_id='.$group_id.'&atid='. $ath->getID() .'">'._('Edit template').'</a><br />';
154 echo '<a href="'.getStringFromServer('PHP_SELF').'?deletetemplate=1&group_id='.$group_id.'&atid='. $ath->getID() .'">'._('Delete template').'</a><br />';
157 $ath->footer(array());
161 // c-file-style: "bsd"