/// <summary> /// Constructor /// </summary> protected Report() { HtmlStringWriter = new StringWriter(); HtmlWriter = new HtmlTextWriterEx(HtmlStringWriter); Status = ReportStatus.None; CanAsync = true; }
public override string Process(string[] texts, Nparams attrib3) { if (texts.Length < 1) { throw new InvalidOperationException(); } var attrib = Nparams.Parse(texts[0].Split(';')); var videoBlock = new VideoBlock() { ID = attrib.Slice("id", "Video" + CoreEx.GetNextID()), }; if (attrib.Exists("uri")) { videoBlock.Uri = attrib.Slice <string>("uri"); } if (attrib.Exists("width")) { videoBlock.Width = new Unit(attrib.Slice <string>("width")); } if (attrib.Exists("height")) { videoBlock.Height = new Unit(attrib.Slice <string>("height")); } string responseText; HtmlTextWriterEx.RenderControl(videoBlock, out responseText); return(responseText); }
protected internal virtual void AddAttribute(HtmlBuilder b, HtmlTextWriterEx w, HtmlTag tag, Nparams args) { bool isSelected; string appendStyle; bool isStyleDefined; string appendClass; bool isClassDefined; if (args != null) { isSelected = args.Slice <bool>("selected"); appendStyle = args.Slice <string>("appendStyle"); isStyleDefined = args.ContainsKey("style"); appendClass = args.Slice <string>("appendClass"); isClassDefined = args.ContainsKey("class"); if (tag == HtmlTag.Tr) { IsTrHeader = args.Slice <bool>("header"); } if (args.HasValue()) { b.AddAttribute(args, null); } } else { isSelected = false; appendStyle = string.Empty; isStyleDefined = false; appendClass = string.Empty; isClassDefined = false; } // only apply remaining to td/th if ((tag == HtmlTag.Td) || (tag == HtmlTag.Th)) { // style if (!isStyleDefined) { string effectiveStyle; if ((isSelected) && (!string.IsNullOrEmpty(SelectedStyle))) { effectiveStyle = (appendStyle.Length == 0 ? SelectedStyle : SelectedStyle + " " + appendStyle); w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, effectiveStyle); } else if (!string.IsNullOrEmpty(AlternateStyle)) { effectiveStyle = (appendStyle.Length == 0 ? AlternateStyle : AlternateStyle + " " + appendStyle); switch (AlternateOrientation) { case TableAlternateOrientation.Column: if ((((ColumnIndex - ColumnOffset - 1 + ColumnPitch) / ColumnPitch) % 2) == 0) { w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, effectiveStyle); } else if (appendStyle.Length > 0) { w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, appendStyle); } break; case TableAlternateOrientation.Row: if ((((RowIndex - RowOffset - 1 + RowPitch) / RowPitch) % 2) == 0) { w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, effectiveStyle); } else if (appendStyle.Length > 0) { w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, appendStyle); } break; default: throw new InvalidOperationException(); } } else if (appendStyle.Length > 0) { w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, appendStyle); } } // class if (!isClassDefined) { string effectiveClass; if ((isSelected) && (!string.IsNullOrEmpty(SelectedClass))) { effectiveClass = (appendClass.Length == 0 ? SelectedClass : SelectedClass + " " + appendClass); w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, effectiveClass); } else if (!string.IsNullOrEmpty(AlternateClass)) { effectiveClass = (appendClass.Length == 0 ? AlternateClass : AlternateClass + " " + appendClass); switch (AlternateOrientation) { case TableAlternateOrientation.Column: if ((((ColumnIndex - ColumnOffset - 1 + ColumnPitch) / ColumnPitch) % 2) == 0) { w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, effectiveClass); } else if (appendClass.Length > 0) { w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, appendClass); } break; case TableAlternateOrientation.Row: if ((((RowIndex - RowOffset - 1 + RowPitch) / RowPitch) % 2) == 0) { w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, effectiveClass); } else if (appendClass.Length > 0) { w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, appendClass); } break; default: throw new InvalidOperationException(); } } else if (appendClass.Length > 0) { w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, appendClass); } } } }
/// <summary> /// Adds the attribute. /// </summary> /// <param name="b">The b.</param> /// <param name="w">The w.</param> /// <param name="tag">The tag.</param> /// <param name="args">The args.</param> protected internal virtual void AddAttribute(HtmlBuilder b, HtmlTextWriterEx w, HtmlTag tag, Nparams args) { bool isSelected; string appendStyle; bool isStyleDefined; string appendClass; bool isClassDefined; if (args != null) { isSelected = args.Slice<bool>("selected"); appendStyle = args.Slice<string>("appendStyle"); isStyleDefined = args.ContainsKey("style"); appendClass = args.Slice<string>("appendClass"); isClassDefined = args.ContainsKey("class"); if (tag == HtmlTag.Tr) IsTrHeader = args.Slice<bool>("header"); if (args.HasValue()) b.AddAttribute(args, null); } else { isSelected = false; appendStyle = string.Empty; isStyleDefined = false; appendClass = string.Empty; isClassDefined = false; } // only apply remaining to td/th if (tag == HtmlTag.Td || tag == HtmlTag.Th) { // style if (!isStyleDefined) { string effectiveStyle; if (isSelected && !string.IsNullOrEmpty(SelectedStyle)) { effectiveStyle = (appendStyle.Length == 0 ? SelectedStyle : SelectedStyle + " " + appendStyle); w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, effectiveStyle); } else if (!string.IsNullOrEmpty(AlternateStyle)) { effectiveStyle = (appendStyle.Length == 0 ? AlternateStyle : AlternateStyle + " " + appendStyle); switch (AlternateOrientation) { case TableAlternateOrientation.Column: if ((((ColumnIndex - ColumnOffset - 1 + ColumnPitch) / ColumnPitch) % 2) == 0) w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, effectiveStyle); else if (appendStyle.Length > 0) w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, appendStyle); break; case TableAlternateOrientation.Row: if ((((RowIndex - RowOffset - 1 + RowPitch) / RowPitch) % 2) == 0) w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, effectiveStyle); else if (appendStyle.Length > 0) w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, appendStyle); break; default: throw new InvalidOperationException(); } } else if (appendStyle.Length > 0) w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Style, appendStyle); } // class if (!isClassDefined) { string effectiveClass; if (isSelected && !string.IsNullOrEmpty(SelectedClass)) { effectiveClass = (appendClass.Length == 0 ? SelectedClass : SelectedClass + " " + appendClass); w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, effectiveClass); } else if (!string.IsNullOrEmpty(AlternateClass)) { effectiveClass = (appendClass.Length == 0 ? AlternateClass : AlternateClass + " " + appendClass); switch (AlternateOrientation) { case TableAlternateOrientation.Column: if ((((ColumnIndex - ColumnOffset - 1 + ColumnPitch) / ColumnPitch) % 2) == 0) w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, effectiveClass); else if (appendClass.Length > 0) w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, appendClass); break; case TableAlternateOrientation.Row: if ((((RowIndex - RowOffset - 1 + RowPitch) / RowPitch) % 2) == 0) w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, effectiveClass); else if (appendClass.Length > 0) w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, appendClass); break; default: throw new InvalidOperationException(); } } else if (appendClass.Length > 0) w.AddAttributeIfUndefined(HtmlTextWriterAttribute.Class, appendClass); } } }