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

Forums / Developing with Sitefinity / Template for new wiki page

Template for new wiki page

4 posts, 0 answered
  1. Joe Lee
    Joe Lee avatar
    4 posts
    Registered:
    15 Mar 2010
    17 Mar 2010
    Link to this post
    Hi,

        1.
        I would like to create a template for all new wiki page. That mean when I create a new wiki page, some words will already filled-in to the wiki content.

        So I'd like to ask if there is any way to replace the default word "New page for wiki 'xxxxx'" to other words I want? Or should I use other approach to fulfilll that "template" requirement??

        2.
        Another minor problem is about the Tag List (Tag cloud), is there any way to remove (hide) the "Display as: cloud | list"?

        Thanks very much.

    Best Regards
    Joe
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    17 Mar 2010
    Link to this post
    Hi Joe Lee,

    1. You can change the default content by overriding

    Telerik.Wiki.WebControls.WikiAdmin

    protected override void OnPreRender(EventArgs e)
     {
         base.OnPreRender(e);
     
         if (canCreate && this.wikiPageCreating)
         {
                 this.CreateWikiPageCustom();
         }
             else
             {
         showCreatePage = false;
             }
         }
          
     }
     
     protected void CreateWikiPageCustom(string wikiName, string wikiPage, bool homePage)
     {
         IContent wikiContent = this.WikiManager.CreateWikiItem(wikiName);
         wikiContent.SetMetaData("Name", wikiPage);
         wikiContent.SetMetaData("Wiki", wikiName);
         if (homePage)
         {
             wikiContent.Content = "some content here;
         }
         else
         {
             wikiContent.Content = "some content here;
         }
         this.WikiManager.Content.SaveContent(wikiContent);
     }

    Telerik.Wiki.WebControls.Admin.WikiEditView

    override CreateWiki method and set homePage.Content

    2. The easiest way is to map TagsList.ascx external template and hide the Linkbuttons

    <p>
        <asp:Literal ID="lblDisplayAs" runat="server" Text='<%$Resources:DisplayAs %>'></asp:Literal> :
        <asp:LinkButton ID="displayCloudLink" runat="server" Text='<%$Resources:Cloud %>'></asp:LinkButton> |
        <asp:LinkButton ID="displayListLink" runat="server" Text='<%$Resources:List %>'></asp:LinkButton>
    </p>


    All the best,
    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. Joe Lee
    Joe Lee avatar
    4 posts
    Registered:
    15 Mar 2010
    19 Mar 2010
    Link to this post
    Hi Ivan,

    Thanks for your reply.
    I've follow this Knowledge Base to create a CustomWikiAdmin class inherit from WikiAdmin. But I not sure why the Create button is not responding. I didn't modify anything on the layout template. Below is the code i write, could you advice is there anything I have make it wrong?

    Thanks.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Cms.Engine;
    using System.Web.UI.WebControls;
     
    namespace Telerik.Wiki.WebControls
    {
        /// <summary>
        /// Summary description for CustomWikiAdmin
        /// </summary>
        public class CustomWikiAdmin : WikiAdmin
        {
            protected override void CreateChildControls()
            {
                base.LayoutTemplatePath = "~/Sitefinity/ControlTemplates/Wiki/WikiAdmin.ascx";
                base.CreateChildControls();
            }
     
            protected override void OnPreRender(EventArgs e)
            {
                base.OnPreRender(e);
     
                if (this.AllowCreateWiki && this.wikiPageCreating)
                {
                    this.CreateWikiPageCustom(GetWikiName(), WikiPage.Text, false);
                }
                else
                {
                    //showCreatePage = false;
                }
            }
     
            protected override void OnLoad(EventArgs e)
            {
                base.OnLoad(e);
            }
     
            protected void CreateWikiPageCustom(string wikiName, string wikiPage, bool homePage)
            {
                IContent wikiContent = this.WikiManager.CreateWikiItem(wikiName);
                wikiContent.SetMetaData("Name", wikiPage);
                wikiContent.SetMetaData("Wiki", wikiName);
                if (homePage)
                {
                    wikiContent.Content = "some content here";
                }
                else
                {
                    wikiContent.Content = "some content here";
                }
                this.WikiManager.Content.SaveContent(wikiContent);
            }
     
            protected void CreatePageButton_Command(object sender, CommandEventArgs e)
            {
                base.CreatePageButton_Command(sender, e);
            }
     
            protected void CreateWikiButton_Command(object sender, CommandEventArgs e)
            {
                base.CreateWikiButton_Command(sender, e);
            }
        }
    }

    Best Regards,
    Joe Lee
  4. Joe Lee
    Joe Lee avatar
    4 posts
    Registered:
    15 Mar 2010
    19 Mar 2010
    Link to this post
    Hi Ivan,

    I've found out what happened. It is not "responding" because there is two WikiAdmin control. One of the validator is not valid that's why the page is not posting back.

    Best Regards,
    Joe Lee
Register for webinar
4 posts, 0 answered