protected void createTag_Click() { string parentPath = newTagParentLiteral.Text; string categoryName = categoryNameEdit.Text; string categoryWeight = categoryWeightEdit.Value.ToString(); string categoryParentRelated = categoryRelatedToParentEdit.Value.ToString(); string categoryChildRelated = categoryRelatedToChildEdit.Value.ToString(); if (string.IsNullOrEmpty(parentPath) || string.IsNullOrEmpty(categoryName) || string.IsNullOrEmpty(categoryWeight) || string.IsNullOrEmpty(categoryParentRelated) || string.IsNullOrEmpty(categoryChildRelated)) { SheerResponse.Alert("You need to fill all the fields and select parent category/group to create new category."); return; } Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; UrlHandle handle = UrlHandle.Get(); Item rootItem = db.GetItem(new ID(handle["categoriesRootId"])); parentPath = rootItem.Paths.Path + parentPath; Item parentItem = db.GetItem(parentPath); Item newCategoryItem = parentItem.Add(categoryName, new TemplateID(new ID("{FCE30413-F1D8-43F4-8B93-B51FDED4D251}"))); using (new EditContext(newCategoryItem)) { newCategoryItem[CategoryItem.Fields.Weight] = categoryWeight; newCategoryItem[CategoryItem.Fields.RelatedToParent] = categoryParentRelated; newCategoryItem[CategoryItem.Fields.RelatedWithChildren] = categoryChildRelated; } SheerResponse.Eval("categoryTreeview_AddNode('{0}','I{1}','{2}');", categoryName, newCategoryItem.ID.ToShortID(), Images.GetThemedImageSource(newCategoryItem.Appearance.Icon, ImageDimension.id16x16)); }
protected void Node_Selected() { string selected = WebUtil.GetFormValue("categoryTreeview_Selected"); selected = ShortID.Decode(StringUtil.Mid(selected, 1)); if (Sitecore.Data.ID.IsID(selected)) { UrlHandle handle = UrlHandle.Get(); Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; Item selectedItem = db.GetItem(new ID(selected)); Item rootItem = db.GetItem(new ID(handle["categoriesRootId"])); if (selectedItem.TemplateID.ToString() != "{A69C0097-5CE1-435B-99E9-FA2B998D1C70}") { SheerResponse.Eval("enableButton_Ok();"); } else { SheerResponse.Eval("disableButton_Ok();"); } string categoryPath = selectedItem.Paths.Path.Substring(rootItem.Paths.Path.Length); newTagParentLiteral.Text = string.Format("{0}", categoryPath); createTagBtn.Disabled = !(selectedItem.Access.CanCreate() && selectedItem.Access.CanWrite()); } }
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(); } }
/// <summary> /// Reads the raw value and set initial values. /// </summary> private void ReadRawValueAndSetInitValues() { bool queryString = WebUtil.GetQueryString("hdl") != string.Empty; string empty = string.Empty; if (queryString) { empty = UrlHandle.Get()["va"]; } if (empty == string.Empty) { return; } XElement xElement = XElement.Parse(empty); if (InsertAnchor.GetXmlAttributeValue(xElement, "linktype") == "anchor") { this.Text.Parameters["Text"] = InsertAnchor.GetXmlAttributeValue(xElement, "text"); this.Style.Parameters["Text"] = InsertAnchor.GetXmlAttributeValue(xElement, "class"); this.Anchor.Parameters["Text"] = InsertAnchor.GetXmlAttributeValue(xElement, "anchor"); this.AlternateText.Parameters["Text"] = InsertAnchor.GetXmlAttributeValue(xElement, "title"); //////////////////////////////////////////////////////// START CUSTOM BIT //////////////////////////////////////////////////////// this.GoalLoadedValue.Parameters["Text"] = InsertAnchor.GetXmlAttributeValue(xElement, "goal"); this.EventLoadedValue.Parameters["Text"] = InsertAnchor.GetXmlAttributeValue(xElement, "pageevent"); //this.Goal.Parameters["Text"] = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "goal"); //this.Event.Parameters["Text"] = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "pageevent"); //////////////////////////////////////////////////////// END CUSTOM BIT //////////////////////////////////////////////////////// } }
private void PopulateAvailableColumns() { var handle = UrlHandle.Get(); var itemUri = ItemUri.Parse(handle["id"]); var item = Sitecore.Data.Database.GetItem(itemUri); if (item == null) { return; } try { var referenceItem = new ReferenceItem(item); var viewer = BaseViewer.Create(referenceItem.FullType, string.Empty); if (viewer == null) { return; } foreach (var availableColumn in viewer.AvailableColumns) { ColumnName.Controls.Add(new ListItem { Header = availableColumn, Value = availableColumn.ToLowerInvariant() }); } } catch (FileNotFoundException) { //todo } }
public void Run(ClientPipelineArgs args) { Item item = Database.GetItem(ItemUri.Parse(args.Parameters["uri"])); bool isPostBack = args.IsPostBack; if (isPostBack) { isPostBack = !args.HasResult; if (!isPostBack) { UrlHandle urlHandle = UrlHandle.Get(new UrlString(string.Concat("hdl=", args.Result)), "hdl", true); string str = urlHandle["fields"]; FieldDescriptor fieldDescriptor = FieldDescriptor.Parse(str); string value = fieldDescriptor.Value; item.Editing.BeginEdit(); item.Fields[Data.ProjectFieldId].Value = value; item.Editing.EndEdit(); String refresh = String.Format("item:refreshchildren(id={0})", item.Parent.ID); Sitecore.Context.ClientPage.SendMessage(this, refresh); } } else { SheerResponse.ShowModalDialog(GetOptions(args, args.Parameters).ToUrlString().ToString(), "720", "320", 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 })); } } }
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); } }
/// <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); } }
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 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) { 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(); } } }
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 override void OnInit(System.EventArgs e) { UrlHandle handle = UrlHandle.Get(); string categoriesValue = handle["categories"]; categories.Value = categoriesValue.Replace(@"//", @"/"); base.OnInit(e); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Context.ClientPage.IsEvent && !Context.ClientPage.IsPostBack) { var handle = UrlHandle.Get(); var path = handle["path"]; if (path == null) { var uri = Sitecore.Data.ItemUri.ParseQueryString(Context.ContentDatabase); var item = Database.GetItem(uri); if (item != null) { ItemUri.Attributes["value"] = item.Uri.ToString(); } } else { ItemUri.Attributes["value"] = path; } Versioned.Attributes["value"] = handle["versioned"]; LanguageName.Attributes["value"] = handle["language"]; Overwrite.Attributes["value"] = handle["overwrite"]; Unpack.Attributes["value"] = handle["unpack"]; var title = handle["te"]; if (!string.IsNullOrEmpty(title)) { DialogHeader.Text = WebUtil.SafeEncode(title); } var icon = handle["ic"]; if (!string.IsNullOrEmpty(icon)) { DialogIcon.Src = WebUtil.SafeEncode(icon); DialogIcon.Visible = true; } var message = handle["ds"]; if (!string.IsNullOrEmpty(message)) { DialogDescription.Text = WebUtil.SafeEncode(message); } var ok = handle["ok"]; if (!string.IsNullOrEmpty(ok)) { OKButton.Header = WebUtil.SafeEncode(ok); } var cancel = handle["cancel"]; if (!string.IsNullOrEmpty(cancel)) { CancelButton.Header = WebUtil.SafeEncode(cancel); } TypeResolver.Resolve <IUrlHandleWrapper>().DisposeHandle(handle); } }
/// <summary> /// Raises the load event. /// </summary> /// <param name="e"> /// The <see cref="System.EventArgs"/> instance containing the event data. /// </param> /// <remarks> /// This method notifies the server control that it should perform actions common to each HTTP /// request for the page it is associated with, such as setting up a database query. At this /// stage in the page lifecycle, server controls in the hierarchy are created and initialized, /// view state is restored, and form controls reflect client-side data. Use the IsPostBack /// property to determine whether the page is being loaded in response to a client postback, /// or if it is being loaded and accessed for the first time. /// </remarks> protected override void OnLoad([NotNull] EventArgs e) { Assert.ArgumentNotNull(e, "e"); this.CheckSecurity(); base.OnLoad(e); if (Context.ClientPage.IsEvent) { return; } var urlHandle = UrlHandle.Get(); var icon = urlHandle["ic"]; if (!string.IsNullOrEmpty(icon)) { this.Dialog["Icon"] = icon; } var header = WebUtil.SafeEncode(urlHandle["he"]); if (header.Length > 0) { this.Dialog["Header"] = header; } var text = WebUtil.SafeEncode(urlHandle["txt"]); if (text.Length > 0) { this.Dialog["Text"] = text; } var button = WebUtil.SafeEncode(urlHandle["btn"]); if (button.Length > 0) { this.Dialog["OKButton"] = button; } var filter = urlHandle["flt"]; var blobsList = LogStorageManager.ListBlobs(filter); foreach (var blob in blobsList) { var item = new ListviewItem(); this.FileLister.Controls.Add(item); item.ID = Control.GetUniqueID("I"); item.Header = blob.Uri.Segments.Last(); item.Icon = "Applications/16x16/document.png"; item.ServerProperties["Blob"] = blob.Name; item.ColumnValues["size"] = MainUtil.FormatSize(blob.Properties.Length); item.ColumnValues["modified"] = blob.Properties.LastModified.HasValue ? blob.Properties.LastModified.Value.LocalDateTime : DateTime.Now; } }
public bool DisposeHandle(UrlHandle handle) { if (string.IsNullOrEmpty(handle.Handle) || WebUtil.GetSessionValue(handle.Handle) == null) { return(false); } WebUtil.RemoveSessionValue(handle.Handle); return(true); }
/// <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> /// Reads the root parameter and update root placeholders. /// </summary> private void ReadQueryParamsAndUpdatePlaceholders() { Item item; string queryString = WebUtil.GetQueryString("ro"); string str = WebUtil.GetQueryString("hdl"); if (!string.IsNullOrEmpty(queryString) && queryString != "{0}") { this.TreeView.Parameters["RootItem"] = queryString; } this.InsertAnchorButton.Parameters["Click"] = string.Format(this.InsertAnchorButton.Parameters["Click"], WebUtility.UrlEncode(queryString), WebUtility.UrlEncode(str)); this.InsertEmailButton.Parameters["Click"] = string.Format(this.InsertEmailButton.Parameters["Click"], WebUtility.UrlEncode(queryString), WebUtility.UrlEncode(str)); this.ListViewToggleButton.Parameters["Click"] = string.Format(this.ListViewToggleButton.Parameters["Click"], WebUtility.UrlEncode(queryString), WebUtility.UrlEncode(str)); bool empty = str != string.Empty; string empty1 = string.Empty; if (empty) { empty1 = UrlHandle.Get()["va"]; } if (empty1 == string.Empty) { return; } XElement xElement = XElement.Parse(empty1); if (InsertLinkDialogTree.GetXmlAttributeValue(xElement, "linktype") == "internal") { string xmlAttributeValue = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "id"); if (string.IsNullOrWhiteSpace(xmlAttributeValue)) { return; } if (string.IsNullOrEmpty(queryString)) { item = null; } else { item = ClientHost.Databases.ContentDatabase.GetItem(queryString); } Item rootItem = item ?? ClientHost.Databases.ContentDatabase.GetRootItem(); Item mediaItemFromQueryString = SelectMediaDialog.GetMediaItemFromQueryString(xmlAttributeValue); if (rootItem != null && mediaItemFromQueryString != null && mediaItemFromQueryString.Paths.LongID.StartsWith(rootItem.Paths.LongID)) { this.TreeView.Parameters["PreLoadPath"] = string.Concat(rootItem.ID, mediaItemFromQueryString.Paths.LongID.Substring(rootItem.Paths.LongID.Length)); } this.TextDescription.Parameters["Text"] = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "text"); this.AltText.Parameters["Text"] = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "title"); this.StyleClass.Parameters["Text"] = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "class"); this.QueryString.Parameters["Text"] = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "querystring"); this.CustomAttributes.Parameters["Text"] = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "customattributes"); this.AnchorText.Parameters["Text"] = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "anchor"); this.SetupTargetDropbox(xElement); } }
private void SetValue(string value) { UrlHandle urlHandle = UrlHandle.Get(); string itemId = urlHandle["itemId"]; string fieldId = urlHandle["fieldId"]; string sessionKey = string.Format("{0}_{1}_classification", itemId, fieldId); result.Value = value; WebUtil.SetSessionValue(sessionKey, value); }
/// <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); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (!AjaxScriptManager.IsEvent) { UrlHandle handle = UrlHandle.Get(); Value = handle["value"]; RenderTaxonomies(); } }
/// <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 name of the BLOB from the specified handle. /// </summary> /// <param name="blobHandle">The blob handle.</param> /// <returns></returns> public static string GetBlobName(string blobHandle) { Assert.ArgumentNotNull(blobHandle, "blobHandle"); var parameters = new NameValueCollection { { "blob", blobHandle } }; return(UrlHandle.Get(new UrlString(parameters), "blob")["blob"]); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Sitecore.Context.ClientPage.IsEvent) { UrlHandle urlHandle = UrlHandle.Get(); categories.Value = urlHandle["categories"]; conflictcatigory.Value = urlHandle["conflictcat"]; tagsBox.InnerHtml = urlHandle["rendered"]; SheerResponse.Eval("SaveResult();"); } }
/// <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 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!"); } } }
protected override void OnLoad(EventArgs e) { Assert.ArgumentNotNull(e, "e"); base.OnLoad(e); UrlHandle handle = UrlHandle.Get(); base.Header = handle["templatename"]; var cSharpFormat = new CSharpFormat(); string t4TemplateClassFormated = cSharpFormat.FormatCode(handle["class"]); OutputDiv.InnerHtml = t4TemplateClassFormated; }
public bool TryGetHandle(out UrlHandle handle) { try { handle = UrlHandle.Get(); } catch { handle = null; return(false); } return(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); }
/// <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 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 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; } }
/// <summary> /// Gets non-empty value from UrlHandle. /// /// </summary> /// <param name="handle">The handle.</param><param name="key">The key.</param> /// <returns/> /// /// <remarks> /// Throws AccessDeniedException if value is empty. /// </remarks> internal static string UrlHandleNonEmptyValue(UrlHandle handle, string key) { Assert.ArgumentNotNull((object)handle, "handle"); Assert.ArgumentNotNull((object)key, "key"); string str = handle[key]; Assert.HasAccess(!string.IsNullOrEmpty(str), "Application access denied."); return str; }
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 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 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(); } }
/// <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 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(); } }
/// <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> /// 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); } }
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()); }
// 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(); } } }
/// <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> /// 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 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 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 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 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); } }
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 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(); } }
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(); } }