Professional InfoPath 2003 [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Professional InfoPath 2003 [Electronic resources] - نسخه متنی

Ian Williams, Pierre Greborio

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید











Conditional Formatting and Display

If you want to include any controls that determine conditional formatting in a form, you’ll have to include elements for them in your schema.

In our scenario, there isn’t much scope for conditional formatting in the capture view. However, in one news desk view, we decided to emphasize the status of a form.


Status


The status element itself is set by default when a contributor fills out a form:


<xsd:element name="status" type="statusType"

Here’s the type definition:


<xsd:simpleType name="statusType">
<xsd:union>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Draft"/>
<xsd:enumeration value="In Review"/>
<xsd:enumeration value="Spiked"/>
<xsd:enumeration value="Filed"/>
<xsd:enumeration value="Embargoed"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>

Then for the status field, we create five formatting elements, one for each status value. They’ll contain icons that display next to the status field in the interface.


<xsd:element name="iconDraft" xsd:type="string"/>
<xsd:element name="iconReview" xsd:type="string"/>
<xsd:element name="iconSpiked" xsd:type="string"/>
<xsd:element name="iconEmbargoed" xsd:type="string"/>
<xsd:element name="iconApproved" xsd:type="string"/>

A section control bound to the iconDraft element contains the formatting rule, which hides the section if the content of the status element is not “Draft”. Formatting matches to text values are case-sensitive.

Here’s an XSLT template fragment for the view, showing the conditional formatting for the iconDraft element:


<xsl:template match="iconDraft" mode="_13">
<div title=" style="PADDING-LEFT: 1px;
MARGIN: 0px; WIDTH: 24px; HEIGHT: 24px" align="left" xd:CtrlId="CTRL25" xd:xctname="Section" tabIndex="-1">
<xsl:attribute name="style">PADDING-LEFT: 1px; MARGIN: 0px;
WIDTH: 20px; HEIGHT: 20px;
<xsl:choose>
<xsl:when test="status != &quot;Draft&quot;">DISPLAY: none
</xsl:when>
</xsl:choose>
</xsl:attribute>
<div>
<img style="WIDTH: 24px; HEIGHT: 24px" height="24" src="msoA607E.gif" width="24"/>
</div>
</div>
</xsl:template>


Category Filter


When editors have merged data from a series of story forms, it is likely that the Desk view will become rather long. To make the list easier to handle, we decided to create a Story List view and add a filter for the different resource categories. Again, we’ve used a drop-down list of category names.


<xsd:element name="category" type="resourceCategory>

The type declaration contains a selection of PRISM resource categories. You may recall from Chapter 12 that these specify the genre of the story, as distinct from its presentation.


<xsd:simpleType name="resourceCategory">
<xsd:union>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Analysis"/>
<xsd:enumeration value="Bulletin"/>
<xsd:enumeration value="Cartoon"/>
<xsd:enumeration value="Column"/>
<xsd:enumeration value="Biography"/>
<xsd:enumeration value="Feature"/>
<xsd:enumeration value="Financial Statement"/>
<xsd:enumeration value="Interview"/>
<xsd:enumeration value="Opinion"/>
<xsd:enumeration value="Portrait"/>
<xsd:enumeration value="Press Release"/>
<xsd:enumeration value="Profile"/>
<xsd:enumeration value="Review"/>
<xsd:enumeration value="Transcript"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>

Here’s part of the HTML select element in the XSLT for the view:


.
.
<select title=" size="1" xd:binding="categoryFilter" xd:boundProp="value" tabIndex="0"
xd:xctname="DropDown" xd:CtrlId="CTRL1" style="WIDTH: 130px">
<xsl:attribute name="value">
<xsl:value-of select="filter_category"/>
</xsl:attribute>
<option value="Any">
<xsl:if test="categoryFilter=&quot;Any&quot;">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>Any category...
</option>
<option value="analysis">
<xsl:if test="categoryFilter=&quot;analysis&quot;">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>analysis
</option>
<option value="biography">
<xsl:if test="categoryFilter=&quot;biography&quot;">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>biography
</option>
<option value="column">
<xsl:if test="categoryFilter=&quot;column&quot;">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>column
</option>
.
.
</select>
.
.

A repeating table contains the story elements in the listing. Two conditions set up the relationship between the filter and the table:


categoryFilter ? category AND categoryFilter ? "Any"

A match of the value in the drop-down list with any resource category element in the story hides everything but that category; choosing Any displays all the story data. Part of the repeating table XSLT shows the logic:


.
.
<tbody xd:xctname="RepeatingTable">
<xsl:for-each select="resourceList/meta">
<tr>
<xsl:attribute name="style">;
<xsl:choose>
<xsl:when test="category != resource_filter and resource_filter!=
&quot;Any&quot;">DISPLAY: none</xsl:when>
</xsl:choose>
</xsl:attribute>
<td>
<span hideFocus="1" title="Title" xd:binding="title"
tabIndex="0" xd:xctname="PlainText" xd:CtrlId="CTRL3" style="WIDTH:100%">
<xsl:value-of select="title"/>
</span>
</td>
.
.
</tr>
</xsl:for-each>
</tbody>
.
.


External Sources


One secondary data source applies to both the Contributor and the Desk views of the form. Both contributors and editors use a subject lookup feature when adding subject terms to the meta data. This provides a controlled vocabulary of terms and related encodings.

The form schema offers a choice of one or more of company, country, event, industry, organization, or person, using the type attribute:


<xsd:element name="subject">
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
</xsd:element>

The lookup source is an XML file containing topics derived from a topic map maintained by NewsLine. This is a convenient way to support unconnected contributors. In our scenario the data is fairly static, and the file can be updated regularly by the relevant news desk. There will be core topics of use to contributors in every region, but not all topics have to go to everyone. We think it will be easy to maintain and will perform well, and the company won’t have to pay for the development and deployment of a more complex system. You’ll read more about how to use XML sources and how we handle the form data in the next chapter.

The subject element is contained in a subjects element wrapper:


<xsd:element name="subjects">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="subject" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

/ 166