+1-888-365-2779
Try Now
More in this section
Categories
Bloggers
Blogs RSS feed

Control Panel: Automatic breadcrumb

by Ivan Osmak

[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.]

 

Similarly to the automatic command generation, base Control Panel also provides built-in breadcrumb that is automatically generated from the given View hierarchy.

 

The breadcrumb will take the title of the View as the text of the node, while the command will be generated automatically for you. Let us take a look at one such sample of the automatic breadcrumb.

 

 

Hiding the breadcrumb


Automatic breadcrumb is the built in feature of the base Control Panel class and it was not meant to be removed. However, it is possible to hide the breadcrumb, just as it is possible to alter the Control Panel in any other way. In order to this, we will map the embedded template for the Control Panel and alter it. To do so, follow these steps:

 

Create a Control Panel template

 

  • Navigate to this folder in your Sitefinity website: ~/Sitefinity/Admin/ControlTemplates/Common
  • Add new User Control to that folder and name it ControlPanel.ascx (do not mark “Put code in separate file” checkbox)
  • Paste following markup in the file (this is the structure of the embedded Control Panel template):
    <%@ Control Language="C#" %> 
    <%@ Register TagPrefix="sf" Namespace="Telerik.Cms.Web.UI.Backend" Assembly="Telerik.Cms.Web.UI" %> 
    <sf:BackendBreadcrumb CssClass="ContorlPanelTitle" CurrentItemCssClass="currentBCItem" ID="breadcrumb" runat="server"></sf:BackendBreadcrumb> 
    <asp:PlaceHolder ID="controlPanelView" runat="server"></asp:PlaceHolder> 
     
  • Save the file.
Next thing we need to do is determine for which module we wish to hide the breadcrumb. Let us assume we have decided not to display the breadcrumb in the news module, so that our news module looks something like this:

Next step is to map the Control Panel template of the news module to an external template, the one we have defined few moments earlier. To do so we will paste following declaration in our Controls Config file (click here to learn more about template mappings): 

 

<!--This template defines the layout of the Control Panel for all backend modules.--> 
    <viewSettings hostType="Telerik.News.WebControls.Admin.NewsControlPanel" 
                  layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Common/ControlPanel.ascx" /> 
 
 

 

*** IMPORTANT *** 

 

Every time you modify ControlsConfig file it is necessary to restart the application in order for the changes to be applied. While there are numerous ways to restart an application, here are few handy ones - you can restart the IIS server, resave web.config file (e.g. open web.config file, press space, press backspace, save config.file), resave global.asax file (e.g. open global.asax file, press space, press backspace, save global.asax file)… 

 

*** END IMPORTANT ***

 

Now, that we have mapped the NewsControlPanel to an external template all we are left with is to hide the Breadcrumb control.

 

To do so we will open the template file we’ve created at the beginning of this tutorial and placed in ~/Sitefinity/Admin/ControlTemplates/Common/ControlPanel.ascx and modify it to look like this:

 

<%@ Control Language="C#" %> 
<%@ Register TagPrefix="sf" Namespace="Telerik.Cms.Web.UI.Backend" Assembly="Telerik.Cms.Web.UI" %> 
<div style="display:none;"
    <sf:BackendBreadcrumb CssClass="ContorlPanelTitle" CurrentItemCssClass="currentBCItem" ID="breadcrumb" runat="server"></sf:BackendBreadcrumb> 
</div> 
<asp:PlaceHolder ID="controlPanelView" runat="server"></asp:PlaceHolder> 
 
 

 

*** NOTE ***

 

BackendBreadcrumb control is defined as required control on the Control Panel class, so we cannot simply delete it. The workaround for this is to hide it with CSS.

 

*** END NOTE ***

3 comments

Leave a comment
  1. Romi Feb 26, 2009
    Hi Team,
    It's a good pratice to add this breadcrumb, many thanks, but what about the many users that quit this panel without push the Save/ Breadcrumbs or back to all news?. In this case the item is locked by the user and we lost the click event. I have this problem, i have linked to this items some complementary events to use my custom databases, or clear some variables. How to prevent to lock the items by not diciplined user?, some way to generate one cancel event backside if the user quit this panel?. Regards  
  2. Ivan Mar 03, 2009
    Hi Romi,

    it is our beleif that "undisciplined users" as you put it are exactly the reason for this feature to exist. You could handle this differently, but it would necessarily have to include javascript monitor and some sort of webservice implementation. We do not have immediate plans for implementing such a functionality.
  3. almny May 28, 2009
    thanks
    can i found documentation about all functions or sitefinty api like this ?

    Leave a comment