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

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

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

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

Ian Williams, Pierre Greborio

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

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

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











Contributor View


The Contributor view is pretty simple. We’ve set it as the default because that’s how most users will want to see it. We’ve also allowed all users to see all the views. Of course, it would be possible to package the form into separate configurations for contributors and desk editors, with appropriate restrictions, and deploy two versions of the template.

The first thing to note here is that the form allows multiple meta elements. So contributors can batch up items if they wish. The labels for the controls differ from the unfriendly names of elements and attributes, even though that is sometimes just a matter of a shift to uppercase. We’ve used ScreenTips where possible and have a simple work-based tab sequence. Figure 14-3 shows the view.


Figure 14-3: The Contributor view.

The Status control is set to Draft as a schema default and is read-only.

The Date created control is bound to the creationTime element. Here we set its value with a script. There are several date-setting calls to be made during a form life cycle, so first we include a couple of script functions for ISO 8601 date and time.


function getDateString(oDate)
{ // Use today as default value.
if (oDate == null) oDate = new Date();
var m = oDate.getMonth() + 1;
var d = oDate.getDate();
if (m < 10) m = "0" + m;
if (d < 10) d = "0" + d; // (YYYY-MM-DD)
return oDate.getFullYear() + "-" + m + "-" + d;
}
function getTimeString(oTime)
{
if (oTime == null) oTime = new Date();
var h = oTime.getHours();
var m = oTime.getMinutes();
var s = oTime.getSeconds();
var ms = oTime.getMilliseconds();
if (h < 10) h = "0" + h;
if (m < 10) m = "0" + m;
if (s < 10) s = "0" + s;
if (ms < 100) ms = "0" + (ms < 10 ? "0" : ") + ms; // (HH:MM:SS.SSS)
// ISO 8601 time (HH:MM:SS.SSS).
return h + ":" + m + ":" + s + "." + ms;
}

Then we use the OnLoad event to get current date and time values and build a string for the form. The control formatting takes care of the display, which is also read-only. One simple way to prevent an update of creationTime taking place on subsequent open actions is to compare it with a default value. Note that we also call a setModified function.


function XDocument::OnLoad(oEvent)
{
var formDate = new Date();
var formTime = new Date();
var createdNode = XDocument.DOM.selectSingleNode("//creationTime");
//if default value is there set new date time
if(createdNode.text=="2003-01-01T00:00:00")
createdNode.text= getDateString(formDate) + "T" + getTimeString(formTime);
setModified();
}
function setModified()
{
var formDate = new Date();
var formTime = new Date();
var modifiedNode = XDocument.DOM.selectSingleNode("//modificationTime");

modifiedNode.text= getDateString(formDate) + "T" + getTimeString(formTime);
}

The default behavior when a user e-mails a form is for InfoPath to attach the XML schema and any form images to the message, and include the HTML for the form in the body. NewsLine wants a way to package up the story and its meta data.

Data source option is set to concat(“mailto:”, ../formHeader/@email, “?subject=”, title). When the user clicks the icon, it opens Outlook with the correct e-mail address for the contributor’s desk, along with the story title as the subject. We decide on a simple manual solution, but it would be quite easy to create a script to do the attachments and turn the hyperlink into a button to kick off the message process. You may recall seeing one way of managing that process in Chapter 7, under Integrating with Applications and Services.


Figure 14-4: Editing the hyperlink.

In Story details, the Type and Format controls are bound to the related elements. Because the schema constrains the possible values for both elements, InfoPath populated the drop-down options automatically. The only change we had to make is for user-friendly display names in the Format properties.

Subjects contains two lists contained in a repeating table. The lists are populated from a secondary data source. You’ll get to the details of how that is constructed in a short while.

/ 166