/// <summary> /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content /// </summary> /// <param name="context">Context of Call</param> public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); if (context.Items.Length == 1) { var itemId = context.Parameters[0]; //if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(itemId)) //{ // SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + itemId + "')"); //} //else //{ var urlString = new UrlString("/sitecore%20modules/Shell/Sitecore/ItemBuckets/ShowResult.aspx"); urlString.Add(Util.Constants.OpenItemEditorQueryStringKeyName, itemId); context.Items[0].Uri.AddToUrlString(urlString); UIUtil.AddContentDatabaseParameter(urlString); urlString.Add(Util.Constants.ModeQueryStringKeyName, "preview"); urlString.Add(Util.Constants.RibbonQueryStringKeyName, "{D3A2D76F-02E6-49DE-BE90-D23C9771DC8D}"); var language = context.Parameters["la"].IsNull() ? Sitecore.Context.Language.CultureInfo.TwoLetterISOLanguageName : context.Parameters["la"]; urlString.Add("la", language); //SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = "Another Search", Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = Id, Closeable = true, Activate = true }.ToString()); SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchblanktab", Header = "Search " + DateTime.Now.ToLongTimeString(), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = new Random().Next(0, 99999999).ToString(), Closeable = true, Activate = true }.ToString()); // } } }
/// <summary> /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content /// </summary> /// <param name="context">Context of Call</param> public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); if (context.Items.Length == 1) { var itemId = context.Parameters[0]; if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(itemId)) { SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + itemId + "')"); } else { var urlString = new UrlString("/sitecore/shell/sitecore/content/Applications/Content%20Editor.aspx"); urlString.Add(Util.Constants.OpenItemEditorQueryStringKeyName, itemId); TrackOpenTab(context); context.Items[0].Uri.AddToUrlString(urlString); UIUtil.AddContentDatabaseParameter(urlString); urlString.Add(Util.Constants.ModeQueryStringKeyName, "preview"); urlString.Add(Util.Constants.RibbonQueryStringKeyName, "{D3A2D76F-02E6-49DE-BE90-D23C9771DC8D}"); var language = context.Parameters["la"].IsNull() ? Sitecore.Context.Language.CultureInfo.TwoLetterISOLanguageName : context.Parameters["la"]; urlString.Add("la", language); urlString.Add("isbucket", "1"); AddLatestVersionToUrlString(urlString, itemId, language); SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = Translate.Text(Context.ContentDatabase.GetItem(itemId).Name), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = itemId, Closeable = true, Activate = Util.Constants.SettingsItem.Fields[Util.Constants.OpenSearchResult].Value == "New Tab Not Selected" ? false : true }.ToString()); } } }
public override void Execute(CommandContext context) { var child = context.Items[0]; if (child == null) { return; } this.AccountItem = AccountManager.GetAccountItemForDescendant(child); if (this.AccountItem == null) { LogHelper.Error("Error while executing manual operation. An Account item cannot be found.", this); return; } var urlString = new UrlString(UIUtil.GetUri(Constants.Authentication.ControlWizard)); this.AccountItem.Uri.AddToUrlString(urlString); UIUtil.AddContentDatabaseParameter(urlString); Context.ClientPage.Start(this, "RunWizard", new NameValueCollection { { "url", urlString.ToString() } }); }
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"); } }
/// <summary> /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content /// </summary> /// <returns>Void</returns> public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); if (context.Items.Length == 1) { if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(context.Parameters[0])) { SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + context.Parameters[0] + "')"); } else { var urlString = new UrlString("/sitecore/shell/sitecore/content/Applications/Content%20Editor.aspx"); urlString.Add("fo", context.Parameters[0]); context.Items[0].Uri.AddToUrlString(urlString); UIUtil.AddContentDatabaseParameter(urlString); //Open the new tab without the content tree showing urlString.Add("mo", "preview"); AddLatestVersionToUrlString(context, urlString); SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = Translate.Text(Context.ContentDatabase.GetItem(context.Parameters[0]).Name), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = context.Parameters[0], Closeable = true, Activate = false }.ToString()); SheerResponse.Eval("scContent.onEditorTabClick('scEditorTabHeaderActive', 'scEditorTabHeaderActive', '" + "{59F53BBB-D1F5-4E38-8EBA-0D73109BB59B}" + "')"); } } }
/// <summary> /// Refresh the content tree with the new item opened /// </summary> /// <param name="item">Item that is being added</param> /// <remarks>You will need to override this if you are running without HttpContext e.g. Unit Tests</remarks> protected virtual void SetLocation(Item item) { if (Context.ClientPage.IsNotNull()) { var urlString = new UrlString(Constants.ContentEditorRawUrlAddress); urlString.Add(Constants.OpenItemEditorQueryStringKeyName, item.ID.ToString()); item.Uri.AddToUrlString(urlString); UIUtil.AddContentDatabaseParameter(urlString); SheerResponse.SetLocation(urlString.ToString()); } }
/// <summary> /// Executes the command in the specified context. /// </summary> /// <param name="context">The context.</param> public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); if ((int)context.Items.Length != 1) { return; } DeviceSimulationUtil.DeactivateSimulators(); Item items = context.Items[0]; ShortID shortID = items.ID.ToShortID(); string str = string.Concat("SEO Check", shortID); if ((new EditorTabsClientManager()).ShowEditorTabs.Any <ShowEditorTab>((ShowEditorTab tab) => { if (tab.Command != "contenteditor:seocheck") { return(false); } return(tab.Id == str); })) { SheerResponse.Eval(string.Concat("scContent.onEditorTabClick(null, null, '", str, "')")); return; } var url = LinkManager.GetItemUrl(items, new UrlOptions() { AlwaysIncludeServerUrl = true }); Uri myUri = new Uri(url); UrlString urlString = new UrlString(myUri.Host + "/sitecore/shell/-/xaml/Sitecore.Shell.Applications.ContentEditor.Editors.Preview.aspx"); items.Uri.AddToUrlString(urlString); UIUtil.AddContentDatabaseParameter(urlString); WebClient client = new WebClient(); String htmlCode = client.DownloadString(urlString.ToString()); //Below code is to open the SEO Report //SheerResponse.Eval((new ShowEditorTab() //{ // Command = "contenteditor:seocheck", // Header = Translate.Text("SEO Check"), // Title = string.Concat(Translate.Text("SEO Check"), ": ", (!UserOptions.View.UseDisplayName ? items.Name : items.DisplayName)), // Icon = Images.GetThemedImageSource("Network/16x16/environment.png"), // Url = urlString.ToString(), // Id = str, // Closeable = true, // Activate = true, // Language = items.Language, // Version = items.Version //}).ToString()); }
private static void Show(CommandContext context, string tabId) { var urlString = new UrlString(); context.Items[0].Uri.AddToUrlString(urlString); UIUtil.AddContentDatabaseParameter(urlString); SheerResponse.Eval(new ShowEditorTab { Command = "crownpeakdqm:previewtab", Header = "Crownpeak DQM Preview", Icon = Images.GetThemedImageSource("/Content/crownpeak/16x16/crownpeak.png"), Url = UIUtil.GetUri("control:Crownpeak.PreviewTab", urlString), Id = tabId, Closeable = true, }.ToString()); }
/// <summary> /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content /// </summary> /// <param name="context">Context of Call</param> public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); if (context.Items.Length == 1) { var itemId = context.Parameters[0]; if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(itemId)) { SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + itemId + "')"); } else { var urlString = new UrlString(Util.Constants.ContentEditorRawUrlAddress); urlString.Add(Util.Constants.OpenItemEditorQueryStringKeyName, itemId); context.Items[0].Uri.AddToUrlString(urlString); UIUtil.AddContentDatabaseParameter(urlString); urlString.Add(Util.Constants.ModeQueryStringKeyName, "preview"); AddLatestVersionToUrlString(urlString, itemId); SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = Translate.Text(Context.ContentDatabase.GetItem(itemId).Name), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = itemId, Closeable = true, Activate = false }.ToString()); } } }
/// <summary>Gets the URL.</summary> /// <returns>The URL.</returns> /// <contract> /// <requires name="url" condition="not empty" /> /// <requires name="mode" condition="not empty" /> /// <ensures condition="not null" /> /// </contract> public UrlString GetUrl() { this.Handle = Control.GetUniqueID("H"); NameValueCollection querystring = new NameValueCollection(1); if (string.IsNullOrEmpty(this.Url)) { if (this.Disabled || UserOptions.HtmlEditor.ContentEditorMode == UserOptions.HtmlEditor.Mode.Preview) { this.Url = "/sitecore/shell/Controls/TinyMCE Editor/Preview.aspx"; querystring["sc_disableproperties"] = "1"; } else { this.Url = "/sitecore/shell/Controls/TinyMCE Editor/Default.aspx"; } } UrlString url = new UrlString(this.Url); url["da"] = Context.Database.Name; url["id"] = StringUtil.GetString(new string[1] { this.ItemID }); url["ed"] = StringUtil.GetString(new string[1] { this.ID }); url["vs"] = StringUtil.GetString(new string[1] { this.Version }); url["la"] = StringUtil.GetString(new string[1] { this.Language }); url["fld"] = StringUtil.GetString(new string[1] { this.FieldID }); url["so"] = StringUtil.GetString(new string[1] { this.Source }); url["di"] = this.Disabled ? "1" : "0"; url["hdl"] = this.Handle; url["mo"] = this.Mode; url["pe"] = this.IsPageEdit ? "1" : "0"; url["fbd"] = this.ShowInFrameBasedDialog ? "1" : "0"; UIUtil.AddContentDatabaseParameter(url); string body = this.Value; if (body == "__#!$No value$!#__") { body = string.Empty; } if (this.Conversion == TinyMCEEditorUrl.HtmlConversion.DesignTime) { querystring["sc_live"] = "0"; string controlName = string.Empty; if (Settings.HtmlEditor.SupportWebControls) { controlName = "control:IDEHtmlEditorControl"; } body = DesignTimeHtml.Convert(body, controlName, querystring); } else if (this.Conversion == TinyMCEEditorUrl.HtmlConversion.Runtime) { body = RuntimeHtml.Convert(body, Settings.HtmlEditor.SupportWebControls); } HttpContext.Current.Session[this.Handle] = (object)body; return(url); }