private static void OpenContentEditor(Sitecore.Data.Items.Item item) { Assert.IsNotNull(item, "item is null"); Sitecore.Text.UrlString parameters = new Sitecore.Text.UrlString(); parameters.Add("id", item.ID.ToString()); parameters.Add("fo", item.ID.ToString()); parameters.Add("la", item.Language.Name); parameters.Add("vs", item.Version.Number.ToString()); Sitecore.Shell.Framework.Windows.RunApplication("Content editor", parameters.ToString()); }
/// <summary> /// Get the Source /// </summary> /// <returns> /// The Source String <see cref="string"/>. /// </returns> protected override string GetSource() { var baseUrl = new Sitecore.Text.UrlString(base.GetSource().Replace("&", "&")); if (Parameters.ContainsKey("useCustomFunctions")) { baseUrl.Add("useCustomFunctions", Parameters["useCustomFunctions"]); // remove useNamicsFuctions from the parameters dictionary so it's not added as an attribute on the img tag Parameters.Remove("useCustomFunctions"); } if (Parameters.ContainsKey("centerCrop")) { baseUrl.Add("centerCrop", Parameters["centerCrop"]); // remove centerCrop from the parameters dictionary so it's not added as an attribute on the img tag Parameters.Remove("centerCrop"); } if (Parameters.ContainsKey("cropX") && Parameters.ContainsKey("cropY")) { baseUrl.Add("cropX", Parameters["cropX"]); baseUrl.Add("cropY", Parameters["cropY"]); // remove cropStartX, cropStartY, cropWidth and cropHeight from the parameters dictionary so they not added as attributes on the img tag Parameters.Remove("cropX"); Parameters.Remove("cropY"); } if (Parameters.ContainsKey("keepOrientation")) { baseUrl.Add("keepOrientation", Parameters["keepOrientation"]); // remove keepOrientation from the parameters dictionary so it's not added as an attribute on the img tag Parameters.Remove("keepOrientation"); } if (Parameters.ContainsKey("greyScale")) { baseUrl.Add("greyScale", Parameters["greyScale"]); // remove greyScale from the parameters dictionary so it's not added as an attribute on the img tag Parameters.Remove("greyScale"); } if (Parameters.ContainsKey("rotateFlip")) { baseUrl.Add("rotateFlip", Parameters["rotateFlip"]); // remove rotateFlip from the parameters dictionary so it's not added as an attribute on the img tag Parameters.Remove("rotateFlip"); } return(baseUrl.GetUrl(Xhtml && Settings.Rendering.ImagesAsXhtml)); }
/// <summary> /// Execute the debug command. /// </summary> /// <param name="context">The command context.</param> public override void Execute( Sitecore.Shell.Framework.Commands.CommandContext context) { // Prompt to save if necessary. Context.ClientPage.ClientResponse.CheckModified(false); // Database selected by user. Sitecore.Data.Database contentDatabase = Context.ContentDatabase; // Database associated with item selected by user. if ((context.Items != null) && (context.Items.Length == 1)) { contentDatabase = context.Items[0].Database; } // Default URL for context (shell) site. Sitecore.Text.UrlString webSiteUrl = Sitecore.Sites.SiteContext.GetWebSiteUrl(); // Enable debugging. webSiteUrl.Add("sc_debug", "1"); if ((context.Items != null) && (context.Items.Length == 1)) { Sitecore.Data.Items.Item item = context.Items[0]; if (item.Visualization.Layout != null) { // Set the item to debug. webSiteUrl.Add("sc_itemid", item.ID.ToString()); } // Set the language to debug. webSiteUrl.Add("sc_lang", item.Language.ToString()); } // Set the database to debug. if (contentDatabase != null) { webSiteUrl.Add("sc_database", contentDatabase.Name); } // Enable profiling. webSiteUrl.Add("sc_prof", "1"); // Enable tracing. webSiteUrl.Add("sc_trace", "1"); // Enable rendering information. webSiteUrl.Add("sc_ri", "1"); // Show the debugging window. Context.ClientPage.ClientResponse.Eval("window.open('" + webSiteUrl + "', '_blank')"); }
private string GetRenderingContent() { StringWriter sw = new StringWriter(); //Sitecore.Data.Fields.ReferenceField device = this.dataSourceItem.Fields["Use Device"]; var pdfurl = new Sitecore.Text.UrlString(HttpContext.Current.Request.Url.ToString()); pdfurl.Add("sc_device", this.dataSourceItem["Use Device"]); string html = GenerateResponseXMl(pdfurl.ToString()); return(html); }
public override void Execute(SC.Shell.Framework.Commands.CommandContext context) { SC.Diagnostics.Assert.IsNotNull(context, "context"); SC.Text.UrlString webSiteUrl = new SC.Text.UrlString("/"); webSiteUrl.Add("sc_debug", "1"); webSiteUrl.Add("sc_prof", "1"); webSiteUrl.Add("sc_trace", "1"); webSiteUrl.Add("sc_ri", "1"); SC.Data.Database db = SC.Context.ContentDatabase; SC.Globalization.Language lang = SC.Context.ContentLanguage; // if the context for invoking the command specifies exactly one item if (context.Items != null && context.Items.Length == 1 && context.Items[0] != null) { // ensure the user has saved the selected item SC.Context.ClientPage.ClientResponse.CheckModified(false); SC.Data.Items.Item item = context.Items[0]; db = item.Database; lang = item.Language; webSiteUrl.Add("sc_itemid", item.ID.ToString()); } if (db != null) { webSiteUrl.Add("sc_database", db.Name); } if (lang != null) { webSiteUrl.Add("sc_lang", lang.ToString()); } // without this, I didn't see the ribbon SC.Publishing.PreviewManager.RestoreUser(); SC.Context.ClientPage.ClientResponse.Eval( "window.open('" + webSiteUrl + "', '_blank')"); }
public override void Execute( Sitecore.Shell.Framework.Commands.CommandContext context) { Context.ClientPage.ClientResponse.CheckModified(false); Sitecore.Data.Database contentDatabase = Context.ContentDatabase; if ((context.Items != null) && (context.Items.Length == 1)) { Sitecore.Data.Database database = context.Items[0].Database; } Sitecore.Text.UrlString webSiteUrl = Sitecore.Sites.SiteContext.GetWebSiteUrl(); webSiteUrl.Add("sc_debug", "1"); if ((context.Items != null) && (context.Items.Length == 1)) { Sitecore.Data.Items.Item item = context.Items[0]; if (item.Visualization.Layout != null) { webSiteUrl.Add("sc_itemid", item.ID.ToString()); } webSiteUrl.Add("sc_lang", item.Language.ToString()); } if (contentDatabase != null) { webSiteUrl.Add("sc_database", contentDatabase.Name); } webSiteUrl.Add("sc_prof", "1"); webSiteUrl.Add("sc_trace", "1"); webSiteUrl.Add("sc_ri", "1"); Context.ClientPage.ClientResponse.Eval( "window.open('" + webSiteUrl + "', '_blank')"); }
protected string GetCampaignQueryString() { var options = _linkManager.GetDefaultUrlOptions(); options.AlwaysIncludeServerUrl = true; string itemUrl = _linkManager.GetItemUrl(_pageContext.Item, options); var urlString = new Sitecore.Text.UrlString(itemUrl); var campaignId = GetCamapignId(); if (!campaignId.IsNull) { urlString.Add("sc_camp", campaignId.ToShortID().ToString()); } return urlString.GetUrl(); }
private static void OpenContentEditor(Sitecore.Data.Items.Item item) { Assert.IsNotNull(item,"item is null"); Sitecore.Text.UrlString parameters = new Sitecore.Text.UrlString(); parameters.Add("id", item.ID.ToString()); parameters.Add("fo", item.ID.ToString()); parameters.Add("la", item.Language.Name); parameters.Add("vs", item.Version.Number.ToString()); Sitecore.Shell.Framework.Windows.RunApplication("Content editor", parameters.ToString()); }