Monday, May 30, 2005

Urls and Modes

Few common query strings (which are related with modes) and their possible values are given bellow. A query string can take one of the possible value given in the bellow table.

Query stringPossible Value
NRMODE (PublishingMode)PUBLISHED or UNPUBLISHED or UPDATE
WBCMODE (WebAuthorContextMode)PresentationUnpublished or PresentationUnpublishedPreview or AuthoringNew or AuthoringReedit or AuthoringPreview
wbc_purposeAuthoring or Basic
nr_emitThinEdit or View

Even though NRMODE is directly related with PublishingMode, WebAuthorContextMode is not only related with WBCMODE. The table given below have modes and relevant query string in detail.

Query string and valueAdditional checkMode
NRMODEWBCMODEwbc_purposenr_emitPublishing
Mode
WebAuthorContext Mode
PUBLISHED----PUBLISHEDPresentationPublished
UNPUBLISHED or UPDATEAuthoringNew--Posting. CanSetProperties =trueUNPUBLISHED or UPDATEAuthoringNew
UNPUBLISHED or UPDATE-AuthoringThinEditPosting.State =PostingState.New and Posting. CanSetProperties =trueUNPUBLISHED or UPDATEAuthoringNew
UNPUBLISHED or UPDATEAuthoringNew--Posting. CanSetProperties =falseUNPUBLISHED or UPDATEPresentationUnpublished
UNPUBLISHED or UPDATE-AuthoringThinEditPosting.State =stingState.New and Posting. CanSetProperties =falseUNPUBLISHED or UPDATEPresentationUnpublished
UNPUBLISHED or UPDATEAuthoringReedit--Posting. CanSetProperties =trueUNPUBLISHED or UPDATEAuthoringReedit
UNPUBLISHED or UPDATE-AuthoringThinEdit Posting. CanSetProperties =trueUNPUBLISHED or UPDATEAuthoringReedit
UNPUBLISHED or UPDATEAuthoringReedit--Posting. CanSetProperties =falseUNPUBLISHED or UPDATEPresentationUnpublished
UNPUBLISHED or UPDATE-AuthoringThinEditPosting. CanSetProperties =falseUNPUBLISHED or UPDATEPresentationUnpublished
UNPUBLISHED or UPDATEAuthoringPreview--Posting. CanSetProperties =trueUNPUBLISHED or UPDATEAuthoringPreview
UNPUBLISHED or UPDATEAuthoringPreview--Posting. CanSetProperties =falseUNPUBLISHED or UPDATEPresentationUnpublished
UNPUBLISHED or UPDATEPresentation Unpublished Preview---UNPUBLISHED or UPDATEPresentationUnpublished Preview
UNPUBLISHED or UPDATE-""""-UNPUBLISHED or UPDATEPresentationUnpublished Preview
UNPUBLISHED or UPDATE-""View-UNPUBLISHED or UPDATEPresentationUnpublished Preview
UNPUBLISHED or UPDATE---CmsHttpContext. IsUsingTemplate =trueUNPUBLISHED or UPDATETemplatePreview
UNPUBLISHED or UPDATEPresentation Unpublished---UNPUBLISHED or UPDATEPresentationUnpublished
UNPUBLISHED or UPDATE-""""-UNPUBLISHED or UPDATEPresentationUnpublished
UNPUBLISHED or UPDATE-BasicView-UNPUBLISHED or UPDATEPresentationUnpublished
UNPUBLISHED or UPDATE---Otherwise ( if non of the above)UNPUBLISHED or UPDATEPresentationUnpublished

Note :

  • PublishingMode - Staging is ignored, it is equivalent to WebAuthorContextMode PresentationPublished.

  • PublishingMode - UPDATE is only used; and need to be used when making changes to the site.

  • Even though HierarchyItem.CanSetProperties is not relevant with PublishingMode,
    WebAuthorContextMode relates with that.

  • As stated before, PublishingMode will be same as NRMODE.

  • More information about modes can be found here - Microsoft Content Management Server 2002 Developers Guide.

Friday, May 20, 2005

Posting - Posting - Channel Relationship

Everyone knows that there can be relationship between posting - posting (connected postings) and posting - channel (patent of the posting). But how they are really connected? To understand that, we must have a look at MCMS database schema.

All the objects in MCMS are referred as Nodes in database level. If we take a node of a posting, it will have NodeGuid(Guid of the posting), ParentGuid and FollowGuid. Each node has a type. Type 16 can be a page object or a Posting object. If the IsShortcut value is 1 then the item is a Posting. If it is 0 then it is a Page object. Placeholders are bound to the Page objects. The FollowGuid of the Posting Object points to it's underlying Page object. (Thanks for the clear explanation Stefan!)

  • Posting-Posting

    So all the connected postings will have the same FollowGuid. Because placeholders are bound to the Page objects (IsShortcut=0), connected postings will have reference to the same placeholders.

  • Posting-Channel

    All the posting will have a ParentGuid which are the Guids of the channels. So relationship between posting and channels are maintained via this. So until ParentGuid gets changed, the relationship will be always there.

As a conclusion, Change to any - other than these Guids and IsShortcut, won’t change the relationship. Which means renaming channels, postings wont change relationship.

N.B: This blog is only to make a clear understanding on how postings and channels are related. Handling MCMS database directly or using any undocumented API to handle the database will break the Microsoft support boundary - don't do that.

Monday, May 16, 2005

CmsHttpContext Vs CmsApplicationContext

Compared OnCmsHttpContextCmsApplicationContext
InstanceOnly one instance can be created using Current property. When we call CmsHttpContext.Current, the request is send to the server and it will check the HttpContext for an existing CmsHttpContext. If it finds one, then it will returns that. Otherwise it will create a new instance of it with the current identity, save that in the HttpContext and returns the new one.Any number of instances can be created with the constructor. All the instances will be created with an authentication and mode.
AuthenticationIt will take the correct authentication from the current HttpContext. The identity will be created accordingly (Windows Identity or Passport Identity or Forms Identity) and the correct token will be taken for the creation of a new context.There are four kind of Authentication available with four different type of overloads. The appropriate one can be used. For more info on this, check the PAPI help.
Where it can be usedThis one can be only used in application's which comes under HttpContext (web applications and web services). This can be used in windows applications, web applications, console applications, web services, etc.
ModeAn instance is created by the server with the mode, which depends on the request we send. It can't be changed. Must switch the request to change the mode (it will create an instance with that mode).An instance can be created with any mode which is required. It can't be changed, a new instance must be created with a different mode.
DurationBecause this is used in web based, duration of the instance is small.It is possible to have long running sessions (duration of time from when an object is modified to when CommitAll() is called) using this. But it is not a good practice to have long sessions. Because long running sessions can block accessing a site.
Dispose()It is not necessary to dispose the instance always, it will automatically handled by the server - CmsEndRequestModule will call this, if there is a valid instance exist in HttpContext after the response is send to client.After the use of CmsApplicationContext instance it must be disposed. Otherwise it may give problems. For more
information check Creating scalable applications using the CmsApplicationContext.
RollBackAll()After calling RollBackAll(), the instance is invalid, but after the call to this method, if we don't use the instance, no need to call Dispose(), server will handle that. If we use after calling this, then its a must to call Dispose() and get a new instance.After calling RollBackAll(), the instance is invalid and it must be disposed and a new instance must be created for future use.

There are few properties and a method which are only available in CmsHttpContext(driven from CmsAspContext). They are not available in CmsApplicaitonContext. They are Channel, ChannelItem, CmsQueryString, IsUsingTemplate, Posting, UserCacheKey, ChannelItemIsVisible and ResolveUrl (). For more information, check the PAPI documentation.

Wednesday, May 11, 2005

EnableLeaveAuthoringWarning - A Closer look

After Mei Ying's post about Getting Rid of the Leave Warning Alert after a Preview and Stefan's comment I thought of checking EnableLeaveAuthoringWarning more deeper. If EnableLeaveAuthoringWarning is set to true, Console generate this script to the page,

var __consoleCachedOriginalPostBack;
if( eval("window.__doPostBack") != null )
{
__consoleCachedOriginalPostBack = __doPostBack;
__doPostBack = __consoleCustomDoPostBack;
} __consoleCachedOriginalOnSubmit = __CMS_PostbackForm.onsubmit; __CMS_PostbackForm.onsubmit = __consoleHandleOnSubmit;
function __consoleCustomDoPostBack( eventTarget, eventArgument )
{
WBC_offWarningBeforeLeave();
__consoleCachedOriginalPostBack( eventTarget, eventArgument );
}
function __consoleHandleOnSubmit()
{
WBC_offWarningBeforeLeave();
if (__consoleCachedOriginalOnSubmit != null)
{
__consoleCachedOriginalOnSubmit();
}
}

where if it is false it generates

WBC_offWarningBeforeLeave();

Both are totally different. As Stefan explained in his post - How to disable the "Leave Authoring" warning for a specific control rather than for the whole template (last update: 08/12/2004),"So the problem is that using href in anchor tags will not allow the client side code to be executed that checks if the current action is actually a postback or if the user really decided to leave the page. If the redirect would have been done using the onclick attribute rather than the href this would not have happened."

It is true for the first instance (where EnableLeaveAuthoringWarning = true). But in the second place, there are no client side script to check this! This is fine until CMS_restoreAfterPreviewPostback() get called. Because upto that point global variable g_bWarnBeforeLeave is set to false. So any call to beforeUnload wont bring the warning because beforeUnload will check whether g_bWarnBeforeLeave is true or not to give the warning. But the function CMS_restoreAfterPreviewPostback() set g_bWarnBeforeLeave to true, so until WBC_offWarningBeforeLeave() get called, it will be true (eg : another postback). Which means after a preview first action will give the warning message even if EnableLeaveAuthoringWarning is set to false, because the preview set g_bWarnBeforeLeave to true.

As a solution it can be resolved by Getting Rid of the Leave Warning Alert after a Preview or by this one.

Monday, May 09, 2005

MCMS Manager 2.1

Another update to MCMS Manager! The new version have some more new features...

1. Connected posting search.
2. Tooltip preview for postings, templates - (Thanks Rob, Jubjup, Nimalan and Sutha for html to image creator) and resources. But tooltip for postings and templates will take more resource and time :(.
3. New UI related features to give more useful information (Connected postings, templates, important channels and more).

Please post your feedbacks.