Saturday, December 31, 2005

Spencer's Article Series on 'ASP.NET 2.0 and MCMS 2002 SP2'

Via Spencer:

With the recent release of Service Pack 2 for MCMS, it is now
possible to take advantage of many ASP.NET 2.0 features within your
MCMS applications. The ASP.NET 2.0 AdRotator control has been enhanced to
allow for programatic population, which makes it much easier to produce a
AdRotator using MCMS Resource Gallery Items.
[Read More]
With the recent release of Service Pack 2 for MCMS, it is now
possible to take advantage of many ASP.NET 2.0 features within your MCMS
applications. One the best new features introduced with ASP.NET 2.0 is Master
Pages, which allow developers to enforce common layout and behaviour across
pages within an application. Whilst at first pass many Master Pages concepts are
similar to those of MCMS, there are a number of benefits to be gained by taking
advantage of Master Pages within MCMS applications.

Labels: ,

Tuesday, December 27, 2005

MCMS Manager 6.0

This version includes,

1. Incremental Export/Import & User Backup/Restore
2. Resource hit Statistics
3. Extended Search

Get the new version from here. For more information check MCMS Manager site. Please don't forget to post your feedbacks here.

Labels: , ,

Friday, December 23, 2005

Modifying Resource Browser to Display Thumbnail for Bitmaps

The Resource Browser (Web Author - Resource Manager) ships with MCMS doesn't provide a thumbnail preview for bmp files. That is acceptable as bmp is not a web image format. But if you are interested in showing a thumbnail for bmp files, it can be done via a customized Resource Manager.

1. Create a class inheriting Microsoft.ContentManagement.WebAuthor.ResourcesBrowse
a) Create a class library.
b) Body of the class -

using System;
using System.Drawing;
using Microsoft.ContentManagement.WebAuthor;
using Microsoft.ContentManagement.Publishing;

namespace MCMS
{
public class CustomResourceBrowser : ResourcesBrowse
{
public CustomResourceBrowser()
{
}

//Create a new method to hide the default DataBindResourceColumnThumbnailUrl
protected new string DataBindResourceColumnThumbnailUrl(object dataitem)
{
Resource resource = (Resource)dataitem;
string url = string.Empty;
IntPtr Missing = IntPtr.Zero;
if(resource.FileExtension.ToLower()=="bmp")
{
using(Image image = Bitmap.FromStream(resource.OpenReadStream()))
{
using(Image thumbImage = image.GetThumbnailImage(32,32,null,Missing))
{
thumbImage.Save(@"PhysicalPath"+resource.Name,System.Drawing.Imaging.ImageFormat.Icon);
url = "http://WebPath/"+resource.Name;
}
}
}
else
{
url = resource.UrlThumbnail;
}
return url;
}
}
}

2. Add the following references
a) using System.Drawing
b) System.Web
c) using Microsoft.ContentManagement.WebAuthor
d) using Microsoft.ContentManagement.Publishing

3. Create a temporary folder with appropriate rights for a web user to write data to that. Have the folder in a saver place as it can be assessed by anyone. Make it as a virtual directory. In the PhysicalPath above class replace it with the path of this directory and WebPath with the virtual directory name.

4. Deploy the dll in the bin folder of your MCMS project.

5. Make a copy of ResourcesBrowse.aspx - its default location "C:\Program Files\Microsoft Content Management
Server\Server\IIS_CMS\WebAuthor\Dialogs\ResourceBrowser\Management\"

6. Open ResourcesBrowse.aspx in notepad and change the Page derivative as bellow
<%@ Page language="c#" Codebehind="ResourcesBrowse.aspx.cs" SmartNavigation="true" AutoEventWireup="false"
Inherits="MCMS.CustomResourceBrowser" %>

This will make thumbnail in the temporary folder for bitmap files, which will be referred by Resource Manager - used to show the preview.

Note: Take precautions before using this method as ResourcesBrowse.aspx may get changed without any notification.