protected void Run(ClientPipelineArgs args) { Item item = base.DeserializeItems(args.Parameters["items"])[0]; if (item == null) { return; } if (SheerResponse.CheckModified()) { //prompt user they want to add versions if (args.IsPostBack) { if (args.Result == "yes") { LanguageHelper.CreateVersionInEachLanguage(item); Sitecore.Web.UI.HtmlControls.DataContext contentEditorDataContext = Sitecore.Context.ClientPage.FindControl("ContentEditorDataContext") as Sitecore.Web.UI.HtmlControls.DataContext; contentEditorDataContext.SetFolder(item.Uri); } } else { StringBuilder builder = new StringBuilder(); builder.Append("Create version for each language?"); SheerResponse.Confirm(builder.ToString()); args.WaitForPostBack(); } } }
// update the data context to specify the initial selection in the tree protected void SelectFirstItem(string idPathOrQuery) { SC.Data.Items.Item[] queried = this.DetermineItems(idPathOrQuery); if (queried != null && queried.Length > 0 && queried[0] != null) { SC.Web.UI.WebControls.TreeviewEx tree = this.FindControl(this.ID + "_all") as SC.Web.UI.WebControls.TreeviewEx; SC.Diagnostics.Assert.IsNotNull(tree, "tree"); SC.Web.UI.HtmlControls.DataContext dataContext = this.FindDataContext(this); SC.Diagnostics.Assert.IsNotNull(dataContext, "dataContext"); dataContext.Folder = queried[0].Paths.FullPath; } }
// find the data context to allow specification // of the initial selection in the tree protected SC.Web.UI.HtmlControls.DataContext FindDataContext( Control control) { SC.Web.UI.HtmlControls.DataContext dataContext = control as SC.Web.UI.HtmlControls.DataContext; if (dataContext != null) { return(dataContext); } foreach (Control childControl in control.Controls) { dataContext = this.FindDataContext(childControl); if (dataContext != null) { return(dataContext); } } return(null); }