More in this section

Forums / Developing with Sitefinity / Document Selector

Document Selector

8 posts, 1 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    07 Mar 2010
    Link to this post
    Whats the markup for a document selector in an Intra-Site module ControlPanel?

    Also, can it be restricted to the file system instead of the Library?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Mar 2010
    Link to this post
    Hi Steve,

    You can use ItemSelector, but you will need a custom selector if you want to allow access only to the file system.

    sample code

    public class CustomSelectorDialog : ItemSelector
        {
            public CustomSelectorDialog()
            {
            }
     
            protected override void CreateChildControls()
            {
     
                base.CreateChildControls();
                this.container.TabStrip.Tabs[0].Visible = false;
                this.container.TabStrip.Tabs[1].Visible = false;
                this.container.TabStrip.SelectedIndex = 2;
                this.container.TabStrip.MultiPage.SelectedIndex = 2;           
     
            }
      }

    You can replace the default selector declared in Sitefinity/UserControls/Dialogs/ImageDialog.aspx with your custom.

    Greetings,
    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. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    07 Mar 2010
    Link to this post
    I tried a bunch of selectors (just as Id do in a custom designer), but they all end up looking like the attached image

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Mar 2010
    Link to this post
    Hi Steve,

    Check whether all scripts and skins are loaded when you make a request to the selector. The problem could also appear if you are setting some global styles that breaks the RadWindow appearance.

    Sincerely yours,
    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. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    07 Mar 2010
    Link to this post
    Looks like it's a RadWindow script reference issue (at least for now)

    getRadWindow() is null

    I tried placing a RadWindowManager and a RadWindow into the ControlPanel.ascx, then into the UserControl hosting the selector but neither seemed to work...

  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Mar 2010
    Link to this post
    Hi Steve,

    1. In  your insert/edit templates add the following declaration

    <li class="selector">
                     <asp:Label ID="Label2" AssociatedControlID="File" runat="server"><asp:Literal ID="Literal14" runat="server" Text="Insert file"></asp:Literal> <em id="FileNote" runat="server"></em></asp:Label>
                     <asp:TextBox ID="File" Text="" runat="server" MaxLength="250"></asp:TextBox>
                     <sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" AssociatedControls="File" runat="server" cssclass="pickerWrapper" ButtonText="Select" />
                     <p class="example">
                         <asp:Literal ID="Literal15" runat="server" Text="Note"></asp:Literal>
                     </p>
                 </li>


    2. Create the class below in App_Code folder

    namespace Sitefinity.Samples
    {
       public class CustomSelectorDialog : ItemSelector
        {
            public CustomSelectorDialog()
            {
            }
            protected override void CreateChildControls()
            {          
                base.CreateChildControls();
                this.container.TabStrip.Tabs[0].Visible = false;
                this.container.TabStrip.Tabs[1].Visible = false;
                this.container.TabStrip.SelectedIndex = 2;
                this.container.TabStrip.MultiPage.SelectedIndex = 2;           
     
            }
      }
    }


    3. Open Sitefinity/UserControls/Dialogs/ImageDialog.aspx and replace the default selector with a custom one.

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ImageDialog.aspx.cs" Inherits="Sitefinity_UserControls_EditorDialogs_LibraryImageDialog" %>
    <%@ Register Assembly="Telerik.Libraries" Namespace="Telerik.Libraries.WebControls" TagPrefix="lib" %>
    <%@ Register TagPrefix="cc1" Assembly="App_Code" Namespace="Sitefinity.Samples" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
    ImageDialog
        <title>Select an image</title>
        <link type="text/css" rel="stylesheet" href="~/Sitefinity/UserControls/Dialogs/CustomDialogs.css" />
        <link type="text/css" rel="stylesheet" href="~/sitefinity/admin/Themes/Default/CustomDialogs.css" />
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
      <cc1:CustomSelectorDialog runat="server" DisplayMode="Documents" ></cc1:CustomSelectorDialog>
        </form>
    </body>
    </html>



    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.
    Answered
  7. bilal
    bilal avatar
    5 posts
    Registered:
    05 Jul 2010
    05 Jul 2010
    Link to this post
    hi
    Now inside the image dialog there are two tab one for "files" ans the other for "libararies", how can i delete/hide "libararies" tabe.

    thanks
    bilal
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    05 Jul 2010
    Link to this post
    Hi bilal,

    Set the WindowNavigateUrl of the ButtonSelector control to Sitefinity/UserControls/Dialogs/ImageDialog.aspx. Add a break point inside CreateChildControls of CustomSelectorDialog to verify that the custom class is called. You should see only the Files Tab, since the first two are hidden

    this.container.TabStrip.Tabs[0].Visible = false;
    this.container.TabStrip.Tabs[1].Visible = false;
    this.container.TabStrip.SelectedIndex = 2;


    Sincerely yours,
    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
Register for webinar
8 posts, 1 answered