Working with MWSDefault.master page along with meeting workspace definition

 

Recently I came across an issue with a custom master page created based on the OOB MWSDefault.master page.

MWSDefault.Master is the master page used by the OOB meeting workspace definition "MPS". This master page has been used with all the configuration of the MPS meeting workspace site definition. You can find this master page under the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL folder. All the modules in the MPS site definition refers the master page from this set up path to provision it to the master page gallery.

Created a custom master page based on this MWSDefault.master page and has successfully provisioned it to the master page gallery. But applying this master page to the meeting workspace site doesn't replicate the same behavior as the OOB MWSDefault.master.

The following screenshot shows you the multipage meeting workspace site with the OOB MWSDefault.master page applied :

Blog1 

 

The following screenshot shows you the multipage meeting workspace site with the Custom MWSDefault.master page applied :

Blog2

 

From the above screenshots you can find the difference that the multi page meeting workspace with the custom master page appears with a "Meeting Navigator" in the quick launch. This meeting navigator should appear only if more than one meeting event is linked with the meeting workspace. There are no meeting events linked with the meeting workspace but still the meeting workspace shows the "Meeting Navigator" with the message that "There are no more meeting occurrences to select from" but with the OOB MWSDefault.master everything is fine.

 

If you have a look into the "Default.aspx" page then you can find that the "HideMtgNavigatorPane" JavaScript function has been called to hide the meeting navigator if the meeting count for the meeting workspace is less than or equal to one (<=1). The following is the snippet from the default.aspx page :

<div id="MeetingNavigatorPane" class="ms-quicklaunchouter">

  <div class="ms-quickLaunch" style="width:100%">

      <div>

       <table height=100% cellspacing=0 cellpadding=2 class="ms-navSubMenu2">

            <tr valign=top>

                  <td id="onetidMtgNavigator">

                        <script> if (typeof(g_meetingCount) != "undefined" && (g_meetingCount == 0 || g_meetingCount == 1)) HideMtgNavigatorPane(); </script>

                        <!-- Begin Date Picker Column -->

                        <WebPartPages:WebPartZone runat="server" Title="loc:MeetingNavigator" ID="MeetingNavigator" Orientation="Vertical" FrameType="None" AllowLayoutChange="False" AllowPersonalization="false"/>

                        <!-- End Meeting Date Picker -->

                  </td>

            </tr>

       </table>

      </div>

The custom master page has the JavaScript reference but this JavaScript method (HideMtgNavigatorPane) was not called when we are applying the custom master page. While doing the further source code debugging with the variable "g_meetingCount" found an interesting thing which is the root cause of the behavior.

 

The variable "g_meetingCount" has been assigned with the value in the fly by registering a Client Script Block. This has been implemented in the HandlePrerender method of Microsoft.SharePoint.Meetings.PropertyBag Class. The following is the snippet of the "HandlePrerender" method in which you can find that the "g_meetingCount" is assigned with the value of meeting count from the current web object.

 

private void HandlePreRender(object sender, EventArgs e)

        {

            // This item is obfuscated and can not be translated.

            SPWeb contextWeb = SPControl.GetContextWeb(this.Context);

            if (SPMeeting.IsMeetingWorkspaceWeb(contextWeb))

            {

                ScriptBuilder builder = new ScriptBuilder();

                string fullOrRelativeUri = contextWeb.GetWebRelativeUrlFromUrl(SPGlobal.GetVTIRequestUrl(this.Page.Request, contextWeb.Request).ToString(), false, false);

                builder.AddVariable("g_pageUrl", "\"" + SPHttpUtility.UrlPathEncode(MtgUtility.GetServerRelativeUrl(contextWeb) + fullOrRelativeUri, true) + "\"");

                builder.AddVariable("g_webUrl", "\"" + SPHttpUtility.UrlPathEncode(contextWeb.ServerRelativeUrl, true) + "\"");

                builder.AddVariable("g_instanceId", "\"" + contextWeb.MeetingInformation.InstanceId + "\"");

                builder.AddVariable("g_meetingCount", "\"" + contextWeb.MeetingCount + "\"");

                SPList homepageLib = MtgUtility.GetHomepageLib(contextWeb);

                if (homepageLib != null)

                {

                    string str2;

                    string str3;

                    Utility.SplitUrl(fullOrRelativeUri, out str2, out str3);

                    if (SPUtility.StsCompareStrings(str2, contextWeb.MeetingInformation.MakeInstanceFolder(homepageLib.RootFolder.Url)))

                    {

                    }

                    builder.AddVariable("g_fPageGlobal", "0");

                }

                this.Page.ClientScript.RegisterClientScriptBlock(typeof(PropertyBag), "Mtg_MeetingsPropertyBag", builder.ScriptText);

            }

        }

So we need to add this class to the Body of the custom master page so that the "g_meetingCount" variable will be assigned with the value and hide/show of the meeting Navigator panel will work as expected. There is already a Tag prefix has been included in the custom Master page for the "Microsoft.SharePoint.Meetings" namespace in the master page so we just need to add the reference to the "PropertyBag" class in the "Body" of the custom master page. This fixed the issue and now the Branding works as expected :

Blog3

Note :

This "PropertyBag" class is very important and it's not only important for this "g_meetingCount" because there are some other variables are also used in this PropertyBag. So when you are missing any functionalities while customizing the "MWSDefault.master" please make sure that you adds this "PropertyBag" to the "Body" of the custom master page.