Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Aileen 59 posts 79 karma points
    Jan 03, 2013 @ 11:43
    Aileen
    0

    Removing Dependencies from Dropdown

    Hi

    Does anyone know if there is a way to remove the options from the dropdown list when you use Courier so that users can transfer selected items only?

    Because of security restraints I have to stop content editors from being able to transfer anything other than Documents and Media.

    I control what is released to our 2 environments so I always know that they are in sync with regards to Doc Types, assemblies etc.

    Thanks

  • Jeremy Pyne 106 posts 244 karma points MVP c-trib
    Jan 03, 2013 @ 22:44
    Jeremy Pyne
    0

    I do this(while techincaly i jsut change the default but you could remove options) with javascript clicnt sidea s the popup renders.  

    Simaplest way is to do thisis something like this in your app_code directory.

     

    ///<summary>

            /// Run when each dialog is rendered and look for extra script nad css files to attach for easy umbraco customizations.

            ///</summary>

            ///<param name="sender"></param>

            ///<param name="e"></param>

            void umbracoDialog_Load(object sender, EventArgs e)

            {

                // Get the page and path.

                umbracoDialog up = (umbracoDialog)sender;

                string path = up.Page.Request.Path.ToLower().Split('/').Last();

     

                #region Page Include Links

                // Automaticly attach a Javascript file with the same name as the aspx page.

                var js = new ClientDependency.Core.Controls.JsInclude();

                js.FilePath = string.Format("/scripts/umbraco/{0}", path.Replace(".aspx", ".js"));

                up.Page.Header.Controls.Add(js);

     

                // Automaticly attach a Stylesheet file with the same name as the aspx page.

                var css = new ClientDependency.Core.Controls.CssInclude();

                css.FilePath = string.Format("/css/umbraco/{0}", path.Replace(".aspx", ".css"));

                up.Page.Header.Controls.Add(css);

                #endregion

            }

    This will cause umbraco to automaticaly load a /scripts/umbraco/dialogFileName.js file if it exists each time a dialog is opened. (I do the same thing for normal pages too to tweak the and fill in default information.)
    Than just add somecode to /scripts/umbraco/commitItem.js to do what you want.  Alternatly you can do it in .Net Directly instead of client side with something like this.

            ///<summary>

            /// Run on each dialog page load to locate the default transfer depth and change it to Self Only.

            ///</summary>

            ///<param name="sender"></param>

            ///<param name="e"></param>

            void umbracoDialog_Load(object sender, EventArgs e)

            {

                // Get the dialog page and path.

                umbracoDialog ud = (umbracoDialog)sender;

                string path = ud.Page.Request.Path.ToLower().Replace((umbraco.GlobalSettings.Path + "/").ToLower(), "");

     

                // If this is the courier commit page.

                if (path == "plugins/courier/dialogs/commititem.aspx")

                {

                    // Find the depth dropdown and change the default to self only.

                    var ddlDepth = ud.SearchControl("ddlDepth").Cast<DropDownList>().First();

     

                    if (ddlDepth != null)

                    {

                        ddlDepth.SelectedIndex = 1;

                    }

                }

            }

Please Sign in or register to post replies

Write your reply to:

Draft