Anatomy of the Web Author .NET Console

The Web Author .NET application is constructed from many ingredients. The architecture is based on ASP.NET principles, so if you are familiar with ASP.NET, then you will be comfortable with the Web Author.

The console itself is contained within a .NET user control, the controls within the console are .NET server controls, and the underlying code is contained within .NET classes (e.g., the WebAuthorContext).

Web Author Controls

There are a few different types of .NET server controls within the Web Author architecture (Figure 30-1): console controls, site mode container controls, action controls, and status controls. The fact that these controls are all .NET server controls offers great advantages in terms of class inheritance and development experience.

Figure 30-1. Web Author .NET architecture


Console Controls

CMS ships with two console controls. These two server controls are the authoring console and the error console. The controls are used to encapsulate the .NET server controls used by the Web Author. When you open the WoodgroveNet DefaultConsole.ascx file in design mode, you can see these two controls.

The authoring console appears when a CMS user clicks the Switch to Edit Mode link. The error console is displayed when the WebAuthorContext class encounters an error. To make things easy, the two controls are displayed within the same .NET user control. For example, when you add the WoodgroveNet default console or the BOTS Consulting console to a template, you are also adding the error control.

Site Mode Container Controls

Site mode containers enable Web Author controls to act differently under different Web Author modes. There are three types of container controls: presentation mode containers, authoring mode containers, and error mode containers. For example, looking at the source for the DefaultConsole.ascx file, you can see container controls such as PresentationModeContainer and AuthoringModeContainer. These containers give the CMS developer an easy way to organize the Web Author action and status controls. If you created a new custom control, you could add your control to one of these containers and you would not have to worry about the control appearing in the wrong CMS mode. In other words, you do not have to write any code to determine whether your control appears in the WebAuthorContext Published mode or authoring mode.

The mode containers support a number of different submodes, shown in Table 30-1.

Table 30-1. Mode Container Submodes

Mode Container





This is the Live site mode. If a CMS user is logged in, the Switch to Edit Site link appears.



Various action and status controls appear in this mode. The specific controls that appear are determined by the rights of the CMS user. For example, the Approve link will only appear if the current posting is in the "waiting for approval" state and the current user has rights to perform the approval.



Controls added to this section will appear in both Published mode and Unpublished mode.



This mode is used when a page is first created.



This mode is available when an existing page is edited.



Controls added to this section will appear in both AuthoringNew mode and AuthoringReedit mode.



The Save action failed.



More than one Save action was detected.



A Save action failed when placeholder changes were being saved.



The Submit action failed.



The Approve action failed.



The Decline action failed.



The Delete action failed.

Example: Displaying the Web Author Mode

You may be curious about these modes and when they come into play. Add this code to your DefaultConsole.ascx file to output the current Web Author mode.

 using Microsoft.ContentManagement.WebControls; <%       WebAuthorContext webAuthor = new WebAuthorContext();       string mode = webAuthor.Mode.ToString();       Response.Write(mode); %> 
Action Controls and Status Controls

These .NET server controls are the most obvious components within the Web Author console. Status controls are used to display information about CMS objects (such as the publication status of the current posting), and action controls allow CMS users to do things like create or edit the content on the Web site.

Action controls and status controls render HTML inside server control tags. Rather than restricting the rendering of the controls, they provide an object model to retrieve rendering details. For example, the Text property is used to show the text within the anchor tags, and the Action Javascript property determines the JavaScript that runs when the link is clicked.

The following are examples of Web Author action controls:

  • Create New Page: Allows the user to create a new page.

  • Move: Moves the page to another CMS channel.

  • Save: Saves edits to the current page.

  • Submit: Submits the page into the CMS workflow.

  • Approve: Approves the saved changes and changes the live version to the saved version.

The following are examples of Web Author status controls:

  • Posting State: Indicates the current stage in the CMS workflow.

  • Lock Status: Shows which CMS author has locked the page.

  • Version: Indicates whether another version of the page exists. For example, if the page has been edited but the changes have not been approved, this control shows that the live version of the page is different from the version displayed in Unpublished mode.

Most of the Web Author action controls are contained within the container control for authoring. The only one that is visible in presentation mode is the link that allows a CMS author to switch to Unpublished mode. This is the Switch to Edit Site link that you see as a CMS user with authoring rights. The control has added logic that hides the link if the current user is the CMS guest account.

WebAuthorContext Class

The WebAuthorContext class is the heart of the Web Author application. CMS offers different rendering of pages based on different modes. It is the WebAuthorContext class that allows the Web Author to manage these different modes. For example, in Published mode, CMS placeholders render content, but in Unpublished mode it is usual that they allow authors to edit the content. It is the WebAuthorContext.Current method that allows the Web Author to detect the current mode. Take a look at the CMS help files for a complete breakdown of the WebAuthor Context class.

This is the same class that handles the new PAPI event model. CMS developers can use the event model to perform custom actions based on changes to the CMS site for example, when new pages are created. But this is a topic for another chapter.

Microsoft Content Management Server 2002. A Complete Guide
Microsoft Content Management Server 2002: A Complete Guide
ISBN: 0321194446
EAN: 2147483647
Year: 2003
Pages: 298 © 2008-2017.
If you may any questions please contact us: