public override void Execute(CommandContext context) { string scriptId = context.Parameters["script"]; string scriptDb = context.Parameters["scriptDb"]; Item scriptItem = Factory.GetDatabase(scriptDb).GetItem(new ID(scriptId)); string showResults = scriptItem[ScriptItemFieldNames.ShowResults]; string itemId = string.Empty; string itemDb = string.Empty; if (context.Items.Length > 0) { itemId = context.Items[0].ID.ToString(); itemDb = context.Items[0].Database.Name; } var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner")); str.Append("id", itemId); str.Append("db", itemDb); str.Append("scriptId", scriptId); str.Append("scriptDb", scriptDb); str.Append("autoClose", showResults); Context.ClientPage.ClientResponse.Broadcast( SheerResponse.ShowModalDialog(str.ToString(), "400", "220", "PowerShell Script Results", false), "Shell"); }
public void GetDestination(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Database database = GetDatabase(args); if (args.Result == "undefined") { args.AbortPipeline(); } else if ((args.Result != null) && (args.Result.Length > 0)) { args.Parameters["target"] = args.Result; Item item = database.GetItem(args.Result); Assert.IsNotNull(item, typeof(Item), "ID: {0}", new object[] { args.Result }); if (!item.Access.CanCreate()) { Context.ClientPage.ClientResponse.Alert("You do not have permission to create items here."); args.AbortPipeline(); } args.IsPostBack = false; } else { ListString str = new ListString(args.Parameters["items"], '|'); Item item2 = database.Items[str[0]]; Assert.IsNotNull(item2, typeof(Item), "ID: {0}", new object[] { str[0] }); UrlString str2 = new UrlString("/sitecore/shell/Applications/Dialogs/SmartMoveToSubItems.aspx"); str2.Append("fo", item2.ID.ToString()); str2.Append("sc_content", item2.Database.Name); Context.ClientPage.ClientResponse.ShowModalDialog(str2.ToString(), true); args.WaitForPostBack(); } }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); string dbName = args.Parameters["databasename"]; string id = args.Parameters["id"]; string lang = args.Parameters["language"]; string ver = args.Parameters["version"]; Database database = Factory.GetDatabase(dbName); Assert.IsNotNull(database, dbName); Item obj = database.Items[id, Language.Parse(lang), Version.Parse(ver)]; if (obj == null) { SheerResponse.Alert("Item not found."); } else { if (!SheerResponse.CheckModified()) return; if (args.IsPostBack) { return; } UrlString urlString = new UrlString(UIUtil.GetUri("control:SchedulePublish")); urlString.Append("id", obj.ID.ToString()); urlString.Append("unpublish", args.Parameters["unpublish"]); SheerResponse.ShowModalDialog(urlString.ToString(), "600", "600", string.Empty, true); args.WaitForPostBack(); } }
protected void InsertLink(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if (!string.IsNullOrEmpty(args.Result) && (args.Result != "undefined")) { this.XmlValue = new Sitecore.Shell.Applications.ContentEditor.XmlValue(args.Result, "link"); this.SetValue(); this.SetModified(); Context.ClientPage.ClientResponse.SetAttribute(this.ID, "value", this.Value); SheerResponse.Eval("scContent.startValidators()"); } } else { UrlString urlString = new UrlString(args.Parameters["url"]); string width = args.Parameters["width"]; string height = args.Parameters["height"]; this.GetHandle().Add(urlString); urlString.Append("ro", this.Source); urlString.Add("la", this.ItemLanguage); urlString.Append("sc_content", WebUtil.GetQueryString("sc_content")); Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), width, height, string.Empty, true); args.WaitForPostBack(); } }
protected virtual void Run(ClientPipelineArgs args) { string databaseName = args.Parameters["databasename"]; string id = args.Parameters["id"]; Database database = Factory.GetDatabase(databaseName); Assert.IsNotNull(database, typeof (Database), "Database \"" + database + "\" not found.", new object[0]); Item item = database.Items[id]; if (item != null) { if (item.Fields[FieldIDs.LayoutField] != null && item.Fields[FieldIDs.LayoutField].Value != string.Empty) { if (!args.IsPostBack) { UrlString url = new UrlString(UIUtil.GetUri("control:Calendar.ConfigureControls")); url.Append("id", item.ID.ToString()); url.Append("db", item.Database.Name); Windows.RunApplication("Calendar ConfigureControls", url.GetUrl()); } } else { Context.ClientPage.ClientResponse.Alert(ResourceManager.Localize("ITEM_HAS_NO_LAYOUT")); } } else { SheerResponse.Alert("Item not found.", new string[0]); } }
} // Example "|" ... originally tried adding this as input to rule, but, oddly a single pipe as a value breaks the UI public override void Apply(T ruleContext) { Assert.ArgumentNotNull(ruleContext, "ruleContext"); Assert.ArgumentNotNullOrEmpty(Name, "Name"); Assert.ArgumentNotNullOrEmpty(Term, "Term"); // Assert.ArgumentNotNullOrEmpty(Delimiter, "Delimiter"); Delimiter = "|"; // hard code for now if (string.IsNullOrWhiteSpace(ruleContext.Reference.Settings.Parameters)) { ruleContext.Reference.Settings.Parameters = $"{Name}={Term ?? string.Empty}}}"; return; } var urlString = new UrlString(ruleContext.Reference.Settings.Parameters); var rawValue = urlString.Parameters[Name]; if (string.IsNullOrWhiteSpace(rawValue)) { urlString.Append(Name, Term ?? string.Empty); return; } if (!rawValue.EndsWith(Delimiter)) { rawValue += Delimiter; } rawValue += Term; urlString.Append(Name, rawValue); ruleContext.Reference.Settings.Parameters = urlString.GetUrl(); }
public static ClientCommand ShowTestingModalDialog(ID pageContextItemId, Language language, PageMode pageMode) { if (pageContextItemId.IsNull) { throw new ArgumentNullException(nameof(pageContextItemId)); } if (language == null) { throw new ArgumentNullException(nameof(language)); } if (pageMode == PageMode.None) { throw new ArgumentException(nameof(pageMode)); } var urlString = new UrlString(UIUtil.GetUri(SitecoreCommandsConstants.TestPageControl)); urlString.Append(SitecoreCommandsConstants.PageIdArgumentKey, pageContextItemId.ToString()); urlString.Append(SitecoreCommandsConstants.PageLangArgumentKey, language.ToString()); urlString.Append(SitecoreCommandsConstants.PageModeArgumentKey, pageMode.ToString()); urlString.Append(SitecoreCommandsConstants.CypressReportUrlArgumentKey, HttpUtility.UrlEncode(CypressSettings.ReportUrl)); var clientCommand = SheerResponse.ShowModalDialog(urlString.ToString(), "800px", "800px"); clientCommand.Load += new EventHandler(ShowLoadingDialog); return(clientCommand); }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (SheerResponse.CheckModified()) { if (args.IsPostBack) { var tempItem = Factory.GetDatabase(args.Parameters["database"]).GetItem(args.Parameters["id"]); 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(); if (item1.Fields["tags"].IsNotNull()) { item1.Editing.BeginEdit(); if (item1.Fields["tags"].Value == string.Empty) { item1.Fields["tags"].Value = args.Result; } else { item1.Fields["tags"].Value = item1.Fields["tags"].Value + "|" + args.Result; } item1.Editing.EndEdit(); } } } else { var searchStringModel = ExtractSearchQuery(args.Parameters["searchString"]); var tempItem = Factory.GetDatabase(args.Parameters["database"]).GetItem(args.Parameters["id"]); int hitsCount; var listOfItems = tempItem.Search(searchStringModel, out hitsCount).ToList(); if (hitsCount > 0) { var urlString = new UrlString(ItemBucket.Kernel.Util.Constants.ContentEditorRawUrlAddress); var handle = new UrlHandle(); handle["itemid"] = args.Parameters["id"]; handle["databasename"] = args.Parameters["database"]; handle["la"] = args.Parameters["language"]; handle.Add(urlString); //SheerResponse.Input("Please enter the Tag ID", "Tag ID"); UrlString str2 = new UrlString("/sitecore/shell/Applications/Item browser.aspx"); str2.Append("ro", "/sitecore/content/Applications"); str2.Append("sc_content", Context.ContentDatabase.Name); SheerResponse.ShowModalDialog(str2.ToString(), "1000", "700", "", true); args.WaitForPostBack(); } } } }
private void OpenNewWindow(ID id, string name) { Assert.ArgumentNotNull(id, "id"); UrlString url = new UrlString(Constants.Url.ExportFromDataPage); url.Append(Constants.QueryString.Name.ItemId, HttpContext.Current.Server.UrlEncode(id.ToString())); url.Append(Constants.QueryString.Name.ItemName, HttpContext.Current.Server.UrlEncode(name)); SheerResponse.Eval(string.Format("window.open('{0}');", url)); }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (!SheerResponse.CheckModified()) { return; } UrlString urlString2 = new UrlString("/sitecore/shell/Applications/Item browser.aspx"); urlString2.Append("ro", "/sitecore"); urlString2.Append("sc_content", Context.ContentDatabase.Name); urlString2.Append("filter", "AddTagDialog"); SheerResponse.ShowModalDialog(urlString2.ToString(), "1000", "600", string.Empty, true); AjaxScriptManager.Current.Dispatch("item:refresh(id={0})".FormatWith(new object[] { args.Parameters["id"] })); return; //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 (AjaxScriptManager.Current != null) // { // AjaxScriptManager.Current.Dispatch("analytics:trackingchanged"); // AjaxScriptManager.Current.Dispatch("item:refresh(id={0})".FormatWith(new object[] // { // args.Parameters["id"] // })); // return; // } // Context.ClientPage.SendMessage(this, "analytics:trackingchanged"); // Context.ClientPage.SendMessage(this, "item:refresh(id={0})".FormatWith(new object[] // { // args.Parameters["id"] // })); // return; // } //} //else //{ // UrlString urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Analytics.Personalization.ProfileCardsForm.aspx"); // UrlHandle expr_113 = new UrlHandle(); // expr_113["itemid"] = args.Parameters["id"]; // expr_113["databasename"] = args.Parameters["database"]; // expr_113["la"] = args.Parameters["language"]; // UrlHandle urlHandle = expr_113; // urlHandle.Add(urlString); // SheerResponse.ShowModalDialog(urlString.ToString(), "1000", "600", string.Empty, true); // args.WaitForPostBack(); //} }
/// <summary> /// Inserts a new link into the link list. /// </summary> /// <param name="args">Sitecore Client arguments.</param> public void InsertLink(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { // Make sure that the result was not empty or undefined (result when user cancels out of link dialog) if (!string.IsNullOrEmpty(args.Result) && args.Result != "undefined") { // Get the result from the link dialog var result = args.Result; var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(result); var selectText = this.GetSelectText(xmlDocument.SelectSingleNode("link")); var xmlDocument2 = new XmlDocument(); xmlDocument2.LoadXml(this.GetValue()); var linksNode = xmlDocument2.SelectSingleNode("links"); if (linksNode != null) { // import the node into the document and set the value. var linkNode = xmlDocument.SelectSingleNode("link"); if (linkNode != null) { linksNode.AppendChild(xmlDocument2.ImportNode(linkNode, true)); SetValue(xmlDocument2.OuterXml); SetModified(); } } //xmlDocument2.SelectSingleNode("links").AppendChild(xmlDocument2.ImportNode(xmlDocument.SelectSingleNode("link"), true)); // Call Sitecore client to update the link list client side. Sitecore.Context.ClientPage.ClientResponse.Eval(string.Concat(new string[] { "scContent.linklistInsertLink('", ID, "', {text:'", selectText, "'})" })); } } else { // Show the dialog using ShowModalDialog. var urlString = new UrlString(args.Parameters["url"]); UrlHandle urlHandle = new UrlHandle(); urlHandle["ro"] = Source; urlHandle["db"] = Client.ContentDatabase.Name; urlHandle["va"] = this.XmlValue.ToString(); urlHandle.Add(urlString); urlString.Append("ro", Source); urlString.Append("sc_content", WebUtil.GetQueryString("sc_content")); Sitecore.Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), true); args.WaitForPostBack(); } }
protected void Diff(string id, string language, string version) { UrlString str = new UrlString(UIUtil.GetUri("control:Diff")); str.Append("id", id); str.Append("la", language); str.Append("vs", version); str.Append("wb", "1"); Context.ClientPage.ClientResponse.ShowModalDialog(str.ToString()); }
public override void Execute(CommandContext context) { string itemId = context.Items[0].ID.ToString(); string itemDb = context.Items[0].Database.Name; Item item = Factory.GetDatabase(itemDb).GetItem(new ID(itemId)); var urlString = new UrlString(); urlString.Append("item", item.Paths.Path.ToLower().Replace("sitecore/", "")); urlString.Append("db", itemDb); Windows.RunApplication("PowerShell/PowerShell Console", urlString.ToString()); }
/// <summary> /// Executes the command in the specified context. /// /// </summary> /// <param name="context">The context.</param> public override void Execute(CommandContext context) { Error.AssertObject((object)context, "context"); if (context.Items.Length != 1 || context.Items[0] == null) return; Item obj = context.Items[0]; UrlString urlString = new UrlString(UIUtil.GetUri("control:CsvUserImport")); urlString.Append("id", obj.ID.ToString()); urlString.Append("database", obj.Database.ToString()); Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString()); }
protected void Open(string id, string language, string version) { string sectionID = RootSections.GetSectionID(id); UrlString str2 = new UrlString(); str2.Append("ro", sectionID); str2.Append("fo", id); str2.Append("id", id); str2.Append("la", language); str2.Append("vs", version); Windows.RunApplication("Content editor", str2.ToString()); }
public override void Execute(CommandContext context) { var itemId = context.Items[0].ID.ToString(); var itemDb = context.Items[0].Database.Name; var item = Factory.GetDatabase(itemDb).GetItem(new ID(itemId)); var urlString = new UrlString(); urlString.Append("item", item.Paths.Path.ToLower().Replace("sitecore/", "")); urlString.Append("db", itemDb); Windows.RunApplication("PowerShell/PowerShell Console", urlString.ToString()); }
} // Example "|" ... originally tried adding this as input to rule, but, oddly a single pipe as a value breaks the UI public override void Apply(T ruleContext) { Assert.ArgumentNotNull(ruleContext, "ruleContext"); Assert.ArgumentNotNullOrEmpty(Name, "Name"); Assert.ArgumentNotNullOrEmpty(Term, "Term"); // Assert.ArgumentNotNullOrEmpty(Delimiter, "Delimiter"); Delimiter = "|"; // hard code for now foreach (var rendering in ruleContext.SelectedRenderings) { // Simple case, no parameters, set our name-value directly (no conflicts) if (string.IsNullOrWhiteSpace(rendering.Parameters)) { rendering.Parameters = $"{Name}={Term ?? string.Empty}"; ruleContext.HasLayoutChange = true; BotLog.Log.Info($"UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) parameter {Name} added term '{Term}'"); Log.Info($"DESIGNBOT:: UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) parameter {Name} added term '{Term}'", this); continue; } var urlString = new UrlString(rendering.Parameters); var rawValue = urlString.Parameters[Name]; // Missing parameter case, add our name-value to list if (string.IsNullOrWhiteSpace(rawValue)) { urlString.Append(Name, Term ?? string.Empty); ruleContext.HasLayoutChange = true; BotLog.Log.Info($"UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) parameter {Name} added term '{Term}'"); Log.Info($"DESIGNBOT:: UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) parameter {Name} added term '{Term}'", this); continue; } if (!rawValue.EndsWith(Delimiter)) { rawValue += Delimiter; } // Case already exists if (string.Concat(Delimiter, HttpUtility.UrlDecode(rawValue)).Contains(string.Concat(Delimiter, HttpUtility.UrlDecode(Term), Delimiter))) { continue; } rawValue += Term; urlString.Append(Name, rawValue); rendering.Parameters = urlString.GetUrl(); ruleContext.HasLayoutChange = true; BotLog.Log.Info($"UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) parameter {Name} added term '{Term}'"); Log.Info($"DESIGNBOT:: UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) parameter {Name} added term '{Term}'", this); } }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (!args.IsPostBack) { var str2 = new UrlString(UIUtil.GetUri("control:DataSyncWizard")); str2.Append("id", args.Parameters["id"]); str2.Append("la", args.Parameters["language"]); str2.Append("vs", args.Parameters["version"]); SheerResponse.ShowModalDialog(str2.ToString(), "550", "500"); args.WaitForPostBack(); } }
public override void Execute(CommandContext context) { Error.AssertObject(context, "context"); if ((context.Items.Length == 1) && (context.Items[0] != null)) { Item item = context.Items[0]; UrlString str = new UrlString("/sitecore modules/Shell/Cloning Manager/Controls/CloningInfo.aspx"); str.Append("id", item.ID.ToString()); str.Append("la", item.Language.ToString()); str.Append("vs", item.Version.ToString()); Sitecore.Context.ClientPage.ClientResponse.ShowModalDialog(str.ToString()); } }
public void EditLink(ClientPipelineArgs args) { var index = System.Convert.ToInt32(args.Parameters["index"]); var node = GetNodeByIndex(GetDocument(), index); if (args.IsPostBack) { if (!string.IsNullOrEmpty(args.Result) && args.Result != "undefined") { string result = args.Result; var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(result); string selectText = this.GetSelectText(xmlDocument.SelectSingleNode("link")); var xmlDocument2 = new XmlDocument(); xmlDocument2.LoadXml(GetValue()); xmlDocument2.DocumentElement.ReplaceChild( xmlDocument2.ImportNode(xmlDocument.SelectSingleNode("link"), true), GetNodeByIndex(xmlDocument2, index) ); SetValue(xmlDocument2.OuterXml); SetModified(); Sitecore.Context.ClientPage.ClientResponse.Eval( string.Concat(new string[] { "scContent.linklistUpdateLink('", ID, "', {index: " + index + ", text:'", selectText, "'})" }) ); } } else { // Show the dialog using ShowModalDialog. var urlString = new UrlString(args.Parameters["url"]); UrlHandle urlHandle = new UrlHandle(); urlHandle["ro"] = Source; urlHandle["db"] = Client.ContentDatabase.Name; urlHandle["va"] = node.OuterXml; urlHandle.Add(urlString); urlString.Append("ro", Source); urlString.Append("sc_content", WebUtil.GetQueryString("sc_content")); Sitecore.Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), true); args.WaitForPostBack(); } }
public void Run(ITaskOutput output, NameValueCollection metaData) { var attributes = new AttributesContainer(metaData["Attributes"]); var scriptId = attributes.Get("scriptId")?.ToString(); var scriptDb = attributes.Get("scriptDb")?.ToString() ?? "master"; var width = attributes.Get("width")?.ToString() ?? "400"; var height = attributes.Get("height")?.ToString() ?? "260"; var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner")); str.Append("scriptId", scriptId); str.Append("scriptDb", scriptDb); JobContext.ShowModalDialog(str.ToString(), width, height); }
public override void Execute(CommandContext context) { var itemId = context.Items[0].ID.ToString(); var itemDb = context.Items[0].Database.Name; var item = Factory.GetDatabase(itemDb).GetItem(new ID(itemId)); var urlString = new UrlString(); urlString.Append("id", item.ID.ToString()); urlString.Append("db", itemDb); if (!string.IsNullOrEmpty(context.Parameters["frameName"])) { urlString.Add("pfn", context.Parameters["frameName"]); } Windows.RunApplication("PowerShell/PowerShellIse", urlString.ToString()); }
} // Example "|" ... ugh this breaks the UI public override void Apply(T ruleContext) { Assert.ArgumentNotNull(ruleContext, "ruleContext"); Assert.ArgumentNotNullOrEmpty(Name, "Name"); Assert.ArgumentNotNullOrEmpty(Term, "Term"); // Assert.ArgumentNotNullOrEmpty(Delimiter, "Delimiter"); Delimiter = "|"; if (string.IsNullOrWhiteSpace(ruleContext.Reference.Settings.Parameters)) { return; } var urlString = new UrlString(ruleContext.Reference.Settings.Parameters); var rawValue = urlString.Parameters[Name]; if (string.IsNullOrWhiteSpace(rawValue)) { return; } var valueList = rawValue.Split(new string[] { Delimiter }, StringSplitOptions.RemoveEmptyEntries); var newList = string.Join(Delimiter, valueList.Where(x => x != null && !HttpUtility.UrlDecode(x).Equals(HttpUtility.UrlDecode(Term), StringComparison.OrdinalIgnoreCase)) ); urlString.Append(Name, newList ?? string.Empty); ruleContext.Reference.Settings.Parameters = urlString.GetUrl(); }
protected override void DoRender(HtmlTextWriter output) { var src = new UrlString("/sitecore/shell/~/xaml/Outercore.FieldTypes.Carousel.Frame.aspx"); src.Append("s", Source); src.Append("id", ItemID); src.Append("fid", ID); src.Append("v", Value); if (Disabled) { src.Append("d", "1"); } output.Write("<div id='{0}_pane' class='scContentControl scImageList'>".FormatWith(ID)); output.Write("<iframe id='{0}_frame' src='{1}' frameborder='0' marginwidth='0' marginheight='0' width='100%' height='128' allowtransparency='allowtransparency'></iframe>".FormatWith(ID, src.ToString())); output.Write("</div>"); output.Write("<input type='hidden' id='{0}' value='{1}' />".FormatWith(ID + "_selected", Value)); }
public override void Execute(CommandContext context) { var itemId = context.Items[0].ID.ToString(); var itemDb = context.Items[0].Database.Name; var item = Factory.GetDatabase(itemDb).GetItem(new ID(itemId)); var urlString = new UrlString(); urlString.Append("id", item.ID.ToString()); urlString.Append("db", itemDb); if (!string.IsNullOrEmpty(context.Parameters["frameName"])) { urlString.Add("pfn", context.Parameters["frameName"]); } Sitecore.Shell.Framework.Windows.RunApplication("PowerShell/PowerShellIse", urlString.ToString()); }
public override void Apply(T ruleContext) { Assert.ArgumentNotNull(ruleContext, "ruleContext"); Assert.ArgumentNotNullOrEmpty(Name, "Name"); foreach (var rendering in ruleContext.SelectedRenderings) { // Simple case, no existing parameters if (string.IsNullOrWhiteSpace(rendering.Parameters)) { rendering.Parameters = $"{Name}={Value ?? string.Empty}}}"; ruleContext.HasLayoutChange = true; BotLog.Log.Info($"UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) parameter {Name} to value '{Value}'"); Log.Info($"DESIGNBOT:: UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) parameter {Name} to value '{Value}'", this); continue; } // Parse case, set new value keeping other name-value pairs // Value matches case, exit var urlString = new UrlString(rendering.Parameters); if (!string.IsNullOrWhiteSpace(urlString[Name]) && HttpUtility.UrlDecode(urlString[Name]).Equals(HttpUtility.UrlDecode(Value))) { continue; } urlString.Append(Name, Value ?? string.Empty); rendering.Parameters = urlString.GetUrl(); ruleContext.HasLayoutChange = true; BotLog.Log.Info($"UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) parameter {Name} to value '{Value}'"); Log.Info($"DESIGNBOT:: UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) parameter {Name} to value '{Value}'", this); } }
public override void Execute(CommandContext context) { try { Assert.ArgumentNotNull(context, "context"); if (context.Items.Length == 1) { //Check if the tab is already open and refresh it is needed if (WebUtil.GetFormValue("scEditorTabs").Contains("ModerateContent:ModerateContentCommand")) { } else //Open a new tab { UrlString urlString = new UrlString("/Admin/ContentModerator.aspx"); urlString.Append("itemId", context.Items[0].ID.ToString()); context.Items[0].Uri.AddToUrlString(urlString); UIUtil.AddContentDatabaseParameter(urlString); SheerResponse.Eval(new ShowEditorTab { Command = "ModerateContent:ModerateContentCommand", Header = "Reviewing Content", Icon = Images.GetThemedImageSource("Applications/32x32/document_ok.png"), Url = urlString.ToString(), Id = "ModerateContent", Closeable = true }.ToString()); } } } catch (Exception ex) { Sitecore.Diagnostics.Log.Error("Error setting context menu for moderation", ex, "ContentModerator"); } }
protected void OpenLink(ClientPipelineArgs args) { if (args.IsPostBack) { if (!string.IsNullOrEmpty(args.Result) && (args.Result != "undefined")) { Item item = this.GetContentDatabase().Items[args.Result]; if (item != null) { if (this.Value != item.Paths.Path) { this.SetModified(); } this.Value = item.Paths.Path; } else { if (this.Value.Length > 0) { this.SetModified(); } SheerResponse.Alert("Item not found.", new string[0]); this.Value = string.Empty; } } } else { UrlString str = new UrlString("/sitecore/shell/Applications/Item browser.aspx"); string str2 = this.Value; string str3 = this.Value; Item item2 = this.GetContentDatabase().Items[str2]; if (item2 != null) { str3 = item2.ID.ToString(); } str.Append("db", this.GetContentDatabase().Name); str.Append("id", str3); str.Append("fo", str3); if (!string.IsNullOrEmpty(this.Source)) { str.Append("ro", this.Source); } SheerResponse.ShowModalDialog(str.ToString(), true); args.WaitForPostBack(); } }
protected void EditWeight(string index) { int indexValue = Int32.Parse(index); ClientPipelineArgs args = ContinuationManager.Current.CurrentArgs as ClientPipelineArgs; if (args.IsPostBack) { if (args.HasResult && args.Result != "undefined") { if (indexValue > -1) { string oldValue = CategoryWeightList[indexValue]; string newValue = string.Format("{0}:{1}", StringUtil.GetPrefix(oldValue, ':'), args.Result); Value = Value.Replace(oldValue, newValue); } else { Value += string.Format("|{0}:{1}|", Sitecore.Data.ID.Null, args.Result); Value = Value.Replace("||", "|").Trim("|".ToCharArray()); } this.RenderTaxonomies(); } } else { string weightsRootID = "{4A36115B-6120-4EDD-B6F2-E5F0EB2678EE}"; UrlHandle handle = UrlHandle.Get(); string sourceItemId = handle["sourceItemId"]; Item classificationSourceItem = Client.ContentDatabase.GetItem(new ID(sourceItemId)); if (classificationSourceItem != null) { Item taxonomies = classificationSourceItem.Children["Weights"]; if (taxonomies != null) { weightsRootID = taxonomies.ID.ToString(); } } UrlString url = new UrlString("/sitecore/shell/Applications/Item browser.aspx"); url.Append("ro", weightsRootID); url.Append("id", weightsRootID); url.Append("sc_content", Sitecore.Context.ContentDatabase.Name); //url.Append("flt", "Contains('{EB06CEC0-5E2D-4DC4-875B-01ADCC577D13},{C20ED30F-D974-4C65-AE57-CE745C37940E}', @@templateid)"); SheerResponse.ShowModalDialog(url.ToString(), "300px", "300px", string.Empty, true); args.WaitForPostBack(); } }
protected void PostStep(Item item) { Assert.ArgumentNotNull(item, "item"); if (callback != null) { callback(item.ID.ToString()); } UrlString url = new UrlString(); url.Append("ro", item.ID.ToString()); url.Append("fo", item.ID.ToString()); url.Append("id", item.ID.ToString()); url.Append("la", item.Language.Name); url.Append("vs", item.Version.Number.ToString()); Windows.RunApplication("Content editor", url.GetUrl()); }
private static string GetUrl(string directory) { Assert.ArgumentNotNull(directory, "directory"); var urlString = new UrlString(Constants.UploadFileApp); urlString.Append("di", ApplicationContext.StoreObject(directory)); return(urlString.ToString()); }
private static string GetDialogUrl(ID id) { Assert.ArgumentCondition(!ID.IsNullOrEmpty(id), "id", "ID must be set!"); UrlString urlString = new UrlString(Sitecore.UIUtil.GetUri("control:ItemDiff")); urlString.Append("id", id.ToString()); return(urlString.ToString()); }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); string[] uris = StringUtil.Split(args.Parameters["uris"], '|', false); if (args.IsPostBack) { if (args.HasResult) { string result = args.Result; if (result == "-") { result = string.Empty; } foreach (var uri in uris) { if (ItemUri.IsItemUri(uri)) { Item item = Database.GetItem(ItemUri.Parse(uri)); item.Editing.BeginEdit(); item[FieldIDs.Owner] = result; item.Editing.EndEdit(); Log.Audit(this, "Set owner: {0}", new string[] { AuditFormatter.FormatItem(item) }); } } } } else { if (ItemUri.IsItemUri(uris[0])) { ItemUri uri = ItemUri.Parse(uris[0]); UrlString str6 = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Security.SetOwner.aspx"); str6.Append("id", uri.Path); str6.Append("la", uri.Language.ToString()); str6.Append("vs", uri.Version.ToString()); str6.Append("db", uri.DatabaseName); SheerResponse.ShowModalDialog(str6.ToString(), "450", "180", string.Empty, true); args.WaitForPostBack(); } } }
public override void Execute(CommandContext context) { var scriptId = context.Parameters["scriptId"]; var scriptDb = context.Parameters["scriptDb"]; var itemId = string.Empty; var itemDb = string.Empty; var itemLang = string.Empty; var itemVer = string.Empty; if (context.Items.Length > 0) { itemId = context.Items[0].ID.ToString(); itemDb = context.Items[0].Database.Name; itemLang = context.Items[0].Language.Name; itemVer = context.Items[0].Version.Number.ToString(CultureInfo.InvariantCulture); } var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner")); str.Append(context.Parameters); str.Append("id", itemId); str.Append("db", itemDb); str.Append("lang", itemLang); str.Append("ver", itemVer); str.Append("scriptId", scriptId); str.Append("scriptDb", scriptDb); SheerResponse.ShowModalDialog(str.ToString(), "400", "260", "PowerShell Script Results", false); }
protected void OpenSearch(ClientPipelineArgs args) { if (args.IsPostBack) { if (!string.IsNullOrEmpty(args.Result) && (args.Result != "undefined")) { Item item = this.GetContentDatabase().Items[args.Result]; if (item != null) { if (this.Value != item.Paths.Path) { this.SetModified(); } this.Value = item.Paths.Path; } else { this.SetModified(); var dirtyResult = args.Result; this.Value = this.CleanResult(dirtyResult); } } } else { UrlString str = new UrlString("/sitecore/shell/Applications/Dialogs/Bucket Internal Link.aspx"); string str2 = this.Value; string str3 = this.Value; Item item2 = this.GetContentDatabase().Items[str2]; if (item2 != null) { str3 = item2.ID.ToString(); } str.Append("db", this.GetContentDatabase().Name); str.Append("id", str3); str.Append("fo", str3); if (!string.IsNullOrEmpty(this.Source)) { str.Append("ro", this.Source); } SheerResponse.ShowModalDialog(str.ToString(), "900", "600", "", true); args.WaitForPostBack(); } }
protected void Process(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { Context.ClientPage.SendMessage(this, $"item:refresh(id={itemId})"); Context.ClientPage.SendMessage(this, $"item:refreshchildren(id={itemId})"); if (args.HasResult && !args.Result.IsNullOrEmpty()) { foreach (var closeMessage in args.Result.Split('\n')) { Context.ClientPage.ClientResponse.Timer(closeMessage, 2); } } } else { var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner")); if (!string.IsNullOrWhiteSpace(itemId)) { str.Append("id", itemId); str.Append("db", itemDb); str.Append("lang", itemLang); str.Append("ver", itemVer); if ((bool)(args.Properties["UsesBrowserWindows"] ?? false)) { str.Append("cfs", "1"); } } str.Append("scriptId", scriptId); str.Append("scriptDb", scriptDb); SheerResponse.ShowModalDialog(str.ToString(), "400", "260", "", true); args.WaitForPostBack(); } }
public void GetDestination(CopyItemsArgs args) { Assert.ArgumentNotNull(args, "args"); if (SheerResponse.CheckModified()) { Database database = GetDatabase(args); ListString str = new ListString(args.Parameters["items"], '|'); Item item = database.Items[str[0]]; UrlString str2 = new UrlString(this.GetDialogUrl()); if (item != null) { str2.Append("fo", item.ID.ToString()); str2.Append("sc_content", item.Database.Name); } Context.ClientPage.ClientResponse.ShowModalDialog(str2.ToString(), true); args.WaitForPostBack(false); } }
/// <summary> /// Handles the RunPicklistBrowser event /// </summary> protected void OnRunPicklistBrowser() { var args = ContinuationManager.Current.CurrentArgs as ClientPipelineArgs; var field = this.Info[this.ActiveField.Value]; Assert.IsNotNull(args, "args"); if (args.IsPostBack) { if (args.HasResult) { string result = args.Result; if (result == "-") { return; } var value = CrmCampaignIntegrations.Core.LookupValue.Parse(result); field.LookupValue = value; this.UpdateSettings(this.ActiveField.Value, true); } } else { var urlString = new UrlString("/sitecore modules/shell/Web Forms for Marketers/Shell/OpenXamlModalDialog/OpenXamlModalDialog.aspx"); urlString.Add("type", "xaml"); urlString.Add("control", "Sitecore.CrmCampaignIntegration.Shell.UI.Dialogs.LookupRecords"); var attribute = (ICrmLookupAttributeMetadata)this.Metadata.GetAttribute(this.ActiveField.Value); urlString.Append("field", this.ActiveField.Value); var value = attribute.Targets.ToList().IndexOf(field.EntityReference); urlString.Append("targets", string.Join("|", attribute.Targets)); urlString.Append("skey", Data.ID.NewID.ToString()); urlString.Append("w", "620px"); urlString.Append("h", "800px"); ModalDialog.Show(urlString); args.WaitForPostBack(); } }
/// <summary> /// Runs the specified args. /// </summary> /// <param name="args">The arguments.</param> protected void Run(ClientPipelineArgs args) { string item = args.Parameters["id"]; string str = args.Parameters["language"]; string item1 = args.Parameters["version"]; string str1 = args.Parameters["database"]; Database database = Factory.GetDatabase(str1); Error.Assert(database != null, string.Concat("Database \"", str1, "\" not found.")); Item item2 = database.GetItem(ID.Parse(item), Language.Parse(str), Sitecore.Data.Version.Parse(item1)); Error.AssertItemFound(item2); Item item3 = item2.Database.GetItem(ItemIDs.TemplateRoot); if (item3 != null && !item3.Axes.IsAncestorOf(item2)) { item2 = item3; } if (!args.IsPostBack) { UrlString urlString = new UrlString("/sitecore/client/Asserts/StandardValuesTool?itemid=" + item); if (item2.TemplateID != TemplateIDs.Template) { urlString.Append("fo", item2.ID.ToString()); } else { urlString.Append("fo", item2.Parent.ID.ToString()); } Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), true); args.WaitForPostBack(); } else if (args.Result != null && args.Result.Length > 0 && args.Result != "undefined") { TemplateItem templateItem = Context.ContentDatabase.Templates[args.Result]; if (templateItem != null) { Context.ClientPage.SendMessage(this, string.Concat("template:added(id=", templateItem.ID, ")")); Context.ClientPage.SendMessage(this, string.Concat("item:load(id=", templateItem.ID, ")")); return; } } }
protected void BrowseIconDialog(ClientPipelineArgs args) { if (args.IsPostBack) { if (args.HasResult) { Value = args.Result; SetModified(); } } else { UrlString urlString = new UrlString("/sitecore/shell/Applications/Dialogs/FontIconPickerField/Browse.aspx"); urlString.Append("source", GetViewStateString("source")); urlString.Append("value", Value); SheerResponse.ShowModalDialog(urlString.ToString(), "1120", "600", string.Empty, true); args.WaitForPostBack(); } }
public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); if (context.Items.Length == 1) { UrlString parameters = new UrlString(); parameters.Append("fo", context.Items[0].ID.ToString()); Shell.Framework.Windows.RunApplication("Media Conversion Tool", parameters.ToString()); } }
public override void Execute(CommandContext context) { if (context.Items.Length == 1) { Item item = context.Items[0]; UrlString str = new UrlString(); str.Append("sc_content", item.Database.Name); str.Append("id", item.ID.ToString()); str.Append("la", item.Language.ToString()); str.Append("vs", item.Version.ToString()); if (!string.IsNullOrEmpty(context.Parameters["frameName"])) { str.Add("pfn", context.Parameters["frameName"]); } SheerResponse.Eval("window.open('/sitecore modules/pixlr/pixlr.aspx?" + str + "&mode=editor', 'MediaLibrary', 'location=0,resizable=1')"); } }
public override void Execute(CommandContext context) { var scriptId = context.Parameters["script"]; var scriptDb = context.Parameters["scriptDb"]; var itemId = string.Empty; var itemDb = string.Empty; var itemLang = string.Empty; var itemVer = string.Empty; if (context.Items.Length > 0) { itemId = context.Items[0].ID.ToString(); itemDb = context.Items[0].Database.Name; itemLang = context.Items[0].Language.Name; itemVer = context.Items[0].Version.Number.ToString(CultureInfo.InvariantCulture); } var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner")); str.Append("id", itemId); str.Append("db", itemDb); str.Append("lang", itemLang); str.Append("ver", itemVer); str.Append("scriptId", scriptId); str.Append("scriptDb", scriptDb); Context.ClientPage.ClientResponse.Broadcast( SheerResponse.ShowModalDialog(str.ToString(), "400", "260", "PowerShell Script Results", false), "Shell"); }
protected void Run(ClientPipelineArgs args) { if (args.IsPostBack) { if ((!String.IsNullOrEmpty(args.Result)) && args.Result != "undefined") { Context.ClientPage.SendMessage(this, "item:load(id=" + args.Result + ")"); Item createdBlog = ItemManager.GetItem(new ID(args.Result), Sitecore.Context.Language, Sitecore.Data.Version.Latest, Factory.GetDatabase(args.Parameters["database"])); string oldSiteName = Sitecore.Context.GetSiteName(); Sitecore.Context.SetActiveSite("website"); string url = LinkManager.GetItemUrl(createdBlog); Sitecore.Context.SetActiveSite(oldSiteName); SheerResponse.Eval("window.parent.location.href='http://" + WebUtil.GetHostName() + "/" + url + "'"); } } else { string currentTID = args.Parameters["tid"]; if (currentTID == Settings.BlogTemplateIDString) { Context.ClientPage.ClientResponse.Alert("Cannot create a blog within a blog"); } else if (currentTID == Sitecore.Configuration.Settings.GetSetting("Blog.EntryTemplateID")) { Context.ClientPage.ClientResponse.Alert("Cannot create a blog within a blogentry"); } else { UrlString url = new UrlString("/sitecore modules/Blog/Admin/NewBlog.aspx"); url.Append("id", args.Parameters["currentid"]); url.Append("database", args.Parameters["database"]); Context.ClientPage.ClientResponse.ShowModalDialog(url.ToString(), true); args.WaitForPostBack(true); } } }
public void Process(WorkflowPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); var processorItem = args.ProcessorItem; if (processorItem == null) { return; } var actionItem = processorItem.InnerItem; var dataItem = args.DataItem; if (string.IsNullOrEmpty(actionItem[ScriptItemFieldNames.Script])) { return; } var scriptItem = actionItem.Database.GetItem(new ID(actionItem[ScriptItemFieldNames.Script])); if (RulesUtils.EvaluateRules(actionItem[ScriptItemFieldNames.EnableRule], dataItem) && RulesUtils.EvaluateRules(scriptItem[ScriptItemFieldNames.EnableRule], dataItem)) { var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner")); str.Append("id", dataItem.ID.ToString()); str.Append("db", dataItem.Database.Name); str.Append("lang", dataItem.Language.Name); str.Append("ver", dataItem.Version.Number.ToString(CultureInfo.InvariantCulture)); str.Append("scriptId", scriptItem.ID.ToString()); str.Append("scriptDb", scriptItem.Database.Name); Context.ClientPage.ClientResponse.Broadcast( SheerResponse.ShowModalDialog(str.ToString(), "400", "220", "PowerShell Script Results", false), "Shell"); } }
public static void ShowItemBrowser(string header, string text, string icon, string button, string root, string selected, string database) { UrlString str2 = new UrlString("/sitecore/shell/Applications/Item browser.aspx"); str2.Append("db", database); //str2.Append("id", selected.ToString()); str2.Append("fo", selected); str2.Append("ro", root); str2.Append("he", header); str2.Append("txt", text); str2.Append("ic", icon); str2.Append("btn", button); SheerResponse.ShowModalDialog(str2.ToString(), true); }
protected void Run(ClientPipelineArgs args) { Item item = Sitecore.Context.Database.GetItem(args.Parameters["id"]); if (SheerResponse.CheckModified()) { if (args.IsPostBack) { if (args.Result == "yes") { Context.ClientPage.SendMessage(this, "item:templatechanged"); var searchStringModel = ExtractSearchQuery(args.Parameters["searchString"]); var hitsCount = 0; var listOfItems = item.Search(searchStringModel, out hitsCount).ToList(); Assert.IsNotNull(item, "item"); foreach (var sitecoreItem in listOfItems) { var item1 = sitecoreItem.GetItem(); item1.Editing.BeginEdit(); item1.ChangeTemplate(listOfItems.First().GetItem().Template); item1.Editing.EndEdit(); } } } else { string str = args.Parameters["id"]; Item item3 = Context.ContentDatabase.Items[str]; if (item3 == null) { SheerResponse.Alert("Item not found.", new string[0]); } else { UrlString str2 = new UrlString("/sitecore/shell/Applications/Templates/Change template.aspx"); var searchStringModel = ExtractSearchQuery(args.Parameters["searchString"]); var hitsCount = 0; var listOfItems = item.Search(searchStringModel, out hitsCount).ToList(); str2.Append("id", listOfItems.First().GetItem().ID.ToString()); Context.ClientPage.ClientResponse.ShowModalDialog(str2.ToString(), true); args.WaitForPostBack(); } } } }
protected void Open(string id, string language, string version) { Assert.ArgumentNotNull(id, "id"); Assert.ArgumentNotNull(language, "language"); Assert.ArgumentNotNull(version, "version"); string sectionID = RootSections.GetSectionID(id); UrlString str2 = new UrlString(ItemBucket.Kernel.Util.Constants.ContentEditorRawUrlAddress); str2.Append("ro", sectionID); str2.Append("fo", id); str2.Append("id", id); str2.Append("la", language); str2.Append("vs", version); str2.Append("mo", "popup"); SheerResponse.ShowModalDialog(str2.ToString(), "960", "600", string.Empty, false); }
public static void ShowItemBrowser(string header, string text, string icon, string button, Sitecore.Data.ID root, Sitecore.Data.ID selected, string database) { //string str = selected; //Item item = Client.ContentDatabase.Items[selected]; //if (item != null) //{ // selected = item.ID.ToString(); // if (item.Parent != null) // { // str = item.ParentID.ToString(); // } //} UrlString str2 = new UrlString("/sitecore/shell/Applications/Item browser.aspx"); str2.Append("db", database); str2.Append("id", selected.ToString()); str2.Append("fo", selected.ToString()); str2.Append("ro", root.ToString()); str2.Append("he", header); str2.Append("txt", text); str2.Append("ic", icon); str2.Append("btn", button); SheerResponse.ShowModalDialog(str2.ToString(), true); }
private static UrlString GetItemUrl(Item item, NameValueCollection parameters) { var str = new UrlString(); if (item != null) { str.Append("id", item.ID.ToString()); str.Append("la", item.Language.ToString()); str.Append("vs", item.Version.ToString()); str.Append("db", item.Database.Name); str.Append("sc_content", item.Database.Name); } if (parameters != null) { foreach (string str2 in parameters) { str.Append(str2, parameters[str2]); } } return str; }
/// <summary> /// Opens the specified item. /// </summary> /// <param name="id"> /// The id. /// </param> /// <param name="language"> /// The language. /// </param> /// <param name="version"> /// The version. /// </param> protected void Open(string id, string language, string version) { Assert.ArgumentNotNull(id, "id"); Assert.ArgumentNotNull(language, "language"); Assert.ArgumentNotNull(version, "version"); string sectionID = RootSections.GetSectionID(id); UrlString urlString = new UrlString(); urlString.Append("ro", sectionID); urlString.Append("fo", id); urlString.Append("id", id); urlString.Append("la", language); urlString.Append("vs", version); Windows.RunApplication("Content editor", urlString.ToString()); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <exception cref="ValidatorException">Order could not be created.</exception> protected void Page_Load(object sender, EventArgs e) { DomainModel.Carts.ShoppingCart shoppingCart = Sitecore.Ecommerce.Context.Entity.GetInstance<DomainModel.Carts.ShoppingCart>(); if (string.IsNullOrEmpty(shoppingCart.PaymentSystem.Code)) { return; } PaymentUrlResolver paymentUrlResolver = new PaymentUrlResolver(); PaymentArgs paymentArgs = new PaymentArgs { PaymentUrls = paymentUrlResolver.Resolve(), ShoppingCart = shoppingCart }; ITransactionData transactionData = Sitecore.Ecommerce.Context.Entity.Resolve<ITransactionData>(); PaymentProvider paymentProvider = Sitecore.Ecommerce.Context.Entity.Resolve<PaymentProvider>(shoppingCart.PaymentSystem.Code); DomainModel.Payments.PaymentSystem paymentSystem = shoppingCart.PaymentSystem; try { paymentProvider.ProcessCallback(paymentSystem, paymentArgs); } catch (Exception exception) { IOrderManager<Order> orderManager = Sitecore.Ecommerce.Context.Entity.Resolve<IOrderManager<Order>>(); shoppingCart.OrderNumber = orderManager.GenerateOrderNumber(); transactionData.DeletePersistentValue(shoppingCart.OrderNumber); HttpContext.Current.Session["paymentErrorMessage"] = exception.Message; this.Response.Redirect(paymentArgs.PaymentUrls.FailurePageUrl); return; } switch (paymentProvider.PaymentStatus) { case PaymentStatus.Succeeded: { IOrderManager<Order> orderManager = Sitecore.Ecommerce.Context.Entity.Resolve<IOrderManager<Order>>(); Order order = orderManager.CreateOrder(shoppingCart); if (order != null) { // Redirect to order confirmation page string orderId = shoppingCart.OrderNumber; ICheckOut checkOut = Sitecore.Ecommerce.Context.Entity.Resolve<ICheckOut>(); if (checkOut is CheckOut) { ((CheckOut)checkOut).ResetCheckOut(); } if (MainUtil.IsLoggedIn()) { orderId = string.Format("orderid={0}", orderId); } else { string encryptKey = Crypto.EncryptTripleDES(orderId, "5dfkjek5"); orderId = string.Format("key={0}", Uri.EscapeDataString(encryptKey)); } this.StartOrderCreatedPipeline(order.OrderNumber); if (!string.IsNullOrEmpty(orderId)) { UrlString url = new UrlString(paymentArgs.PaymentUrls.SuccessPageUrl); url.Append(new UrlString(orderId)); this.Response.Redirect(url.ToString()); } } else { IOrderManager<Order> orderProvider = Sitecore.Ecommerce.Context.Entity.Resolve<IOrderManager<Order>>(); shoppingCart.OrderNumber = orderProvider.GenerateOrderNumber(); transactionData.DeletePersistentValue(shoppingCart.OrderNumber); HttpContext.Current.Session["paymentErrorMessage"] = "Order could not be created."; this.Response.Redirect(paymentArgs.PaymentUrls.FailurePageUrl); } break; } case PaymentStatus.Canceled: { IOrderManager<Order> orderProvider = Sitecore.Ecommerce.Context.Entity.Resolve<IOrderManager<Order>>(); shoppingCart.OrderNumber = orderProvider.GenerateOrderNumber(); transactionData.DeletePersistentValue(shoppingCart.OrderNumber); HttpContext.Current.Session["paymentErrorMessage"] = "Payment has been aborted by user."; this.Response.Redirect(paymentArgs.PaymentUrls.CancelPageUrl); break; } case PaymentStatus.Failure: { IOrderManager<Order> orderProvider = Sitecore.Ecommerce.Context.Entity.Resolve<IOrderManager<Order>>(); shoppingCart.OrderNumber = orderProvider.GenerateOrderNumber(); transactionData.DeletePersistentValue(shoppingCart.OrderNumber); this.Response.Redirect(paymentArgs.PaymentUrls.FailurePageUrl); break; } } }
protected void Translate(string fieldID) { Assert.ArgumentNotNull(fieldID, "fieldID"); Item currentItem = this.GetCurrentItem(Message.Empty); if (currentItem != null) { Language translatingLanguage = this.GetTranslatingLanguage(currentItem); if (translatingLanguage != null) { Item item2 = currentItem.Database.Items[currentItem.ID, translatingLanguage]; if (item2 != null) { UrlString str = new UrlString(UIUtil.GetUri("control:WorldLingo")); str.Append("ph", item2[fieldID]); str.Append("src", item2.Language.ToString()); str.Append("trg", currentItem.Language.ToString()); SheerResponse.ShowModalDialog(str.ToString()); } } } }
private void RedirectToLoginPage() { string loginPage = this.GetLoginPage(Context.Site); if (loginPage.Length > 0) { Tracer.Info("Redirecting to login page \"" + loginPage + "\"."); UrlString urlString = new UrlString(loginPage); if (Settings.Authentication.SaveRawUrl) { urlString.Append("url", HttpUtility.UrlEncode(Context.RawUrl)); } WebUtil.Redirect(urlString.ToString(), false); } else { Tracer.Info("Redirecting to error page as no login page was found."); WebUtil.RedirectToErrorPage("Login is required, but no valid login page has been specified for the site (" + Context.Site.Name + ").", false); } }
private void Current_OnExecute(object sender, AjaxCommandEventArgs args) { switch (args.Command.Name) { case "item:open": string itemid = args.Parameters["itemid"]; Item item = this.Database.GetItem(itemid); var str2 = new UrlString(); str2.Append("fo", itemid); str2.Append("id", itemid); str2.Append("la", item.Language.ToString()); str2.Append("vs", item.Version.ToString()); str2.Append("sc_content", this.Database.Name); Windows.RunApplication("Content Editor", str2.ToString()); break; case "appshortcut:open": ID appId; if (Sitecore.Data.ID.TryParse(args.Parameters["appid"], out appId)) { Windows.RunShortcut(appId); } break; } }
public void EditLink(ClientPipelineArgs args) { var index = System.Convert.ToInt32(args.Parameters["index"]); var node = GetNodeByIndex(GetDocument(), index); if (args.IsPostBack) { if (!string.IsNullOrEmpty(args.Result) && args.Result != "undefined") { string result = args.Result; var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(result); string selectText = this.GetSelectText(xmlDocument.SelectSingleNode("link")); var xmlDocument2 = new XmlDocument(); xmlDocument2.LoadXml(GetValue()); xmlDocument2.DocumentElement.ReplaceChild( xmlDocument2.ImportNode(xmlDocument.SelectSingleNode("link"), true), GetNodeByIndex(xmlDocument2, index) ); SetValue(xmlDocument2.OuterXml); SetModified(); Sitecore.Context.ClientPage.ClientResponse.Eval( string.Concat(new string[] { "scContent.linklistUpdateLink('", ID, "', {index: " + index + ", text:'", selectText, "'})" }) ); } } else { var urlString = new UrlString(args.Parameters["url"]); urlString.Append("va", node.OuterXml); urlString.Append("ro", Source); Sitecore.Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), true); args.WaitForPostBack(); } }
/// <summary> /// Inserts a new link into the link list. /// </summary> /// <param name="args">Sitecore Client arguments.</param> public void InsertLink(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { // Make sure that the result was not empty or undefined (result when user cancels out of link dialog) if (!string.IsNullOrEmpty(args.Result) && args.Result != "undefined") { // Get the result from the link dialog var result = args.Result; var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(result); var selectText = this.GetSelectText(xmlDocument.SelectSingleNode("link")); var xmlDocument2 = new XmlDocument(); xmlDocument2.LoadXml(this.GetValue()); var linksNode = xmlDocument2.SelectSingleNode("links"); if (linksNode != null) { // import the node into the document and set the value. var linkNode = xmlDocument.SelectSingleNode("link"); if (linkNode != null) { linksNode.AppendChild(xmlDocument2.ImportNode(linkNode, true)); SetValue(xmlDocument2.OuterXml); SetModified(); } } //xmlDocument2.SelectSingleNode("links").AppendChild(xmlDocument2.ImportNode(xmlDocument.SelectSingleNode("link"), true)); // Call Sitecore client to update the link list client side. Sitecore.Context.ClientPage.ClientResponse.Eval(string.Concat(new string[] { "scContent.linklistInsertLink('", ID, "', {text:'", selectText, "'})" })); } } else { // Show the dialog using ShowModalDialog. var urlString = new UrlString(args.Parameters["url"]); urlString.Append("va", XmlValue.ToString()); urlString.Append("ro", Source); Sitecore.Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), true); args.WaitForPostBack(); } }