Exemplo n.º 1
0
        private void SetUpTextAreas(bool flush)
        {
            Guid selectedTemplateId = this.SelectedTemplateId;

            PageTemplateDescriptor pageTemplate = PageTemplateFacade.GetPageTemplate(selectedTemplateId);

            Verify.IsNotNull(pageTemplate, "Failed to get page template by id '{0}'", selectedTemplateId);
            if (!pageTemplate.IsValid)
            {
                throw new InvalidOperationException(
                          "Page template '{0}' contains errors. You can edit the template in the 'Layout' section".FormatWith(selectedTemplateId),
                          pageTemplate.LoadingException);
            }

            var handledIds = new List <string>();

            ContentsPlaceHolder.Controls.Clear();
            foreach (var placeholderDescription in pageTemplate.PlaceholderDescriptions)
            {
                string placeholderId = placeholderDescription.Id;

                if (handledIds.Contains(placeholderId) == false)
                {
                    var pageTypeContainerClasses = ContainerClassManager.GetPageTypeContainerClasses(this.PageTypeId, placeholderDescription.Id);
                    var allContainerClasses      = ContainerClassManager.MergeContainerClasses(placeholderDescription.ContainerClasses, pageTypeContainerClasses);

                    TextBox contentTextBox = new Composite.Core.WebClient.UiControlLib.TextBox();
                    contentTextBox.TextMode = TextBoxMode.MultiLine;
                    contentTextBox.ID       = placeholderId;
                    contentTextBox.Attributes.Add("placeholderid", placeholderId);
                    contentTextBox.Attributes.Add("placeholdername", placeholderDescription.Title);
                    contentTextBox.Attributes.Add("containerclasses", string.Join(",", allContainerClasses));

                    if (placeholderId == pageTemplate.DefaultPlaceholderId)
                    {
                        contentTextBox.Attributes.Add("selected", "true");
                    }
                    if (flush)
                    {
                        if (this.NamedXhtmlFragments.ContainsKey(placeholderId))
                        {
                            contentTextBox.Text = this.NamedXhtmlFragments[placeholderId];
                        }
                        else
                        {
                            contentTextBox.Text = "";
                        }
                    }
                    ContentsPlaceHolder.Controls.Add(contentTextBox);
                    handledIds.Add(placeholderId);
                }
            }
        }
Exemplo n.º 2
0
        private void SetUpTextAreas(bool flush)
        {
            List <string> handledIds = new List <string>();

            ContentsPlaceHolder.Controls.Clear();

            bool isFirst = true;

            foreach (string placeHolderId in this.PlaceholderDefinitions.Keys)
            {
                if (handledIds.Contains(placeHolderId) == false)
                {
                    string  containerClasses = this.PlaceholderContainerClasses.ContainsKey(placeHolderId) ? this.PlaceholderContainerClasses[placeHolderId] : "";
                    TextBox contentTextBox   = new Composite.Core.WebClient.UiControlLib.TextBox();
                    contentTextBox.TextMode = TextBoxMode.MultiLine;
                    contentTextBox.ID       = placeHolderId;
                    contentTextBox.Attributes.Add("placeholderid", placeHolderId);
                    contentTextBox.Attributes.Add("placeholdername", this.PlaceholderDefinitions[placeHolderId]);
                    contentTextBox.Attributes.Add("containerclasses", containerClasses);

                    if (isFirst)
                    {
                        contentTextBox.Attributes.Add("selected", "true");
                        isFirst = false;
                    }
                    if (flush == true)
                    {
                        if (this.NamedXhtmlFragments.ContainsKey(placeHolderId))
                        {
                            contentTextBox.Text = this.NamedXhtmlFragments[placeHolderId];
                        }
                        else
                        {
                            contentTextBox.Text = "";
                        }
                    }
                    ContentsPlaceHolder.Controls.Add(contentTextBox);
                    handledIds.Add(placeHolderId);
                }
            }
        }
        private void SetUpTextAreas(bool flush)
        {
            List<string> handledIds = new List<string>();

            ContentsPlaceHolder.Controls.Clear();

            bool isFirst = true;

            foreach (string placeHolderId in this.PlaceholderDefinitions.Keys)
            {
                if (handledIds.Contains(placeHolderId) == false)
                {
                    TextBox contentTextBox = new Composite.Core.WebClient.UiControlLib.TextBox();
                    contentTextBox.TextMode = TextBoxMode.MultiLine;
                    contentTextBox.ID = placeHolderId;
                    contentTextBox.Attributes.Add("placeholderid", placeHolderId);
                    contentTextBox.Attributes.Add("placeholdername", this.PlaceholderDefinitions[placeHolderId]);
                    if ( isFirst )
                    {
                        contentTextBox.Attributes.Add("selected", "true");
                        isFirst = false;
                    }
                    if (flush == true)
                    {
                        if (this.NamedXhtmlFragments.ContainsKey(placeHolderId))
                        {
                            contentTextBox.Text = this.NamedXhtmlFragments[placeHolderId];
                        }
                        else
                        {
                            contentTextBox.Text = "<br />";
                        }
                    }
                    ContentsPlaceHolder.Controls.Add(contentTextBox);
                    handledIds.Add(placeHolderId);
                }
            }
        }
Exemplo n.º 4
0
        private void SetUpTextAreas(bool flush)
        {
            Guid selectedTemplateId = this.SelectedTemplateId;

            PageTemplateDescriptor pageTemplate = PageTemplateFacade.GetPageTemplate(selectedTemplateId);

            Verify.IsNotNull(pageTemplate, "Failed to get page template by id '{0}'", selectedTemplateId);
            if (!pageTemplate.IsValid)
            {
                throw new InvalidOperationException(
                    "Page template '{0}' contains errors. You can edit the template in the 'Layout' section".FormatWith(selectedTemplateId),
                    pageTemplate.LoadingException);
            }

            var handledIds = new List<string>();

            ContentsPlaceHolder.Controls.Clear();
            foreach (var placeholderDescription in pageTemplate.PlaceholderDescriptions)
            {
                string placeholderId = placeholderDescription.Id;

                if (handledIds.Contains(placeholderId) == false)
                {
                    TextBox contentTextBox = new Composite.Core.WebClient.UiControlLib.TextBox();
                    contentTextBox.TextMode = TextBoxMode.MultiLine;
                    contentTextBox.ID = placeholderId;
                    contentTextBox.Attributes.Add("placeholderid", placeholderId);
                    contentTextBox.Attributes.Add("placeholdername", placeholderDescription.Title);
                    if (placeholderId == pageTemplate.DefaultPlaceholderId)
                    {
                        contentTextBox.Attributes.Add("selected", "true");
                    }
                    if (flush)
                    {
                        if (this.NamedXhtmlFragments.ContainsKey(placeholderId))
                        {
                            contentTextBox.Text = this.NamedXhtmlFragments[placeholderId];
                        }
                        else
                        {
                            contentTextBox.Text = "";
                        }
                    }
                    ContentsPlaceHolder.Controls.Add(contentTextBox);
                    handledIds.Add(placeholderId);
                }
            }
        }
Exemplo n.º 5
0
        private void SetUpTextAreas(bool flush)
        {
            TemplatePlaceholdersInfo info = TemplateInfo.GetRenderingPlaceHolders(this.SelectedTemplateId);

            List<string> handledIds = new List<string>();

            ContentsPlaceHolder.Controls.Clear();
            foreach (KeyValuePair placeHolderInfo in info.Placeholders)
            {
                if (handledIds.Contains(placeHolderInfo.Key) == false)
                {
                    TextBox contentTextBox = new Composite.Core.WebClient.UiControlLib.TextBox();
                    contentTextBox.TextMode = TextBoxMode.MultiLine;
                    contentTextBox.ID = placeHolderInfo.Key;
                    contentTextBox.Attributes.Add("placeholderid", placeHolderInfo.Key);
                    contentTextBox.Attributes.Add("placeholdername", placeHolderInfo.Value);
                    if (placeHolderInfo.Key == info.DefaultPlaceholderId)
                    {
                        contentTextBox.Attributes.Add("selected", "true");
                    }
                    if (flush == true)
                    {
                        if (this.NamedXhtmlFragments.ContainsKey(placeHolderInfo.Key))
                        {
                            contentTextBox.Text = this.NamedXhtmlFragments[placeHolderInfo.Key];
                        }
                        else
                        {
                            contentTextBox.Text = "<br />";
                        }
                    }
                    ContentsPlaceHolder.Controls.Add(contentTextBox);
                    handledIds.Add(placeHolderInfo.Key);
                }
            }
        }