protected virtual void Run(ClientPipelineArgs args)
 {
     Assert.ArgumentNotNull((object)args, "args");
     if (!SheerResponse.CheckModified())
     {
         return;
     }
     if (args.IsPostBack)
     {
         if (!args.HasResult)
         {
             return;
         }
         WebEditCommand.Reload();
     }
     else
     {
         //SheerResponse.ShowModalDialog(this.GetOptions(args).ToUrlString().ToString(), true);
         SortContentOptions sco = this.GetOptions(args);
         Assert.IsNotNull((object)Context.Site, "context site");
         UrlString urlString = new UrlString(Context.Site.XmlControlPage);
         urlString["xmlcontrol"] = "Sitecore.Shell.Applications.Dialogs.FacDirSort";
         sco.Item.Uri.AddToUrlString(urlString);
         SheerResponse.ShowModalDialog(urlString.ToString(), true);
         args.WaitForPostBack(true);
     }
 }
 protected static void Run(ClientPipelineArgs args)
 {
     Assert.ArgumentNotNull(args, "args");
     if (SheerResponse.CheckModified())
     {
         if (args.IsPostBack)
         {
             SheerResponse.Eval("window.top.location.href=window.top.location.href");
             var  itemId = ParseForAttribute(args.Result, "id");
             Item item   = Sitecore.Context.ContentDatabase.GetItem(itemId);
             if (item.IsNotNull())
             {
                 var url =
                     new UrlString("http://" + HttpContext.Current.Request.Url.Host +
                                   LinkManager.GetItemUrl(item).Replace("/sitecore/shell", ""));
                 WebEditCommand.Reload(url);
             }
         }
         else
         {
             SheerResponse.ShowModalDialog(
                 new UrlString("/sitecore/shell/Applications/Dialogs/Bucket%20link.aspx?").ToString(), "1000", "700", "", true);
             args.WaitForPostBack();
         }
     }
 }
Example #3
0
        protected void Run(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            if (SheerResponse.CheckModified())
            {
                if (args.IsPostBack)
                {
                    if (((Context.Page != null) && (Context.Page.Page != null)) && ((Context.Page.Page.Session["TrackingFieldModified"] as string) == "1"))
                    {
                        Context.Page.Page.Session["TrackingFieldModified"] = null;
                        if (args.Parameters["isPageEditor"] == "1")
                        {
                            Reload(WebEditCommand.GetUrl());
                        }
                        else if (AjaxScriptManager.Current != null)
                        {
                            AjaxScriptManager.Current.Dispatch("analytics:trackingchanged");
                        }
                        else
                        {
                            Context.ClientPage.SendMessage(this, "analytics:trackingchanged");
                            var tempItem = Factory.GetDatabase(args.Parameters["database"]).GetItem(args.Parameters["id"]);

                            var valueForAllOtherItems = tempItem.Fields["__tracking"].Value;
                            var searchStringModel     = ExtractSearchQuery(args.Parameters["searchString"]);
                            int hitsCount;
                            var listOfItems = tempItem.Search(searchStringModel, out hitsCount).ToList();
                            Assert.IsNotNull(tempItem, "item");

                            foreach (var sitecoreItem in listOfItems)
                            {
                                var item1 = sitecoreItem.GetItem();
                                Context.Job.Status.Messages.Add("Applying Profile Card to " + item1.Paths.FullPath + " item");
                                item1.Editing.BeginEdit();
                                item1["__tracking"] = valueForAllOtherItems;
                                item1.Editing.EndEdit();
                            }

                            this.Execute(args.Parameters["searchString"], tempItem.ID.ToString(), args.Parameters["database"]);
                            tempItem.Editing.BeginEdit();
                            tempItem.Fields["__tracking"].Value = Context.ClientData.GetValue("tempTrackingField").ToString();
                            tempItem.Editing.EndEdit();
                        }
                    }
                }
                else
                {
                    var tempItem = Factory.GetDatabase(args.Parameters["database"]).GetItem(args.Parameters["id"]);
                    Context.ClientData.SetValue("tempTrackingField", tempItem.Fields["__tracking"].Value);
                    var urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Analytics.Personalization.ProfileCardsForm.aspx");
                    var handle    = new UrlHandle();
                    handle["itemid"]       = args.Parameters["id"];
                    handle["databasename"] = args.Parameters["database"];
                    handle["la"]           = args.Parameters["language"];
                    handle.Add(urlString);
                    SheerResponse.ShowModalDialog(urlString.ToString(), "1000", "600", string.Empty, true);
                    args.WaitForPostBack();
                }
            }
        }
Example #4
0
        public override CommandState QueryState(CommandContext context)
        {
            if (!WebEditCommand.CanWebEdit() || WebUtil.GetQueryString("mode") != "edit" || context.Items.Length == 0)
            {
                return(CommandState.Hidden);
            }

            return(base.QueryState(context));
        }
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull((object)context, "context");
            WebEditCommand.ExplodeParameters(context);
            string formValue = WebUtil.GetFormValue("scPlainValue");

            context.Parameters.Add("fieldValue", formValue);
            Context.ClientPage.Start((object)this, "Run", context.Parameters);
        }
        /// <inheritdoc />
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull((object)context, nameof(context));
            WebEditCommand.ExplodeParameters(context);
            string formValue = WebUtil.GetFormValue("scPlainValue");

            context.Parameters.Add(Templates.ImportImageClientPipeline.Parameters.FieldValue, formValue);
            Context.ClientPage.Start((object)this, "Run", context.Parameters);
        }
Example #7
0
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");
            WebEditCommand.ExplodeParameters(context);
            bool   containsTagNotFound = false;
            string currentValue        = WebUtil.GetFormValue("scPlainValue");

            doc = new HtmlDocument();
            doc.LoadHtml(currentValue);
            if (doc.DocumentNode.SelectSingleNode("//span[@class='tagSet' or @class='tagNotFound']") != null)
            {
                string taxValue = string.Empty;
                foreach (HtmlNode span in doc.DocumentNode.SelectNodes("//span[@class='tagSet' or @class='tagNotFound']"))
                {
                    string tagId;
                    string weightId;
                    switch (span.Attributes["class"].Value)
                    {
                    case "tagSet":
                        tagId    = span.Attributes["tagid"].Value;
                        weightId = span.Attributes["weightid"].Value;
                        taxValue = taxValue + tagId + ":" + weightId + "|";
                        break;

                    case "tagNotFound":
                        tagId               = ID.Null.ToString();
                        weightId            = span.InnerText;
                        taxValue            = taxValue + tagId + ":" + weightId + "|";
                        containsTagNotFound = true;
                        break;
                    }
                }

                taxValue = taxValue.Trim('|');
                if (!string.IsNullOrEmpty(taxValue))
                {
                    currentValue = taxValue;
                }
            }

            if ((context.Parameters["mode"] == "check") && !containsTagNotFound)
            {
                SheerResponse.Alert("There are not any unrecognized categories.");
            }
            else
            {
                context.Parameters.Add("currentValue", currentValue);
                SheerResponse.SetAttribute("scHtmlValue", "value", string.Empty);
                SheerResponse.SetAttribute("scPlainValue", "value", string.Empty);
                Sitecore.Context.ClientPage.Start(this, "SelectTag", context.Parameters);
            }
        }
 protected virtual void Run(ClientPipelineArgs args)
 {
     Assert.ArgumentNotNull(args, "args");
     if (SheerResponse.CheckModified())
     {
         if (args.IsPostBack)
         {
             if (args.HasResult)
             {
                 WebEditCommand.Reload();
             }
         }
         else
         {
             SheerResponse.ShowModalDialog(this.GetOptions(args).ToUrlString().ToString(), true);
             args.WaitForPostBack(true);
         }
     }
 }
        protected void Run(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull((object)args, "args");
            parentItemID = args.Parameters["itemid"];
            Item itemNotNull = Sitecore.Client.GetItemNotNull(args.Parameters["itemid"], Language.Parse(args.Parameters["language"]));

            if (args.IsPostBack)
            {
                if (!args.HasResult)
                {
                    return;
                }
                string[] strArray    = args.Result.Split(new[] { "||" }, StringSplitOptions.None);
                string   id          = strArray[0];
                string   name        = Uri.UnescapeDataString(strArray[1]);
                string   displayName = Uri.UnescapeDataString(strArray[2]);
                string   metaTitle   = Uri.UnescapeDataString(strArray[3]);
                if (ShortID.IsShortID(id))
                {
                    id = ShortID.Parse(id).ToID().ToString();
                }
                BranchItem branch = Sitecore.Client.ContentDatabase.Branches[id, itemNotNull.Language];
                Assert.IsNotNull((object)branch, typeof(BranchItem));
                this.ExecuteCommand(itemNotNull, branch, name);
                Sitecore.Client.Site.Notifications.Disabled = true;
                Item obj = Context.Workflow.AddItem(name, branch, itemNotNull);
                Sitecore.Client.Site.Notifications.Disabled = false;
                if (obj == null)
                {
                    return;
                }
                this.PolicyBasedUnlock(obj);
                if (!HasPresentationPipeline.Run(obj) || !MainUtil.GetBool(args.Parameters["navigate"], true))
                {
                    WebEditCommand.Reload();
                }
                else
                {
                    UrlOptions  defaultOptions = UrlOptions.DefaultOptions;
                    SiteContext site           = SiteContext.GetSite(string.IsNullOrEmpty(args.Parameters["sc_pagesite"]) ? Sitecore.Web.WebEditUtil.SiteName : args.Parameters["sc_pagesite"]);
                    if (site == null)
                    {
                        return;
                    }
                    string url = string.Empty;
                    using (new SiteContextSwitcher(site))
                    {
                        using (new LanguageSwitcher(obj.Language))
                            url = LinkManager.GetItemUrl(obj, defaultOptions);
                    }
                    WebEditCommand.Reload(new UrlString(url));
                    SheerResponse.Alert("New page item created.");
                }
                HealthIS.Apps.Util.SetDisplayNameAndMetaTitle(obj, displayName, metaTitle);
            }
            else if (!itemNotNull.Access.CanCreate())
            {
                SheerResponse.Alert("You do not have permission to create an item here.");
            }
            else
            {
                UrlString urlString = ResourceUri.Parse("control:CustomAddMasterWebEdit").ToUrlString();
                itemNotNull.Uri.AddToUrlString(urlString);
                SheerResponse.ShowModalDialog(urlString.ToString(), "1200px", "700px", string.Empty, true);
                args.WaitForPostBack();
            }
        }
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     WebEditCommand.ExplodeParameters(context);
     Sitecore.Context.ClientPage.Start(this, "Run", context.Parameters);
 }
 public new static bool CanWebEdit()
 {
     return(WebEditCommand.CanWebEdit());
 }