/// <summary> /// Gets the field value. /// /// </summary> /// <param name="args">The arguments.</param><contract><requires name="args" condition="none"/></contract> public new void Process(RenderFieldArgs args) { if (args.FieldTypeKey != "image with cropping") { return; } ImageRenderer renderer = CreateRenderer(); renderer.Item = args.Item; renderer.FieldName = args.FieldName; XmlValue xmlValue = new XmlValue(args.FieldValue, "image"); string width = xmlValue.GetAttribute("width"); string height = xmlValue.GetAttribute("height"); if (string.IsNullOrWhiteSpace(width) || string.IsNullOrWhiteSpace(height)) { string cropRegion = xmlValue.GetAttribute("cropregion"); try { var coordinates = CustomMediaManager.ConvertToIntArray(cropRegion); if ((coordinates[2] - coordinates[0] + coordinates[3] + coordinates[1]) > 0) { xmlValue.SetAttribute("width", (coordinates[2] - coordinates[0]).ToString()); xmlValue.SetAttribute("height", (coordinates[3] - coordinates[1]).ToString()); renderer.FieldValue = xmlValue.ToString(); } } catch (Exception ex) { Log.Error(ex.Message, ex, this); } } if (renderer.FieldValue == null) { renderer.FieldValue = args.FieldValue; } renderer.Parameters = args.Parameters; args.WebEditParameters.AddRange(args.Parameters); RenderFieldResult renderFieldResult = renderer.Render(); args.Result.FirstPart = renderFieldResult.FirstPart; args.Result.LastPart = renderFieldResult.LastPart; args.DisableWebEditContentEditing = true; args.DisableWebEditFieldWrapping = true; args.WebEditClick = "return Sitecore.WebEdit.editControl($JavascriptParameters, 'webedit:chooseimage')"; }
public void Process(RenderFieldArgs args) { if (args.FieldTypeKey == "classification") { string temp = RenderToHtml(args); RenderFieldResult result = new RenderFieldResult(temp); args.Result.FirstPart = result.FirstPart; args.Result.LastPart = result.LastPart; args.DisableWebEditContentEditing = false; args.DisableWebEditContentSelecting = false; } }
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(); } }
/// <summary> /// Gets the field value. /// </summary> /// <param name="args">The arguments.</param> public void Process(RenderFieldArgs args) { if (!SkipProcessor(args)) { SetWebEditParameters(args, "class", "text", "target", "haschildren"); if (!string.IsNullOrEmpty(args.Parameters["text"])) { args.WebEditParameters["text"] = args.Parameters["text"]; } UltraLinkRenderer linkRenderer = CreateRenderer(args.Item); linkRenderer.FieldName = args.FieldName; linkRenderer.FieldValue = args.FieldValue; linkRenderer.Parameters = args.Parameters; linkRenderer.RawParameters = args.RawParameters; args.DisableWebEditFieldWrapping = true; args.DisableWebEditContentEditing = true; RenderFieldResult renderFieldResult = linkRenderer.Render(); args.Result.FirstPart = renderFieldResult.FirstPart; args.Result.LastPart = renderFieldResult.LastPart; } }
/// <summary> /// Gets the field value. /// /// </summary> /// <param name="args">The arguments.</param><contract><requires name="args" condition="none"/></contract> public void Process(RenderFieldArgs args) { if (args.FieldTypeKey != "image") { return; } ImageRendererEx renderer = CreateRenderer(); renderer.Item = args.Item; renderer.FieldName = args.FieldName; renderer.FieldValue = args.FieldValue; renderer.Parameters = args.Parameters; args.WebEditParameters.AddRange(args.Parameters); renderer.Parameters.Add("la", args.Item.Language.Name); RenderFieldResult renderFieldResult = renderer.Render(); args.Result.FirstPart = renderFieldResult.FirstPart; args.Result.LastPart = renderFieldResult.LastPart; args.DisableWebEditContentEditing = true; args.DisableWebEditFieldWrapping = true; args.WebEditClick = "return Sitecore.WebEdit.editControl($JavascriptParameters, 'webedit:chooseimage')"; }
/// <summary> /// Processes render field pipline. /// </summary> /// <param name="args"> /// The render field argument list. /// </param> public new void Process(RenderFieldArgs args) { if (args.FieldTypeKey != "image") { return; } MediaObject mediaObject = new MediaObject { // Database = Context.Database.Name, // DataSource = args.Item.ID.ToString(), Item = args.Item, FieldName = args.FieldName, FieldValue = args.FieldValue, RenderParameters = args.Parameters }; args.WebEditParameters.AddRange(args.Parameters); RenderFieldResult result = new RenderFieldResult(HtmlUtil.RenderControl(mediaObject)); args.Result.FirstPart = result.FirstPart; args.Result.LastPart = result.LastPart; args.DisableWebEditContentEditing = true; args.WebEditClick = "return Sitecore.WebEdit.editControl($JavascriptParameters, 'webedit:chooseimage')"; }
public void Process([NotNull] RenderFieldArgs args) { if (args.RenderParameters.ContainsKey(LinkFieldWrapperOptions.OptionsParameterName)) { var renderer = new Renderers.LinkRenderer(args.Item) { InnerHTML = args.RenderParameters[LinkFieldWrapperOptions.InnerHtmlParameterName], CSS = args.RenderParameters[LinkFieldWrapperOptions.CssParameterName], IncludeContentEditorCss = ConvertParameterToBool(args.RenderParameters[LinkFieldWrapperOptions.EditorCssParameterName]), DisplayHrefByDefault = ConvertParameterToBool(args.RenderParameters[LinkFieldWrapperOptions.HrefDefaultParameterName]), FieldName = args.FieldName, FieldValue = args.FieldValue, Parameters = args.Parameters, RawParameters = args.RawParameters }; args.DisableWebEditContentEditing = true; RenderFieldResult result = renderer.Render(); args.Result.FirstPart = result.FirstPart; args.Result.LastPart = result.LastPart; } }
/// <summary> /// Processes render field pipline. /// </summary> /// <param name="args"> /// The render field argument list. /// </param> public new void Process(RenderFieldArgs args) { if (args.FieldTypeKey != "image") { return; } MediaObject mediaObject = new MediaObject { // Database = Context.Database.Name, // DataSource = args.Item.ID.ToString(), Item = args.Item, FieldName = args.FieldName, FieldValue = args.FieldValue, RenderParameters = args.Parameters }; args.WebEditParameters.AddRange(args.Parameters); RenderFieldResult result = new RenderFieldResult(HtmlUtil.RenderControl(mediaObject)); args.Result.FirstPart = result.FirstPart; args.Result.LastPart = result.LastPart; args.DisableWebEditContentEditing = true; args.WebEditClick = "return Sitecore.WebEdit.editControl($JavascriptParameters, 'webedit:chooseimage')"; }