This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, master has been updated
via 465c44d61a4c50be7ff377655b15df181efcb8e0 (commit)
from 6827a94160dc1dd38165f6cc2b0f06531df45428 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=465c44d61a4c50be7ff377655b15df181efcb8e0
commit 465c44d61a4c50be7ff377655b15df181efcb8e0
Author: Stéphane-Eymeric Bredthauer <[email protected]>
Date: Thu Jul 7 21:31:05 2016 +0200
Tracker: add 'disabled' & 'hidden on submit' properties to extra fields
diff --git a/src/common/tracker/ArtifactExtraField.class.php
b/src/common/tracker/ArtifactExtraField.class.php
index b82570b..94b4a8d 100644
--- a/src/common/tracker/ArtifactExtraField.class.php
+++ b/src/common/tracker/ArtifactExtraField.class.php
@@ -107,7 +107,7 @@ class ArtifactExtraField extends FFError {
* @param int $autoassign True or false whether it
triggers auto-assignment rules
* @return bool true on success / false on failure.
*/
- function create($name, $field_type, $attribute1, $attribute2,
$is_required = 0, $alias = '', $show100 = true, $show100label = 'none',
$description = '', $pattern='', $parent=100, $autoassign=0) {
+ function create($name, $field_type, $attribute1, $attribute2,
$is_required = 0, $alias = '', $show100 = true, $show100label = 'none',
$description = '', $pattern='', $parent=100, $autoassign=0,
$is_hidden_on_submit=0, $is_disabled=0) {
//
// data validation
//
@@ -152,6 +152,8 @@ class ArtifactExtraField extends FFError {
}
$is_required = ($is_required ? 1 : 0);
$autoassign = ($autoassign ? 1 : 0);
+ $is_hidden_on_submit = ($is_hidden_on_submit ? 1 : 0);
+ $is_disabled = ($is_disabled ? 1 : 0);
if (!($alias = $this->generateAlias($alias,$name))) {
$this->setError(_('Unable to generate alias'));
@@ -159,8 +161,8 @@ class ArtifactExtraField extends FFError {
}
db_begin();
- $result = db_query_params ('INSERT INTO
artifact_extra_field_list (group_artifact_id, field_name, field_type,
attribute1, attribute2, is_required, alias, show100, show100label, description,
pattern, parent)
- VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)',
+ $result = db_query_params ('INSERT INTO
artifact_extra_field_list (group_artifact_id, field_name, field_type,
attribute1, attribute2, is_required, alias, show100, show100label, description,
pattern, parent, is_hidden_on_submit, is_disabled)
+ VALUES
($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)',
array ($this->ArtifactType->getID(),
htmlspecialchars($name),
$field_type,
@@ -172,7 +174,9 @@ class ArtifactExtraField extends FFError {
$show100label,
$description,
$pattern,
- $parent));
+ $parent,
+ $is_hidden_on_submit,
+ $is_disabled));
if ($result && db_affected_rows($result) > 0) {
$this->clearError();
@@ -421,6 +425,24 @@ class ArtifactExtraField extends FFError {
}
/**
+ * is_hidden_on_submit - whether this field is hidden on a new
submission or not.
+ *
+ * @return boolean required.
+ */
+ function is_hidden_on_submit() {
+ return $this->data_array['is_hidden_on_submit'];
+ }
+
+ /**
+ * is_disabled - whether this field is disabled or not.
+ *
+ * @return boolean required.
+ */
+ function is_disabled() {
+ return $this->data_array['is_disabled'];
+ }
+
+ /**
* isAutoAssign
*
* @return boolean assign.
@@ -556,7 +578,7 @@ class ArtifactExtraField extends FFError {
* @param int $parent Parent extra field id.
* @return bool success.
*/
- function update($name, $attribute1, $attribute2, $is_required = 0,
$alias = "", $show100 = true, $show100label = 'none', $description = '',
$pattern='', $parent=100, $autoassign=0) {
+ function update($name, $attribute1, $attribute2, $is_required = 0,
$alias = "", $show100 = true, $show100label = 'none', $description = '',
$pattern='', $parent=100, $autoassign=0, $is_hidden_on_submit=0,
$is_disabled=0) {
if (!forge_check_perm ('tracker_admin',
$this->ArtifactType->Group->getID())) {
$this->setPermissionDeniedError();
return false;
@@ -581,10 +603,14 @@ class ArtifactExtraField extends FFError {
$is_required = ($is_required ? 1 : 0);
$autoassign = ($autoassign ? 1 : 0);
+ $is_hidden_on_submit = ($is_hidden_on_submit ? 1 : 0);
+ $is_disabled = ($is_disabled ? 1 : 0);
+ $parent = (is_integer($parent) ? $parent : 100);
if (!($alias = $this->generateAlias($alias,$name))) {
return false;
}
+
$result = db_query_params ('UPDATE artifact_extra_field_list
SET field_name = $1,
description = $2,
@@ -595,9 +621,11 @@ class ArtifactExtraField extends FFError {
show100 = $7,
show100label = $8,
pattern = $9,
- parent = $10
- WHERE extra_field_id = $11
- AND group_artifact_id = $12',
+ parent = $10,
+ is_hidden_on_submit = $11,
+ is_disabled = $12
+ WHERE extra_field_id = $13
+ AND group_artifact_id = $14',
array (htmlspecialchars($name),
$description,
$attribute1,
@@ -608,6 +636,8 @@ class ArtifactExtraField extends FFError {
$show100label,
$pattern,
$parent,
+ $is_hidden_on_submit,
+ $is_disabled,
$this->getID(),
$this->ArtifactType->getID())) ;
if ($result && db_affected_rows($result) > 0) {
diff --git a/src/common/tracker/ArtifactType.class.php
b/src/common/tracker/ArtifactType.class.php
index 3a2fbaa..ca9d524 100644
--- a/src/common/tracker/ArtifactType.class.php
+++ b/src/common/tracker/ArtifactType.class.php
@@ -606,7 +606,14 @@ class ArtifactType extends FFError {
* @param array $types
* @return array arrays of data;
*/
- function getExtraFields($types = array()) {
+ function getExtraFields($types = array(), $get_is_disabled = false,
$get_is_hidden_on_submit = true) {
+ $where ='';
+ if (!$get_is_disabled) {
+ $where = ' AND is_disabled = 0';
+ }
+ if (!$get_is_hidden_on_submit) {
+ $where = ' AND is_hidden_on_submit = 0';
+ }
if (count($types)) {
$filter = implode(',', $types);
$types = explode(',', $filter);
@@ -619,15 +626,17 @@ class ArtifactType extends FFError {
$res = db_query_params('SELECT *
FROM artifact_extra_field_list
WHERE group_artifact_id=$1
- AND field_type = ANY ($2)
- ORDER BY field_type ASC',
+ AND field_type = ANY ($2)'.
+ $where.' '.
+ 'ORDER BY field_type ASC',
array($this->getID(),
db_int_array_to_any_clause($types)));
} else {
$res = db_query_params('SELECT *
FROM artifact_extra_field_list
- WHERE group_artifact_id=$1
- ORDER BY field_type ASC',
+ WHERE group_artifact_id=$1'.
+ $where.' '.
+ 'ORDER BY field_type ASC',
array($this->getID()));
}
while ($arr = db_fetch_array($res)) {
diff --git a/src/common/tracker/actions/admin-updates.php
b/src/common/tracker/actions/admin-updates.php
index 4633603..1acc0c5 100644
--- a/src/common/tracker/actions/admin-updates.php
+++ b/src/common/tracker/actions/admin-updates.php
@@ -46,6 +46,8 @@ if (getStringFromRequest('add_extrafield')) {
$hide100 = getStringFromRequest('hide100');
$show100label = getStringFromRequest('show100label');
$autoassign = getStringFromRequest('autoassign');
+ $is_hidden_on_submit = getStringFromRequest('is_hidden_on_submit');
+ $is_disabled = getStringFromRequest('is_disabled');
$ab = new ArtifactExtraField($ath);
if (!$ab || !is_object($ab)) {
@@ -58,7 +60,7 @@ if (getStringFromRequest('add_extrafield')) {
} else {
$show100 = 1;
}
- if (!$ab->create($name, $field_type, $attribute1, $attribute2,
$is_required, $alias, $show100, $show100label, $description, $pattern, $parent,
$autoassign)) {
+ if (!$ab->create($name, $field_type, $attribute1, $attribute2,
$is_required, $alias, $show100, $show100label, $description, $pattern, $parent,
$autoassign, $is_hidden_on_submit, $is_disabled)) {
$error_msg .= _('Error inserting a custom field')._(':
').$ab->getErrorMessage();
$ab->clearError();
} else {
@@ -241,6 +243,8 @@ if (getStringFromRequest('add_extrafield')) {
$hide100 = getStringFromRequest('hide100');
$show100label = getStringFromRequest('show100label');
$autoassign = getStringFromRequest('autoassign');
+ $is_hidden_on_submit = getStringFromRequest('is_hidden_on_submit');
+ $is_disabled = getStringFromRequest('is_disabled');
$ac = new ArtifactExtraField($ath, $id);
if (!$ac || !is_object($ac)) {
$error_msg .= _('Unable to create ArtifactExtraField Object');
@@ -252,7 +256,7 @@ if (getStringFromRequest('add_extrafield')) {
} else {
$show100 = 1;
}
- if (!$ac->update($name, $attribute1, $attribute2, $is_required,
$alias, $show100, $show100label, $description, $pattern, $parent, $autoassign))
{
+ if (!$ac->update($name, $attribute1, $attribute2, $is_required,
$alias, $show100, $show100label, $description, $pattern, $parent, $autoassign,
$is_hidden_on_submit, $is_disabled)) {
$error_msg .= _('Update failed')._(':
').$ac->getErrorMessage();
$ac->clearError();
} else {
diff --git a/src/common/tracker/include/ArtifactTypeHtml.class.php
b/src/common/tracker/include/ArtifactTypeHtml.class.php
index 50deb5f..4d892db 100644
--- a/src/common/tracker/include/ArtifactTypeHtml.class.php
+++ b/src/common/tracker/include/ArtifactTypeHtml.class.php
@@ -163,7 +163,7 @@ class ArtifactTypeHtml extends ArtifactType {
* @param string $text_any
* @param array $types
* @param bool $status_show_100 Force display of the
'100' value if needed. Default is false.
- * @param string $mode
+ * @param string $mode QUERY, DISPLAY, UPDATE,
NEW
*/
function renderExtraFields($selected = array(),
$show_100 = false, $text_100 = 'none',
@@ -171,7 +171,11 @@ class ArtifactTypeHtml extends ArtifactType {
$types = array(),
$status_show_100 = false,
$mode = '') {
- $efarr = $this->getExtraFields($types);
+ if ($mode == 'NEW') {
+ $efarr = $this->getExtraFields($types, false, false);
+ } else {
+ $efarr = $this->getExtraFields($types);
+ }
//each two columns, we'll reset this and start a new row
$template = $this->getRenderHTML($types, $mode);
@@ -326,8 +330,8 @@ class ArtifactTypeHtml extends ArtifactType {
} elseif ($efarr[$i]['field_type'] ==
ARTIFACT_EXTRAFIELDTYPE_RELATION) {
$str =
$this->renderRelationField($efarr[$i]['extra_field_id'],$selected[$efarr[$i]['extra_field_id']],$efarr[$i]['attribute1'],$efarr[$i]['attribute2'],
$attrs);
- if ($mode == 'UPDATE') {
- $post_name =
html_image('ic/forum_edit.gif', 37, 15, array('title'=>"Click to edit",
'alt'=>"Click to edit", 'onclick'=>"switch2edit(this, 'show$i', 'edit$i')"));
+ if ($mode == 'UPDATE' || $mode == 'NEW') {
+ $post_name =
html_image('ic/forum_edit.gif', 37, 15 ,array('title'=>"Click to edit",
'alt'=>"Click to edit", 'onclick'=>"switch2edit(this, 'show$i', 'edit$i')"));
}
} elseif ($efarr[$i]['field_type'] ==
ARTIFACT_EXTRAFIELDTYPE_USER) {
$str =
$this->renderUserField($efarr[$i]['extra_field_id'],$selected[$efarr[$i]['extra_field_id']],$efarr[$i]['show100'],$efarr[$i]['show100label'],$show_any,$text_any,false,
$attrs);
@@ -336,7 +340,7 @@ class ArtifactTypeHtml extends ArtifactType {
$template =
str_replace('{$'.$efarr[$i]['field_name'].'}',$str,$template);
}
if($template != NULL){
- if ($mode == 'UPDATE') {
+ if ($mode == 'UPDATE' || $mode == 'NEW') {
$jsvariable ="
var invalidSelectMsg = '"._("One or more of the selected options is not
allowed")."';
var invalidInputMsg = '". _("This choice is not allowed")."';";
@@ -550,7 +554,7 @@ EOS;
*/
function getRenderHTML($types=array(), $mode='') {
// Use template only for the browse (not for query or mass
update)
- if (($mode === 'DISPLAY' || $mode === 'DETAIL' || $mode ===
'UPDATE')
+ if (($mode === 'DISPLAY' || $mode === 'DETAIL' || $mode ===
'UPDATE' || $mode == 'NEW')
&& $this->data_array['custom_renderer']) {
return
preg_replace('/<!--(\S+.*?)-->/','{$\\1}',$this->data_array['custom_renderer']);
} else {
diff --git a/src/common/tracker/include/build_submission_form.php
b/src/common/tracker/include/build_submission_form.php
index 5965b8d..eb93cd7 100644
--- a/src/common/tracker/include/build_submission_form.php
+++ b/src/common/tracker/include/build_submission_form.php
@@ -50,7 +50,7 @@ function artifact_submission_form($ath, $group, $summary='',
$details='', $assig
$cells[] = array(html_e('input', array('type'=>'submit',
'name'=>'submit', 'value'=>_('Submit'))), 'class'=>'top');
echo $HTML->multiTableRow(array(), $cells);
-
$ath->renderExtraFields($extra_fields,true,'none',false,'Any',array(),false,'UPDATE');
+
$ath->renderExtraFields($extra_fields,true,'none',false,'Any',array(),false,'NEW');
if (forge_check_perm ('tracker', $ath->getID(), 'manager')) {
$content = html_e('strong', array(), _('Assigned
to')._(':')).html_e('br');
diff --git a/src/common/tracker/views/form-addextrafield.php
b/src/common/tracker/views/form-addextrafield.php
index 0d66983..c496133 100644
--- a/src/common/tracker/views/form-addextrafield.php
+++ b/src/common/tracker/views/form-addextrafield.php
@@ -35,7 +35,7 @@ $ath->adminHeader(array('title'=>$title, 'modal'=>1));
/*
List of possible user built Selection Boxes for an ArtifactType
*/
-$efarr = $ath->getExtraFields();
+$efarr = $ath->getExtraFields(array(),true,true);
$eftypes=ArtifactExtraField::getAvailableTypes();
$keys=array_keys($efarr);
$rows=count($keys);
@@ -44,6 +44,9 @@ if ($rows > 0) {
$title_arr=array();
$title_arr[]=_('Custom Fields Defined');
$title_arr[]=_('Type');
+ $title_arr[]=_('Enabled');
+ $title_arr[]=_('Required');
+ $title_arr[]=_('Shown on Submit');
$title_arr[]=_('Auto Assign');
$title_arr[]=_('Depend on');
$title_arr[]=_('Elements Defined');
@@ -62,6 +65,21 @@ if ($rows > 0) {
util_make_link('/tracker/admin/?copy_opt=1&id='.$efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='.
$ath->getID(), ' ['._('Copy').']').
"</td>\n";
echo '<td>'.$eftypes[$efarr[$i]['field_type']]."</td>\n";
+ if ($efarr[$i]['is_disabled'] == 0) {
+ echo '<td
class="align-center">'.html_image("ic/check.png",'15','13').'</td>'."\n";
+ } else {
+ echo '<td></td>'."\n";
+ }
+ if ($efarr[$i]['is_required'] == 1) {
+ echo '<td
class="align-center">'.html_image("ic/check.png",'15','13').'</td>'."\n";
+ } else {
+ echo '<td></td>'."\n";
+ }
+ if ($efarr[$i]['is_hidden_on_submit'] == 0) {
+ echo '<td
class="align-center">'.html_image("ic/check.png",'15','13').'</td>'."\n";
+ } else {
+ echo '<td></td>'."\n";
+ }
if ($autoAssignFieldId==$i) {
echo '<td
class="align-center">'.html_image("ic/check.png",'15','13').'</td>'."\n";
} else {
@@ -147,11 +165,76 @@ echo html_e('input', array('type'=>'text',
'name'=>'description', 'value'=>'', '
echo html_ac(html_ap() - 1);
echo html_ao('p');
+echo html_build_checkbox('is_disabled', false, false);
+echo html_e('label', array('for'=>'is_disabled'), _('Field is disabled'));
+echo html_ac(html_ap() - 1);
+
+echo html_ao('p');
echo html_build_checkbox('is_required', false, false);
echo html_e('label', array('for'=>'is_required'), _('Field is mandatory'));
echo html_ac(html_ap() - 1);
echo html_ao('p');
+echo html_build_checkbox('is_hidden_on_submit', false, false);
+echo html_e('label', array('for'=>'is_hidden_on_submit'), _('Hide this Field
on a new submission'));
+echo html_ac(html_ap() - 1);
+
+$jsvariable ="
+ var size = '"._("Size")."';
+ var maxLength = '". _("Maxlength")."';
+ var rows = '"._("Rows")."';
+ var columns = '". _("Columns")."';";
+$javascript = <<<'EOS'
+ $("p[class^='for-']").hide()
+ $("input[value=1]").on('change', function(){
+ $("p.for-select").show();
+ $("p[class^='for-']:not(.for-select)").hide();
+ });
+ $("input[value=2]").on('change', function(){
+ $("p.for-check").show();
+ $("p[class^='for-']:not(.for-check)").hide();
+ });
+ $("input[value=3]").on('change', function(){
+ $("p.for-radio").show();
+ $("p[class^='for-']:not(.for-radio)").hide();
+ });
+ $("input[value=4]").on('change', function(){
+ $("label[for='attribute1']").text(size);
+ $("label[for='attribute2']").text(maxLength);
+ $("p.for-text").show();
+ $("p[class^='for-']:not(.for-text)").hide();
+ });
+ $("input[value=5]").on('change', function(){
+ $("p.for-multiselect").show();
+ $("p[class^='for-']:not(.for-multiselect)").hide();
+ });
+ $("input[value=6]").on('change', function(){
+ $("label[for='attribute1']").text(rows);
+ $("label[for='attribute2']").text(columns);
+ $("p.for-textarea").show();
+ $("p[class^='for-']:not(.for-textarea)").hide();
+ });
+ $("input[value=9]").on('change', function(){
+ $("label[for='attribute1']").text(size);
+ $("label[for='attribute2']").text(maxLength);
+ $("p.for-relation").show();
+ $("p[class^='for-']:not(.for-relation)").hide();
+ });
+ $("input[value=10]").on('change', function(){
+ $("label[for='attribute1']").text(size);
+ $("label[for='attribute2']").text(maxLength);
+ $("p.for-integer").show();
+ $("p[class^='for-']:not(.for-integer)").hide();
+ });
+ $("input[value=14]").on('change', function(){
+ $("p.for-user").show();
+ $("p[class^='for-']:not(.for-user)").hide();
+ });
+
+EOS;
+echo html_e('script', array( 'type'=>'text/javascript'),
'//<![CDATA['."\n".'$(function(){'.$jsvariable."\n".$javascript.'});'."\n".'//]]>');
+
+echo html_ao('p');
echo html_e('strong', array(), _('Type of custom
field').utils_requiredField()._(':')).html_e('br');
if ($ath->usesCustomStatuses()) {
unset($eftypes[ARTIFACT_EXTRAFIELDTYPE_STATUS]);
@@ -161,31 +244,28 @@ $texts = array_values($eftypes);
echo html_build_radio_buttons_from_arrays($vals, $texts, 'field_type', '',
false, '', false ,'', false, array('required'=>'required') );
echo html_ac(html_ap() - 1);
-echo html_ao('p');
-echo _('Text Fields and Text Areas need to have Size/Maxlength and Rows/Cols
defined, respectively.').html_e('br');
-echo _('Text Field Size/Text Area Rows');
+echo html_ao('p', array('class'=>'for-text for-textarea for-integer
for-relation'));
+echo html_e('label', array('for'=>'attribute1'), _('Size')._(':'));
echo html_e('input', array('type'=>'text', 'name'=>'attribute1',
'value'=>'20', 'size'=>'2', 'maxlength'=>'2')).html_e('br');
-echo _('Text Field Maxlength/Text Area Columns');
+echo html_e('label', array('for'=>'attribute2'), _('Maxlength')._(':'));
echo html_e('input', array('type'=>'text', 'name'=>'attribute2',
'value'=>'80', 'size'=>'2', 'maxlength'=>'2')).html_e('br');
echo html_ac(html_ap() - 1);
-echo html_ao('p');
-echo _('Text Field Pattern');
+echo html_ao('p', array('class'=>'for-text'));
+echo _('Pattern');
echo html_e('input', array('type'=>'text', 'name'=>'pattern', 'value'=>'',
'size'=>'50', 'maxlength'=>'255')).html_e('br');
echo html_ac(html_ap() - 1);
-echo html_ao('p');
+echo html_ao('p', array('class'=>'for-select for-multiselect for-radio
for-check'));
echo html_build_checkbox('hide100', false, false);
echo html_e('label', array('for'=>'hide100'), _('Hide the default none
value'));
-echo html_ac(html_ap() - 1);
-
-echo html_ao('p');
-echo _('Label for the none value');
+echo html_e('br');
+echo html_e('label', array('for'=>'show100label'), _('Label for the none
value'));
echo html_e('input', array('type'=>'text', 'name'=>'show100label',
'value'=>_('none'), 'size'=>'30')).html_e('br');
echo html_ac(html_ap() - 1);
-echo html_ao('p');
-$pfarr = $ath->getExtraFields(array(ARTIFACT_EXTRAFIELDTYPE_RADIO,
ARTIFACT_EXTRAFIELDTYPE_CHECKBOX,ARTIFACT_EXTRAFIELDTYPE_SELECT,ARTIFACT_EXTRAFIELDTYPE_MULTISELECT));
+echo html_ao('p', array('class'=>'for-select for-multiselect for-radio
for-check'));
+$pfarr = $ath->getExtraFields(array(ARTIFACT_EXTRAFIELDTYPE_RADIO,
ARTIFACT_EXTRAFIELDTYPE_CHECKBOX,ARTIFACT_EXTRAFIELDTYPE_SELECT,ARTIFACT_EXTRAFIELDTYPE_MULTISELECT),fasle,true);
$parentField = array();
if (is_array($pfarr)) {
foreach ($pfarr as $pf) {
@@ -193,11 +273,11 @@ if (is_array($pfarr)) {
}
}
asort($parentField,SORT_FLAG_CASE | SORT_STRING);
-echo _('Parent Field');
+echo html_e('label', array('for'=>'parent'), _('Parent Field'));
echo html_build_select_box_from_arrays(array_keys($parentField),
array_values($parentField), 'parent', null, true, 'none').html_e('br');
echo html_ac(html_ap() - 1);
-echo html_ao('p');
+echo html_ao('p', array('class'=>'for-select for-multiselect for-radio
for-check'));
echo html_build_checkbox('autoassign', false, false);
echo html_e('label', array('for'=>'autoassign'), _('Field that triggers
auto-assignment rules'));
echo html_ac(html_ap() - 1);
diff --git a/src/common/tracker/views/form-updateextrafield.php
b/src/common/tracker/views/form-updateextrafield.php
index c56fdbd..9d64679 100644
--- a/src/common/tracker/views/form-updateextrafield.php
+++ b/src/common/tracker/views/form-updateextrafield.php
@@ -65,43 +65,55 @@ if (!$ac || !is_object($ac)) {
echo html_ac(html_ap() - 1);
echo html_ao('p');
+ echo html_build_checkbox('is_disabled', false, $ac->is_disabled());
+ echo html_e('label', array('for'=>'is_disabled'), _('Field is
disabled'));
+ echo html_ac(html_ap() - 1);
+
+ echo html_ao('p');
echo html_build_checkbox('is_required', false, $ac->isRequired());
echo html_e('label', array('for'=>'is_required'), _('Field is
mandatory'));
echo html_ac(html_ap() - 1);
+ echo html_ao('p');
+ echo html_build_checkbox('is_hidden_on_submit', false,
$ac->is_hidden_on_submit());
+ echo html_e('label', array('for'=>'is_hidden_on_submit'), _('Hide this
Field on a new submission'));
+ echo html_ac(html_ap() - 1);
+
$efType=$ac->getType();
if ($efType == ARTIFACT_EXTRAFIELDTYPE_TEXTAREA) {
echo html_ao('p');
- echo html_e('label', array('for'=>'attribute1'), _('Text Area
Columns'));
+ echo html_e('label', array('for'=>'attribute1'), _('Rows'));
echo html_e('input', array('type'=>'text', 'id'=>'attribute1',
'name'=>'attribute1', 'value'=>$ac->getAttribute1(), 'size'=>'2',
'maxlength'=>'2'));
echo html_ac(html_ap() - 1);
echo html_ao('p');
- echo html_e('label', array('for'=>'attribute2'), _('Text Area
Columns'));
+ echo html_e('label', array('for'=>'attribute2'), _('Columns'));
echo html_e('input', array('type'=>'text', 'id'=>'attribute2',
'name'=>'attribute2', 'value'=>$ac->getAttribute2(), 'size'=>'2',
'maxlength'=>'2'));
echo html_ac(html_ap() - 1);
- } elseif ($efType == ARTIFACT_EXTRAFIELDTYPE_TEXT || $efType ==
ARTIFACT_EXTRAFIELDTYPE_RELATION) {
+ } elseif ($efType == ARTIFACT_EXTRAFIELDTYPE_TEXT || $efType ==
ARTIFACT_EXTRAFIELDTYPE_INTEGER || $efType == ARTIFACT_EXTRAFIELDTYPE_RELATION)
{
echo html_ao('p');
- echo html_e('label', array('for'=>'attribute1'), _('Text Field
Size'));
+ echo html_e('label', array('for'=>'attribute1'), _('Size'));
echo html_e('input', array('type'=>'text', 'id'=>'attribute1',
'name'=>'attribute1', 'value'=>$ac->getAttribute1(), 'size'=>'2',
'maxlength'=>'2'));
echo html_ac(html_ap() - 1);
echo html_ao('p');
- echo html_e('label', array('for'=>'attribute2'), _('Text Field
Maxlength'));
+ echo html_e('label', array('for'=>'attribute2'),
_('Maxlength'));
echo html_e('input', array('type'=>'text', 'id'=>'attribute2',
'name'=>'attribute2', 'value'=>$ac->getAttribute2(), 'size'=>'2',
'maxlength'=>'2'));
echo html_ac(html_ap() - 1);
-
- if ($efType == ARTIFACT_EXTRAFIELDTYPE_TEXT) {
- echo html_ao('p');
- echo html_e('label', array('for'=>'pattern'), _('Text
Field Pattern'));
- echo html_e('input', array('type'=>'text',
'id'=>'pattern', 'name'=>'pattern', 'value'=>$ac->getPattern(), 'size'=>'50',
'maxlength'=>'255'));
- echo html_ac(html_ap() - 1);
- }
} else {
echo html_e('input', array('type'=>'hidden',
'name'=>'attribute1', 'value'=>'0'));
echo html_e('input', array('type'=>'hidden',
'name'=>'attribute2', 'value'=>'0'));
-
+ }
+ if ($efType == ARTIFACT_EXTRAFIELDTYPE_TEXT) {
+ echo html_ao('p');
+ echo html_e('label', array('for'=>'pattern'), _('Pattern'));
+ echo html_e('input', array('type'=>'text', 'id'=>'pattern',
'name'=>'pattern', 'value'=>$ac->getPattern(), 'size'=>'50',
'maxlength'=>'255'));
+ echo html_ac(html_ap() - 1);
+ } else {
+ echo html_e('input', array('type'=>'hidden', 'name'=>'pattern',
'value'=>''));
+ }
+ if (in_array($efType, array(ARTIFACT_EXTRAFIELDTYPE_RADIO,
ARTIFACT_EXTRAFIELDTYPE_CHECKBOX,ARTIFACT_EXTRAFIELDTYPE_SELECT,ARTIFACT_EXTRAFIELDTYPE_MULTISELECT)))
{
echo html_ao('p');
echo html_build_checkbox('hide100', false, !$ac->getShow100());
echo html_e('label', array('for'=>'hide100'), _('Hide the
default none value'));
@@ -112,29 +124,34 @@ if (!$ac || !is_object($ac)) {
echo html_e('input', array('type'=>'text',
'name'=>'show100label', 'value'=>$ac->getShow100label(), 'size'=>'30'));
echo html_ac(html_ap() - 1);
- if (in_array($efType, array(ARTIFACT_EXTRAFIELDTYPE_RADIO,
ARTIFACT_EXTRAFIELDTYPE_CHECKBOX,ARTIFACT_EXTRAFIELDTYPE_SELECT,ARTIFACT_EXTRAFIELDTYPE_MULTISELECT)))
{
- $pfarr =
$ath->getExtraFields(array(ARTIFACT_EXTRAFIELDTYPE_RADIO,
ARTIFACT_EXTRAFIELDTYPE_CHECKBOX,ARTIFACT_EXTRAFIELDTYPE_SELECT,ARTIFACT_EXTRAFIELDTYPE_MULTISELECT));
- $parentField = array();
- $progenyField = $ac->getProgeny();
- if (is_array($pfarr)) {
- foreach ($pfarr as $pf) {
- if ($pf['extra_field_id'] != $id &&
!in_array($pf['extra_field_id'], $progenyField))
- $parentField[$pf['extra_field_id']] =
$pf['field_name'];
- }
+ $pfarr =
$ath->getExtraFields(array(ARTIFACT_EXTRAFIELDTYPE_RADIO,
ARTIFACT_EXTRAFIELDTYPE_CHECKBOX,ARTIFACT_EXTRAFIELDTYPE_SELECT,ARTIFACT_EXTRAFIELDTYPE_MULTISELECT));
+ $parentField = array();
+ $progenyField = $ac->getProgeny();
+ if (is_array($pfarr)) {
+ foreach ($pfarr as $pf) {
+ if ($pf['extra_field_id'] != $id &&
!in_array($pf['extra_field_id'], $progenyField))
+ $parentField[$pf['extra_field_id']] =
$pf['field_name'];
}
- asort($parentField,SORT_FLAG_CASE | SORT_STRING);
- echo html_ao('p');
- echo html_e('label', array('for'=>'parent'),
html_e('strong', array(), _('Parent Field')._(':')).html_e('br'));
- echo
html_build_select_box_from_arrays(array_keys($parentField),
array_values($parentField), 'parent', $ac->getParent(), true,
'none').html_e('br');
- echo html_ac(html_ap() - 1);
- }
- if (in_array($efType, array(ARTIFACT_EXTRAFIELDTYPE_RADIO,
ARTIFACT_EXTRAFIELDTYPE_SELECT))) {
- echo html_ao('p');
- echo html_build_checkbox('autoassign', false,
$ac->isAutoAssign());
- echo html_e('label', array('for'=>'autoassign'),
_('Field that triggers auto-assignment rules'));
- echo html_ac(html_ap() - 1);
}
+ asort($parentField,SORT_FLAG_CASE | SORT_STRING);
+ echo html_ao('p');
+ echo html_e('label', array('for'=>'parent'), html_e('strong',
array(), _('Parent Field')._(':')).html_e('br'));
+ echo
html_build_select_box_from_arrays(array_keys($parentField),
array_values($parentField), 'parent', $ac->getParent(), true,
'none').html_e('br');
+ echo html_ac(html_ap() - 1);
+ } else {
+ echo html_e('input', array('type'=>'hidden', 'name'=>'hide100',
'value'=>0));
+ echo html_e('input', array('type'=>'hidden',
'name'=>'show100label', 'value'=>''));
+ echo html_e('input', array('type'=>'hidden', 'name'=>'parent',
'value'=>100));
}
+ if (in_array($efType, array(ARTIFACT_EXTRAFIELDTYPE_RADIO,
ARTIFACT_EXTRAFIELDTYPE_SELECT))) {
+ echo html_ao('p');
+ echo html_build_checkbox('autoassign', false,
$ac->isAutoAssign());
+ echo html_e('label', array('for'=>'autoassign'), _('Field that
triggers auto-assignment rules'));
+ echo html_ac(html_ap() - 1);
+ } else {
+ echo html_e('input', array('type'=>'hidden',
'name'=>'autoassign', 'value'=>0));
+ }
+
echo $HTML->warning_msg(_('It is not recommended that you change the
custom field name because other things are dependent upon it. When you change
the custom field name, all related items will be changed to the new name.'));
diff --git
a/src/db/20160703-tracker-extra_field-is_disabled-and-is_hidden_on_submit.sql
b/src/db/20160703-tracker-extra_field-is_disabled-and-is_hidden_on_submit.sql
new file mode 100644
index 0000000..ae05181
--- /dev/null
+++
b/src/db/20160703-tracker-extra_field-is_disabled-and-is_hidden_on_submit.sql
@@ -0,0 +1,3 @@
+ALTER TABLE artifact_extra_field_list
+ ADD is_disabled integer NOT NULL DEFAULT 0,
+ ADD is_hidden_on_submit integer NOT NULL DEFAULT 0;
\ No newline at end of file
-----------------------------------------------------------------------
Summary of changes:
src/common/tracker/ArtifactExtraField.class.php | 46 +++++++--
src/common/tracker/ArtifactType.class.php | 19 +++-
src/common/tracker/actions/admin-updates.php | 8 +-
.../tracker/include/ArtifactTypeHtml.class.php | 16 +--
.../tracker/include/build_submission_form.php | 2 +-
src/common/tracker/views/form-addextrafield.php | 112 ++++++++++++++++++---
src/common/tracker/views/form-updateextrafield.php | 83 +++++++++------
...a_field-is_disabled-and-is_hidden_on_submit.sql | 3 +
8 files changed, 218 insertions(+), 71 deletions(-)
create mode 100644
src/db/20160703-tracker-extra_field-is_disabled-and-is_hidden_on_submit.sql
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits