elvis0123

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

参考,翻译此页面All FIELD XML Elements Reference(http://msdn.microsoft.com/en-us/library/ms194953.aspx

对于每一个字段的功能,我都亲自试验了一遍,并添加自己对功能的理解和使用用例。

注意:以下功能可以叠加使用,但是不要出现冲突,例如在只读的情况下要求必填,虽然模板保存验证上会通过,但实际操作工作项,会导致无法保存。

当打开字段的属性页面的时候,你会用到它们。如下图

Element

Description and syntax

ALLOWEDVALUES

Defines a list of values that users can specify in a field list on work item forms and in the query editor. Users must specify one of the values that you list.

定义下拉列表,此列表项为必选项。

例:如上一章组别,我们可以选择此功能,定义一个必选的组别。它与SUGGESTEDVALUES的区别在于,此功能为必须从列表中选择一项,SUGGESTEDVALUES则可以不选,或自定义填写。

更多可参考: Define Pick Lists.

ALLOWEXISTINGVALUE

Specifies that a field can retain an existing value, even if it is no longer in a pick list. All new field values must be in the list.

类似Textbox录入框。(无权限定义)

更多可参考: Define Pick Lists.

CANNOTLOSEVALUE

Specifies that users cannot clear a field of all values after a value has been specified. After the field contains a value, that field must always contain a non-NULL value.

字段一旦填写保存,则不可再置为空。

如图,这是在有值保存后,修改为空,提示不能为空。

更多可参考: Set Conditions on a Work Item Field.

COPY

Copies a specified value to a field when a user creates or modifies a work item.

当用户创建或修改一个工作项的时候,拷贝一个值到此处。有四个选项。Value-值 | field-字段 | clock-时间 | currentuser-用户。注意,要对应类型正确,不然无法通过验证

如图,选择的是currentuser,这创建工作项后,直接填写的是当前操作人员。

例:时间可作为保存当前操作时间。用户保存当前用户。值为填入默认值。字段为拷贝字段(注意类型正确,可拷贝某些隐藏属性值)

更多可参考: Define a Default Value or Copy a Value to a Field.

DEFAULT

Specifies a value for a field that is empty when a user creates or modifies a work item. If a field already has a value, the default rule is ignored.

当用户创建或修改一个工作项的时候,此字段为空,则填入值。如果非空,则忽略操作。有四个选项。Value-值 | field-字段 | clock-时间 | currentuser-用户。注意,要对应类型正确,不然无法通过验证

例:和COPY相同,但只可操作空字段。

更多可参考: Define a Default Value or Copy a Value to a Field.

EMPTY

Clears the field of any value that it contains. The EMPTY rule also makes a field read-only, and you should not be use it with the READONLY rule.

The field value is cleared when a user saves the work item, and you cannot specify any value. This rule is primarily used during state transition to clear fields that apply to the state to which the item is transitioning.

清除这个字段的值,且将字段置为只读。

例:此功能可以用来,当工作流到某个阶段的时候,清空此字段值。(我的理解是,但不一定这样用)

更多可参考: Set Conditions on a Work Item Field.

FROZEN

Specifies that you cannot change the field to a non-empty value after changes are committed. As soon as a user saves the work item with a value in that field, the value can no longer be modified.

字段一旦填写保存,则不可再修改。

例:类似默认字段中的创建者字段,一旦保存,则不可更改。或需要记录某些创建时间,也可以使用此功能。

更多可参考: Set Conditions on a Work Item Field.

HELPTEXT

Defines the text to appear when a user points to the field in the work item form.

tooltipText: A string of text that contains between 1 and 255 characters.

此功能未找到!(可能版本问题,目前的帮助信息可以写在面板的定制里)

更多可参考: Define the Help Text for a Work Item Field.

MATCH

Defines a pattern that values of String type fields must match.

定义字段必须匹配的类型,使用"A", "N", and "X"的方式限制字母,数字(纯正则表达式使用不成功)。具体见下面的更多参考。

例:可限制此字段输入的值。如4位数字这样的要求。

更多可参考: Make a String Field Match a Pattern.

NOTSAMEAS

Specifies that a field is not assigned the same value as that to which another specified field is assigned. The value of the field attribute must be a valid reference name of a field.

通过字段名称,判断此字段是否和那个字段内容相同,相同则不可保存。

更多可参考: Set Conditions on a Work Item Field.

PROHIBITEDVALUES

Defines a list of values that a field cannot contain. Users cannot save a work item if the field contains a prohibited value.

定义过滤词,如出现则不可保存。

例:可作黑名单词汇过滤功能。

更多可参考: Define Pick Lists.

READONLY

Specifies that you cannot modify the value to which the field is assigned.

此字段为只读。

注意,不要将此功能与EMPTY功能共同使用,因为EMPTY功能也会置字段为只读,则会出现歧义。

更多可参考: Set Conditions on a Work Item Field.

REQUIRED

Specifies that users must specify a value for the field. Required fields cannot be empty. Users cannot save a work item until they have assigned values to all required fields.

必填字段,设置后,此字段为必填,不可为空。

例:可将任何字段作为必填项。

更多可参考: Set Conditions on a Work Item Field.

SERVERDEFAULT

Copies a specified server value to a field when a user saves a work item. These fields usually appear as read-only on the form.

复制一个服务器值到此字段(clock-时间 | currentuser-用户),这个字段被默认为只读(为其再添加只读属性会有问题)。

更多可参考: Define a Default Value or Copy a Value to a Field.

SUGGESTEDVALUES

Defines a suggested list of values that users can specify in a field list on work item forms and in the query editor. Users can specify values other than those that you suggest.

定义下拉列表,此列表可选,或自定义填写。与ALLOWEDVALUES的区别是,ALLOWEDVALUES必须选择列表项填写,而SUGGESTEDVALUES是可以不填,或填写自定义内容的。

例:可作为建议选择项,建议一些内容。比如我们可以修改"标题"的字段,为其加入一些建议选择项,方便填写。

更多可参考: Define Pick Lists.

VALIDUSER

Restricts work items from being modified by users who belong to the group that you specify. The default group is the Team Foundation Valid Users group.

All attributes are optional. All attributes must consist of a string of text that contains between 1 and 255 characters. You can use tokens to specify groups. For more information, see Use Tokens to Reference Users and Groups.

不知为何,我这里只能选collection的全剧组,无法添加[project]组。因此我这里实验暂时不成功。

更多可参考: Manage Permission to Create or Modify Work Items.

WHEN

Specifies one or more rules to apply to the current field when another field has a specific value. The parent FIELD element defines the current field.

当某一个字段为某一个状态值的时候,此字段可以做某些事情。可做的事情包括<ALLOWEDVALUES>、<ALLOWEXISTINGVALUE>、<CANNOTLOSEVALUE>、<COPY> 、<DEFAULT>、<EMPTY>、<FROZEN>、<MATCH>、<NOTSAMEAS>、<PROHIBITEDVALUES>、<READONLY>、<REQUIRED>、<SERVERDEFAULT>、<SUGGESTEDVALUES>、<VALIDUSER>

例:如我们上章添加了组别,则可以设置当选择"组2"的时候,此字段出现下拉选项,可选择"组2一小队"或"组2二小队"

更多可参考: Assign Conditional-Based Values and Rules

WHENNOT

Specifies one or more rules to apply to the current field when another field does not have a specific value. The parent FIELD element defines the current field.

当某一个字段为某一个状态值的时候,此字段可做某些事情。可做的事情包括<ALLOWEDVALUES>、<ALLOWEXISTINGVALUE>、<CANNOTLOSEVALUE>、<COPY> 、<DEFAULT>、<EMPTY>、<FROZEN>、<MATCH>、<NOTSAMEAS>、<PROHIBITEDVALUES>、<READONLY>、<REQUIRED>、<SERVERDEFAULT>、<SUGGESTEDVALUES>、<VALIDUSER>

例:我们上章添加了组别,则可以设置任何时候,我们都可选择"一小队"、"二小队",除了当选择"组2"的时候。

更多可参考: Assign Conditional-Based Values and Rules.

WHENCHANGED

Specifies one or more rules to apply to the current field when another field is changed during the revision of the work item. The parent FIELD element defines the current field.

当某一个字段状态改变的时候,此字段可以做某些事情。可做的事情包括<ALLOWEDVALUES>、<ALLOWEXISTINGVALUE>、<CANNOTLOSEVALUE>、<COPY> 、<DEFAULT>、<EMPTY>、<FROZEN>、<MATCH>、<NOTSAMEAS>、<PROHIBITEDVALUES>、<READONLY>、<REQUIRED>、<SERVERDEFAULT>、<SUGGESTEDVALUES>、<VALIDUSER>

更多可参考: Assign Conditional-Based Values and Rules.

WHENNOTCHANGED

Specifies one or more rules to apply to the current field when another field is not changed during the revision of the work item. The parent element defines the current field.

当某一个字段状态改变的时候,此字段可以做某些事情。可做的事情包括<ALLOWEDVALUES>、<ALLOWEXISTINGVALUE>、<CANNOTLOSEVALUE>、<COPY> 、<DEFAULT>、<EMPTY>、<FROZEN>、<MATCH>、<NOTSAMEAS>、<PROHIBITEDVALUES>、<READONLY>、<REQUIRED>、<SERVERDEFAULT>、<SUGGESTEDVALUES>、<VALIDUSER>

更多可参考: Assign Conditional-Based Values and Rules.

posted on 2013-07-24 10:01  elvis  阅读(3823)  评论(0编辑  收藏  举报