More in this section

Forums / Developing with Sitefinity / Where is Telerik.cms.engine in SF 4.1?

Where is Telerik.cms.engine in SF 4.1?

8 posts, 0 answered
  1. Ron
    Ron avatar
    13 posts
    Registered:
    25 Apr 2011
    28 Jun 2011
    Link to this post
    In 3.7 we are using the telerik.cms.engine namespace for UrlCacheMode. Please point me in the right namespace...I have done searches and still no luck. Thanks in advance.
  2. Ron
    Ron avatar
    13 posts
    Registered:
    25 Apr 2011
    28 Jun 2011
    Link to this post
    Also would like to know where Telerik.Security.WebControls and Telerik.Security.ActiveDirectory went in SF 4.1.
  3. Ron
    Ron avatar
    13 posts
    Registered:
    25 Apr 2011
    28 Jun 2011
    Link to this post
    and Telerik.DataAccess.AspnetProviders
  4. Ron
    Ron avatar
    13 posts
    Registered:
    25 Apr 2011
    28 Jun 2011
    Link to this post
    and Telerik.Cms.Engine.Data
    and Telerik.Cms.Engine.Data.Providers
  5. Ron
    Ron avatar
    13 posts
    Registered:
    25 Apr 2011
    28 Jun 2011
    Link to this post
    and Telerik.Cms.Engine.Configuration
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Jun 2011
    Link to this post
    Hello Ron,

    The 4.x is a completely new version written from scratch and the API is not the same. There are methods and classes from which equivalents does not exist under 4.x. You can take a look at the dev manual and api reference that comes with it.

    I will give you a simple example.

    In 3.x we use Telerik.Cms.ICmsPage, since in 4.x we have Telerik.Sitefinity.Pages.Model.PageNode and Telerik.Sitefinity.Pages.Model.PageData

    Also there are fluent facades like App.WorkWith().Pages and direct instance of PageManager.GetManager();

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Ron
    Ron avatar
    13 posts
    Registered:
    25 Apr 2011
    28 Jun 2011
    Link to this post
    I'm trying to figure out the custom navigation.
    If you go to http://www.mayo.edu/diversity/meet-us/diversity-policy-statement/diversity-director you'll see what I'm trying to do. Here's the Page hierarchy (this site is in Sitefinity 3.7):
    - Diversity (Home)
         - Meet Us
              - Diversity Statement
                   - Director for Diversity, Mayo Clinic
              - Our Students
              - Student Diversity Profiles
              - Physician-Scientist Champions
              - Diversity Champions
              - Office for Diversity Staff
         - Programs
         - Resources
         - Contact Us

    My goal is to accomplish the following structure (this is the PrimaryNavigation.cs which is working):
    <ol id="site-nav">
         <li class="home">
              <a href="/diversity">Home</a>
         </li>
         <li class="selected">
              <a href="/diversity/meet-us">Meet Us</a>
         </li>
         <li>
              <a href="/diversity/programs">Programs</a>
         </li>
         <li>
              <a href="/diversity/resources">Resources</a>
         </li>
         <li>
              <a href="/diversity/contact">Contact Us</a>
         </li>
    </ol>
    
    And for the left column sub navigation I want to achieve the following (This is the one I'm having trouble with):
    
    <ul class="lnav_group">
         <li class="lnav_item lnav_first lnav_selected">
              <a href="/diversity/meet-us/diversity-policy-statement" class="">
                   <span class="rpOut"><span class="rpText">Diversity Statement</span></span>
              </a>
              <div class="lnav_sub">
                   <ul class="lnav_subgroup">
                        <li class="lnav_item">
                            <a href="/diversity/meet-us/diversity-policy-statement/diversity-director" class="">
                                 <span class="rpOut"><span class="rpText">Director for Diversity, Mayo Clinic</span></span>
                            </a>
                        </li>
                   </ul>
              </div>
          </li>
          <li class="lnav_item">
                <a href="/diversity/meet-us/our-students" class="">
                     <span class="rpOut"><span class="rpText">Our Students</span></span>
                </a>
          </li>
          <li class="lnav_item">
                <a href="/diversity/meet-us/diversity-students" class="">
                     <span class="rpOut"><span class="rpText">Student Diversity Profiles</span></span>
                </a>
          </li>
          <li class="lnav_item">
                <a href="/diversity/meet-us/physician-scientists" class="">
                     <span class="rpOut"><span class="rpText">Physician-Scientist Champions</span></span>
                </a>
          </li>
          <li class="lnav_item">
                <a href="/diversity/meet-us/diversity-champions" class="">
                     <span class="rpOut"><span class="rpText">Diversity Champions</span></span>
                </a>
           </li>
           <li class="lnav_item lnav_last">
                 <a href="/diversity/meet-us/our-staff" class="">
                      <span class="rpOut"><span class="rpText">Office for Diversity Staff</span></span>
                 </a>
           </li>
    </ul>

    I do have the Primary Navigation working (Home, Meet Us, Programs, Resources, Contact Us).

    Here's the code for my PrimaryNavigation.cs file:
    using System;
    using System.ComponentModel;
    using System.Web;
    using System.Web.UI.WebControls;

    namespace Controls
    {
        public class PrimaryNavigation : WebControl
        {
            #region Properties

            /// <summary>
            /// Gets or sets a node in the site map that the data sourcethen uses as a reference
            /// point to retrieve nodes from a hierarchical site map.
            /// </summary>
            /// <remarks>
            /// <para>
            /// The SiteMapDataSource property binds to site map data andpresents its view based on a specified
            /// starting node in the site map hierarchy. By default, thestarting node is the root node of the
            /// hierarchy, but you can set the starting node to any nodewith the StartingNodeUrl property or set
            /// the StartFromCurrentNode property to true.
            /// </para>
            /// <para>The value of the StartingNodeUrl propertyis stored in view state.</para>
            /// </remarks>
            /// <seealsocref="!:http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sitemapdatasource.startingnodeurl.aspx"/>               
            [Browsable(true)]
            [Category("Navigation")]
            public string StartingPageUrl
            {
                get;
                set;
            }

            /// <summary>
            /// Gets or sets a value indicating whether the RadTabStripshould show the starting node
            /// in the sitemap
            /// </summary>
            [Browsable(true)]
            [Category("Navigation")]
            public bool ShowStartingPage
            {
                get;
                set;
            }

            /// <summary>
            /// (Exposed from contained SitemapDataSource.) Gets or sets avalue indicating
            /// whether the site map node tree is retrieved using the nodethat represents the current
            /// page.
            /// </summary>
            /// <value>
            ///   <strong>true</strong> if the node tree is retrieved relativeto the current page;
            /// otherwise, <b>false</b>. Thedefault is <b>false</b>.
            /// </value>
            /// <remarks>
            /// The <b>StartFromCurrentNode</b> property is evaluated during calls to the GetView
            /// and the GetHierarchicalView methods to help determinewhich site map node to use as a
            /// starting point to build the node tree. The <b>StartFromCurrentNode</b> and
            /// StartingNodeUrl properties are mutually exclusive —if you set the
            /// <b>StartingNodeUrl</b> property, ensure that the <b>StartFromCurrentNode</b> property
            /// is <b>false</b>.
            /// </remarks>
            /// <seealsocref="!:http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sitemapdatasource.startfromcurrentnode.aspx"/>
            [Browsable(true)]
            [Category("Navigation")]
            [DefaultValue(false)]
            public bool StartFromCurrentPage
            {
                get;
                set;
            }

            private SiteMapNode _StartingNode;

            public SiteMapNode StartingNode
            {
                get
                {
                    if (_StartingNode != null)
                    {
                        return _StartingNode;
                    }

                    _StartingNode = GetStartingNode();

                    return _StartingNode;
                }
            }
            #endregion

            public override void RenderBeginTag(System.Web.UI.HtmlTextWriter writer)
            {
                writer.Write("<ol id=\"site-nav\">");
            }

            protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
            {
                if (StartingNode != null)
                {
                    int index = 0;

                    if (ShowStartingPage)
                    {
                        RenderNavigationItem(writer
                            , StartingNode
                            , GetCssClass(SiteMap.CurrentNode != null && SiteMap.CurrentNode == StartingNode, true)
                            , "Home");
                        index++;
                    }

                    foreach (SiteMapNode childNode in StartingNode.ChildNodes)
                    {
                        RenderNavigationItem(writer
                            , childNode
                            , GetCssClass(SiteMap.CurrentNode != null && (SiteMap.CurrentNode.Key == childNode.Key || SiteMap.CurrentNode.IsDescendantOf(childNode)),index == 0)
                            , null);
                        index++;
                    }
                }
            }

            private string GetCssClass(bool isSelected, bool isFirstLink)
            {
                if (isSelected && isFirstLink)
                {
                    return " class=\"home selected\"";
                }

                else if (isFirstLink)
                {
                    return " class=\"home\"";
                }
                else if (isSelected)
                {
                    return " class=\"selected\"";
                }
                else
                {
                    return string.Empty;
                }
            }

            private void RenderNavigationItem(System.Web.UI.HtmlTextWriter writer, SiteMapNode node, string cssClass, string overrideTitle)
            {
                writer.Write(string.Format("<li{0}><a href=\"{1}\">{2}</a></li>"
                    , cssClass
                    , Telerik.Sitefinity.Web.UrlPath.ResolveUrl(node.Url)
                    , string.IsNullOrEmpty(overrideTitle)? node.Title : overrideTitle));
            }

            private SiteMapNode GetStartingNode()
            {
                SiteMapNode currentNode = null;

                if (!string.IsNullOrEmpty(StartingPageUrl)&& StartFromCurrentPage)
                {
                    throw new InvalidOperationException("StartingPageUrl and StartFromCurrentPage are both defined.");
                }

                if (StartFromCurrentPage)
                {
                    currentNode = SiteMap.CurrentNode;
                }
                else if (!string.IsNullOrEmpty(StartingPageUrl))
                {
                    string resolvedUrl = Telerik.Sitefinity.Web.UrlPath.ResolveUrl(StartingPageUrl);
                    currentNode = SiteMap.Provider.FindSiteMapNode(resolvedUrl);
                }

                return currentNode;
            }

            public override void RenderEndTag(System.Web.UI.HtmlTextWriter writer)
            {
                writer.Write("</ol>");
            }
        }
    }

    -----------------------
    The idea is to keep the css untouched.

    Thanks!
     
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    29 Jun 2011
    Link to this post
    Hi Ron,

    In your code you use only SiteMap objects which are also accessible in Sitefinity 4.x edition. You can use the SiteMap and SiteMapBase classes to get the same objects as you have in your code.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
8 posts, 0 answered