Thursday, May 26, 2005

Office 12 Timetable Released

The news is out: Beta2 version of Office 12 will be released by the end of this year and a full release probably in the second half of 2006.

Why is this significant? Because MCMS v.Next will be part of Office 12! Read a full report on zdnet here.

There will probably be lot more buzz and details trickling out about Office 12 over the coming months. This will be exciting!

Tuesday, May 17, 2005

Keirsey says I'm a Rational!

I find it amazing that my personality type changes each time I take the Keirsey Temperament Sorter. Right now, it says I'm a rational. I guess I'll take it with a pinch of salt.

Tuesday, May 10, 2005

Welcome to TripleZ!

TripleZ (a.k.a Justin Lee), Microsoft Valuable Professional for C# and sgdotnet council member, has swallowed the pill and joined my department! Welcome, TripleZ! We have snagged a world-class developer (thanks to a recommendation from yours truly). 2 MVPs on the same project, what on earth will happen???

Monday, May 09, 2005

Getting Rid of the Leave Warning Alert after a Preview

Have you tried turning off the Leave Warning alert only to find that despite repeated attempts to get rid of it, it seems to reset itself after a Preview? And do you find that this problem occurs more frequently for templates that make use of complex controls, like DataGrids and Calendars that require a post back to the server?

You've already set the EnableLeaveAuthoringWarning attribute to false on the Authoring Console. Or alternatively, you have implemented Stefan's sample to turn off the leave warning for a particular control. Somehow, the warning goes away for a while, but after a Preview, the EnableLeaveAuthoringWarning flag seems to reset itself and appears once again.

Try it:
1. Add an ASP.NET Button to a template file.
2. Set the EnableLeaveAuthoringWarning flag of the Authoring Console to false.
3. Click Preview.
4. Close the Preview window.
5. Click on the Button you have added to the template. The alert appears despite being disabled!

Last week, we finally found the reason. The reason lies in the CMS_restoreAfterPreviewPostback() Javascript routine that is called after the Preview button is clicked.

In that routine (found in the Console.js file), the g_bWarnBeforeLeave global variable, which decides whether or not the leave warning appears is reset to true:

function CMS_restoreAfterPreviewPostback()
{
// restore state of form

. . . code continues . . .
g_bWarnBeforeLeave = true;
}

We need to set it to false when EnableLeaveAuthoringWarning is false. I'm not sure if modifying the Console.js file violates any support agreement with Microsoft. Anyway, it's probably not a good idea to do so as the next service pack will just overwrite all changes that we have done to it.

So to get around this, we will take advantage of the fact that the routine is written in a linked script file. This means that if we were to embed a routine of the same name within postings, our custom version will run instead of the linked routine.

We added the following code to the DefaultConsole.ascx.cs file. The script basically re-generates the Cms_restoreAfterPreviewPostback() method, but instead of always setting the g_bWarnBeforeLeave flag to true, it is assigned the value of the Console's EnableLeaveAuthoringWarning property. So if the leave warning is turned off, it stays off!


private void Page_Load(object sender, System.EventArgs e)

{
GeneratePreviewScript();
}
private void GeneratePreviewScript()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script language=\"javascript\">\n");
sb.Append("function CMS_restoreAfterPreviewPostback()\n");
sb.Append("{\n");
sb.Append("// restore state of form\n");
sb.Append("__CMS_PostbackForm.action = g_strOriginalFormAction;\n");
sb.Append("__CMS_PostbackForm.target = g_strOriginalFormTarget;\n");
sb.Append("g_bWarnBeforeLeave = " +

Console1.EnableLeaveAuthoringWarning.ToString().ToLower() +
";\n");
sb.Append("}\n");
sb.Append("</script>\n");

if(!Page.IsClientScriptBlockRegistered("WACConsolePreviewScript"))
{
Page.RegisterStartupScript("WACConsolePreviewScript",sb.ToString());
}
}


I'm not sure why the preview button resets the flag in the first place, but at least with this workaround, our users will continue to receive a pleasant authoring experience!

Thursday, May 05, 2005

Uniquely Singapore Moment

Have you been to Singapore? National Grographic Channel is giving you a chance to win a trip for 2 to this sunny island!
---
Win a Trip to Singapore

Singapore is a unique destination that appeals to every sophisticated traveler.
Its blend of diverse cultures and the harmonious co-existence between centuries' old traditions and modern influences and conveniences have translated into amazing art, spectacular architecture, mouth-watering food and a nirvana for even the most fastidious shoppers - set in a clean and green city of the future. Over a period of 12 days in September and October 2004, three renowned photographers from National Geographic flew to Singapore, went around the island and captured memorable mementos of various facets of life in this garden city like no other.

To view and share these breathtaking images, just click here. And like these famous world travelers, you, too, can create your own "Uniquely Singapore" experience and take them home with you! Simply fill out the survey and get a chance to win a trip for two to Singapore