![]() |
Previous | Next |
When your e-service is successfully added to the Windows system registry on the user's computer as a WebHost key, and the user chooses to use your e-service, a hosted browser window in the Publish Wizard loads the Web page you specified in the HTMLBasedUIURL subkey. This page serves as the customized user interface for your e-service. This documentation shall refer to this page as the "custom UI" page. From the custom UI page, you should specify any values related to the current publishing session that you did not specify when you added the e-service to the user's computer or that you wish to change during the Publish Wizard session. Which values you supply in the code and which values you require the user to supply is up to you. The following is a list of properties that you may want to set during the publishing process:
You must specify at least the Properties.PublishName and WebHost.PublishDestination property values, and you must also specify at least one profile.
You can use virtually any HTML syntax in the custom UI page that you would use in Internet Explorer. This means you can also include HTML controls such as BUTTON elements, TEXT and TEXTAREA elements, SELECT elements, and CHECKBOX elements.
Note You cannot write code that navigates to other Web pages from the custom UI page.
You can, however, imitate the functionality provided by multiple Web pages. The Producer object model exposes two events for this purpose: OnWizardBack and OnWizardNext. To use these events, first associate each event with a function block in your script code:
window.document.OnWizardNext = MyOnWizardNext;
window.document.OnWizardBack = MyOnWizardBack;
Then, create the function blocks that execute when Producer raises each event in response to the user clicking Next or Back in the Publish Wizard:
function MyOnWizardNext(){ }
function MyOnWizardBack(){ }
Once you have created these two event handlers, you can then write code to expose or hide DIV elements in your Web page in order to create a sequence of pages. For an example of how to create a Web page that uses this technique, see the topic Using Properties and Multiple Pages in the Samples section
The following simple example uses a single, static custom UI page.
The custom UI page cannot be resized by the user, but it will display scrollbars if the content exceeds the size of the hosted browser window. The minimum size of the client area in the custom UI page is 460 pixels wide by 340 pixels high. Microsoft recommends that you author your Web page to fit into those dimensions to avoid forcing the user to use scrollbars to access content.
Following are the basic steps to follow to create the custom UI page:
<HTML>
<HEAD></HEAD>
<BODY onload = "OnLoad()">
This page allows the user to publish the presentation.<BR>
All the values are supplied in script, except <BR>
the name of the presentation, which is supplied<BR>
by the user.<BR>
The presentation must contain content on the video timeline<BR>
or an error will result. <BR>
<BR>
<B>Click the <B> Next </B> button to publish the presentation.</B>
<BR>
</BODY>
</HTML>
Presentation name:
<INPUT TYPE = "TEXT" ID = "presName" NAME = "presName">
// Global variables that correspond to WebHost properties.
var Application;
var WebHost;
var ProfileMgr;
var PubDest = "http://MyServer/MyPath";
var PlayBackLoc = "http://MyServer/MyPath";
// Create the function to handle the Next button event
// in the Publish Wizard.
window.document.OnWizardNext = MyOnWizardNext;
// Test whether the Producer version is compatible with this WebHost.
var AppVersion = Application.Version;
if (AppVersion.substring(0,3) != "2.0")
alert ("Warning: Producer version doesn't match.");
// Set the value of the Application object to window.external
// to gain access to the Producer object model.
Application = window.external;
// Retrieve a WebHost object that represents the current e-service.
WebHost = Application.Project.Properties.PublishWebHost;
// Create a Profile Manager object.
ProfileMgr = Application.ProfileManager;
Note Avoid using the OnLoad function to start time consuming processes because this may cause unexpected behavior in the Publish Wizard.
// Set the profile to one of the Producer built-in profiles.
// Change this profile if necessary for your content.
var myProfile = ProfileMgr.MediumQualityAudioVideo;
WebHost.AddProfile(myProfile);
// Set the presentation name.
Application.Project.Properties.PublishName = presName.value;
// Set the path for the presentation publish destination.
WebHost.PublishDestination = PubDest;
// Set the path of the playback location, if desired.
// This value is used only when the user wants to preview the published presentation.
WebHost.PlaybackAddress = PlayBackLoc;
// Use try/catch error handling to verify publish validation.
try{
// Verify that a presentation doesn't exist with the same name.
// Validate publishing parameters.
var bDoesNotExist = Application.Publisher.ValidatePublishPresentation();
// Test whether ValidatePublishPresentation was successful.
if (bDoesNotExist == true){
// Publish the presentation.
Application.Publisher.PublishPresentation()
}
else{
// Tell the user the there is a problem.
alert ("Cannot publish because the name exists.")
}
}
catch(e){
// Show an error message.
alert ("There were errors. Publish failed.");
}
// Tell the user it is done.
alert("Publish complete.");
// Get a window object that represents the Publish Wizard.
var WizardWin = Application.Windows.FindByName("PublishWizard");
// Close the Publish Wizard.
Application.Windows(WizardWin).Close();
For the complete working sample that accompanies this topic, see A Complete Simple E-service in the Samples section.
Previous | Next |