Example #1
0
        public void Run(ClientPipelineArgs args)
        {
            string fieldValue = args.Parameters["fieldValue"];

            if (!args.IsPostBack)
            {
                var url = UIUtil.GetUri("control:ProductBrowser", "product=" + fieldValue);
                SheerResponse.ShowModalDialog(url,true);
                args.WaitForPostBack();
            }
            else
            {
                if (args.HasResult)
                {
                    var result = args.Result;
                    SheerResponse.SetAttribute("scHtmlValue", "value", result);
                    SheerResponse.SetAttribute("scPlainValue", "value", result);
                    var builder = new ScriptInvokationBuilder("scSetHtmlValue");
                    builder.AddString(args.Parameters["controlid"], new object[0]);
                    if (string.IsNullOrEmpty(result))
                    {
                        builder.Add("true");
                    }
                    SheerResponse.Eval(builder.ToString());
                }
            }
        }
Example #2
0
        protected static void Run(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Item item = Context.ContentDatabase.GetItem(args.Parameters["itemid"]);

            Assert.IsNotNull(item, typeof(Item));
            Field field = item.Fields[args.Parameters["fieldid"]];

            Assert.IsNotNull(field, typeof(Field));
            string value = args.Parameters["controlid"];

            if (args.IsPostBack)
            {
                if (args.HasResult)
                {
                    RenderFieldResult renderFieldResult = RenderLink(args);
                    string            text = renderFieldResult.ToString();
                    SheerResponse.SetAttribute("scHtmlValue", "value",
                                               string.IsNullOrEmpty(text) ? WebEditLinkCommand.GetDefaultText() : text);
                    SheerResponse.SetAttribute("scPlainValue", "value", args.Result);
                    ScriptInvokationBuilder scriptInvokationBuilder = new ScriptInvokationBuilder("scSetHtmlValue");
                    scriptInvokationBuilder.AddString(value);
                    if (!string.IsNullOrEmpty(text) && string.IsNullOrEmpty(StringUtil.RemoveTags(text)))
                    {
                        scriptInvokationBuilder.Add("true");
                    }

                    SheerResponse.Eval(scriptInvokationBuilder.ToString());
                }
            }
            else
            {
                UrlString urlString = new UrlString(Context.Site.XmlControlPage);
                urlString["xmlcontrol"] = "UltraLink";
                UrlHandle urlHandle = new UrlHandle();
                urlHandle["va"] = new XmlValue(args.Parameters["fieldValue"], "ultralink").ToString();
                urlHandle.Add(urlString);
                urlString.Append("ro", field.Source);
                Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), "550", "650", string.Empty,
                                                                  response: true);
                args.WaitForPostBack();
            }
        }
Example #3
0
 public void Run(ClientPipelineArgs args)
 {
     if (!args.IsPostBack)
     {
         SheerResponse.Confirm("Clear this product?");
         args.WaitForPostBack();
     }
     else
     {
         if (args.HasResult && args.Result == "yes")
         {
             var result = string.Empty;
             SheerResponse.SetAttribute("scHtmlValue", "value", result);
             SheerResponse.SetAttribute("scPlainValue", "value", result);
             var builder = new ScriptInvokationBuilder("scSetHtmlValue");
             builder.AddString(args.Parameters["controlid"], new object[0]);
           //  builder.Add("true");
             SheerResponse.Eval(builder.ToString());
         }
     }
 }