Page Processing in Authoring Mode

When a page is requested in authoring mode, the placeholders are rendered as authoring controls that provide the ability to create and edit the content within the placeholders. The overall logical processing is similar to presentation mode page processing. However, there are differences in how the placeholder server controls render the content and how the new content is written to the CMS database.

In Chapters 5 and 6, we have discussed CMS content authoring using the Web Author. In order to understand page processing in authoring mode, we need to take into consideration the modes of the Web Author application used for the different stages of the editing process. It is the combination of the publishing mode (specified by the CmsHttpContext.Mode property) and the Web Author mode that defines how the placeholder server controls run and how the placeholders are rendered in the page.

A special class called WebAuthorContext provides a set of properties, methods, and events that are required for the functioning of the Web Author. The current context of the Web Author application is available from the property WebAuthorContext.Current. The current mode of the Web Author is available from the property WebAuthor Context.Current.Mode. We will discuss the WebAuthorContext class in more detail in Chapter 30 when we look into customizing the Web Author.

As we have already mentioned in the previous main section, when a user with authoring rights requests a page in presentation mode, the Switch to Edit Site link is displayed. When the page is generated in presentation mode, WebAuthorContext.Current.Mode is PresentationPublished. CmsHttpContext.Mode is set to Published.

When the user switches to Edit mode, another page request is sent to the CMS site. In the URL, the query string parameter WBCMODE defines the current mode of the Web Author application. The Web AuthorContext.Current.Mode property takes its value from the WBC MODE parameter in the query string of the URL in the request. In this case, WebAuthorContext.Current.Mode is PresentationUnpublished. The CmsHttpContext.Mode is set to Unpublished.

Let's go through the steps when an author edits an existing page. You may need to refer to Figures 11-1 and 11-2 for the sequence of steps and the relationship between objects.

  1. The user clicks Edit in the Web Author console. The request for the page is sent to the CMS site.

  2. IIS receives the request and passes it to the CMS Resolution ISAPI filter.

  3. The request is passed to the appropriate worker process.

  4. The request arrives at the CMS Web application and goes through the HTTP pipeline as defined by HTTP modules contained in the machine.config file and the web.config file. The request is authenticated and authorized, and the CMS context is created. In this case, the CmsHttpContext.Mode property is set to Unpublished. WebAuthorContext.Current.Mode is AuthoringReedit.

  5. ASP.NET instantiates the template compiled class and runs the code. The placeholder server controls determine the publishing mode and the Web Author mode, and then render the placeholders in the resulting page as authoring controls. The configuration of these authoring controls is defined by the Placeholder Definition objects contained in the template. For example, an HTML placeholder definition may have the AllowHyperLinks property set to False, which means that authors are not allowed to use <A> tags for hyperlinks in the content of this placeholder. In this example, the authoring control will be rendered without the Hyperlink formatting button.

    The placeholders in the resulting page are populated by the existing content obtained from the CMS database by the corresponding Placeholder objects.

    During template execution, Web Author server controls check the Web Author mode and render the Web Author console in a resulting page.

  6. The resulting page is put in the ASP.NET output cache. Because the page is unpublished, it will never be served from the cache for subsequent requests.

  7. IIS returns the page to the requesting browser.

The user edits the page and changes the content of the placeholders, and then clicks Save. Let's look at the steps; once again, you may need to refer to Figures 11-1 and 11-2 for the sequence of steps and the relationship between objects.

  1. When the user clicks Save, browser issues a request to CMS.

  2. IIS receives the request and passes it to the CMS Resolution ISAPI filter.

  3. The request is passed to the worker process that does the initial processing of the request.

  4. The CMS context is created as before. In this instance, the CmsHttpContext.Mode property is set to Update. WebAuthor Context.Current.Mode is AuthoringReedit.

  5. The template code runs. The placeholder server controls instantiate the corresponding PlaceholderDefinition and Placeholder objects. The properties configured in the placeholder definition are used to validate the new content. For example, if hyperlinks are not allowed for the HTML placeholder, the content in this placeholder is checked for the presence of <A> tags. After the validation, cleanup of invalid content is performed, such as deleting the <A> tags in our example. After the content has been validated and cleaned, it is committed to the CMS database using a Placeholder object. Then, the rest of the code in the template runs, including Web Author server controls, and the resulting page is rendered. The page status in the Web Author console is set to Saved.

  6. The resulting page is put in the cache.

  7. IIS returns the page to the requesting browser.



Microsoft Content Management Server 2002. A Complete Guide
Microsoft Content Management Server 2002: A Complete Guide
ISBN: 0321194446
EAN: 2147483647
Year: 2003
Pages: 298

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net