Wednesday, June 29, 2005

MCMS Manager 2.2

This release includes,

1. Rich Html Editor (Uses Carl Norton's Html Editor Control).
2. More Features in Search.
3. Updated Resource Dependency Finder.

Now MCMS Manager can be downloaded from SourceForge - MCMS Manager Site.
Please post your feedbacks.

Stefan's Article Series on 'ASP.NET 2.0 and MCMS'

This collection of articles explain some new features which MCMS will gain from ASP.NET 2.0. Even though ASP.NET 2.0 is not supported in the current version of MCMS (MCMS 2002 Service Pack 2 will support ASP.NET 2.0), Stefan plays around with ASP.NET 2.0 and the current version of MCMS with some limitations. Check these articles, they are way cool!

ASP.NET 2.0 and MCMS - a first look
ASP.NET 2.0 and MCMS - The easy way to site navigation & glitches with navigation controls when switching between modes
ASP.NET 2.0 and MCMS - Try it out now!
ASP.NET 2.0 and MCMS - Master Pages
ASP.NET 2.0 and MCMS - Web Parts
ASP.NET 2.0 and MCMS - glitches with themes
ASP.NET 2.0 and MCMS - Try it out - Now even in Authoring Mode!
ASP.NET 2.0 and MCMS - creating a custom membership provider for MCMS
ASP.NET 2.0 and MCMS - implementing page summary controls using a custom SiteMapProvider and a TreeView control

Monday, June 27, 2005

MCMS Resource Stream

At some point of time, we may need to access MCMS resource through code. Getting the stream of the resource may be very much useful, if we are trying to manipulate an image resource to do some trick with .NET.

Before analyzing how to get the resource, it is a must to understand MCMS Resources first. MCMS Resources can be divided into two categories depending on how they are added to the system / used by the system.


The first type is commonly referred as 'Resources' in MCMS. They are added to the system through Site Manager / Web Author / MCMS API as resource into the system and with posting these resources can be referred. These resources are named as Shared Resources / Resources. They can be accessed using MCMS API.

The other type of resource come in when adding a local resource with a posting / using MCMS API (CmsContext.AcceptBinaryFile) - a local resource can be added to the system, which can be only referred by that posting / using the URL. It is not possible to access this type of resources through MCMS API. These types of resources are called as Local Resources / Internal Resources.

URL - Shared Resource - "/NR/rdonlyres/GUID of the Resource/an integer/Name of the Resource.File Type"
URL - Internal Resource - "/NR/rdonlyres/GUID of the Positng/BlobId/Name of the Resource.File Type"

So accessing a Shared Resource is simple as accessing a posting. By using the Publishing API, it is possible to get the resource. As we have the GUID of the resource, we can use that to get the resource.

Code:

//Here GUID is the guid of the Shared Resource
Resource r = CmsContext.GetByGuid("{"+GUID+"}") as Resource;
Stream stream = r.OpenStream;

But, as internal resources are related with postings (the GUID which relates with internal resource is the Guid of the posting, not the resource - they don't have public Guids) and not publicly available through MCMS API it is not straight forward as Shared Resource to access them. So we may need to use some other common method to access internal resources.

Code:
(Don't forget to add references to System.IO and System.Net)


WebClient webClient=new WebClient();
NetworkCredential networkCredential = new NetworkCredential("username", "password","domain");
webClient.Credentials = networkCredential;
Stream outputStream = webClient.OpenRead("URL of the resource");



Saturday, June 18, 2005

Posting State Change by Submission

Rights on Channel (Posting)Current User's Rights on postingCurrent State of the Posting (PostingState)After Submission (PostingState)
Editor and ModeratorAuthor, Editor, Moderator, Template Designer, Channel Manager, or AdministratorNew, Saved, or EditorDeclinedWaiting for Editor Approval
Editor and ModeratorAuthor, Editor, Moderator, Template Designer, Channel Manager, or AdministratorModeratorDeclinedWaiting for Moderator Approval
Only EditorAuthor, Editor, Template Designer, Channel Manager, or AdministratorNew, Saved, or EditorDeclinedWaiting for Editor Approval
Only ModeratorAuthor, Moderator, Template Designer, Channel Manager, or AdministratorNew, Saved, or ModeratorDeclinedWaiting for Moderator Approval
No Editor or ModeratorAuthor, Template Designer, Channel Manager, or AdministratorNew, or SavedApproved, Published, or Expired

Notes :

1. A posting can be approved without submission, if that person has appropriate rights.

2. Authors can only submit a posting if it is not owned by any other person.

This is a summary from MCMS 2002 SP1a SDK.

Friday, June 17, 2005

Posting State Change by Approval

Rights on Channel (Posting)Current User's Rights on postingCurrent State of the Posting (PostingState) After Approval (PostingState)
Only EditorAdministrator, Editor, Template Designer, or Channel ManagerNew, Saved, EditorDeclined or WaitingForEditorApprovalApproved, Published, or Expired
Editor and ModeratorEditorNew, Saved, EditorDeclined or WaitingForEditorApprovalWaiting for Moderator Approval
Editor and ModeratorAdministrator, Template Designer, or Channel ManagerNew, Saved, EditorDeclined or WaitingForEditorApprovalApproved, Published, or Expired
Editor and ModeratorAdministrator, Moderator, Template Designer, or Channel ManagerModeratorDeclined or WaitingForModeratorApprovalApproved, Published, or Expired
Only ModeratorAdministrator, Moderator, Template Designer, or Channel ManagerNew, Saved, ModeratorDeclined or WaitingForModeratorApprovalApproved, Published, or Expired
No Moderator or EditorAdministrator, Template Designer, or Channel Manager New or SavedApproved, Published, or Expired

Notes :

1. Posting object in MCMS API is actually a Combination of underlying Page object and Posting object. Properties such as StartDate, ExpiryDate, and IsImportant belong to underlying posting object, while Description and Name are properties of the underlying page object (Also placeholders and custom properties are bounded to page objects). When an editor approves a posting, they are actually approving the page the posting is based on. When a moderator subsequently approves the posting, they approve the posting itself.

2. Modification to posting object require Moderator Approval.

3. Only page object have revisions, not posting objects. So a modification to posting object if the posting is published will make the posting offline until it gets approved by a moderator.

4. A page object modification will require Editor Approval.

5. As page objects can have revisions when it gets modified, the live posting will be still there until the modified one gets proper approval.

This is a summary from MCMS 2002 SP1a SDK.

Sunday, June 05, 2005

Validatable Controls and Validators

Everyone knows that MCMS controls can't be validated with normal ASP.NET validators. I always had the feeling that common MCMS placeholder controls were not made for validation by default.

Controls, which are to be validated, are bounded with validator controls using their ControlToValidate property. In a web form, if we have a validatable control and a validator, ControlToValidate property (dropdown) of the validator lists all the controls, which can be validated. But the placeholder controls that I've seen up to now are not showed up in the dropdown of the validators.

Normally validators pick the controls which can be validated by them using an attribute -
ValidationPropertyAttribute - ValidationProperty. But normally the placeholder control doesn't have this attribute defined with them - they are not listed in the dropdown of validators - ControlToValidate property.

So if we are designing a custom placeholder control and if we like it to be a validatable control (I always like) then we must have ValidationProperty attribute defined with the class definition.

e.g. If we are creating a placeholder control from BasePlaceholder control, and the property of the control which we want to validate is Html then the class declaration must be

[ValidationProperty("Html")]
public class HtmlValidattableControl : BasePlaceholderControl