5 * Copyright 2010 (c) FusionForge Team
6 * Copyright 2014, Franck Villaume - TrivialDev
7 * http://fusionforge.org
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 // FORM TO BUILD SELECTION BOXES
31 $title = sprintf(_('Manage Custom Fields for %s'), $ath->getName());
32 $ath->adminHeader(array('title'=>$title));
35 List of possible user built Selection Boxes for an ArtifactType
37 $efarr = $ath->getExtraFields();
38 $eftypes=ArtifactExtraField::getAvailableTypes();
39 $keys=array_keys($efarr);
44 $title_arr[]=_('Custom Fields Defined');
45 $title_arr[]=_('Type');
46 $title_arr[]=_('Elements Defined');
47 $title_arr[]=_('Add Options');
48 echo $HTML->listTableTop($title_arr);
50 for ($k=0; $k < $rows; $k++) {
52 $id=str_replace('@','',$efarr[$i]['alias']);
53 echo '<tr id="field-'.$id.'" '. $HTML->boxGetAltRowStyle($i) .">\n".
54 '<td>'.$efarr[$i]['field_name'].(($efarr[$i]['is_required']) ? utils_requiredField() : '').'<a href="'.getStringFromServer('PHP_SELF').'?update_box=1&id='.
55 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">'.
56 ' ['._('Edit').']</a>'.
57 '<a href="'.getStringFromServer('PHP_SELF').'?deleteextrafield=1&id='.
58 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">'.
59 ' ['._('Delete').']</a>'.
60 '<a href="'.getStringFromServer('PHP_SELF').'?copy_opt=1&id='.
61 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">'.
62 ' ['._('Copy').']</a>'.
64 echo '<td>'.$eftypes[$efarr[$i]['field_type']]."</td>\n";
66 List of possible options for a user built Selection Box
68 $elearray = $ath->getExtraFieldElements($efarr[$i]['extra_field_id']);
70 if (!empty($elearray)) {
71 $optrows=count($elearray);
74 for ($j=0; $j <$optrows; $j++) {
75 echo $elearray[$j]['element_name'];
76 echo ' <a href="'.getStringFromServer('PHP_SELF').'?update_opt=1&id='.
77 $elearray[$j]['element_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'&boxid='.
78 $efarr[$i]['extra_field_id'].'">'.
79 '['._('Edit').']</a>';
80 echo ' <a href="'.getStringFromServer('PHP_SELF').'?delete_opt=1&id='.
81 $elearray[$j]['element_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'&boxid='.
82 $efarr[$i]['extra_field_id'].'">'.
83 '['._('Delete').']</a>';
92 if ($efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_SELECT
93 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_RADIO
94 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX
95 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_MULTISELECT
96 || $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
97 echo '<a href="'.getStringFromServer('PHP_SELF').'?add_opt=1&boxid='.
98 $efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">['.
99 _('Add/Reorder choices').']</a>';
104 echo $HTML->listTableBottom();
105 echo $HTML->addRequiredFieldsInfoBox();
107 echo $HTML->warning_msg(_('You have not defined any custom fields'));
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')._(':').utils_requiredField(); ?></strong><br />
116 <input type="text" name="name" value="" size="15" maxlength="30" required="required" />
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" required="required" /> <?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" /><br />
142 <?php echo _('Hide the default none value'); ?>
143 <input type="checkbox" name="hide100" /><br />
144 <?php echo _('Label for the none value'); ?>
145 <input type="text" name="show100label" size="30" value="<?php echo _('none') ?>" /><br />
148 echo $HTML->warning_msg(_('Warning: this add new custom field'));
151 <input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" />
156 echo "<h2>"._('Custom Field Rendering Template')."</h2>";
159 echo '<a href="'.getStringFromServer('PHP_SELF').'?edittemplate=1&group_id='.$group_id.'&atid='. $ath->getID() .'">'._('Edit template').'</a><br />';
160 echo '<a href="'.getStringFromServer('PHP_SELF').'?deletetemplate=1&group_id='.$group_id.'&atid='. $ath->getID() .'">'._('Delete template').'</a><br />';
167 // c-file-style: "bsd"