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

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

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

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

Ian Williams, Pierre Greborio

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

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

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











Chapter 13.


Conditional Formatting


In Chapter 11 you saw how to add conditional formatting rules to objects on a form—how you can highlight a control by changing text style, color, or background, or hide an object entirely.

In our design, a table cell in the Desk and Story List views contains a group of status icons, each of which is inside a section control. The section controls are bound to their respective icon data source elements, for example, iconReview. Each section control contains a conditional formatting rule that hides the section when the content of the status element does not match the icon. Figure 14-5 shows the layout.


Figure 14-5: The conditional formatting section for status icons.

status element is not “In Review.”


Figure 14-6: The Conditional Format dialog box with the rule for the “In Review” status.

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


<xsl:template match="iconReview" mode="_18">
<div title=" style="PADDING-RIGHT: 0px;
PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: auto auto 0px; WIDTH: 27px;
PADDING-TOP: 0px; HEIGHT: 13px" align="left" xd:CtrlId="CTRL10" xd:xctname="Section" tabIndex="-1">
<xsl:attribute name="style">PADDING-RIGHT: 0px; PADDING-LEFT: 0px;
PADDING-BOTTOM: 0px; MARGIN: auto auto 0px; WIDTH: 27px; PADDING-TOP: 0px;
HEIGHT: 13px;
<xsl:choose>
<xsl:when test="../status != &quot;In Review&quot;">DISPLAY: none</xsl:when>
</xsl:choose>
</xsl:attribute>
<div>
<img title="In Review" style="WIDTH: 24px; HEIGHT: 24px"
height="24" src="47826624.gif" width="24"/>
</div>
</div>
</xsl:template>

We use similar formatting to hide the embargo date and time until the status element is set to “Embargoed” by a button in the view. Here the fieldEmbargoed element is bound to a date picker control inside a section. Figure 14-7 shows the arrangement.


Figure 14-7: The conditional formatting section for the embargo date control.


Unbound Controls


Three further changes of status involve actions by an editor. Button controls for Embargo, File, and Spike set the respective status values.

The date controls Last modified and Received are set by script code or XSLT. Received is set when a form is merged, and Last modified gets an update with every status change.


function CTRLembargo_story::OnClick(eventObj)
{
var statusNode = XDocument.DOM.selectSingleNode("//status");
statusNode.text = "Embargoed";
}

Because of the conditional formatting, the Embargo until control is made visible as soon as the value for status is changed by the script.

Before a story is filed, an editor needs to complete the Extent control. When the editor clicks the File button, Identifier is automatically completed, and Filed gets filled in too. Both changes are scripted, along with the other fields completed at this time: Byline and Payment. Chapters 15 and 16.


Figure 14-8: Date controls and buttons in the Desk view.



Replacement Elements


In the Desk view you need to handle the choice between the copyright and rightsAgent elements. When you drag the rights element onto the form, InfoPath forms a section containing two nested sections within it. The second of these is an optional section. In design mode the interface looks like Figure 14-9.


Figure 14-9: The design mode interface for the Rights controls.

In the XSF file, InfoPath has included an xReplace component.


<xmlToEdit name="rightsAgent_13" item="/resourceList/meta/rights/copyright"
container="/resourceList/meta/rights">
<editWith caption="Rights Agent" xd:autogeneration="template" component="xReplace">
<fragmentToInsert>
<chooseFragment>
<rightsAgent/>
</chooseFragment>
</fragmentToInsert>
</editWith>
</xmlToEdit>
<xmlToEdit name="copyright_14" item="/resourceList/meta/rights/rightsAgent"
container="/resourceList/meta/rights">
<editWith caption="Copyright" xd:autogeneration="template" component="xReplace">
<fragmentToInsert>
<chooseFragment>
<copyright>NewsLine Inc</copyright>
</chooseFragment>
</fragmentToInsert>
</editWith>
</xmlToEdit>

You’ll need to modify the interface by setting user-friendly values for the Replace commands in each of the two sections. Right-click and choose Properties and click Customize Commands to show the Section Commands dialog box. The values for the Copyright section should look like Figure 14-10.


Figure 14-10: Customizing the Copyright replacement section.

/ 166