protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (SheerResponse.CheckModified()) { 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 (args.Parameters["isPageEditor"] == "1") { Reload(WebEditCommand.GetUrl()); } else if (AjaxScriptManager.Current != null) { AjaxScriptManager.Current.Dispatch("analytics:trackingchanged"); } else { Context.ClientPage.SendMessage(this, "analytics:trackingchanged"); var tempItem = Factory.GetDatabase(args.Parameters["database"]).GetItem(args.Parameters["id"]); var valueForAllOtherItems = tempItem.Fields["__tracking"].Value; 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(); Context.Job.Status.Messages.Add("Applying Profile Card to " + item1.Paths.FullPath + " item"); item1.Editing.BeginEdit(); item1["__tracking"] = valueForAllOtherItems; item1.Editing.EndEdit(); } this.Execute(args.Parameters["searchString"], tempItem.ID.ToString(), args.Parameters["database"]); tempItem.Editing.BeginEdit(); tempItem.Fields["__tracking"].Value = Context.ClientData.GetValue("tempTrackingField").ToString(); tempItem.Editing.EndEdit(); } } } else { var tempItem = Factory.GetDatabase(args.Parameters["database"]).GetItem(args.Parameters["id"]); Context.ClientData.SetValue("tempTrackingField", tempItem.Fields["__tracking"].Value); var urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Analytics.Personalization.ProfileCardsForm.aspx"); var handle = new UrlHandle(); handle["itemid"] = args.Parameters["id"]; handle["databasename"] = args.Parameters["database"]; handle["la"] = args.Parameters["language"]; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "1000", "600", string.Empty, true); args.WaitForPostBack(); } } }
protected void SelectRoles(ClientPipelineArgs args) { Edit edit = args.CustomData["RoleList"] as Edit; if (edit != null) { if (!args.IsPostBack) { UrlString urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Security.SelectRoles.aspx"); UrlHandle handle = new UrlHandle(); handle["roles"] = edit.Value; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), string.Empty, "600", string.Empty, true); args.WaitForPostBack(); } else if (args.HasResult) { string[] array = args.Result.TrimStart(new char[] { '-' }).Split(new char[] { '|' }); Array.Sort <string>(array); string str2 = string.Empty; edit.Value = string.Empty; foreach (string str3 in array) { str2 = str2 + "<div>" + str3.Replace(@"\", "\") + "</div>"; edit.Value = edit.Value + str3 + "|"; } edit.Value = edit.Value.TrimEnd(new char[] { '|' }); SheerResponse.Eval("$('RolesBox').innerHTML = '{0}'".FormatWith(new object[] { str2 })); } } }
/// <summary> /// Shows a confirmation dialog. /// </summary> protected override void ShowUI() { if (AdvancedDialog) { var urlString = new UrlString("/sitecore/shell/Applications/Media/UploadManager/UploadManager.aspx"); var item = Context.ContentDatabase.GetItem(Path); item.Uri.AddToUrlString(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), true); } else { var urlString = new UrlString("/sitecore modules/Shell/PowerShell/UploadFile/PowerShellUploadFile.aspx"); var handle = new UrlHandle { ["te"] = Title ?? string.Empty, ["ds"] = Description ?? string.Empty, ["ic"] = Icon ?? string.Empty, ["ok"] = OkButtonName ?? string.Empty, ["cancel"] = CancelButtonName ?? string.Empty, ["path"] = Path, ["mask"] = "*.*", ["de"] = "txt", ["versioned"] = Versioned ? "1" : string.Empty, ["language"] = Language ?? string.Empty, ["overwrite"] = Overwrite ? "1" : string.Empty, ["unpack"] = Unpack ? "1" : string.Empty }; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), Width, Height, "", true); } }
public void SelectFields(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (!args.IsPostBack) { UrlString urlString = new UrlString(UIUtil.GetUri("control:TreeListExEditor")); UrlHandle urlHandle = new UrlHandle(); urlHandle["title"] = PullUpFieldsSettings.SelectFieldsDialogTitle; urlHandle["text"] = PullUpFieldsSettings.SelectFieldsDialogText; urlHandle["source"] = GetSelectFieldsDialogSource(args); urlHandle.Add(urlString); SheerResponse.ShowModalDialog ( urlString.ToString(), PullUpFieldsSettings.SelectFieldsDialogWidth, PullUpFieldsSettings.SelectFieldsDialogHeight, string.Empty, true ); args.WaitForPostBack(); } else if (args.HasResult) { args.Parameters["fieldIds"] = args.Result; args.IsPostBack = false; } else { CancelOperation(args); } }
protected void ShowTags(string notFoundTag) { ClientPipelineArgs args = ContinuationManager.Current.CurrentArgs as ClientPipelineArgs; if (args.IsPostBack) { if (args.HasResult && args.Result != "undefined") { Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; Item categoryItem = db.GetItem(new ID(args.Result)); string tagValue = GetCategoryName(categoryItem); string tagId = categoryItem.ID.ToString(); SheerResponse.Eval("SetTag('{0}','{1}')", tagValue, tagId); } } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.TagBrowser"))); UrlHandle currentHandle = UrlHandle.Get(); UrlHandle handle = new UrlHandle(); handle["tagNotFound"] = notFoundTag; handle["categoriesRootId"] = currentHandle["categoriesRootId"]; handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "650px", "600px", string.Empty, true); args.WaitForPostBack(); } }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (SheerResponse.CheckModified()) { 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"] })); } else { Context.ClientPage.SendMessage(this, "analytics:trackingchanged"); Context.ClientPage.SendMessage(this, "item:refresh(id={0})".FormatWith(new object[] { args.Parameters["id"] })); } } } else { var urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Rules.RulesEditor.aspx"); var handle = new UrlHandle(); handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "1000", "600", string.Empty, true); args.WaitForPostBack(); } } }
/// <summary> /// Shows a confirmation dialog. /// </summary> protected override void ShowUI() { var urlString = new UrlString(Url); if (HandleParams != null && HandleParams.Count > 0) { var handle = new UrlHandle(); foreach (string key in HandleParams.Keys) { var value = HandleParams[key]; if ((value is string) && ((string)value).StartsWith("packPath:", StringComparison.OrdinalIgnoreCase)) { string strValue = (string)value; strValue = strValue.Substring(9); handle[key] = ApplicationContext.StoreObject(strValue); } else { handle[key] = value != null?value.ToString() : string.Empty; } } handle.Add(urlString); } Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), Width, Height, string.Empty, ReceiveResults); }
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(); } } } }
/// <summary> /// Shows the video. /// </summary> /// <param name="args">The arguments.</param> protected virtual void ShowVideo(ClientPipelineArgs args) { var urlString = new UrlString(Sitecore.UIUtil.GetUri("control:ShowVideo")); UrlHandle handle = new UrlHandle(); handle["value"] = this.Value; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "420px", "500px", string.Empty, true); args.WaitForPostBack(); }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Item item = base.DeserializeItems(args.Parameters["items"])[0]; if (SheerResponse.CheckModified()) { string str = args.Parameters["fieldid"]; if (string.IsNullOrEmpty(str)) { str = "__Tracking"; } if (args.IsPostBack) { if (args.HasResult) { 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[str] = args.Result; item1.Editing.EndEdit(); } if (AjaxScriptManager.Current != null) { AjaxScriptManager.Current.Dispatch("analytics:trackingchanged"); } else { Context.ClientPage.SendMessage(this, "analytics:trackingchanged"); // Context.ClientPage.SendMessage(this, "item:refresh(id={0})".FormatWith(new object[] { item.ID.ToString() })); } } } else if (item.Appearance.ReadOnly) { SheerResponse.Alert("You cannot edit the '{0}' item because it is protected.", new string[] { item.DisplayName }); } else if (!item.Access.CanWrite()) { SheerResponse.Alert("You cannot edit this item because you do not have write access to it.", new string[0]); } else { UrlString urlString = new UrlString(this.GetUrl()); UrlHandle handle = new UrlHandle(); handle["tracking"] = item[str]; handle.Add(urlString); this.ShowDialog(urlString.ToString()); 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(); } }
/// <summary> /// Gets the BLOB handle. /// </summary> /// <param name="blobName">Name of the BLOB.</param> /// <returns></returns> public static string GetBlobHandle(string blobName) { Assert.ArgumentNotNull(blobName, "blobName"); var handle = new UrlHandle(); handle["blob"] = blobName; handle.Add(new UrlString()); return (handle.Handle ?? string.Empty); }
/// <summary> /// Gets the BLOB handle. /// </summary> /// <param name="blobName">Name of the BLOB.</param> /// <returns></returns> public static string GetBlobHandle(string blobName) { Assert.ArgumentNotNull(blobName, "blobName"); var handle = new UrlHandle(); handle["blob"] = blobName; handle.Add(new UrlString()); return(handle.Handle ?? string.Empty); }
public override void Execute(CommandContext context) { UrlHandle urlHandle = new UrlHandle(); UrlString urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Flow.Dialogs.Pages.Schema.aspx"); urlString.Append("id", context.Items[0].ID.ToString()); urlHandle.Add(urlString); SheerResponse.ShowModalDialog(new ModalDialogOptions(urlString.ToString()) { Width = "650" }); }
public override void HandleMessage(Message message) { Assert.ArgumentNotNull(message, "message"); base.HandleMessage(message); if (message.Name.Contains("sct4class:preview")) { if (CurrentTreeviewItem != null) { var dialogUrl = new UrlString( ControlManager.GetControlUrl( new ControlName("Sitecore.T4Class.Generate.Module.PresentationLayer.Application.T4ClassPreview"))); var handle = new UrlHandle(); handle["class"] = T4TemplateClass; handle.Add(dialogUrl); SheerResponse.ShowModalDialog(dialogUrl.ToString(), "800"); } else { SheerResponse.Alert("Please, select item!"); } } if (message.Name.Contains("sct4class:config")) { var parameters = new NameValueCollection(); Context.ClientPage.Start(this, "ConfigMethod", parameters); } if (message.Name.Contains("sct4class:generate")) { if (CurrentTreeviewItem != null) { string fileName = string.Format("{0}.cs", string.IsNullOrEmpty(_configT4Class.DefaultFileName) ? CurrentTreeviewItem.Name : _configT4Class.DefaultFileName); string projectPath = WebUtil.GetQueryString("SolutionPath"); if (string.IsNullOrEmpty(projectPath)) { projectPath = AppDomain.CurrentDomain.BaseDirectory; } File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + fileName, T4TemplateClass); SheerResponse.Alert(string.Format("Class '{0}' has been generated! \n\nFile are located in '{1}{0}'", fileName, projectPath)); } else { SheerResponse.Alert("Please, select item!"); } } }
/// <summary> /// Runs the field editor. /// </summary> protected void OnRunFieldEditor() { var args = ContinuationManager.Current.CurrentArgs as ClientPipelineArgs; Assert.IsNotNull(args, "args"); if (args.IsPostBack) { if (args.HasResult) { string result = args.Result; if (result == "-") { return; } this.SaveInfo(this.ActiveField.Value); this.Info.AddRange(this.Metadata.GetAttributesByNames(result.Split('|'))); this.FieldsTree.LoadFromCrmEntry(this.Info); var field = this.Info.Fields.Where(f => !f.Disabled).Last(); if (field != null) { this.ActiveField.Value = field.Name; TreeViewExtensions.Select(this.FieldsTree, field.Name); } this.UpdateSettings(this.ActiveField.Value, true); this.SaveInfo(this.ActiveField.Value); AjaxScriptManager.Current.SetInnerHtml(this.TreeViewBorder.ID, this.FieldsTree); } } else { this.SaveInfo(this.ActiveField.Value); var urlString = new UrlString(UIUtil.GetUri("control:Forms.SelectFields")); var handle = new UrlHandle(); handle["values"] = ParametersUtil.NameValueCollectionToXml(this.GetListOfAvailableFields(), true); handle["title"] = ResourceManager.Localize("SELECT_FIELDS"); handle["text"] = ResourceManager.Localize("SELECT_FIELDS_DETAILED"); handle.Add(urlString); SheerResponse.ShowModalDialog( urlString.ToString(), string.Empty, string.Empty, ResourceManager.Localize("SELECT_FIELDS_FOR_EXPORT"), true); args.WaitForPostBack(); } }
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(); } }
/// <summary> /// Shows a confirmation dialog. /// </summary> protected override void ShowUI() { Item item = null; if (ItemDb != null) { item = Factory.GetDatabase(ItemDb).GetItem(ItemId); } if (NoDialog) { if (item != null && MediaManager.HasMediaContent(item)) { var str = item.Uri.ToUrlString(string.Empty); str.Append("field", "Blob"); Files.Download(str.ToString()); PowerShellLog.Audit("Download file: {0}", str.ToString()); } else if (!string.IsNullOrEmpty(FileName)) { SheerResponse.Download(FileName); } else { SheerResponse.Alert("There is no file attached."); } } else { var urlString = new UrlString("sitecore/shell/default.aspx?xmlcontrol=DownloadFile"); var handle = new UrlHandle { ["te"] = Message ?? string.Empty, ["fn"] = FileName ?? string.Empty, ["cp"] = Title ?? string.Empty, ["fp"] = ShowFullPath.ToString(), ["uri"] = ItemUri ?? string.Empty, ["db"] = ItemDb ?? string.Empty }; handle.Add(urlString); SheerResponse.ShowModalDialog( urlString.ToString(), Width ?? "600", Height ?? "200", string.Empty, true ); } }
protected void Run(ClientPipelineArgs args) { UrlString urlString = new UrlString(UIUtil.GetUri("control:OfflineExportWizard")); UrlHandle handle = new UrlHandle(); //Get ID of the curent control (rich text field) handle["value"] = string.Empty; handle["db"] = Sitecore.Context.ContentDatabase.Name; handle["source"] = "/sitecore/content/Global/Products"; handle["language"] = Sitecore.Context.ContentLanguage.Name; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "500px", "400px", string.Empty, false); }
protected void SelectTag(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); string currentValue = args.Parameters["currentValue"]; bool checkTagsMode = args.Parameters["mode"] == "check"; if (args.IsPostBack) { if ((args.HasResult && (args.Result != "undefined")) || checkTagsMode) { string renderedValue = RenderTags(args); SheerResponse.SetAttribute("scHtmlValue", "value", renderedValue); SheerResponse.SetAttribute("scPlainValue", "value", args.Parameters["currentValue"]); SheerResponse.Eval("scSetHtmlValue('" + args.Parameters["controlid"] + "')"); } if (checkTagsMode) { args.Result = "undefined"; args.IsPostBack = false; this.SelectTag(args); } } else { UrlString url = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Taxonomy.Dialogs.TagBrowser.aspx"); UrlHandle handle = new UrlHandle(); if (checkTagsMode) { string tagNotFound = currentValue.Split("|".ToCharArray()).FirstOrDefault(tag => StringUtil.GetPrefix(tag, ':').Equals("Null") || StringUtil.GetPrefix(tag, ':').Equals(ID.Null.ToString())); if (string.IsNullOrEmpty(tagNotFound)) { return; } tagNotFound = StringUtil.GetPostfix(tagNotFound, ':'); handle["tagNotFound"] = tagNotFound; args.Parameters["tagNotFound"] = tagNotFound; } handle["categoriesRootId"] = "{41E44203-3CB9-45DD-8EED-9E36B5282D68}"; handle["value"] = args.Parameters["currentValue"] ?? string.Empty; handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "650px", "600px", string.Empty, true); args.WaitForPostBack(); } }
protected void ShowRelated(ClientPipelineArgs args) { if (args.IsPostBack) { } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.RelatedScreen"))); UrlHandle handle = new UrlHandle(); handle["itemId"] = ItemId; handle["taxonomyValue"] = GetValue(); handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "900px", "400px", string.Empty, true); args.WaitForPostBack(); } }
protected void Set(ClientPipelineArgs args) { Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; if (args.IsPostBack) { if (args.HasResult && (args.Result != "undefined")) { Item item = db.GetItem(args.Parameters["item"]); using (new EditContext(item)) { item[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")] = args.Result; } } } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.SetTags"))); UrlHandle handle = new UrlHandle(); handle["categories"] = GetCategories(args.Parameters["item"]); Item item = db.GetItem(args.Parameters["item"]); handle["value"] = item[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")]; ID categoriesRootId = new ID("{41E44203-3CB9-45DD-8EED-9E36B5282D68}"); string source = item.Fields[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")].Source; if (!string.IsNullOrEmpty(source)) { var classificationSourceItems = LookupSources.GetItems(item, source); if ((classificationSourceItems != null) && (classificationSourceItems.Length > 0)) { Item taxonomies = classificationSourceItems.ToList().Find(sourceItem => sourceItem.Name.Equals("Taxonomies")); if (taxonomies != null) { categoriesRootId = taxonomies.ID; } } } handle["categoriesRootId"] = categoriesRootId.ToString(); handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "400px", "150px", string.Empty, true); args.WaitForPostBack(); } }
protected void SelectTag(ClientPipelineArgs args) { string tagNotFound = args.Parameters["tagNotFound"]; if (args.IsPostBack) { string oldValue = "|" + GetValue() + "|"; string newValue = oldValue; if (!string.IsNullOrEmpty(tagNotFound)) { newValue = newValue.Replace(string.Format("|{0}:{1}|", Sitecore.Data.ID.Null, tagNotFound), "|"); SetValue(newValue.Trim("|".ToCharArray())); SheerResponse.Eval("{0}RemoveTagNotFound('{1}');", scriptBase, tagNotFound); } if (args.HasResult && args.Result != "undefined") { Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; CategoryItem categoryItem = new CategoryItem(db.GetItem(new ID(args.Result))); string tagId = categoryItem.ID.ToString(); string tagValue = categoryItem.CategoryName; newValue += string.Format("{0}:{1}|", tagId, "{C1453A1D-9ED2-428A-8BB3-50B4A877BEA7}"); SetValue(newValue.Trim("|".ToCharArray())); SetModified(); SheerResponse.Eval("{0}SetTag('{1}','{2}');", scriptBase, tagValue, tagId); } CheckTags(); } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.TagBrowser"))); UrlHandle handle = new UrlHandle(); if (!string.IsNullOrEmpty(tagNotFound)) { handle["tagNotFound"] = tagNotFound; } handle["categoriesRootId"] = CategoriesRootId; handle["value"] = GetValue() ?? string.Empty; handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "650px", "600px", string.Empty, true); args.WaitForPostBack(); } }
protected void Set(ClientPipelineArgs args) { Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; if (args.IsPostBack) { if (args.HasResult && (args.Result!="undefined")) { Item item = db.GetItem(args.Parameters["item"]); using (new EditContext(item)) { item[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")] = args.Result; } } } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.SetTags"))); UrlHandle handle = new UrlHandle(); handle["categories"] = GetCategories(args.Parameters["item"]); Item item = db.GetItem(args.Parameters["item"]); handle["value"] = item[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")]; ID categoriesRootId = new ID("{41E44203-3CB9-45DD-8EED-9E36B5282D68}"); string source = item.Fields[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")].Source; if (!string.IsNullOrEmpty(source)) { var classificationSourceItems = LookupSources.GetItems(item, source); if ((classificationSourceItems != null) && (classificationSourceItems.Length > 0)) { Item taxonomies = classificationSourceItems.ToList().Find(sourceItem => sourceItem.Name.Equals("Taxonomies")); if (taxonomies != null) { categoriesRootId = taxonomies.ID; } } } handle["categoriesRootId"] = categoriesRootId.ToString(); handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "400px", "150px", string.Empty, true); args.WaitForPostBack(); } }
/// <summary> /// Shows the properties. /// /// </summary> /// <param name="args">The args.</param> protected new void ShowProperties(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (Disabled) { return; } var attribute = XmlValue.GetAttribute("mediaid"); if (string.IsNullOrEmpty(attribute)) { SheerResponse.Alert("Select an image from the Media Library first."); } else if (args.IsPostBack) { if (!args.HasResult) { return; } XmlValue = new XmlValue(args.Result, "image"); Value = XmlValue.GetAttribute("mediapath"); SetModified(); Update(); } else { var urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Media.ExtendedImageProperties.aspx"); var obj = Client.ContentDatabase.GetItem(attribute, Language.Parse(ItemLanguage)); if (obj == null) { SheerResponse.Alert("Select an image from the Media Library first."); } else { obj.Uri.AddToUrlString(urlString); var urlHandle = new UrlHandle(); urlHandle["xmlvalue"] = XmlValue.ToString(); urlHandle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "700", "700", string.Empty, true); args.WaitForPostBack(); } } }
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(); } }
protected void Edit(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (this.Enabled) { if (args.IsPostBack) { if ((args.Result != null) && (args.Result != "undefined")) { string result = args.Result; if (result == "-") { result = string.Empty; } if (this.Value != result) { Sitecore.Context.ClientPage.Modified = true; } this.Value = result; HtmlTextWriter output = new HtmlTextWriter(new StringWriter()); this.RenderItems(output); SheerResponse.SetInnerHtml(this.ID, output.InnerWriter.ToString()); } } else { UrlString urlString = new UrlString(UIUtil.GetUri("control:TreeListExImageSelector")); UrlHandle handle = new UrlHandle(); string str3 = this.Value; if (str3 == "__#!$No value$!#__") { str3 = string.Empty; } handle["value"] = str3; handle["source"] = this.Source; handle["language"] = this.ItemLanguage; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "800px", "300px", string.Empty, true); args.WaitForPostBack(); } } }
/// <summary> /// Lists the blobs in a modal dialog. /// </summary> /// <param name="header">The header text of the dialog.</param> /// <param name="description">The description text of the dialog.</param> /// <param name="icon">The icon of the dialog.</param> /// <param name="button">The button label text of the dialog.</param> /// <param name="filter">The blob search pattern.</param> public static void ListBlobs(string header, string description, string icon, string button, string filter) { Assert.ArgumentNotNull(header, "header"); Assert.ArgumentNotNull(description, "description"); Assert.ArgumentNotNull(icon, "icon"); Assert.ArgumentNotNull(button, "button"); Assert.ArgumentNotNull(filter, "filter"); var urlString = new UrlString(UIUtil.GetUri("control:BlobLister")); var handle = new UrlHandle(); handle["he"] = header; handle["txt"] = description; handle["ic"] = icon; handle["btn"] = button; handle["flt"] = filter; handle.Add(urlString); Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), true); }
protected void Edit(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (Enabled) { if (args.IsPostBack) { if (((args.Result != null) && (args.Result.Length > 0)) && (args.Result != "undefined")) { XmlDocument doc = XmlUtil.LoadXml(WebUtil.GetSessionString("ASR_COLUMNEDITOR")); WebUtil.SetSessionValue("ASR_COLUMNEDITOR", null); Value = doc.OuterXml; SetModified(); Refresh(); } } else { XmlDocument document = GetDocument(); WebUtil.SetSessionValue("ASR_COLUMNEDITOR", document.OuterXml); UrlString urlString = new UrlString(UIUtil.GetUri("control:ColumnEditor")); UrlHandle handle = new UrlHandle(); string value = Value; if (value == "__#!$No value$!#__") { value = string.Empty; } handle["value"] = value; var item = Sitecore.Context.Database.GetItem(Sitecore.Data.ID.Parse(ItemID)); var currentVersion = item.Versions.GetVersionNumbers().First(x => x.Number == ItemVersion); handle["id"] = new ItemUri(Sitecore.Data.ID.Parse(ItemID), Language.Parse(ItemLanguage), currentVersion, Sitecore.Context.ContentDatabase).ToString(ItemUriFormat.Uri); handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "800px", "500px", string.Empty, true); args.WaitForPostBack(); } } }
protected void ShowProperties(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (this.Disabled) { return; } string attribute = this.XmlValue.GetAttribute("mediaid"); if (string.IsNullOrEmpty(attribute)) { SheerResponse.Alert("Select an image from the Media Library first.", new string[0]); return; } if (!args.IsPostBack) { string str = FileUtil.MakePath("/sitecore/shell", ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Media.ImageProperties"))); UrlString urlString = new UrlString(str); Item item = Client.ContentDatabase.GetItem(attribute, Language.Parse(this.ItemLanguage)); if (item == null) { SheerResponse.Alert("Select an image from the Media Library first.", new string[0]); return; } item.Uri.AddToUrlString(urlString); UrlHandle urlHandle = new UrlHandle(); urlHandle["xmlvalue"] = this.XmlValue.ToString(); urlHandle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), true); args.WaitForPostBack(); } else if (args.HasResult) { this.XmlValue = new XmlValue(args.Result, "image"); this.Value = this.GetMediaPath(); this.SetModified(); this.Update(); return; } }
protected void Edit(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if ((args.Result != null) && (args.Result != "undefined")) { SetValue(args.Result); } } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.TaxonomyEditor"))); UrlHandle urlHandle = new UrlHandle(); urlHandle["value"] = GetValue() ?? string.Empty; urlHandle["sourceItemId"] = SourceItemId; urlHandle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "300px", "300px", string.Empty, true); args.WaitForPostBack(); } }
public static void OpenPageEditor(Page page, Item item, Language language = null) { string cookieValue = WebUtil.GetCookieValue("shell#lang", item.Language.Name); WebUtil.SetCookieValue("shell#lang", item.Language.Name); UrlString urlString = new UrlString(LinkManager.GetItemUrl(Context.Database.GetItem(ID.Parse(UiItemIds.IframeDialogPageGuid)))); urlString.Parameters["size"] = "full"; UrlHandle urlHandle = new UrlHandle(); urlHandle["FrameSrc"] = GetPageEditorLink(item, language); urlHandle["PreventPeUnloadMessage"] = true.ToString((IFormatProvider)CultureInfo.InvariantCulture); urlHandle.Add(urlString); string result; ScriptManager.GetCurrent(page).ShowPopup(HttpUtility.UrlPathEncode(urlString.ToString()), out result); if (!string.IsNullOrEmpty(result)) { //EnumerableExtensions.ForEach<MessageBody>(ControlCollectionExtensions.Flatten<MessageBody>(page.Controls), (System.Action<MessageBody>)(mb => mb.Refresh())); ScriptManagerExtensions.RegisterStartupScript(ScriptManager.GetCurrent(page), "$('.collapsible input:visible').focus().blur();", (Control)null); } WebUtil.SetCookieValue("shell#lang", cookieValue); }
protected void Edit(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (Enabled) { if (args.IsPostBack) { if (((args.Result != null) && (args.Result.Length > 0)) && (args.Result != "undefined")) { XmlDocument doc = XmlUtil.LoadXml(WebUtil.GetSessionString("ASR_COLUMNEDITOR")); WebUtil.SetSessionValue("ASR_COLUMNEDITOR", null); Value = doc.OuterXml; SetModified(); Refresh(); } } else { XmlDocument document = GetDocument(); WebUtil.SetSessionValue("ASR_COLUMNEDITOR", document.OuterXml); UrlString urlString = new UrlString(UIUtil.GetUri("control:ColumnEditor")); UrlHandle handle = new UrlHandle(); string value = Value; if (value == "__#!$No value$!#__") { value = string.Empty; } handle["value"] = value; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "800px", "500px", string.Empty, true); args.WaitForPostBack(); } } }
protected override void OnLoad(EventArgs e) { Assert.ArgumentNotNull(e, "e"); base.OnLoad(e); if (!Sitecore.Context.ClientPage.IsEvent) { UrlString urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Taxonomy.Classification.aspx"); UrlHandle urlHandle = new UrlHandle(); urlHandle["itemId"] = ItemId; urlHandle["fieldId"] = FieldId; urlHandle["db"] = Sitecore.Context.ContentDatabase.Name; urlHandle["categories"] = StringUtil.Join(GetCategories(), "|").Replace(@"//", @"/"); urlHandle["rendered"] = ValueRendered; //urlHandle["conflictcat"] = "{E0B7FD46-ADB2-4AE9-A0D7-44D91806A2BE}:{C23B8255-A0BF-4BAA-93B3-83D072FA940B}&{DF566E92-EEE8-417A-B6BA-4002D2632374}&{9EAB572E-4076-40D5-BDF3-EED53B78629F}|{7CE38A45-1A35-409D-902E-1EC106D54E00}:{6B3DE552-69E6-4150-92B5-6CC071C916C7}"; urlHandle["conflictcat"] = StringUtil.Join(GetConflictCategories(), "|"); if (Disabled) { urlString["di"] = "1"; } urlHandle.Add(urlString); SourceUri = urlString.ToString(); Name = FrameName; } }
protected override void OnLoad(EventArgs e) { Assert.ArgumentNotNull(e, "e"); base.OnLoad(e); if (!Sitecore.Context.ClientPage.IsEvent) { UrlString urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Taxonomy.Classification.aspx"); UrlHandle urlHandle = new UrlHandle(); urlHandle["itemId"] = ItemId; urlHandle["fieldId"] = FieldId; urlHandle["db"] = Sitecore.Context.ContentDatabase.Name; urlHandle["categories"] = StringUtil.Join(GetCategories(), "|").Replace(@"//", @"/"); urlHandle["rendered"] = ValueRendered; //urlHandle["conflictcat"] = "{E0B7FD46-ADB2-4AE9-A0D7-44D91806A2BE}:{C23B8255-A0BF-4BAA-93B3-83D072FA940B}&{DF566E92-EEE8-417A-B6BA-4002D2632374}&{9EAB572E-4076-40D5-BDF3-EED53B78629F}|{7CE38A45-1A35-409D-902E-1EC106D54E00}:{6B3DE552-69E6-4150-92B5-6CC071C916C7}"; urlHandle["conflictcat"] = StringUtil.Join(GetConflictCategories(), "|"); if (Disabled) { urlString["di"] = "1"; } urlHandle.Add(urlString); SourceUri = urlString.ToString(); Name = FrameName; } }
protected void ShowRelated(ClientPipelineArgs args) { if (args.IsPostBack) { } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.RelatedScreen"))); UrlHandle handle = new UrlHandle(); handle["itemId"] = ItemId; handle["taxonomyValue"] = GetValue(); handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "900px", "400px", string.Empty, true); args.WaitForPostBack(); } }
protected void SelectTag(ClientPipelineArgs args) { string tagNotFound = args.Parameters["tagNotFound"]; if (args.IsPostBack) { string oldValue = "|" + GetValue() + "|"; string newValue = oldValue; if (!string.IsNullOrEmpty(tagNotFound)) { newValue = newValue.Replace(string.Format("|{0}:{1}|", Sitecore.Data.ID.Null, tagNotFound), "|"); SetValue(newValue.Trim("|".ToCharArray())); SheerResponse.Eval("{0}RemoveTagNotFound('{1}');", scriptBase, tagNotFound); } if (args.HasResult && args.Result != "undefined") { Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; CategoryItem categoryItem = new CategoryItem(db.GetItem(new ID(args.Result))); string tagId = categoryItem.ID.ToString(); string tagValue = categoryItem.CategoryName; newValue += string.Format("{0}:{1}|", tagId, "{C1453A1D-9ED2-428A-8BB3-50B4A877BEA7}"); SetValue(newValue.Trim("|".ToCharArray())); SetModified(); SheerResponse.Eval("{0}SetTag('{1}','{2}');", scriptBase, tagValue, tagId); } CheckTags(); } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.TagBrowser"))); UrlHandle handle = new UrlHandle(); if (!string.IsNullOrEmpty(tagNotFound)) { handle["tagNotFound"] = tagNotFound; } handle["categoriesRootId"] = CategoriesRootId; handle["value"] = GetValue() ?? string.Empty; handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "650px", "600px", string.Empty, true); args.WaitForPostBack(); } }
protected virtual void ShowEditSchedule(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if (args.HasResult) { if (! string.Equals(args.Result, this.Value, StringComparison.OrdinalIgnoreCase)) { this.Value = args.Result; this.SetModified(); } } } else { var urlString = new UrlString(Sitecore.UIUtil.GetUri("control:ScheduleEditor")); var handle = new UrlHandle(); handle["value"] = this.Value; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "420px", "500px", string.Empty, true); args.WaitForPostBack(); } }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull((object)args, "args"); Item obj = this.DeserializeItems(args.Parameters["items"])[0]; if (!SheerResponse.CheckModified()) return; string index = args.Parameters["fieldid"]; if (string.IsNullOrEmpty(index)) index = "__Tracking"; if (args.IsPostBack) { if (!args.HasResult) return; using (new StatisticDisabler(StatisticDisablerState.ForItemsWithoutVersionOnly)) { obj.Editing.BeginEdit(); obj[index] = args.Result; obj.Editing.EndEdit(); } if (AjaxScriptManager.Current != null) { AjaxScriptManager.Current.Dispatch("analytics:trackingchanged"); } else { Context.ClientPage.SendMessage((object)this, "analytics:trackingchanged"); Context.ClientPage.SendMessage((object)this, "item:refresh(id={0})".FormatWith(new object[] {obj.ID.ToString()} )); } } else if (obj.Appearance.ReadOnly) { SheerResponse.Alert("You cannot edit the '{0}' item because it is protected.", new string[1] { obj.DisplayName }); } else if (!obj.Access.CanWrite()) { SheerResponse.Alert("You cannot edit this item because you do not have write access to it."); } else { UrlString urlString = new UrlString(this.GetUrl()); urlString.Add("id", context.Items[0].ID.ToShortID().ToString()); UrlHandle urlHandle = new UrlHandle(); urlHandle["tracking"] = obj[index]; urlHandle.Add(urlString); this.ShowDialog(urlString.ToString()); args.WaitForPostBack(); } }
/// <summary> /// Shows a confirmation dialog. /// </summary> protected virtual void ShowUI() { var urlString = new UrlString(Url); if (HandleParams != null && HandleParams.Count > 0) { var handle = new UrlHandle(); foreach (string key in HandleParams.Keys) { var value = HandleParams[key]; if ((value is string) && ((string) value).StartsWith("packPath:", StringComparison.OrdinalIgnoreCase)) { string strValue = (string) value; strValue = strValue.Substring(9); handle[key] = ApplicationContext.StoreObject(strValue); } else { handle[key] = value != null ? value.ToString() : string.Empty; } } handle.Add(urlString); } Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), Width, Height, string.Empty, true); }
/// <summary> /// Browses for an image. /// /// </summary> /// <param name="args">The args.</param><exception cref="T:Sitecore.Exceptions.ClientAlertException">The source of this Image field points to an item that does not exist.</exception> protected new void BrowseImage(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if (string.IsNullOrEmpty(args.Result) || args.Result == "undefined") { return; } MediaItem mediaItem = Client.ContentDatabase.Items[args.Result]; if (mediaItem != null) { var template = mediaItem.InnerItem.Template; if (template != null && !IsImageMedia(template)) { SheerResponse.Alert("The selected item does not contain an image."); } else { XmlValue.SetAttribute("mediaid", mediaItem.ID.ToString()); var croppingOption = GetCroppingOption(); var cropRegion = ProduceCropRegionXmlAttributeValueFromAnOption(mediaItem, croppingOption); if (!string.IsNullOrWhiteSpace(cropRegion)) { XmlValue.SetAttribute("cropregion", cropRegion); XmlValue.SetAttribute("ratio", string.Concat(croppingOption.Width, ":", croppingOption.Height)); } XmlValue.SetAttribute("width", croppingOption.Width.ToString()); XmlValue.SetAttribute("height", croppingOption.Height.ToString()); Value = mediaItem.MediaPath; Update(); SetModified(); } } else { SheerResponse.Alert("Item not found."); } } else { var souceValues = HttpUtility.ParseQueryString(Source); var mediaSource = string.Empty; if (souceValues.AllKeys.Any()) { mediaSource = souceValues["mediaSource"]; } var str1 = StringUtil.GetString(new string[2] { mediaSource, "/sitecore/media library" }); var str2 = str1; var path = XmlValue.GetAttribute("mediaid"); var str3 = path; if (str1.StartsWith("~", StringComparison.InvariantCulture)) { str2 = StringUtil.Mid(str1, 1); if (string.IsNullOrEmpty(path)) { path = str2; } str1 = "/sitecore/media library"; } var language = Language.Parse(ItemLanguage); var mediaBrowserOptions = new MediaBrowserOptions(); var obj1 = Client.ContentDatabase.GetItem(str1, language); if (obj1 == null) { throw new ClientAlertException("The source of this Image field points to an item that does not exist."); } mediaBrowserOptions.Root = obj1; if (!string.IsNullOrEmpty(path)) { var obj2 = Client.ContentDatabase.GetItem(path, language); if (obj2 != null) { mediaBrowserOptions.SelectedItem = obj2; } } var urlHandle = new UrlHandle(); urlHandle["ro"] = str1; urlHandle["fo"] = str2; urlHandle["db"] = Client.ContentDatabase.Name; urlHandle["la"] = ItemLanguage; urlHandle["va"] = str3; var urlString = mediaBrowserOptions.ToUrlString(); urlHandle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "1200px", "700px", string.Empty, true); args.WaitForPostBack(); } }
/// <summary> /// Browses for an image. /// /// </summary> /// <param name="args">The args.</param><exception cref="T:Sitecore.Exceptions.ClientAlertException">The source of this Image field points to an item that does not exist.</exception> protected new void BrowseImage(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if (string.IsNullOrEmpty(args.Result) || args.Result == "undefined") return; MediaItem mediaItem = Client.ContentDatabase.Items[args.Result]; if (mediaItem != null) { var template = mediaItem.InnerItem.Template; if (template != null && !IsImageMedia(template)) { SheerResponse.Alert("The selected item does not contain an image."); } else { XmlValue.SetAttribute("mediaid", mediaItem.ID.ToString()); var croppingOption = GetCroppingOption(); var cropRegion = ProduceCropRegionXmlAttributeValueFromAnOption(mediaItem, croppingOption); if (!string.IsNullOrWhiteSpace(cropRegion)) { XmlValue.SetAttribute("cropregion", cropRegion); XmlValue.SetAttribute("ratio", string.Concat(croppingOption.Width, ":", croppingOption.Height)); } XmlValue.SetAttribute("width", croppingOption.Width.ToString()); XmlValue.SetAttribute("height", croppingOption.Height.ToString()); Value = mediaItem.MediaPath; Update(); SetModified(); } } else SheerResponse.Alert("Item not found."); } else { var souceValues = HttpUtility.ParseQueryString(Source); var mediaSource = string.Empty; if (souceValues.AllKeys.Any()) { mediaSource = souceValues["mediaSource"]; } var str1 = StringUtil.GetString(new string[2] { mediaSource, "/sitecore/media library" }); var str2 = str1; var path = XmlValue.GetAttribute("mediaid"); var str3 = path; if (str1.StartsWith("~", StringComparison.InvariantCulture)) { str2 = StringUtil.Mid(str1, 1); if (string.IsNullOrEmpty(path)) path = str2; str1 = "/sitecore/media library"; } var language = Language.Parse(ItemLanguage); var mediaBrowserOptions = new MediaBrowserOptions(); var obj1 = Client.ContentDatabase.GetItem(str1, language); if (obj1 == null) throw new ClientAlertException("The source of this Image field points to an item that does not exist."); mediaBrowserOptions.Root = obj1; if (!string.IsNullOrEmpty(path)) { var obj2 = Client.ContentDatabase.GetItem(path, language); if (obj2 != null) mediaBrowserOptions.SelectedItem = obj2; } var urlHandle = new UrlHandle(); urlHandle["ro"] = str1; urlHandle["fo"] = str2; urlHandle["db"] = Client.ContentDatabase.Name; urlHandle["la"] = ItemLanguage; urlHandle["va"] = str3; var urlString = mediaBrowserOptions.ToUrlString(); urlHandle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "1200px", "700px", string.Empty, true); args.WaitForPostBack(); } }
protected void SelectTag(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); string currentValue = args.Parameters["currentValue"]; bool checkTagsMode = args.Parameters["mode"] == "check"; if (args.IsPostBack) { if ((args.HasResult && (args.Result != "undefined")) || checkTagsMode) { string renderedValue = RenderTags(args); SheerResponse.SetAttribute("scHtmlValue", "value", renderedValue); SheerResponse.SetAttribute("scPlainValue", "value", args.Parameters["currentValue"]); SheerResponse.Eval("scSetHtmlValue('" + args.Parameters["controlid"] + "')"); } if (checkTagsMode) { args.Result = "undefined"; args.IsPostBack = false; this.SelectTag(args); } } else { UrlString url = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Taxonomy.Dialogs.TagBrowser.aspx"); UrlHandle handle = new UrlHandle(); if (checkTagsMode) { string tagNotFound = currentValue.Split("|".ToCharArray()).FirstOrDefault(tag => StringUtil.GetPrefix(tag, ':').Equals("Null") || StringUtil.GetPrefix(tag, ':').Equals(ID.Null.ToString())); if (string.IsNullOrEmpty(tagNotFound)) { return; } tagNotFound = StringUtil.GetPostfix(tagNotFound, ':'); handle["tagNotFound"] = tagNotFound; args.Parameters["tagNotFound"] = tagNotFound; } handle["categoriesRootId"] = "{41E44203-3CB9-45DD-8EED-9E36B5282D68}"; handle["value"] = args.Parameters["currentValue"] ?? string.Empty; handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "650px", "600px", string.Empty, true); args.WaitForPostBack(); } }
protected void Edit(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (Enabled) { if (args.IsPostBack) { if (((args.Result != null) && (args.Result.Length > 0)) && (args.Result != "undefined")) { XmlDocument doc = XmlUtil.LoadXml(WebUtil.GetSessionString("ASR_COLUMNEDITOR")); WebUtil.SetSessionValue("ASR_COLUMNEDITOR", null); Value = doc.OuterXml; SetModified(); Refresh(); } } else { XmlDocument document = GetDocument(); WebUtil.SetSessionValue("ASR_COLUMNEDITOR", document.OuterXml); UrlString urlString = new UrlString(UIUtil.GetUri("control:ColumnEditor")); UrlHandle handle = new UrlHandle(); string value = Value; if (value == "__#!$No value$!#__") { value = string.Empty; } handle["value"] = value; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "800px", "500px", string.Empty, true); args.WaitForPostBack(); } } }
protected void Edit(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (!this.Disabled) { if (args.IsPostBack) { var dsr = this.ContextDatasetRendererItem; var value = args.Result; if (value != this.Value && value != "undefined") { this.SetModified(); this.Value = DatasetRendererTemplateField.ToRawValue(dsr.Dataset.FieldMap, value); SheerResponse.Refresh(this); } } else { var dsr = this.ContextDatasetRendererItem; var fields = string.Empty; if (dsr.SelectFields.Length > 0) fields = string.Join("|", dsr.SelectFields.Select(delegate(string x) { if (dsr.Dataset.FieldMap.ContainsKey(x)) return dsr.Dataset.FieldMap[x]; else return "('" + x + "' not in field list)"; }).OrderBy(x => x).ToArray()); else fields = string.Join("|", dsr.Dataset.FieldMap.Values.OrderBy(x => x).ToArray()); var urlString = new UrlString("/sitecore modules/Shell/Datasets/Field/DatasetRendererTemplateEditor.aspx"); var handle = new UrlHandle(); handle["value"] = DatasetRendererTemplateField.ToEditorValue(dsr.Dataset.FieldMap, this.Value); handle["fields"] = fields; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "1000px", "500px", string.Empty, true); args.WaitForPostBack(); } } }
protected void ShowValidationResult(Item folder) { Assert.ArgumentNotNull(folder, "folder"); ValidatorCollection validators = this.BuildValidators(ValidatorsMode.ValidateButton, folder); ValidatorOptions options = new ValidatorOptions(true); ValidatorManager.Validate(validators, options); IFormatter formatter = new BinaryFormatter(); MemoryStream serializationStream = new MemoryStream(); formatter.Serialize(serializationStream, validators); serializationStream.Close(); UrlHandle handle = new UrlHandle(); handle["validators"] = Convert.ObjectToBase64(serializationStream.ToArray()); UrlString urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.ContentEditor.Dialogs.ValidationResult.aspx"); handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString()); }
protected void InsertLink(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if (!string.IsNullOrEmpty(args.Result) && (args.Result != "undefined")) { GeneralLinkItem selectedLink = null; if (args.Parameters["link"] != null) { selectedLink = XmlUtil.XmlDeserializeFromString<GeneralLinkItem>(args.Parameters["link"]); } GeneralLinkItem returnedLink = XmlUtil.XmlDeserializeFromString<GeneralLinkItem>(args.Result); string rawValue = LinkItems.Aggregate(string.Empty, (current, link) => current + XmlUtil.XmlSerializeToString(link)); if (selectedLink == null) { //item doesn't exist, add to values if (string.IsNullOrEmpty(returnedLink.LinkId)) { returnedLink.LinkId = Guid.NewGuid().ToString(); } rawValue += XmlUtil.XmlSerializeToString(returnedLink); LinkItems.Add(returnedLink); } else { //item exists, set in values int i = 0; while (i <= LinkItems.Count) { GeneralLinkItem linkItem = LinkItems[i]; if (linkItem.LinkId == selectedLink.LinkId) { returnedLink.LinkId = selectedLink.LinkId; LinkItems[i] = returnedLink; rawValue = LinkItems.Aggregate(string.Empty, (current, link) => current + XmlUtil.XmlSerializeToString(link)); break; } i++; } } Value = string.Format("<links>{0}</links>", rawValue); SetModified(); //set new value Sitecore.Context.ClientPage.ClientResponse.SetAttribute(ID + "_Value", "value", Value); //set new display Sitecore.Context.ClientPage.ClientResponse.SetInnerHtml(ID + "_SelectedItems", RenderItems(LinkItems)); SheerResponse.Eval("scContent.startValidators()"); } } else { var str = new UrlString(args.Parameters["url"]); UrlHandle urlHandle = new UrlHandle(); if (args.Parameters["link"] != null && !string.IsNullOrEmpty(args.Parameters["link"])) { str.Append("va", args.Parameters["link"]); urlHandle["va"] = args.Parameters["link"]; } urlHandle.Add(str); str.Append("ro", Source); if ((UIUtil.IsIE() && (GetIEEngineBasedVersion() == 9)) && (args.Parameters["umwn"] == "1")) { ShowIEModelessDialog(str.ToString(), 500, 600); } else { Sitecore.Context.ClientPage.ClientResponse.ShowModalDialog(str.ToString(), true); } args.WaitForPostBack(); } }
// Methods protected void Edit(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (this.Enabled) { if (args.IsPostBack) { if ((args.Result != null) && (args.Result != "undefined")) { string result = args.Result; if (result == "-") { result = string.Empty; } if (this.Value != result) { Sitecore.Context.ClientPage.Modified = true; } this.Value = result; HtmlTextWriter output = new HtmlTextWriter(new StringWriter()); this.RenderItems(output); SheerResponse.SetInnerHtml(this.ID, output.InnerWriter.ToString()); } } else { UrlString urlString = new UrlString(UIUtil.GetUri("control:TreeListExEditor")); UrlHandle handle = new UrlHandle(); string str3 = this.Value; if (str3 == "__#!$No value$!#__") { str3 = string.Empty; } handle["value"] = str3; handle["source"] = this.Source; handle["language"] = this.ItemLanguage; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "800px", "500px", string.Empty, true); args.WaitForPostBack(); } } }
protected void Edit(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if ((args.Result != null) && (args.Result != "undefined")) { SetValue(args.Result); } } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.TaxonomyEditor"))); UrlHandle urlHandle = new UrlHandle(); urlHandle["value"] = GetValue() ?? string.Empty; urlHandle["sourceItemId"] = SourceItemId; urlHandle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "300px", "300px", string.Empty, true); args.WaitForPostBack(); } }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Item item = base.DeserializeItems(args.Parameters["items"])[0]; if (SheerResponse.CheckModified()) { string str = args.Parameters["fieldid"]; if (string.IsNullOrEmpty(str)) { str = "__Tracking"; } if (args.IsPostBack) { if (args.HasResult) { 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[str] = args.Result; item1.Editing.EndEdit(); } if (AjaxScriptManager.Current != null) { AjaxScriptManager.Current.Dispatch("analytics:trackingchanged"); } else { Context.ClientPage.SendMessage(this, "analytics:trackingchanged"); // Context.ClientPage.SendMessage(this, "item:refresh(id={0})".FormatWith(new object[] { item.ID.ToString() })); } } } else if (item.Appearance.ReadOnly) { SheerResponse.Alert("You cannot edit the '{0}' item because it is protected.", new string[] { item.DisplayName }); } else if (!item.Access.CanWrite()) { SheerResponse.Alert("You cannot edit this item because you do not have write access to it.", new string[0]); } else { UrlString urlString = new UrlString(this.GetUrl()); UrlHandle handle = new UrlHandle(); handle["tracking"] = item[str]; handle.Add(urlString); this.ShowDialog(urlString.ToString()); args.WaitForPostBack(); } } }
/// <summary> /// Shows a confirmation dialog. /// </summary> protected virtual void ShowUI() { if (AdvancedDialog) { var urlString = new UrlString("/sitecore/shell/Applications/Media/UploadManager/UploadManager.aspx"); var item = Context.ContentDatabase.GetItem(Path); item.Uri.AddToUrlString(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), true); } else { var urlString = new UrlString("/sitecore modules/Shell/PowerShell/UploadFile/PowerShellUploadFile.aspx"); var handle = new UrlHandle(); handle["te"] = Title ?? string.Empty; handle["ds"] = Description ?? string.Empty; handle["ic"] = "powershell/32x32/powershell8.png"; handle["ok"] = OkButtonName ?? string.Empty; handle["cancel"] = CancelButtonName ?? string.Empty; handle["path"] = Path; handle["mask"] = "*.*"; handle["de"] = "txt"; handle["versioned"] = Versioned ? "1" : string.Empty; handle["language"] = Language ?? string.Empty; handle["overwrite"] = Overwrite ? "1" : string.Empty; handle["unpack"] = Unpack ? "1" : string.Empty; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), Width, Height, "", true); } }
/// <summary> /// Shows the properties. /// /// </summary> /// <param name="args">The args.</param> protected new void ShowProperties(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (Disabled) return; var attribute = XmlValue.GetAttribute("mediaid"); if (string.IsNullOrEmpty(attribute)) SheerResponse.Alert("Select an image from the Media Library first."); else if (args.IsPostBack) { if (!args.HasResult) return; XmlValue = new XmlValue(args.Result, "image"); Value = XmlValue.GetAttribute("mediapath"); SetModified(); Update(); } else { var urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Media.ExtendedImageProperties.aspx"); var obj = Client.ContentDatabase.GetItem(attribute, Language.Parse(ItemLanguage)); if (obj == null) { SheerResponse.Alert("Select an image from the Media Library first."); } else { obj.Uri.AddToUrlString(urlString); var urlHandle = new UrlHandle(); urlHandle["xmlvalue"] = XmlValue.ToString(); urlHandle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "700", "700", string.Empty, true); args.WaitForPostBack(); } } }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull((object)args, "args"); Item obj = this.DeserializeItems(args.Parameters["items"])[0]; if (!SheerResponse.CheckModified()) return; string str = args.Parameters["user"]; string index = args.Parameters["fieldid"]; if (string.IsNullOrEmpty(index)) index = Sitecore.Buckets.Util.Constants.PersonalisationField; if (args.IsPostBack) { if (!args.HasResult) return; List<SearchStringModel> searchQuery = UIFilterHelpers.ExtractSearchQuery(args.Parameters["searchString"]); ProgressBox.Execute(Translate.Text("Applying Goals Change"), Translate.Text("Applying Goals"), "~/icon/Applications/32x32/signpost.png", new ProgressBoxMethod(this.StartProcess), (object)obj, (object)searchQuery, (object)args.Result, (object)index, (object)str); SheerResponse.Alert(Translate.Text("Finished Applying Goals")); if (AjaxScriptManager.Current != null) AjaxScriptManager.Current.Dispatch("analytics:trackingchanged"); else Context.ClientPage.SendMessage((object)this, "analytics:trackingchanged"); } else if (obj.Appearance.ReadOnly) SheerResponse.Alert(Translate.Text("You cannot edit the '{0}' item because it is protected.", (object)obj.DisplayName)); else if (!obj.Access.CanWrite()) { SheerResponse.Alert(Translate.Text("You cannot edit the '{0}' because you do not have write access to it.", (object)obj.DisplayName)); } else { UrlString urlString = new UrlString(this.GetUrl()); UrlHandle urlHandle = new UrlHandle(); urlHandle["tracking"] = obj[index]; urlHandle.Add(urlString); this.ShowDialog(urlString.ToString()); args.WaitForPostBack(); } }
protected void SelectRoles(ClientPipelineArgs args) { Edit edit = args.CustomData["RoleList"] as Edit; if (edit != null) { if (!args.IsPostBack) { UrlString urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Security.SelectRoles.aspx"); UrlHandle handle = new UrlHandle(); handle["roles"] = edit.Value; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), string.Empty, "600", string.Empty, true); args.WaitForPostBack(); } else if (args.HasResult) { string[] array = args.Result.TrimStart(new char[] { '-' }).Split(new char[] { '|' }); Array.Sort<string>(array); string str2 = string.Empty; edit.Value = string.Empty; foreach (string str3 in array) { str2 = str2 + "<div>" + str3.Replace(@"\", "\") + "</div>"; edit.Value = edit.Value + str3 + "|"; } edit.Value = edit.Value.TrimEnd(new char[] { '|' }); SheerResponse.Eval("$('RolesBox').innerHTML = '{0}'".FormatWith(new object[] { str2 })); } } }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (SheerResponse.CheckModified()) { 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 (args.Parameters["isPageEditor"] == "1") { Reload(WebEditCommand.GetUrl()); } else if (AjaxScriptManager.Current != null) { AjaxScriptManager.Current.Dispatch("analytics:trackingchanged"); } else { Context.ClientPage.SendMessage(this, "analytics:trackingchanged"); var tempItem = Factory.GetDatabase(args.Parameters["database"]).GetItem(args.Parameters["id"]); var valueForAllOtherItems = tempItem.Fields["__tracking"].Value; 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(); Context.Job.Status.Messages.Add("Applying Profile Card to " + item1.Paths.FullPath + " item"); item1.Editing.BeginEdit(); item1["__tracking"] = valueForAllOtherItems; item1.Editing.EndEdit(); } this.Execute(args.Parameters["searchString"], tempItem.ID.ToString(), args.Parameters["database"]); tempItem.Editing.BeginEdit(); tempItem.Fields["__tracking"].Value = Context.ClientData.GetValue("tempTrackingField").ToString(); tempItem.Editing.EndEdit(); } } } else { var tempItem = Factory.GetDatabase(args.Parameters["database"]).GetItem(args.Parameters["id"]); Context.ClientData.SetValue("tempTrackingField", tempItem.Fields["__tracking"].Value); var urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Analytics.Personalization.ProfileCardsForm.aspx"); var handle = new UrlHandle(); handle["itemid"] = args.Parameters["id"]; handle["databasename"] = args.Parameters["database"]; handle["la"] = args.Parameters["language"]; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "1000", "600", string.Empty, true); args.WaitForPostBack(); } } }
/// <summary> /// Shows the edit schedule. /// </summary> /// <param name="args">The arguments.</param> protected virtual void ShowEditVideo(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if (string.IsNullOrEmpty(args.Result) || !(args.Result != "undefined")) return; this.SetValue(args.Result); this.SetModified(); Sitecore.Context.ClientPage.ClientResponse.SetAttribute(this.ID, "value", this.Value); SheerResponse.Eval("scContent.startValidators()"); } else { var urlString = new UrlString(Sitecore.UIUtil.GetUri("control:VideoEditor")); UrlHandle handle = new UrlHandle(); handle["value"] = this.Value; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "820px", "600px", string.Empty, true); args.WaitForPostBack(); } }
protected virtual void ShowEditCustomIcon(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if (args.HasResult) { if (!string.Equals(args.Result, Value, StringComparison.OrdinalIgnoreCase)) { Value = args.Result; SetModified(); } } } else { var urlString = new UrlString("/sitecore/client/Your%20Apps/Dialogs/InsertCustomIconDialog"); var handle = new UrlHandle(); handle["value"] = Value; handle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "480px", "300px", string.Empty, true); args.WaitForPostBack(); } }
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(); } } } }
protected void DoSelectFields(ClientPipelineArgs args) { UrlString urlString = new UrlString(UIUtil.GetUri("control:SelectExportFields")); UrlHandle handle = new UrlHandle(); //Get ID of the curent control (rich text field) handle["value"] = string.Empty; handle["db"] = Sitecore.Context.ContentDatabase.Name; handle["source"] = template.Value; handle["language"] = Sitecore.Context.ContentLanguage.Name; handle.Add(urlString); if (!args.IsPostBack) { SheerResponse.ShowModalDialog(urlString.ToString(), "500px", "300px", string.Empty, true); args.WaitForPostBack(); } else { if (!string.IsNullOrEmpty(args.Result)) FieldsToExport = args.Result; SelectedFields.Value = GetSelectedFieldsText(); SheerResponse.SetInnerHtml(SelectedFieldsPanel, SelectedFields); } }