Example #1
0
 protected void Run(Sitecore.Web.UI.Sheer.ClientPipelineArgs args)
 {
     if (args.IsPostBack)
     {
     }
     else
     {
         Sitecore.Text.UrlString url = new Sitecore.Text.UrlString("/sitecore modules/Shell/Demo/TestPage.aspx");
         url.Append("id", args.Parameters["id"]);
         url.Append("database", args.Parameters["database"]);
         Sitecore.Context.ClientPage.ClientResponse.ShowModalDialog(url.ToString(), true);
         args.WaitForPostBack(true);
     }
 }
Example #2
0
 protected void Run(Sitecore.Web.UI.Sheer.ClientPipelineArgs args)
 {
     if (args.IsPostBack)
     {
     }
     else
     {
         Sitecore.Text.UrlString url = new Sitecore.Text.UrlString("/sitecore/client/Your Apps/View Jobs/Job Listing?sc_lang=en");
         url.Append("id", args.Parameters["id"]);
         url.Append("database", args.Parameters["database"]);
         Sitecore.Context.ClientPage.ClientResponse.ShowModalDialog(url.ToString(), true);
         args.WaitForPostBack(true);
     }
 }
        public void Process(Sitecore.Web.UI.Sheer.ClientPipelineArgs args)
        {
            var guid        = args.Parameters[1];
            var newParentID = args.Parameters[5];


            var item = Sitecore.Context.ContentDatabase.GetItem(guid);
            //var oldParentID = Sitecore.Events.Event.ExtractParameter<ID>(args, 1);
            //var newParentID = Sitecore.Events.Event.ExtractParameter<ID>(args, 2);

            var newParent = item.Database.GetItem(newParentID);

            if (newParent != null)
            {
                if (!newParent[FieldIDs.Branches].Contains(item.TemplateID.ToString()))
                {
                    args.AbortPipeline();
                    Sitecore.Context.ClientPage.ClientResponse.Alert("You are not allowed to copy the item to that location");
                }
            }
        }
Example #4
0
        /// <summary>
        /// Retrieve field editor options controlling the field editor,
        /// including the fields displayed.
        /// </summary>
        /// <param name="args">Pipeline arguments.</param>
        /// <param name="form">Form parameters.</param>
        /// <returns>Field editor options.</returns>
        protected override Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions GetOptions(Sitecore.Web.UI.Sheer.ClientPipelineArgs args, NameValueCollection form)
        {
            Sitecore.Diagnostics.Assert.IsNotNull(args, "args");
            Sitecore.Diagnostics.Assert.IsNotNull(form, "form");
            Sitecore.Diagnostics.Assert.IsNotNullOrEmpty(args.Parameters[URI], URI);
            Sitecore.Data.ItemUri uri = Sitecore.Data.ItemUri.Parse(args.Parameters[URI]);
            Sitecore.Diagnostics.Assert.IsNotNull(uri, URI);
            Sitecore.Diagnostics.Assert.IsNotNullOrEmpty(args.Parameters["flds"], "flds");
            string flds = args.Parameters["flds"];

            Sitecore.Data.Items.Item item = Sitecore.Data.Database.GetItem(uri);
            Sitecore.Diagnostics.Assert.IsNotNull(item, "item");

            List <Sitecore.Data.FieldDescriptor> fields = new List <Sitecore.Data.FieldDescriptor>();

            foreach (string fieldName in flds.Split('|'))
            {
                if (item.Fields[fieldName] != null)
                {
                    fields.Add(new Sitecore.Data.FieldDescriptor(item, item.Fields[fieldName].Name));
                }
            }

            // Field editor options.
            Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions options = new Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions(form, fields);
            options.PreserveSections = false;
            options.DialogTitle      = "Update Item";
            options.Icon             = item.Appearance.Icon;

            return(options);
        }
Example #5
0
        /// <summary>
        /// Retrieve field editor options controlling the field editor,
        /// including the fields displayed.
        /// </summary>
        /// <param name="args">Pipeline arguments.</param>
        /// <param name="form">Form parameters.</param>
        /// <returns>Field editor options.</returns>
        protected override Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions GetOptions(Sitecore.Web.UI.Sheer.ClientPipelineArgs args, NameValueCollection form)
        {
            Sitecore.Diagnostics.Assert.IsNotNull(args, "args");
            Sitecore.Diagnostics.Assert.IsNotNull(form, "form");
            Sitecore.Diagnostics.Assert.IsNotNullOrEmpty(args.Parameters[URI], URI);
            Sitecore.Data.ItemUri uri = Sitecore.Data.ItemUri.Parse(args.Parameters[URI]);
            Sitecore.Diagnostics.Assert.IsNotNull(uri, URI);

            Sitecore.Data.Items.Item item = Sitecore.Data.Database.GetItem(uri);
            Sitecore.Diagnostics.Assert.IsNotNull(item, "item");

            List <Sitecore.Data.FieldDescriptor> fields = new List <Sitecore.Data.FieldDescriptor>();

            try
            {
                foreach (string fieldName in GetFieldNames())
                {
                    fields.Add(new Sitecore.Data.FieldDescriptor(item, item.Fields[fieldName].Name));
                }
            }
            catch (Exception ex)
            {
                Sitecore.Diagnostics.Log.Error(string.Format("Could not initialize blogentry fieldeditor. Error {0}, Stacktrace; {1}", ex.Message, ex.StackTrace), this);
            }

            // Field editor options.
            Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions options = new Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions(form, fields);
            options.PreserveSections = false;
            options.DialogTitle      = "Assign categories to the current entry";
            options.Icon             = item.Appearance.Icon;

            return(options);
        }