protected override void RenderHeader(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            TitleStyle headerStyle = base.HeaderStyle;

            if (!headerStyle.IsEmpty)
            {
                Style style2 = new Style();
                if (!headerStyle.ForeColor.IsEmpty)
                {
                    style2.ForeColor = headerStyle.ForeColor;
                }
                style2.Font.CopyFrom(headerStyle.Font);
                if (!headerStyle.Font.Size.IsEmpty)
                {
                    style2.Font.Size = new FontUnit(new Unit(100.0, UnitType.Percentage));
                }
                if (!style2.IsEmpty)
                {
                    style2.AddAttributesToRender(writer, this);
                }
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            HorizontalAlign horizontalAlign = headerStyle.HorizontalAlign;

            if (horizontalAlign != HorizontalAlign.NotSet)
            {
                TypeConverter converter = TypeDescriptor.GetConverter(typeof(HorizontalAlign));
                writer.AddAttribute(HtmlTextWriterAttribute.Align, converter.ConvertToString(horizontalAlign));
            }
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(this.HeaderText);
            writer.RenderEndTag();
            WebPartVerb headerCloseVerb = this.HeaderCloseVerb;

            if (headerCloseVerb.Visible)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                ZoneLinkButton button = new ZoneLinkButton(this, headerCloseVerb.EventArgument)
                {
                    Text     = headerCloseVerb.Text,
                    ImageUrl = headerCloseVerb.ImageUrl,
                    ToolTip  = headerCloseVerb.Description,
                    Enabled  = headerCloseVerb.Enabled,
                    Page     = this.Page
                };
                button.ApplyStyle(this.HeaderVerbStyle);
                button.RenderControl(writer);
                writer.RenderEndTag();
            }
            writer.RenderEndTag();
            writer.RenderEndTag();
        }
예제 #2
0
        protected virtual void RenderCatalogPartLinks(HtmlTextWriter writer)
        {
            RenderInstructionText(writer);

            CatalogPart selectedCatalogPart = SelectedCatalogPart;

            foreach (CatalogPart catalogPart in CatalogParts)
            {
                WebPartDescriptionCollection availableWebParts = catalogPart.GetAvailableWebPartDescriptions();
                int count = ((availableWebParts != null) ? availableWebParts.Count : 0);

                string displayTitle = catalogPart.DisplayTitle;
                //
                string text = displayTitle + " (" + count.ToString(CultureInfo.CurrentCulture) + ")";

                if (catalogPart == selectedCatalogPart)
                {
                    Label label = new Label();
                    label.Text = text;
                    label.Page = Page;
                    label.ApplyStyle(SelectedPartLinkStyle);
                    label.RenderControl(writer);
                }
                else
                {
                    Debug.Assert(!String.IsNullOrEmpty(catalogPart.ID));
                    string eventArgument = selectEventArgument + ID_SEPARATOR + catalogPart.ID;

                    ZoneLinkButton linkButton = new ZoneLinkButton(this, eventArgument);
                    linkButton.Text    = text;
                    linkButton.ToolTip = SR.GetString(SR.CatalogZoneBase_SelectCatalogPart, displayTitle);
                    linkButton.Page    = Page;
                    linkButton.ApplyStyle(PartLinkStyle);
                    linkButton.RenderControl(writer);
                }

                writer.WriteBreak();
            }

            writer.WriteBreak();
        }
예제 #3
0
        protected virtual void RenderCatalogPartLinks(HtmlTextWriter writer)
        {
            this.RenderInstructionText(writer);
            CatalogPart selectedCatalogPart = this.SelectedCatalogPart;

            foreach (CatalogPart part2 in this.CatalogParts)
            {
                WebPartDescriptionCollection availableWebPartDescriptions = part2.GetAvailableWebPartDescriptions();
                int    num          = (availableWebPartDescriptions != null) ? availableWebPartDescriptions.Count : 0;
                string displayTitle = part2.DisplayTitle;
                string str2         = displayTitle + " (" + num.ToString(CultureInfo.CurrentCulture) + ")";
                if (part2 == selectedCatalogPart)
                {
                    Label label = new Label {
                        Text = str2,
                        Page = this.Page
                    };
                    label.ApplyStyle(this.SelectedPartLinkStyle);
                    label.RenderControl(writer);
                }
                else
                {
                    string         eventArgument = "select" + '$' + part2.ID;
                    ZoneLinkButton button        = new ZoneLinkButton(this, eventArgument)
                    {
                        Text    = str2,
                        ToolTip = System.Web.SR.GetString("CatalogZoneBase_SelectCatalogPart", new object[] { displayTitle }),
                        Page    = this.Page
                    };
                    button.ApplyStyle(this.PartLinkStyle);
                    button.RenderControl(writer);
                }
                writer.WriteBreak();
            }
            writer.WriteBreak();
        }
        private void RenderAddVerbs(HtmlTextWriter writer) {
            WebPart webPartToConnect = WebPartToConnect;

            WebPartCollection webParts = null;
            if (WebPartManager != null) {
                webParts = WebPartManager.WebParts;
            }

            if (webPartToConnect != null || DesignMode) {
                // Are there any compatible consumers?
                bool consumersAvailable = DesignMode;
                if (!consumersAvailable && WebPartManager != null) {
                    ProviderConnectionPointCollection providers =
                        WebPartManager.GetEnabledProviderConnectionPoints(webPartToConnect);
                    foreach (ProviderConnectionPoint provider in providers) {
                        if (GetValidConsumers(webPartToConnect, provider, webParts).Count != 0) {
                            consumersAvailable = true;
                            break;
                        }
                    }
                }
                if (consumersAvailable) {
                    ZoneLinkButton connectConsumerButton = new ZoneLinkButton(this, connectConsumerEventArgument);
                    connectConsumerButton.Text = ConnectToConsumerText;
                    connectConsumerButton.ApplyStyle(VerbStyle);
                    connectConsumerButton.Page = Page;
                    connectConsumerButton.RenderControl(writer);
                    writer.WriteBreak();
                }

                // Are there any compatible providers?
                bool providersAvailable = DesignMode;
                if (!providersAvailable && WebPartManager != null) {
                    ConsumerConnectionPointCollection consumers =
                        WebPartManager.GetEnabledConsumerConnectionPoints(webPartToConnect);
                    foreach (ConsumerConnectionPoint consumer in consumers) {
                        if (GetValidProviders(webPartToConnect, consumer, webParts).Count != 0) {
                            providersAvailable = true;
                            break;
                        }
                    }
                }
                if (providersAvailable) {
                    ZoneLinkButton connectProviderButton = new ZoneLinkButton(this, connectProviderEventArgument);
                    connectProviderButton.Text = ConnectToProviderText;
                    connectProviderButton.ApplyStyle(VerbStyle);
                    connectProviderButton.Page = Page;
                    connectProviderButton.RenderControl(writer);
                    writer.WriteBreak();
                }

                // Add separator if anything was rendered
                if (providersAvailable || consumersAvailable) {
                    writer.RenderBeginTag(HtmlTextWriterTag.Hr);
                    writer.RenderEndTag();
                }
            }
        }
 private void RenderAddVerbs(HtmlTextWriter writer)
 {
     WebPart webPartToConnect = this.WebPartToConnect;
     WebPartCollection webParts = null;
     if (base.WebPartManager != null)
     {
         webParts = base.WebPartManager.WebParts;
     }
     if ((webPartToConnect != null) || base.DesignMode)
     {
         bool designMode = base.DesignMode;
         if (!designMode && (base.WebPartManager != null))
         {
             foreach (ProviderConnectionPoint point in base.WebPartManager.GetEnabledProviderConnectionPoints(webPartToConnect))
             {
                 if (this.GetValidConsumers(webPartToConnect, point, webParts).Count != 0)
                 {
                     designMode = true;
                     break;
                 }
             }
         }
         if (designMode)
         {
             ZoneLinkButton button = new ZoneLinkButton(this, "connectconsumer") {
                 Text = this.ConnectToConsumerText
             };
             button.ApplyStyle(base.VerbStyle);
             button.Page = this.Page;
             button.RenderControl(writer);
             writer.WriteBreak();
         }
         bool flag2 = base.DesignMode;
         if (!flag2 && (base.WebPartManager != null))
         {
             foreach (ConsumerConnectionPoint point2 in base.WebPartManager.GetEnabledConsumerConnectionPoints(webPartToConnect))
             {
                 if (this.GetValidProviders(webPartToConnect, point2, webParts).Count != 0)
                 {
                     flag2 = true;
                     break;
                 }
             }
         }
         if (flag2)
         {
             ZoneLinkButton button2 = new ZoneLinkButton(this, "connectprovider") {
                 Text = this.ConnectToProviderText
             };
             button2.ApplyStyle(base.VerbStyle);
             button2.Page = this.Page;
             button2.RenderControl(writer);
             writer.WriteBreak();
         }
         if (flag2 || designMode)
         {
             writer.RenderBeginTag(HtmlTextWriterTag.Hr);
             writer.RenderEndTag();
         }
     }
 }
예제 #6
0
        protected virtual void RenderCatalogPartLinks(HtmlTextWriter writer) {
            RenderInstructionText(writer);

            CatalogPart selectedCatalogPart = SelectedCatalogPart;
            foreach (CatalogPart catalogPart in CatalogParts) {
                WebPartDescriptionCollection availableWebParts = catalogPart.GetAvailableWebPartDescriptions();
                int count = ((availableWebParts != null) ? availableWebParts.Count : 0);

                string displayTitle = catalogPart.DisplayTitle;
                // 
                string text = displayTitle + " (" + count.ToString(CultureInfo.CurrentCulture) + ")";

                if (catalogPart == selectedCatalogPart) {
                    Label label = new Label();
                    label.Text = text;
                    label.Page = Page;
                    label.ApplyStyle(SelectedPartLinkStyle);
                    label.RenderControl(writer);
                }
                else {
                    Debug.Assert(!String.IsNullOrEmpty(catalogPart.ID));
                    string eventArgument = selectEventArgument + ID_SEPARATOR + catalogPart.ID;

                    ZoneLinkButton linkButton = new ZoneLinkButton(this, eventArgument);
                    linkButton.Text = text;
                    linkButton.ToolTip = SR.GetString(SR.CatalogZoneBase_SelectCatalogPart, displayTitle);
                    linkButton.Page = Page;
                    linkButton.ApplyStyle(PartLinkStyle);
                    linkButton.RenderControl(writer);
                }

                writer.WriteBreak();
            }

            writer.WriteBreak();
        }
예제 #7
0
        protected override void RenderHeader(HtmlTextWriter writer) {
            // Render title bar
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");

            TitleStyle headerStyle = HeaderStyle;
            if (!headerStyle.IsEmpty) {
                // Apply font and forecolor from HeaderStyle to inner table
                Style style = new Style();
                if (!headerStyle.ForeColor.IsEmpty) {
                    style.ForeColor = headerStyle.ForeColor;
                }
                style.Font.CopyFrom(headerStyle.Font);
                if (!headerStyle.Font.Size.IsEmpty) {
                    // If the font size is specified on the HeaderStyle, force the font size to 100%,
                    // so it inherits the font size from its parent in IE compatibility mode. I would
                    // think that "1em" would work here as well, but "1em" doesn't work when you change
                    // the font size in the browser.
                    style.Font.Size = new FontUnit(new Unit(100, UnitType.Percentage));
                }
                if (!style.IsEmpty) {
                    style.AddAttributesToRender(writer, this);
                }
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Copied from Panel.cs
            // 
            HorizontalAlign hAlign = headerStyle.HorizontalAlign;
            if (hAlign != HorizontalAlign.NotSet) {
                TypeConverter hac = TypeDescriptor.GetConverter(typeof(HorizontalAlign));
                writer.AddAttribute(HtmlTextWriterAttribute.Align, hac.ConvertToString(hAlign));
            }

            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(HeaderText);
            writer.RenderEndTag();  // Td

            WebPartVerb headerCloseVerb = HeaderCloseVerb;
            if (headerCloseVerb.Visible) {
                writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                ZoneLinkButton closeButton = new ZoneLinkButton(this, headerCloseVerb.EventArgument);
                closeButton.Text = headerCloseVerb.Text;
                closeButton.ImageUrl = headerCloseVerb.ImageUrl;
                closeButton.ToolTip = headerCloseVerb.Description;
                closeButton.Enabled = headerCloseVerb.Enabled;
                closeButton.Page = Page;
                closeButton.ApplyStyle(HeaderVerbStyle);
                closeButton.RenderControl(writer);
                writer.RenderEndTag();  // Td
            }

            writer.RenderEndTag();  // Tr
            writer.RenderEndTag();  // Table
        }
 protected override void RenderHeader(HtmlTextWriter writer)
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
     writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2");
     writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
     writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
     TitleStyle headerStyle = base.HeaderStyle;
     if (!headerStyle.IsEmpty)
     {
         Style style2 = new Style();
         if (!headerStyle.ForeColor.IsEmpty)
         {
             style2.ForeColor = headerStyle.ForeColor;
         }
         style2.Font.CopyFrom(headerStyle.Font);
         if (!headerStyle.Font.Size.IsEmpty)
         {
             style2.Font.Size = new FontUnit(new Unit(100.0, UnitType.Percentage));
         }
         if (!style2.IsEmpty)
         {
             style2.AddAttributesToRender(writer, this);
         }
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Table);
     writer.RenderBeginTag(HtmlTextWriterTag.Tr);
     HorizontalAlign horizontalAlign = headerStyle.HorizontalAlign;
     if (horizontalAlign != HorizontalAlign.NotSet)
     {
         TypeConverter converter = TypeDescriptor.GetConverter(typeof(HorizontalAlign));
         writer.AddAttribute(HtmlTextWriterAttribute.Align, converter.ConvertToString(horizontalAlign));
     }
     writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
     writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     writer.Write(this.HeaderText);
     writer.RenderEndTag();
     WebPartVerb headerCloseVerb = this.HeaderCloseVerb;
     if (headerCloseVerb.Visible)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
         writer.RenderBeginTag(HtmlTextWriterTag.Td);
         ZoneLinkButton button = new ZoneLinkButton(this, headerCloseVerb.EventArgument) {
             Text = headerCloseVerb.Text,
             ImageUrl = headerCloseVerb.ImageUrl,
             ToolTip = headerCloseVerb.Description,
             Enabled = headerCloseVerb.Enabled,
             Page = this.Page
         };
         button.ApplyStyle(this.HeaderVerbStyle);
         button.RenderControl(writer);
         writer.RenderEndTag();
     }
     writer.RenderEndTag();
     writer.RenderEndTag();
 }
예제 #9
0
        protected override void RenderHeader(HtmlTextWriter writer)
        {
            // Render title bar
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");

            TitleStyle headerStyle = HeaderStyle;

            if (!headerStyle.IsEmpty)
            {
                // Apply font and forecolor from HeaderStyle to inner table
                Style style = new Style();
                if (!headerStyle.ForeColor.IsEmpty)
                {
                    style.ForeColor = headerStyle.ForeColor;
                }
                style.Font.CopyFrom(headerStyle.Font);
                if (!headerStyle.Font.Size.IsEmpty)
                {
                    // If the font size is specified on the HeaderStyle, force the font size to 100%,
                    // so it inherits the font size from its parent in IE compatibility mode. I would
                    // think that "1em" would work here as well, but "1em" doesn't work when you change
                    // the font size in the browser.
                    style.Font.Size = new FontUnit(new Unit(100, UnitType.Percentage));
                }
                if (!style.IsEmpty)
                {
                    style.AddAttributesToRender(writer, this);
                }
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Copied from Panel.cs
            //
            HorizontalAlign hAlign = headerStyle.HorizontalAlign;

            if (hAlign != HorizontalAlign.NotSet)
            {
                TypeConverter hac = TypeDescriptor.GetConverter(typeof(HorizontalAlign));
                writer.AddAttribute(HtmlTextWriterAttribute.Align, hac.ConvertToString(hAlign));
            }

            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(HeaderText);
            writer.RenderEndTag();  // Td

            WebPartVerb headerCloseVerb = HeaderCloseVerb;

            if (headerCloseVerb.Visible)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                ZoneLinkButton closeButton = new ZoneLinkButton(this, headerCloseVerb.EventArgument);
                closeButton.Text     = headerCloseVerb.Text;
                closeButton.ImageUrl = headerCloseVerb.ImageUrl;
                closeButton.ToolTip  = headerCloseVerb.Description;
                closeButton.Enabled  = headerCloseVerb.Enabled;
                closeButton.Page     = Page;
                closeButton.ApplyStyle(HeaderVerbStyle);
                closeButton.RenderControl(writer);
                writer.RenderEndTag();  // Td
            }

            writer.RenderEndTag();  // Tr
            writer.RenderEndTag();  // Table
        }
 protected virtual void RenderCatalogPartLinks(HtmlTextWriter writer)
 {
     this.RenderInstructionText(writer);
     CatalogPart selectedCatalogPart = this.SelectedCatalogPart;
     foreach (CatalogPart part2 in this.CatalogParts)
     {
         WebPartDescriptionCollection availableWebPartDescriptions = part2.GetAvailableWebPartDescriptions();
         int num = (availableWebPartDescriptions != null) ? availableWebPartDescriptions.Count : 0;
         string displayTitle = part2.DisplayTitle;
         string str2 = displayTitle + " (" + num.ToString(CultureInfo.CurrentCulture) + ")";
         if (part2 == selectedCatalogPart)
         {
             Label label = new Label {
                 Text = str2,
                 Page = this.Page
             };
             label.ApplyStyle(this.SelectedPartLinkStyle);
             label.RenderControl(writer);
         }
         else
         {
             string eventArgument = "select" + '$' + part2.ID;
             ZoneLinkButton button = new ZoneLinkButton(this, eventArgument) {
                 Text = str2,
                 ToolTip = System.Web.SR.GetString("CatalogZoneBase_SelectCatalogPart", new object[] { displayTitle }),
                 Page = this.Page
             };
             button.ApplyStyle(this.PartLinkStyle);
             button.RenderControl(writer);
         }
         writer.WriteBreak();
     }
     writer.WriteBreak();
 }