+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Need to add property to Blog Settings page

Need to add property to Blog Settings page

5 posts, 0 answered
  1. Solomon
    Solomon avatar
    10 posts
    Registered:
    12 Feb 2008
    16 Feb 2010
    Link to this post
    I need to add a property to the Blog Settings page to capture month and year data. This could be a simple textbox or a dropdown, but I cannot find the location to make this change.

    The BlogSettingsView.ascx control only has a reference to the BlogEditor control (which I cannot find) and I cannot find any other controls that apply. Most of the documentation and post I find are related to add metadata to "posts" and not the actual blog itself.

    Any help would be much appreciated. 

    Solomon
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    16 Feb 2010
    Link to this post
    Hi Solomon,

    The view uses a custom class - BlogEditor which has its own template. You could crate a custom class that inherits from BlogEditor and override CreateChildControls where you could create the controls you would like dynamically. Another option is overriding the container and implementing your own templates

    sample code

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Blogs.WebControls;
    using Telerik.Cms.Web.UI;
    using System.Web.UI;
    using Telerik.Framework.Web;
     
    /// <summary>
    /// Summary description for BlogEditorCustom
    /// </summary>
    public class BlogEditorCustom : BlogEditor
    {
        public BlogEditorCustom()
        {
     
        }
     
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
        }
     
        protected override Telerik.Cms.Web.UI.GenericContainer Container
        {
            get
            {
                this.container = new GenericContainer();
                string templateName = (this.BlogId == Guid.Empty)
                                                  ? BlogEditorCustom.NewBlogTemplateName
                                                  : BlogEditorCustom.BlogSettingsTemplateName;
                ITemplate layoutTemplate = ControlUtils.GetTemplate(null, templateName, GetType(), GetType(), this.GetType(), this.ProviderName);
                layoutTemplate.InstantiateIn(this.container);
                return base.Container;
            }
        }
     
        private GenericContainer container;
     
        private const string NewBlogTemplateName = "";
        private const string BlogSettingsTemplateName = "";
    }


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Solomon
    Solomon avatar
    10 posts
    Registered:
    12 Feb 2008
    18 Feb 2010
    Link to this post
    Thank Ivan. With your help, I got this working.

    I do have another related problem. 

    I am trying to add a few custom properties to the Blog Post as well. One is an Abstract text value (similar to newsItem Summary) and another is an associated image (similar to thumbnail). 

    I added the value to the web.config 

    <add key="Blogs.ArticleImage" valueType="ShortText" visible="True" searchable="False" sortable="False" defaultValue=""/>
    <add key="Blogs.Abstract" valueType="LongText" visible="True" searchable="False" sortable="False" defaultValue=""/>

    Added the control templates and set the configuration xml. I then added my controls to the PostNew.ascx and PostEdit.ascx controls.
    <h3>
                <asp:literal id="Literal7" runat="server" text="<%$Resources:Abstract %>"></asp:literal></h3>
            <fieldset class="set">
                <ol class="setIn clearfix">
                    <li class="selector">
                        <asp:label id="Label3" associatedcontrolid="Abstract" runat="server">
                            <asp:literal id="Literal8" runat="server" text="<%$Resources:Abstract %>"></asp:literal>
                            <em id="Em2" runat="server"></em></asp:label>
                        <asp:textbox id="Abstract" text="" runat="server" textmode="MultiLine" rows="3" maxlength="1000"></asp:textbox>
                        <p class="example">
                            <asp:literal id="Literal9" runat="server" text="<%$Resources:AbstractNote %>"></asp:literal></p>
                    </li>
                </ol>
            </fieldset>
            <div class="bottom">
                <div>
                    <!-- -->
                </div>
            </div>
            <h3>
                <asp:literal id="Literal6" runat="server" text="<%$Resources:Image %>"></asp:literal></h3>
            <fieldset class="set">
                <ol class="setIn clearfix">
                    <li class="selector">
                        <asp:label id="Label2" associatedcontrolid="ArticleImage" runat="server">
                            <asp:literal id="Literal25" runat="server" text="<%$Resources:Image %>"></asp:literal>
                            <em id="ImageLabel" runat="server"></em></asp:label>
                        <asp:textbox id="ArticleImage" text="" runat="server" maxlength="250"></asp:textbox>
                        <sflib:buttonselector id="ButtonSelector1" windownavigateurl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" associatedcontrols="ArticleImage" itemtemplatepath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" runat="server" cssclass="pickerWrapper" buttontext="<%$Resources:Select%>" />
                        <p class="example">
                            <asp:literal id="Literal26" runat="server" text="<%$Resources:ImageNote %>"></asp:literal></p>
                    </li>
                </ol>
            </fieldset>

    It is my understanding that the control ids match up with the values set in the web.config file and no additional code is required for saving and populating on edit. Is this the case?

    The Abstract and Image are not saving in the object. The UI, however, is working great!

    Any ideas?

    Thanks in advance.

    Solomon
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    18 Feb 2010
    Link to this post
    Hi Solomon,

    Make sure that both controls are added inside ContentMetaFields control in PostNew and PostEdit templates.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Solomon
    Solomon avatar
    10 posts
    Registered:
    12 Feb 2008
    18 Feb 2010
    Link to this post
    Thanks Ivan. That was it.
Register for webinar
5 posts, 0 answered