protected internal override void Render(HtmlTextWriter writer) {
     // Render as a label in designer for accessibility
     if (RenderAsLabel) {
         // Total hack for accessibility of labels for login controls!
         writer.Write("<asp:label runat=\"server\" AssociatedControlID=\"");
         writer.Write(_for.ID);
         writer.Write("\" ID=\"");
         writer.Write(_for.ID);
         writer.Write("Label\">");
         writer.Write(Text);
         writer.Write("</asp:label>");
     }
     else {
         writer.AddAttribute(HtmlTextWriterAttribute.For, _for.ClientID);
         writer.RenderBeginTag(HtmlTextWriterTag.Label);
         base.Render(writer);
         writer.RenderEndTag();
     }
 }
Example #2
0
File: Panel.cs Project: LevNNN/mono
		protected override void AddAttributesToRender (HtmlTextWriter w)
		{
			base.AddAttributesToRender (w);
			
			string image = BackImageUrl;
			if (image != "") {
				image = ResolveClientUrl (image);
#if !NET_2_0 // see HtmlTextWriter.WriteStyleAttribute(string, string, bool) 
				image = String.Concat ("url(", image, ")");
#endif
				w.AddStyleAttribute (HtmlTextWriterStyle.BackgroundImage, image);
			}

			if (!String.IsNullOrEmpty (DefaultButton) && Page != null) {
				Control button = FindControl (DefaultButton);
				if (button == null || !(button is IButtonControl))
					throw new InvalidOperationException (String.Format ("The DefaultButton of '{0}' must be the ID of a control of type IButtonControl.", ID));

				Page.ClientScript.RegisterWebFormClientScript ();

				w.AddAttribute ("onkeypress",
						"javascript:return " + Page.WebFormScriptReference + ".WebForm_FireDefaultButton(event, '" + button.ClientID + "')");
			}

			if (Direction != ContentDirection.NotSet) {
				w.AddAttribute (HtmlTextWriterAttribute.Dir, Direction == ContentDirection.RightToLeft ? "rtl" : "ltr", false);
			}

			switch (ScrollBars) {
			case ScrollBars.Auto:
				w.AddStyleAttribute (HtmlTextWriterStyle.Overflow, "auto");
				break;
			case ScrollBars.Both:
				w.AddStyleAttribute (HtmlTextWriterStyle.Overflow, "scroll");
				break;
			case ScrollBars.Horizontal:
				w.AddStyleAttribute (HtmlTextWriterStyle.OverflowX, "scroll");
				break;
			case ScrollBars.Vertical:
				w.AddStyleAttribute (HtmlTextWriterStyle.OverflowY, "scroll");
				break;
			}


			if (!Wrap) {
				w.AddStyleAttribute (HtmlTextWriterStyle.WhiteSpace, "nowrap");
			}

			string align = "";

			switch (HorizontalAlign) {
			case HorizontalAlign.Center: align = "center"; break;
			case HorizontalAlign.Justify: align = "justify"; break;
			case HorizontalAlign.Left: align = "left"; break;
			case HorizontalAlign.Right: align = "right"; break;
			}

			if (align != "")
				w.AddStyleAttribute (HtmlTextWriterStyle.TextAlign, align);
		}
Example #3
0
		protected override void AddAttributesToRender (HtmlTextWriter w)
		{
			Page page = Page;
			if (page != null)
				page.VerifyRenderingInServerForm (this);

			base.AddAttributesToRender (w);
			bool enabled = IsEnabled;
			string onclick = OnClientClick;
			onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick);
			if (HasAttributes && Attributes ["onclick"] != null) {
				onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick + Attributes ["onclick"]);
				Attributes.Remove ("onclick");
			}

			if (onclick.Length > 0)
				w.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick);
			
			if (enabled && page != null) {
				PostBackOptions options = GetPostBackOptions ();
				string href = page.ClientScript.GetPostBackEventReference (options, true);
				w.AddAttribute (HtmlTextWriterAttribute.Href, href);
			}
			
			AddDisplayStyleAttribute (w);
		}
Example #4
0
		protected internal override void RenderChildren (HtmlTextWriter writer)
		{
			base.RenderChildren (writer);
			if (title == null) {
				writer.RenderBeginTag (HtmlTextWriterTag.Title);
				if (!String.IsNullOrEmpty (titleText))
					writer.Write (titleText);
				writer.RenderEndTag ();
			}
#if NET_4_0
			if (descriptionMeta == null && descriptionText != null) {
				writer.AddAttribute ("name", "description");
				writer.AddAttribute ("content", HttpUtility.HtmlAttributeEncode (descriptionText));
				writer.RenderBeginTag (HtmlTextWriterTag.Meta);
				writer.RenderEndTag ();
			}

			if (keywordsMeta == null && keywordsText != null) {
				writer.AddAttribute ("name", "keywords");
				writer.AddAttribute ("content", HttpUtility.HtmlAttributeEncode (keywordsText));
				writer.RenderBeginTag (HtmlTextWriterTag.Meta);
				writer.RenderEndTag ();
			}
#endif
			if (styleSheet != null)
				styleSheet.Render (writer);
		}
Example #5
0
 /// <summary>
 /// Renders the hidden.
 /// </summary>
 /// <param name="w">The w.</param>
 protected void RenderHidden(HtmlTextWriter w)
 {
     w.AddAttribute(HtmlTextWriterAttribute.Type, "hidden");
     w.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
     w.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
     w.AddAttribute(HtmlTextWriterAttribute.Value, Text);
     w.RenderBeginTag(HtmlTextWriterTag.Input);
     w.RenderEndTag();
 }
		protected override void AddAttributesToRender(HtmlTextWriter writer)
		{
			base.AddAttributesToRender(writer);
			if(RenderUplevel)
			{
				writer.AddAttribute("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid");
				writer.AddAttribute("initialvalue", InitialValue);
			}
		}
                /// <summary>
                /// The design time generated HTML for the control.
                /// </summary>
                /// <returns>A string containing the HTML rendering.</returns>
                public override string GetDesignTimeHtml()
                {
                    // Extremely simple design time rendering!
                    // will work on something better sooner or later.
                    // This acts as a placeholder.
                    Web.PlotSurface2D plot = (Web.PlotSurface2D)Component;

                    int xs = Convert.ToInt32(plot.Width.Value);
                    if ( xs < 1 ) return "";
                    int ys = Convert.ToInt32(plot.Height.Value);
                    if ( ys < 1 ) return "";

                    StringWriter sw = new StringWriter();
                    HtmlTextWriter output= new HtmlTextWriter(sw);
                    output.AddAttribute("border",plot.BorderWidth.ToString());
                    output.AddAttribute("borderColor",plot.BorderColor.ToKnownColor().ToString());
                    output.AddAttribute("cellSpacing","0");
                    output.AddAttribute("cellPadding","0");
                    output.AddAttribute("width",xs.ToString());
                    output.RenderBeginTag("table ");
                    output.RenderBeginTag("tr");
                    output.AddAttribute("vAlign","center");
                    output.AddAttribute("align","middle");
                    output.AddAttribute("height",ys.ToString());
                    output.RenderBeginTag("td");
                    output.RenderBeginTag("P");
                    output.Write("PlotSurface2D:" + plot.Title);
                    output.RenderEndTag();
                    output.RenderEndTag();
                    output.RenderEndTag();
                    output.RenderEndTag();
                    output.Flush();
                    return sw.ToString();
                }
Example #8
0
		protected override void AddAttributesToRender (HtmlTextWriter w)
		{
			base.AddAttributesToRender (w);
			AddDisplayStyleAttribute (w);
			if (!IsEnabled)
				return;
			// add attributes - only if they're not empty
			string t = Target;
			string s = NavigateUrl;
			if (s.Length > 0)
				w.AddAttribute (HtmlTextWriterAttribute.Href, ResolveClientUrl (s));
			if (t.Length > 0)
				w.AddAttribute (HtmlTextWriterAttribute.Target, t);
		}
Example #9
0
		protected override void AddAttributesToRender (HtmlTextWriter w)
		{
			if (RenderUplevel) {
#if NET_2_0
				RegisterExpandoAttribute (ClientID, "evaluationfunction", "RequiredFieldValidatorEvaluateIsValid");
				RegisterExpandoAttribute (ClientID, "initialvalue", InitialValue, true);
#else
				w.AddAttribute ("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid", false);
				w.AddAttribute ("initialvalue", InitialValue);
#endif
			}

			base.AddAttributesToRender (w);
		}
		protected override void AddAttributesToRender (HtmlTextWriter w)
		{
			if (RenderUplevel) {
#if NET_2_0
				if (Page!=null){
					RegisterExpandoAttribute (ClientID, "type", Type.ToString ());

					switch (Type) {
					case ValidationDataType.Date:
						DateTimeFormatInfo dateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat;
						string pattern = dateTimeFormat.ShortDatePattern;
						string dateorder = (pattern.StartsWith ("y", true, Helpers.InvariantCulture) ? "ymd" : (pattern.StartsWith ("m", true, Helpers.InvariantCulture) ? "mdy" : "dmy"));
						RegisterExpandoAttribute (ClientID, "dateorder", dateorder);
						RegisterExpandoAttribute (ClientID, "cutoffyear", dateTimeFormat.Calendar.TwoDigitYearMax.ToString ());
						break;
					case ValidationDataType.Currency:
						NumberFormatInfo numberFormat = CultureInfo.CurrentCulture.NumberFormat;
						RegisterExpandoAttribute (ClientID, "decimalchar", numberFormat.CurrencyDecimalSeparator, true);
						RegisterExpandoAttribute (ClientID, "groupchar", numberFormat.CurrencyGroupSeparator, true);
						RegisterExpandoAttribute (ClientID, "digits", numberFormat.CurrencyDecimalDigits.ToString());
						RegisterExpandoAttribute (ClientID, "groupsize", numberFormat.CurrencyGroupSizes [0].ToString ());
						break;
					}
				}
#else
				w.AddAttribute ("datatype", Type.ToString());
#endif
			}

			base.AddAttributesToRender (w);
		}
    protected override void Render(HtmlTextWriter writer)
    {
        //Ugly hack time..
        //Placeholder will be the parent control when the user is in wysiwyg mode
        //We don't want to close any divs if we're being rendered within the umbraco content editor.
        if (!(Parent.TemplateSourceDirectory.EndsWith("umbraco")) && EscapeUserContentBlock)
        {
            writer.WriteLine("</div>");
        }

        //Render in Macro div
        if (RenderInMacroDiv) {
            //Declare this a macro tag
            writer.AddAttribute("class", "macro");
            writer.RenderBeginTag("div");
        }

        base.Render(writer);

        if (RenderInMacroDiv) {
            writer.RenderEndTag();
        }

        if (!(Parent.TemplateSourceDirectory.EndsWith("umbraco")) && EscapeUserContentBlock)
        {
            //Re-open the macro
            writer.WriteLine("<div class='user-content'>");
        }
    }
Example #12
0
		protected override void AddAttributesToRender (HtmlTextWriter w)
		{
			if (RenderUplevel) {
#if NET_2_0
				RegisterExpandoAttribute (ClientID, "evaluationfunction", "RegularExpressionValidatorEvaluateIsValid");
				if (ValidationExpression.Length > 0)
					RegisterExpandoAttribute (ClientID, "validationexpression", ValidationExpression, true);
#else
				w.AddAttribute ("evaluationfunction", "RegularExpressionValidatorEvaluateIsValid", false);
				if (ValidationExpression != "")
					w.AddAttribute ("validationexpression", ValidationExpression);
#endif
			}

			base.AddAttributesToRender (w);
		}
		protected override void AddAttributesToRender (HtmlTextWriter writer) {

			ControlStyle.CopyFrom (_container.ControlStyle);
			writer.AddAttribute (HtmlTextWriterAttribute.Id, _container.ClientID);

			base.AddAttributesToRender (writer);
		}
Example #14
0
		protected override void AddAttributesToRender (HtmlTextWriter w)
		{
			base.AddAttributesToRender (w);
			AddDisplayStyleAttribute (w);
			if (!IsEnabled)
				return;
			// add attributes - only if they're not empty
			string t = Target;
			string s = NavigateUrl;
			if (s.Length > 0)
#if TARGET_J2EE
				w.AddAttribute (HtmlTextWriterAttribute.Href, ResolveClientUrl (s, String.Compare (t, "_blank", StringComparison.InvariantCultureIgnoreCase) != 0));
#else
				w.AddAttribute (HtmlTextWriterAttribute.Href, ResolveClientUrl (s));
#endif
			if (t.Length > 0)
				w.AddAttribute (HtmlTextWriterAttribute.Target, t);
		}
        /// <devdoc>
        /// <para>Adds header cell attributes to the list of attributes to render.</para>
        /// </devdoc>
        protected override void AddAttributesToRender(HtmlTextWriter writer) {
            base.AddAttributesToRender(writer);

            TableHeaderScope scope = Scope;
            if (scope != TableHeaderScope.NotSet) {
                if (scope == TableHeaderScope.Column) {
                    writer.AddAttribute(HtmlTextWriterAttribute.Scope, "col");
                }
                else {
                    writer.AddAttribute(HtmlTextWriterAttribute.Scope, "row");
                }
            }

            String abbr = AbbreviatedText;
            if (!String.IsNullOrEmpty(abbr)) {
                writer.AddAttribute(HtmlTextWriterAttribute.Abbr, abbr);
            }
        }
Example #16
0
		protected override void AddAttributesToRender (HtmlTextWriter w)
		{
			Page page = Page;
			if (page != null)
				page.VerifyRenderingInServerForm (this);

			bool enabled = IsEnabled;
#if NET_2_0
			string onclick = OnClientClick;
			onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick);
			if (HasAttributes && Attributes ["onclick"] != null) {
				onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick + Attributes ["onclick"]);
				Attributes.Remove ("onclick");
			}

			if (onclick.Length > 0)
				w.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick);

			if (enabled && page != null) {
				PostBackOptions options = GetPostBackOptions ();
				string href = page.ClientScript.GetPostBackEventReference (options, true);
				w.AddAttribute (HtmlTextWriterAttribute.Href, href);
			}
			base.AddAttributesToRender (w);
			AddDisplayStyleAttribute (w);
#else
			base.AddAttributesToRender (w);
			if (page == null || !enabled)
				return;
			
			if (CausesValidation && page.AreValidatorsUplevel ()) {
				ClientScriptManager csm = new ClientScriptManager (page);
				w.AddAttribute (HtmlTextWriterAttribute.Href,
						String.Concat ("javascript:{if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); ",
							       csm.GetPostBackEventReference (this, String.Empty), ";}"));
			} else {
				w.AddAttribute (HtmlTextWriterAttribute.Href, page.ClientScript.GetPostBackClientHyperlink (this, String.Empty));
			}
#endif
		}
		protected override void AddAttributesToRender (HtmlTextWriter w)
		{
			if (RenderUplevel) {
#if NET_2_0
				RegisterExpandoAttribute (ClientID, "evaluationfunction", "CompareValidatorEvaluateIsValid");
				if (ControlToCompare.Length > 0)
					RegisterExpandoAttribute (ClientID, "controltocompare", GetControlRenderID (ControlToCompare));
				if (ValueToCompare.Length > 0)
					RegisterExpandoAttribute (ClientID, "valuetocompare", ValueToCompare, true);
				RegisterExpandoAttribute (ClientID, "operator", Operator.ToString ());
#else
				if (ControlToCompare != "")
					w.AddAttribute ("controltocompare", GetControlRenderID(ControlToCompare));
				if (ValueToCompare != "")
					w.AddAttribute ("valuetocompare", ValueToCompare);
				w.AddAttribute ("operator", Operator.ToString());
				w.AddAttribute ("evaluationfunction", "CompareValidatorEvaluateIsValid", false);
#endif
			}

			base.AddAttributesToRender (w);
		}
        /// <summary>
        /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled.
        /// Control is of the form:
        ///       <div id="divPanelDrawer" class="panel-drawer" runat="server">
        ///          <div class="drawer-content" style="display: none;">
        ///              PLACEHOLDER
        ///              <div class="row">
        ///                  <div class="col-md-6">
        ///                      <dl>
        ///                         <dt>Created By</dt>
        ///                         <dd>Admin Admin (6 days ago)</dd>
        ///                      </dl>
        ///                  </div>
        ///                  <div class="col-md-6">
        ///                      <dl>
        ///                         <dt>Last Modified By</dt>
        ///                         <dd>Admin Admin (46 minutes ago)</dd>
        ///                      </dl>
        ///                  </div>
        ///              </div>
        ///          </div>
        ///          <div class="drawer-pull js-drawerpull"><i class="fa fa-chevron-down" data-icon-closed="fa fa-chevron-down" data-icon-open="fa fa-chevron-up"></i></div>
        ///       </div>
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            if (this.Visible)
            {
                // panel-drawer div
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-drawer rock-panel-drawer " + CssClass + (Expanded ? "open" : string.Empty));
                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                // Hidden Field to track expansion
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "filter-expanded");
                _hfExpanded.RenderControl(writer);

                // drawer-content div
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "drawer-content");
                if (!Expanded)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
                }

                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                // PlaceHolder
                if (!string.IsNullOrEmpty(Placeholder))
                {
                    writer.Write(Placeholder);
                }

                if (_entityId != null)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);

                    // div col 6 with Created By
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    writer.RenderBeginTag(HtmlTextWriterTag.Dl);
                    writer.RenderBeginTag(HtmlTextWriterTag.Dt);
                    writer.Write("Created By");
                    writer.RenderEndTag();
                    writer.RenderBeginTag(HtmlTextWriterTag.Dd);
                    writer.Write(_createdAuditHtml);
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                    writer.RenderEndTag();

                    // div col 6 with Modified By
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    writer.RenderBeginTag(HtmlTextWriterTag.Dl);
                    writer.RenderBeginTag(HtmlTextWriterTag.Dt);
                    writer.Write("Last Modified By");
                    writer.RenderEndTag();
                    writer.RenderBeginTag(HtmlTextWriterTag.Dd);
                    writer.Write(_modifiedAuditHtml);
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                    writer.RenderEndTag();

                    writer.RenderEndTag(); // end row
                }

                writer.RenderEndTag(); // end drawer-content div

                // drawer-pull div
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "drawer-pull js-drawerpull");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, Expanded ? "fa fa-chevron-up" : "fa fa-chevron-down");

                writer.RenderBeginTag(HtmlTextWriterTag.I);

                writer.AddAttribute("data-icon-closed", "fa fa-chevron-down");
                writer.AddAttribute("data-icon-open", "fa fa-chevron-up");
                writer.RenderEndTag();
                writer.RenderEndTag(); // end drawer-pull div

                writer.RenderEndTag(); // end panel-drawer div
            }
        }
Example #19
0
        /// <summary>
        /// Renders the base control.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public virtual void RenderBaseControl(HtmlTextWriter writer)
        {
            Dictionary <string, string> definedValues = null;

            if (DefinedTypeId.HasValue)
            {
                definedValues = new Dictionary <string, string>();
                new DefinedValueService(new RockContext())
                .GetByDefinedTypeId(DefinedTypeId.Value)
                .ToList()
                .ForEach(v => definedValues.Add(v.Id.ToString(), v.Value));
            }
            else if (CustomValues != null)
            {
                definedValues = CustomValues;
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "value-list");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.WriteLine();

            _hfValue.RenderControl(writer);
            _hfValueDisableVrm.RenderControl(writer);

            writer.WriteLine();

            StringBuilder valueHtml = new StringBuilder();

            valueHtml.Append(@"<div class=""controls controls-row form-control-group"">");
            if (definedValues != null && definedValues.Any())
            {
                valueHtml.Append(@"<select class=""form-control input-width-lg js-value-list-input"">");
                foreach (var definedValue in definedValues)
                {
                    valueHtml.AppendFormat(@"<option value=""{0}"">{1}</option>", definedValue.Key, definedValue.Value);
                }
                valueHtml.Append(@"</select>");
            }
            else
            {
                valueHtml.AppendFormat(@"<input class=""form-control input-width-lg js-value-list-input"" type=""text"" placeholder=""{0}""></input>", ValuePrompt);
            }
            valueHtml.Append(@"<a href=""#"" class=""btn btn-sm btn-danger value-list-remove""><i class=""fa fa-times""></i></a></div>");

            var hfValueHtml = new HtmlInputHidden();

            hfValueHtml.AddCssClass("js-value-list-html");
            hfValueHtml.Value = valueHtml.ToString();
            hfValueHtml.RenderControl(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "value-list-rows");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.WriteLine();


            var values = this.Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).AsEnumerable();

            values = values.Select(s => HttpUtility.UrlDecode(s));

            foreach (string value in values)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "controls controls-row form-control-group");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.WriteLine();

                if (definedValues != null && definedValues.Any())
                {
                    DropDownList ddl = new DropDownList();
                    ddl.AddCssClass("form-control input-width-lg js-value-list-input");
                    ddl.DataTextField  = "Value";
                    ddl.DataValueField = "Key";
                    ddl.DataSource     = definedValues;
                    ddl.DataBind();
                    ddl.SelectedValue = value;
                    ddl.RenderControl(writer);
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-control input-width-lg js-value-list-input");
                    writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
                    writer.AddAttribute("placeholder", ValuePrompt);
                    writer.AddAttribute(HtmlTextWriterAttribute.Value, value);
                    writer.RenderBeginTag(HtmlTextWriterTag.Input);
                    writer.RenderEndTag();
                }

                writer.Write(" ");
                writer.WriteLine();

                // Write Remove Button
                writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "btn btn-sm btn-danger value-list-remove");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-times");
                writer.RenderBeginTag(HtmlTextWriterTag.I);
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.WriteLine();

                writer.RenderEndTag();
                writer.WriteLine();
            }

            writer.RenderEndTag();
            writer.WriteLine();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "actions");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            var addButtonCssClass = "btn btn-action btn-xs btn-square value-list-add";

            if (!this.Enabled)
            {
                addButtonCssClass += " aspNetDisabled disabled";
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, addButtonCssClass);

            writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-plus-circle");
            writer.RenderBeginTag(HtmlTextWriterTag.I);

            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.WriteLine();

            writer.RenderEndTag();
            writer.WriteLine();
        }
Example #20
0
        protected override void InternalRender(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "search");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "2");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "auto");
            string hint = GetHint();

            if (hint != String.Empty)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Title, hint, true);
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            bool first = true;

            foreach (SearchControl control in _searchControls)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    /*
                     * writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
                     * writer.RenderBeginTag(HtmlTextWriterTag.Td);
                     *  writer.AddAttribute(HtmlTextWriterAttribute.Src, "images/searcharrow.gif");
                     *  writer.AddAttribute(HtmlTextWriterAttribute.Class, "searcharrow");
                     *  writer.AddAttribute(HtmlTextWriterAttribute.Width, "16");
                     *  writer.AddAttribute(HtmlTextWriterAttribute.Height, "10");
                     *  writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                     *  writer.RenderBeginTag(HtmlTextWriterTag.Img);
                     *  writer.RenderEndTag();// IMG
                     * writer.RenderEndTag();// TD
                     */
                }

                writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
                writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, null);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                {
                    if (_titleAlignment != TitleAlignment.None)
                    {
                        writer.Write(HttpUtility.HtmlEncode(Session.RemoveAccellerator(control.GetTitle())));
                        if (_titleAlignment != TitleAlignment.Top)
                        {
                            Session.RenderDummyImage(writer, "10px", "0");
                        }
                    }

                    if (_titleAlignment == TitleAlignment.Top)
                    {
                        writer.Write("<br>");
                    }

                    control.Render(writer);
                }
                writer.RenderEndTag();//TD
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Align, "right");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            Session.RenderDummyImage(writer, "5", "1");
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "button");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
            writer.AddAttribute(HtmlTextWriterAttribute.Value, Strings.Get("FindButtonText"));
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "trigger");
            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, Session.GetActionLink(Session.Get(this).Context, ID + "Search"));

            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            writer.RenderEndTag();    // INPUT

            Session.RenderDummyImage(writer, "5", "1");

            writer.RenderEndTag();      // TD

            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "right");

            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "lookup");
                writer.AddAttribute(HtmlTextWriterAttribute.Src, "images/lookup.png");
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "ShowDropDown('" + ID + "SearchBy', GetParentTable(this))", true);
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            Session.RenderDummyImage(writer, "5", "1");
            writer.RenderEndTag();      // TD

            writer.RenderEndTag();      // TR
            writer.RenderEndTag();      // TABLE

            // Render search-by drop-down
            if (Source != null)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "searchby");
                writer.AddAttribute(HtmlTextWriterAttribute.Style, "display: none");
                writer.AddAttribute(HtmlTextWriterAttribute.Id, ID + "SearchBy");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Table);

                // Construct the a complete list of possible orderings including non-sparse keys
                Orders orders = new Orders();
                orders.AddRange(Source.TableVar.Orders);
                DAE.Schema.Order orderForKey;
                foreach (Key key in Source.TableVar.Keys)
                {
                    if (!key.IsSparse)
                    {
                        orderForKey = new Order(key);
                        if (!orders.Contains(orderForKey))
                        {
                            orders.Add(orderForKey);
                        }
                    }
                }

                foreach (Order order in orders)
                {
                    if (IsOrderVisible(order) && !order.Equals(Source.Order))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, String.Format("Submit('{0}?ActionID={1}&Sort={2}',event)", (string)Session.Get(this).Context.Session["DefaultPage"], ID + "SortBy", HttpUtility.UrlEncode(order.ToString())), true);
                        writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                        writer.AddAttribute("onmouseover", @"className='highlightedmenuitem'");
                        writer.AddAttribute("onmouseout", @"className=''");
                        writer.RenderBeginTag(HtmlTextWriterTag.Td);
                        writer.Write(HttpUtility.HtmlEncode(GetOrderTitle(order)));
                        writer.RenderEndTag();  // TD
                        writer.RenderEndTag();  // TR
                    }
                }


                writer.RenderEndTag();  // TABLE

                writer.RenderEndTag();  // DIV
            }
        }
Example #21
0
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{
			base.AddAttributesToRender (writer);
			if (writer != null) {
				object o = ViewState ["AbbreviatedText"];
				if (o != null)
					writer.AddAttribute (HtmlTextWriterAttribute.Abbr, (string) o);

				switch (Scope) {
				case TableHeaderScope.Column:
					writer.AddAttribute (HtmlTextWriterAttribute.Scope, "column", false);
					break;
				case TableHeaderScope.Row:
					writer.AddAttribute (HtmlTextWriterAttribute.Scope, "row", false);
					break;
				}

				string[] cats = CategoryText;
				if (cats.Length == 1) {
					writer.AddAttribute (HtmlTextWriterAttribute.Axis, cats [0]);
				} else if (cats.Length > 1) {
					StringBuilder sb = new StringBuilder ();
					for (int i=0; i < cats.Length - 1; i++) {
						sb.Append (cats [i]);
						sb.Append (",");
					}
					sb.Append (cats [cats.Length - 1]);
					writer.AddAttribute (HtmlTextWriterAttribute.Axis, sb.ToString ());
				}
			}
		}
Example #22
0
        private string GenReport(XmlDocument WcrXml)
        {
            string       path   = this.mainfrm.CurrentSite.DomainHost + "_Scan_Report_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".html";
            StringWriter writer = new StringWriter();
            string       result;

            try
            {
                HtmlTextWriter writer2 = new HtmlTextWriter(writer);
                writer2.RenderBeginTag(HtmlTextWriterTag.Html);
                writer2.RenderBeginTag(HtmlTextWriterTag.Head);
                writer2.Write("<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">");
                writer2.Write("<style>table{table-layout:fixed;overflow:hidden;}</style>");
                writer2.RenderBeginTag(HtmlTextWriterTag.Title);
                writer2.Write("Scan Report");
                writer2.RenderEndTag();
                writer2.RenderEndTag();
                writer2.RenderBeginTag(HtmlTextWriterTag.Body);
                writer2.RenderBeginTag(HtmlTextWriterTag.Center);
                writer2.Write("<br><br><br><br><br><br><br><br>");
                writer2.RenderBeginTag(HtmlTextWriterTag.H1);
                writer2.Write(this.mainfrm.CurrentSite.DomainHost + " Scan Report<br>");
                writer2.RenderEndTag();
                string str2 = this.txtReportAuthor.Text.Trim();
                if (!string.IsNullOrEmpty(str2))
                {
                    writer2.Write("<br><br><br><br><br><br><br><br>Made By " + str2);
                }
                writer2.Write("<br><br><br><br><br><br><br><br>Created By WebCruiser - Web Vulnerability Scanner<br>" + DateTime.Now.ToString("yyyy-MM-dd"));
                writer2.Write("<div style=\"page-break-after:always\">&nbsp;</div>");
                XmlNodeList list = WcrXml.SelectNodes("//ROOT/SiteSQLEnv/EnvRow");
                if (list.Count > 0)
                {
                    writer2.RenderBeginTag(HtmlTextWriterTag.H2);
                    writer2.Write("Basic Information");
                    writer2.RenderEndTag();
                    writer2.AddAttribute("border", "1");
                    writer2.AddAttribute("width", "640");
                    writer2.AddAttribute("cellspacing", "0");
                    writer2.AddAttribute("bordercolordark", "009099");
                    writer2.RenderBeginTag(HtmlTextWriterTag.Table);
                    string str3 = "";
                    foreach (XmlNode node in list)
                    {
                        string innerText = node.ChildNodes[1].InnerText;
                        if (string.IsNullOrEmpty(innerText))
                        {
                            innerText = "&nbsp;";
                        }
                        string str4 = str3;
                        str3 = string.Concat(new string[]
                        {
                            str4,
                            "<tr><td width=\"130\">",
                            node.ChildNodes[0].InnerText,
                            "</td><td> ",
                            innerText,
                            " </td></tr>"
                        });
                    }
                    writer2.Write(str3);
                    writer2.RenderEndTag();
                    writer2.Write("<br>");
                }
                XmlNodeList list2 = WcrXml.SelectNodes("//ROOT/SiteVulList/VulRow");
                if (list2.Count > 0)
                {
                    writer2.RenderBeginTag(HtmlTextWriterTag.H2);
                    writer2.Write("Vulnerability Result");
                    writer2.RenderEndTag();
                    for (int i = 0; i < list2.Count; i++)
                    {
                        writer2.AddAttribute("border", "1");
                        writer2.AddAttribute("width", "640");
                        writer2.AddAttribute("cellspacing", "0");
                        writer2.AddAttribute("bordercolordark", "009099");
                        writer2.RenderBeginTag(HtmlTextWriterTag.Table);
                        writer2.Write("<tr><td width=\"150\">No.</td><td>" + (i + 1).ToString() + "</td></tr>");
                        XmlNode node2 = list2[i];
                        for (int j = 0; j < node2.ChildNodes.Count; j++)
                        {
                            writer2.Write("<tr><td width=\"150\">");
                            writer2.Write(node2.ChildNodes[j].Name);
                            writer2.Write("</td><td>");
                            writer2.Write(node2.ChildNodes[j].InnerText.Replace("<>", "&lt;&gt;"));
                            writer2.Write("</td></tr>");
                        }
                        writer2.RenderEndTag();
                        writer2.Write("<br>");
                    }
                }
                if (this.mainfrm.CurrentSite.InjType != InjectionType.UnKnown && this.mainfrm.CurrentSite.BlindInjType != BlindType.UnKnown)
                {
                    writer2.RenderBeginTag(HtmlTextWriterTag.H2);
                    writer2.Write("Proof Of Concept - SQL INJECTION");
                    writer2.RenderEndTag();
                    writer2.AddAttribute("border", "1");
                    writer2.AddAttribute("width", "640");
                    writer2.AddAttribute("cellspacing", "0");
                    writer2.AddAttribute("bordercolordark", "009099");
                    writer2.RenderBeginTag(HtmlTextWriterTag.Table);
                    writer2.Write("<tr><td width=\"140\">Parameter</td><td>Value</td></tr>");
                    writer2.Write("<tr><td>URL</td><td>" + this.mainfrm.URL + "</td></tr>");
                    writer2.Write("<tr><td>RequestType</td><td>" + this.mainfrm.ReqType.ToString() + "</td></tr>");
                    writer2.Write("<tr><td>DatabaseType</td><td>" + this.mainfrm.CurrentSite.DatabaseType.ToString() + "</td></tr>");
                    writer2.Write("<tr><td>InjectionType</td><td>" + this.mainfrm.CurrentSite.InjType.ToString() + "</td></tr>");
                    writer2.Write("<tr><td>GettingDataBy</td><td>" + this.mainfrm.CurrentSite.BlindInjType.ToString() + "</td></tr>");
                    writer2.RenderEndTag();
                    writer2.Write("<br>");
                }
                XmlNodeList list3 = WcrXml.SelectNodes("//ROOT/SiteDBStructure/Database");
                if (list3.Count > 0)
                {
                    string str5 = "";
                    foreach (XmlNode node3 in list3)
                    {
                        str5 = str5 + node3.Attributes["Text"].Value + "<br>";
                        foreach (XmlNode node4 in node3.ChildNodes)
                        {
                            str5 = str5 + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + node4.Attributes["Text"].Value + "<br>";
                            foreach (XmlNode node5 in node4.ChildNodes)
                            {
                                str5 = str5 + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + node5.Attributes["Text"].Value + "<br>";
                            }
                        }
                    }
                    writer2.RenderBeginTag(HtmlTextWriterTag.H2);
                    writer2.Write("Proof Of Concept - Getting Database Structure ");
                    writer2.RenderEndTag();
                    string str6 = "DB-----Table---Column\r\n";
                    str6 = (str6 + str5).Replace("\r\n", "<br>").Replace(" ", "&nbsp;");
                    writer2.AddAttribute("border", "1");
                    writer2.AddAttribute("width", "640");
                    writer2.AddAttribute("cellspacing", "0");
                    writer2.AddAttribute("bordercolordark", "009099");
                    writer2.RenderBeginTag(HtmlTextWriterTag.Table);
                    writer2.Write("<tr><td>");
                    writer2.Write(str6);
                    writer2.Write("</td></tr>");
                    writer2.RenderEndTag();
                    writer2.Write("<br>");
                }
                writer2.RenderEndTag();
                writer2.RenderEndTag();
                writer2.RenderEndTag();
                File.WriteAllText(path, writer.ToString());
                result = path;
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                File.WriteAllText(path, writer.ToString());
                result = path;
            }
            return(result);
        }
Example #23
0
        /// <summary>
        /// Renders the base control.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public void RenderBaseControl(HtmlTextWriter writer)
        {
            bool needsAutoPostBack = SelectedDatePartsChanged != null || ValueChanged != null;

            monthDropDownList.AutoPostBack = needsAutoPostBack;
            dayDropDownList.AutoPostBack   = needsAutoPostBack;
            yearDropDownList.AutoPostBack  = needsAutoPostBack;

            writer.AddAttribute("class", "form-control-group date-parts-picker js-datepartspicker");

            writer.AddAttribute("data-required", this.Required.ToTrueFalse().ToLower());
            writer.AddAttribute("data-requireyear", this.RequireYear.ToTrueFalse().ToLower());
            writer.AddAttribute("data-allowFuture", this.AllowFutureDates.ToTrueFalse().ToLower());
            writer.AddAttribute("data-itemlabel", this.Label);

            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Get date format and separater for current culture
            var    dtf       = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat;
            string mdp       = dtf.ShortDatePattern;
            var    dateParts = dtf.ShortDatePattern.Split(dtf.DateSeparator.ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList();

            if (dateParts.Count() != 3 ||
                !dateParts.Any(s => s.Contains("M")) ||
                !dateParts.Any(s => s.Contains("d")) ||
                !dateParts.Any(s => s.Contains("y")))
            {
                dateParts = new List <string> {
                    "MM", "dd", "yyyy"
                };
            }

            string separatorHtml = string.Format(" <span class='separator'>{0}</span> ", dtf.DateSeparator);

            for (int i = 0; i < 3; i++)
            {
                string datePart = dateParts[i].ToStringSafe();

                if (datePart.Contains("d"))
                {
                    dayDropDownList.RenderControl(writer);
                }
                else if (datePart.Contains("M"))
                {
                    monthDropDownList.RenderControl(writer);
                }
                else if (datePart.Contains("y"))
                {
                    yearDropDownList.RenderControl(writer);
                }

                if (i < 2)
                {
                    writer.Write(separatorHtml);
                }
            }

            CustomValidator.RenderControl(writer);

            writer.RenderEndTag();
        }
Example #24
0
		// new in Fx 1.1 SP1 (to support Caption and CaptionAlign)

		public override void RenderBeginTag (HtmlTextWriter writer)
		{
			base.RenderBeginTag (writer);

			string s = Caption;
			if (s.Length > 0) {
				TableCaptionAlign tca = CaptionAlign;
				if (tca != TableCaptionAlign.NotSet)
					writer.AddAttribute (HtmlTextWriterAttribute.Align, tca.ToString ());
				
				writer.RenderBeginTag (HtmlTextWriterTag.Caption);
				writer.Write (s);
				writer.RenderEndTag ();
			} else if (HasControls ()) {
				writer.Indent++;
			}
		}
Example #25
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            // Now render the actual textbox and picker UI

            Debug.Assert(_dateTextBox != null);
            Debug.Assert(_pickerImage != null);
            Debug.Assert(_dateValidator != null);

            // First prepare the text box for rendering by applying this control's
            // style and any attributes to it.
            // This is done as part of Render, so any changes made to the textbox
            // are not persisted in view state. The values are already being held
            // as part of this control's view state, so having the textbox also
            // store them would be redundant.
            if (ControlStyleCreated)
            {
                _dateTextBox.ApplyStyle(ControlStyle);
            }
            _dateTextBox.CopyBaseAttributes(this);
            _dateTextBox.RenderControl(writer);

            // Design-mode is determined by the availability of a non-null Site
            // that is itself in design-mode.
            bool designMode = (Site != null) && Site.DesignMode;

            bool showPicker = _renderClientScript;

            if (showPicker == false)
            {
                // In design-mode, we want the picker to be visible, even though
                // OnPreRender is not called, where the determination is made whether
                // or not to show the picker. Therefore, unless the user has
                // explicitely turned off client script, the picker needs to be shown.
                if (EnableClientScript && designMode)
                {
                    showPicker = true;
                }
            }
            if (showPicker)
            {
                string pickerAction;
                if (_renderPopupScript)
                {
                    pickerAction = "dp_showDatePickerPopup(this, document.all['" + _dateTextBox.ClientID + "'], document.all['" + ClientID + "'])";
                }
                else
                {
                    pickerAction = "dp_showDatePickerFrame(this, document.all['" + _dateTextBox.ClientID + "'], document.all['" + ClientID + "'], document.all['" + ClientID + "_frame'], document)";
                }
                _pickerImage.Attributes["onclick"] = pickerAction;
                _pickerImage.RenderControl(writer);

                if (_renderPopupScript == false)
                {
                    // Use an IFRAME instead of a DHTML popup
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_frame");
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, GetClientFileUrl("CalendarFrame.htm"));
                    writer.AddAttribute("marginheight", "0", false);
                    writer.AddAttribute("marginwidth", "0", false);
                    writer.AddAttribute("noresize", "noresize", false);
                    writer.AddAttribute("frameborder", "0", false);
                    writer.AddAttribute("scrolling", "no", false);
                    writer.AddStyleAttribute("position", "absolute");
                    writer.AddStyleAttribute("z-index", "100");
                    writer.AddStyleAttribute("display", "none");
                    writer.RenderBeginTag(HtmlTextWriterTag.Iframe);
                    writer.RenderEndTag();
                }
            }

            // The designer sets the Visibility of the validator to false,
            // since in design-mode, the control should not show up as invalid.
            // Therefore the extra check.
            // Just the minimal bit of logic to aid the designer...
            if (_dateValidator.Visible)
            {
                _dateValidator.ErrorMessage = ValidationMessage;
                _dateValidator.ToolTip      = ValidationMessage;
                _dateValidator.RenderControl(writer);
            }
        }
Example #26
0
        /// <summary>
        /// This method builds the javascript which instantiates the
        /// autocomplete class and sets the defining options
        /// </summary>
        /// <param name="output">The server control output stream</param>
        protected virtual void BuildJavascript(HtmlTextWriter output)
        {
            // Now we add in our javascript
            output.AddAttribute("language", "javascript");
            output.RenderBeginTag(HtmlTextWriterTag.Script);

            output.Write(string.Format(
                             "var options = {{isIE:{0},\nscript:'{1}'",
                             IsIE.ToString().ToLower(), SearchURL));

            if (MinSearchChars > 0)
            {
                output.Write(string.Format(",\nminchars:{0}", MinSearchChars));
            }
            if (ACCssClass.Length > 0)
            {
                output.Write(string.Format(",\nclassName:'{0}'", ACCssClass));
            }
            if (RowsPerPage > 0)
            {
                output.Write(string.Format(",\nrowsPerPage:{0}", RowsPerPage));
            }
            if (MaxRowsToReturn > 0)
            {
                output.Write(string.Format(",\nmaxresults:{0}", MaxRowsToReturn));
            }
            if (CloseLinkText.Length > 0)
            {
                output.Write(string.Format(",\ncloseText:'{0}'", CloseLinkText));
            }
            output.Write(string.Format(",\nuseNotifier:{0}", UseNotifierIcon.ToString().ToLower()));
            if (this.CallbackFunc.Length > 0)
            {
                output.Write(string.Format(",\ncallback:{0}", CallbackFunc));
            }
            output.Write(string.Format(",\nmeth:'{0}'", URLMethod.ToString()));
            if (SearchDelay > 0)
            {
                output.Write(string.Format(",\ndelay:{0}", SearchDelay));
            }
            if (MinWidth > 0 || MaxWidth > 0)
            {
                output.Write(",\nsetWidth:true");
                if (MinWidth > 0)
                {
                    output.Write(string.Format(",\nminWidth:{0}", MinWidth));
                }
                if (MaxWidth > 0)
                {
                    output.Write(string.Format(",\nmaxWidth:{0}", MaxWidth));
                }
            }
            output.Write(string.Format(",\ncache:{0}", this.CacheResults.ToString().ToLower()));
            output.Write(string.Format(",\ncontains:{0}",
                                       (SearchCriteria == SearchCriteriaEnum.Contains ? "true" : "false")));
            if (this.AjaxErrorFunc.Length > 0)
            {
                output.Write(string.Format(",\nOnAjaxError:{0}", AjaxErrorFunc));
            }
            output.Write(string.Format(",\nboxOutline:{0}", ShowBoxOutline.ToString().ToLower()));
            output.Write("};\n");

            // Create our variable
            output.Write(
                //string.Format("var {0}_json=new AutoComplete('{0}',options);\n", ClientID));
                string.Format("AutoComplete.extendTextBox('{0}',options);\n", ClientID));
            // End script
            output.RenderEndTag();
        }
Example #27
0
		void RenderDisabled (HtmlTextWriter writer)
		{
			if (!IsEnabled) {
				if (!SupportsDisabledAttribute)
					ControlStyle.PrependCssClass (DisabledCssClass);
				else
					writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
			}

		}
Example #28
0
 protected void RenderOptionGroupBeginTag(string optionGroupName, HtmlTextWriter writer)
 {
     writer.AddAttribute("label", optionGroupName);
     writer.RenderBeginTag(OptionGroupTag);
 }
Example #29
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (string.IsNullOrEmpty(CssClass))
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.MarginTop, "5px");
                writer.AddStyleAttribute(HtmlTextWriterStyle.MarginBottom, "5px");
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClass);
            }

            // custom
            writer.AddStyleAttribute("border", "#e0e0e0 1px solid");
            // end

            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, Width.ToString());

            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Render header
            if (string.IsNullOrEmpty(SectionHeaderCssClass))
            {
                writer.AddStyleAttribute("min-height", "25px");
                writer.AddStyleAttribute("background", "url(/_layouts/images/selbg.png) #f6f6f6 repeat-x left top");
                writer.AddStyleAttribute("border-bottom", "#e0e0e0 1px solid");
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "25px");
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, SectionHeaderCssClass);
            }

            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");

            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Render header text
            if (string.IsNullOrEmpty(SectionHeaderTextCssClass))
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "bold");
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, SectionHeaderTextCssClass);
            }

            writer.AddStyleAttribute("float", "left");
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "10px");
            writer.AddStyleAttribute("line-height", "25px");
            writer.AddAttribute("onmouseover", "this.style.textDecoration = 'none';");
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.Write(SectionTitle);
            writer.RenderEndTag();

            // Render header status icon
            writer.AddStyleAttribute("float", "right");
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "10px");
            writer.AddStyleAttribute("line-height", "25px");
            writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "none");
            writer.AddAttribute(HtmlTextWriterAttribute.Onclick,
                                string.Format("SectionControl_OnClick('{0}', '{1}');return false;", hdfState.ClientID,
                                              ClientID));
            writer.RenderBeginTag(HtmlTextWriterTag.A);

            writer.AddAttribute(HtmlTextWriterAttribute.Border, "none");
            writer.AddAttribute(HtmlTextWriterAttribute.Src,
                                Collapsed ? "/_layouts/images/dlmax.gif" : "/_layouts/images/dlmin.gif");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_Icon");
            writer.RenderBeginTag(HtmlTextWriterTag.Img);
            writer.RenderEndTag(); // img

            writer.RenderEndTag(); // p

            writer.RenderEndTag(); // div

            // Render Content
            if (Collapsed)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            }
            base.Render(writer);

            writer.RenderEndTag(); // div
        }
Example #30
0
        protected override void Render(HtmlTextWriter writer)
        {
            string      langId = Utils.GetParameter("langid", Constant.DB.langVn);
            CultureInfo ci     = WebUtils.getResource(langId);

            if ((int)ItemCount <= PageSize)
            {
                return;
            }
            PageClause       = LocalizationUtility.GetText("page_clause", ci);
            OfClause         = LocalizationUtility.GetText("of_clause", ci);
            ShowResultClause = LocalizationUtility.GetText("show_result_clause", ci);
            NextToPageClause = LocalizationUtility.GetText("next_to_page_clause", ci);
            BackToPageClause = LocalizationUtility.GetText("back_to_page_clause", ci);
            ToClause         = LocalizationUtility.GetText("to_clause", ci);
            PreviousClause   = LocalizationUtility.GetText("previous_clause", ci);
            NextClause       = LocalizationUtility.GetText("next_clause", ci);

            if (Page != null)
            {
                Page.VerifyRenderingInServerForm(this);
            }

            if (this.PageCount > this.SmartShortCutThreshold && GenerateSmartShortCuts)
            {
                CalculateSmartShortcutAndFillList();
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "pages");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            if (GeneratePagerInfoSection)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "info");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                int startItem = 0;
                startItem = (CurrentIndex - 1) * PageSize;
                int endItem = startItem + PageSize;
                endItem = endItem > (int)ItemCount ? (int)ItemCount : endItem;

                writer.Write(ShowResultClause + " <b>" + (startItem + 1).ToString() + " - " + endItem.ToString() + "</b>&nbsp;&nbsp;");
                writer.RenderEndTag();
            }

            if (GenerateFirstLastSection && CurrentIndex != 1)
            {
                writer.Write(RenderFirst());
            }

            if (CurrentIndex != 1)
            {
                writer.Write(RenderBack());
            }

            if (CurrentIndex < CompactModePageCount)
            {
                if (CompactModePageCount > PageCount)
                {
                    CompactModePageCount = PageCount;
                }

                for (int i = 1; i < CompactModePageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                RenderSmartShortCutByCriteria(CompactModePageCount, true, writer);
            }
            else if (CurrentIndex >= CompactModePageCount && CurrentIndex < NormalModePageCount)
            {
                if (NormalModePageCount > PageCount)
                {
                    NormalModePageCount = PageCount;
                }

                for (int i = 1; i < NormalModePageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                RenderSmartShortCutByCriteria(NormalModePageCount, true, writer);
            }
            else if (CurrentIndex >= NormalModePageCount)
            {
                int gapValue  = NormalModePageCount / 2;
                int leftBand  = CurrentIndex - gapValue;
                int rightBand = CurrentIndex + gapValue;


                RenderSmartShortCutByCriteria(leftBand, false, writer);

                for (int i = leftBand; (i < rightBand + 1) && i < PageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                if (rightBand < this.PageCount)
                {
                    RenderSmartShortCutByCriteria(rightBand, true, writer);
                }
            }

            if (CurrentIndex != PageCount)
            {
                writer.Write(RenderNext());
            }

            if (GenerateFirstLastSection && CurrentIndex != PageCount)
            {
                writer.Write(RenderLast());
            }

            if (GenerateGoToSection)
            {
                writer.Write(RenderGoTo());
            }

            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "clr");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.RenderEndTag();

            if (GenerateGoToSection)
            {
                writer.Write(RenderGoToScript());
            }

            if (GenerateHiddenHyperlinks)
            {
                writer.Write(RenderHiddenDiv());
            }
        }
Example #31
0
        /// <summary>
        /// Returns a HTML representation of the client side web part
        /// </summary>
        /// <param name="controlIndex">The sequence of the control inside the section</param>
        /// <returns>HTML representation of the client side web part</returns>
        public override string ToHtml(float controlIndex)
        {
            // Can this control be hosted in this section type?
            if (this.Section.Type == CanvasSectionTemplate.OneColumnFullWidth)
            {
                if (!this.SupportsFullBleed)
                {
                    throw new Exception("You cannot host this web part inside a one column full width section, only webparts that support full bleed are allowed");
                }
            }

            ClientSideWebPartControlData controlData = null;

            if (this.usingSpControlDataOnly)
            {
                controlData = new ClientSideWebPartControlDataOnly();
            }
            else
            {
                controlData = new ClientSideWebPartControlData();
            }

            // Obtain the json data
            controlData.ControlType = this.ControlType;
            controlData.Id          = this.InstanceId.ToString("D");
            controlData.WebPartId   = this.WebPartId;
            controlData.Position    = new ClientSideCanvasControlPosition()
            {
                ZoneIndex     = this.Section.Order,
                SectionIndex  = this.Column.Order,
                SectionFactor = this.Column.ColumnFactor,
#if !SP2019
                LayoutIndex = this.Column.LayoutIndex,
#endif
                ControlIndex = controlIndex,
            };

#if !SP2019
            if (this.section.Type == CanvasSectionTemplate.OneColumnVerticalSection)
            {
                if (this.section.Columns.First().Equals(this.Column))
                {
                    controlData.Position.SectionFactor = 12;
                }
            }
#endif

            controlData.Emphasis = new ClientSideSectionEmphasis()
            {
                ZoneEmphasis = this.Column.VerticalSectionEmphasis.HasValue ? this.Column.VerticalSectionEmphasis.Value : this.Section.ZoneEmphasis,
            };

            // Set the control's data version to the latest version...default was 1.0, but some controls use a higher version
            var webPartType = ClientSidePage.NameToClientSideWebPartEnum(controlData.WebPartId);

            // if we read the control from the page then the value might already be set to something different than 1.0...if so, leave as is
            if (this.DataVersion == "1.0")
            {
                if (webPartType == DefaultClientSideWebParts.Image)
                {
                    this.dataVersion = "1.8";
                }
                else if (webPartType == DefaultClientSideWebParts.ImageGallery)
                {
                    this.dataVersion = "1.6";
                }
                else if (webPartType == DefaultClientSideWebParts.People)
                {
                    this.dataVersion = "1.2";
                }
                else if (webPartType == DefaultClientSideWebParts.DocumentEmbed)
                {
                    this.dataVersion = "1.1";
                }
                else if (webPartType == DefaultClientSideWebParts.ContentRollup)
                {
                    this.dataVersion = "2.1";
                }
                else if (webPartType == DefaultClientSideWebParts.QuickLinks)
                {
                    this.dataVersion = "2.0";
                }
            }

            // Set the web part preview image url
            if (this.ServerProcessedContent != null && this.ServerProcessedContent["imageSources"] != null)
            {
                foreach (JProperty property in this.ServerProcessedContent["imageSources"])
                {
                    if (!string.IsNullOrEmpty(property.Value.ToString()))
                    {
                        this.webPartPreviewImage = property.Value.ToString().ToLower();
                        break;
                    }
                }
            }

            ClientSideWebPartData webpartData = new ClientSideWebPartData()
            {
                Id = controlData.WebPartId, InstanceId = controlData.Id, Title = this.Title, Description = this.Description, DataVersion = this.DataVersion, Properties = "jsonPropsToReplacePnPRules", DynamicDataPaths = "jsonDynamicDataPathsToReplacePnPRules", DynamicDataValues = "jsonDynamicDataValuesToReplacePnPRules", ServerProcessedContent = "jsonServerProcessedContentToReplacePnPRules"
            };

            if (this.usingSpControlDataOnly)
            {
                (controlData as ClientSideWebPartControlDataOnly).WebPartData = "jsonWebPartDataToReplacePnPRules";
                this.jsonControlData = JsonConvert.SerializeObject(controlData);
                this.jsonWebPartData = JsonConvert.SerializeObject(webpartData);
                this.jsonWebPartData = this.jsonWebPartData.Replace("\"jsonPropsToReplacePnPRules\"", this.Properties.ToString(Formatting.None));
                this.jsonWebPartData = this.jsonWebPartData.Replace("\"jsonServerProcessedContentToReplacePnPRules\"", this.ServerProcessedContent.ToString(Formatting.None));
                this.jsonWebPartData = this.jsonWebPartData.Replace("\"jsonDynamicDataPathsToReplacePnPRules\"", this.DynamicDataPaths.ToString(Formatting.None));
                this.jsonWebPartData = this.jsonWebPartData.Replace("\"jsonDynamicDataValuesToReplacePnPRules\"", this.DynamicDataValues.ToString(Formatting.None));
                this.jsonControlData = this.jsonControlData.Replace("\"jsonWebPartDataToReplacePnPRules\"", this.jsonWebPartData);
            }
            else
            {
                this.jsonControlData = JsonConvert.SerializeObject(controlData);
                this.jsonWebPartData = JsonConvert.SerializeObject(webpartData);
                this.jsonWebPartData = this.jsonWebPartData.Replace("\"jsonPropsToReplacePnPRules\"", this.Properties.ToString(Formatting.None));
                this.jsonWebPartData = this.jsonWebPartData.Replace("\"jsonServerProcessedContentToReplacePnPRules\"", this.ServerProcessedContent.ToString(Formatting.None));
                this.jsonWebPartData = this.jsonWebPartData.Replace("\"jsonDynamicDataPathsToReplacePnPRules\"", this.DynamicDataPaths.ToString(Formatting.None));
                this.jsonWebPartData = this.jsonWebPartData.Replace("\"jsonDynamicDataValuesToReplacePnPRules\"", this.DynamicDataValues.ToString(Formatting.None));
            }

            StringBuilder html = new StringBuilder(100);
#if NETSTANDARD2_0
            html.Append($@"<div {CanvasControlAttribute}=""{this.CanvasControlData}"" {CanvasDataVersionAttribute}=""{this.DataVersion}"" {ControlDataAttribute}=""{this.JsonControlData.Replace("\"", "&quot;")}"">");
            html.Append($@"<div {WebPartAttribute}=""{this.WebPartData}"" {WebPartDataVersionAttribute}=""{this.DataVersion}"" {WebPartDataAttribute}=""{this.JsonWebPartData.Replace("\"", "&quot;")}"">");
            html.Append($@"<div {WebPartComponentIdAttribute}=""""");
            html.Append(this.WebPartId);
            html.Append("/div>");
            html.Append($@"<div {WebPartHtmlPropertiesAttribute}=""{this.HtmlProperties}"">");
            RenderHtmlProperties(ref html);
            html.Append("</div>");
            html.Append("</div>");
            html.Append("</div>");
#else
            var htmlWriter = new HtmlTextWriter(new System.IO.StringWriter(html), "");
            try
            {
                if (this.usingSpControlDataOnly)
                {
                    htmlWriter.NewLine = string.Empty;
                    htmlWriter.AddAttribute(CanvasControlAttribute, this.CanvasControlData);
                    htmlWriter.AddAttribute(CanvasDataVersionAttribute, this.CanvasDataVersion);
                    htmlWriter.AddAttribute(ControlDataAttribute, this.JsonControlData);
                    htmlWriter.RenderBeginTag(HtmlTextWriterTag.Div);
                    htmlWriter.RenderEndTag();
                }
                else
                {
                    htmlWriter.NewLine = string.Empty;
                    htmlWriter.AddAttribute(CanvasControlAttribute, this.CanvasControlData);
                    htmlWriter.AddAttribute(CanvasDataVersionAttribute, this.CanvasDataVersion);
                    htmlWriter.AddAttribute(ControlDataAttribute, this.JsonControlData);
                    htmlWriter.RenderBeginTag(HtmlTextWriterTag.Div);

                    htmlWriter.AddAttribute(WebPartAttribute, this.WebPartData);
                    htmlWriter.AddAttribute(WebPartDataVersionAttribute, this.DataVersion);
                    htmlWriter.AddAttribute(WebPartDataAttribute, this.JsonWebPartData);
                    htmlWriter.RenderBeginTag(HtmlTextWriterTag.Div);

                    htmlWriter.AddAttribute(WebPartComponentIdAttribute, "");
                    htmlWriter.RenderBeginTag(HtmlTextWriterTag.Div);
                    htmlWriter.Write(this.WebPartId);
                    htmlWriter.RenderEndTag();

                    htmlWriter.AddAttribute(WebPartHtmlPropertiesAttribute, this.HtmlProperties);
                    htmlWriter.RenderBeginTag(HtmlTextWriterTag.Div);
                    // Allow for override of the HTML value rendering if this would be needed by controls
                    RenderHtmlProperties(ref htmlWriter);
                    htmlWriter.RenderEndTag();

                    htmlWriter.RenderEndTag();
                    htmlWriter.RenderEndTag();
                }
            }
            finally
            {
                if (htmlWriter != null)
                {
                    htmlWriter.Dispose();
                }
            }
#endif
            return(html.ToString());
        }
Example #32
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            GridViewEx gv = (GridViewEx)this.NamingContainer;
            string     str;

            if (!_isFirstPage)
            {
                writer.AddStyleAttribute("float", "left");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "gvex-page-link ui-icon ui-icon-seek-first");
                writer.AddAttribute(HtmlTextWriterAttribute.Title, "First Page");
                str = string.Format("1${0}", gv.DefaultSortExpression);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, str);
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.RenderEndTag();
                writer.AddStyleAttribute("float", "left");
                str = string.Format("{0}${1}", gv.PageIndex, gv.DefaultSortExpression);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, str);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "gvex-page-link ui-icon ui-icon-seek-prev");
                writer.AddAttribute(HtmlTextWriterAttribute.Title, "Previous Page");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.RenderEndTag();
            }
            if (!_isLastPage)
            {
                writer.AddStyleAttribute("float", "right");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "gvex-page-link ui-icon ui-icon-seek-end");
                writer.AddAttribute(HtmlTextWriterAttribute.Title, "Last Page");
                str = string.Format("{0}${1}", _pageCount, gv.DefaultSortExpression);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, str);
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.RenderEndTag();
                writer.AddStyleAttribute("float", "right");
                str = string.Format("{0}${1}", gv.PageIndex + 2, gv.DefaultSortExpression);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, str);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "gvex-page-link ui-icon ui-icon-seek-next");
                writer.AddAttribute(HtmlTextWriterAttribute.Title, "Next Page");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.RenderEndTag();
            }

            //writer.Write("Displaying {0:N0} - {1:N0} of {2:N0} results &bull; ",
            //    (gv.PageIndex * gv.PageSize) + 1,
            //    (gv.PageIndex + 1) * gv.PageSize - (gv.PageSize - gv.Rows.Count),
            //    _totalRows);
            writer.Write("Displaying {0:N0} to {1:N0} of ",
                         (gv.PageIndex * gv.PageSize) + 1,
                         (gv.PageIndex + 1) * gv.PageSize - (gv.PageSize - gv.Rows.Count));
            writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "bold");
            writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "1.2em");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write("{0:N0} ", _totalRows);
            writer.RenderEndTag();  // span
            writer.Write("results &bull; ");

            const int MAX_NUMERIC_BUTTONS   = 10;
            int       nFirstButtonPageIndex = gv.PageIndex - (gv.PageIndex % MAX_NUMERIC_BUTTONS);
            int       nLastButtonPageIndex  = Math.Min(_pageCount - 1, nFirstButtonPageIndex + MAX_NUMERIC_BUTTONS);

            for (int i = nFirstButtonPageIndex; i <= nLastButtonPageIndex; ++i)
            {
                if (i == gv.PageIndex)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "ui-state-active");
                }
                else
                {
                    str = string.Format("{0}${1}", i + 1, gv.DefaultSortExpression);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "gvex-page-link");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, str);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write(i + 1);
                writer.RenderEndTag();      //a
                writer.Write(" ");
            }
            return;
        }
        /// <summary>
        /// Adds the notification list for project.
        /// </summary>
        /// <param name="htmlWriter">The HTML writer.</param>
        /// <param name="projectUserInfo">The project user info.</param>
        /// <param name="projectNotificationDetails">The project notification details.</param>
        private static void AddNotificationListForProject(HtmlTextWriter htmlWriter, ProjectUserInfo projectUserInfo, ProjectNotificationDetails projectNotificationDetails, bool isProjectNotification)
        {
            htmlWriter.RenderBeginTag(HtmlTextWriterTag.Ul);

            // Add notification details
            if (isProjectNotification)
            {
                if (projectUserInfo.ProjectEmailNotificationCodeId == DailyEmailNotificationCodeId)
                {
                    AddNotificationTypeList(HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ProjectTeamUpdatesStatus, true),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ItemBriefUpdateStatus, true),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ScheduleUpdateStatus, true),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ProjectUpdateStatus, true),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.TaskUpdateStatus, true),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ItemListUpdateStatus, true),
                                            htmlWriter);
                }
                else if (projectUserInfo.ProjectEmailNotificationCodeId == WeeklyEmailNotificationCodeId)
                {
                    AddNotificationTypeList(HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ProjectTeamUpdatesStatus, false),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ItemBriefUpdateStatus, false),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ScheduleUpdateStatus, false),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ProjectUpdateStatus, false),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.TaskUpdateStatus, false),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ItemListUpdateStatus, false),
                                            htmlWriter);
                }
            }
            else
            {
                if (projectUserInfo.CompanyEmailNotificationCodeId == DailyEmailNotificationCodeId)
                {
                    AddNotificationTypeList(HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ProjectTeamUpdatesStatus, true),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ItemBriefUpdateStatus, true),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ScheduleUpdateStatus, true),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ProjectUpdateStatus, true),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.TaskUpdateStatus, true),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ItemListUpdateStatus, true),
                                            htmlWriter);
                }
                else if (projectUserInfo.CompanyEmailNotificationCodeId == WeeklyEmailNotificationCodeId)
                {
                    AddNotificationTypeList(HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ProjectTeamUpdatesStatus, false),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ItemBriefUpdateStatus, false),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ScheduleUpdateStatus, false),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ProjectUpdateStatus, false),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.TaskUpdateStatus, false),
                                            HasNotifications(projectUserInfo.UserId, projectNotificationDetails.ItemListUpdateStatus, false),
                                            htmlWriter);
                }
            }

            htmlWriter.RenderEndTag(); // end of UL

            // Add Link to notification page
            htmlWriter.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "right");
            htmlWriter.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            htmlWriter.RenderBeginTag(HtmlTextWriterTag.Div);

            string url = string.Format("{0}/Project/ProjectNotifications.aspx?projectid={1}", Utils.GetSystemValue("SBUserWebURL"), projectUserInfo.ProjectId);

            htmlWriter.AddAttribute(HtmlTextWriterAttribute.Href, url);
            htmlWriter.AddAttribute(HtmlTextWriterAttribute.Target, "_blank");
            htmlWriter.RenderBeginTag(HtmlTextWriterTag.A);
            htmlWriter.Write("View Updates Report");
            htmlWriter.RenderEndTag();

            htmlWriter.RenderEndTag();
        }
Example #34
0
        protected override void Render(HtmlTextWriter writer)
        {
            //<div id="calllogs" class="calllogs">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            //<div id="calllogs_content" class="content">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "content");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_content");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            //<div id="calllogs_left" class="leftmenu">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "leftmenu");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_left");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            //<div id="calllogs_toptab" class="toptab">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "toptab");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_toptab");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            //</div>
            writer.RenderEndTag();

            //<div id="calllogs_missedcalltab" class="tab">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "tab");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_missedcalltab");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write(this.missedTabText);
            //</div>
            writer.RenderEndTag();

            //<div id="calllogs_placedcalltab" class="tab_unselected">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "tab_unselected");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_placedcalltab");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write(this.placedTabText);
            //</div>
            writer.RenderEndTag();

            //<div id="calllogs_receivedcalltab" class="tab_unselected">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "tab_unselected");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_receivedcalltab");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write(this.receivedTabText);
            //</div>
            writer.RenderEndTag();

            //<div id="calllogs_bottomtab" class="bottomtab">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "bottomtab");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_bottomtab");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            //</div>
            writer.RenderEndTag();

            //</div>
            writer.RenderEndTag();

            //<div id="calllogs_right" class="rightcontent">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "rightcontent");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_right");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            //<div id="calllogs_missedcalltabcontent" class="tab_content">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "tab_content");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_missedcalltabcontent");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "refresh");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_missedcallrefresh");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write("Rafraîchir");
            //</div>
            writer.RenderEndTag();


            //</div>
            writer.RenderEndTag();

            //<div id="calllogs_placedcalltabcontent" class="tab_content_unselected">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "tab_content_unselected");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_placedcalltabcontent");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "refresh");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_placedcallrefresh");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write("Rafraîchir");
            //</div>
            writer.RenderEndTag();

            //</div>
            writer.RenderEndTag();

            //<div id="calllogs_receivedcalltabcontent" class="tab_content_unselected">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "tab_content_unselected");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_receivedcalltabcontent");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "refresh");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_receivedcallrefresh");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write("Rafraîchir");
            //</div>
            writer.RenderEndTag();

            //</div>
            writer.RenderEndTag();

            //</div>
            writer.RenderEndTag();

            //</div>
            writer.RenderEndTag();
            //</div>
            writer.RenderEndTag();
            base.Render(writer);
        }
Example #35
0
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            // We do not call the base class AddAttributesToRender
            // because, in the DatePicker, the attributes and styles applied to the
            // control affect the contained TextBox. The DatePicker itself renders
            // out as a <span>, which only contains only the ID attribute and any
            // attributes needed for the pop-up calendar and client script.

            writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);

            if (_renderClientScript)
            {
                if (_renderPopupScript)
                {
                    writer.AddAttribute("dp_htcURL", GetClientFileUrl("Calendar.htc"), false);
                }
                if (AutoPostBack)
                {
                    writer.AddAttribute("dp_autoPostBack", "true", false);
                }
                if (_calendarStyle != null)
                {
                    Unit u = _calendarStyle.Width;
                    if (!u.IsEmpty)
                    {
                        writer.AddAttribute("dp_width", u.ToString(CultureInfo.InvariantCulture));
                    }
                    u = _calendarStyle.Height;
                    if (!u.IsEmpty)
                    {
                        writer.AddAttribute("dp_height", u.ToString(CultureInfo.InvariantCulture));
                    }
                    string s = GetCssFromStyle(_calendarStyle);
                    if (s.Length != 0)
                    {
                        writer.AddAttribute("dp_calendarStyle", s, false);
                    }
                }
                if (_titleStyle != null)
                {
                    string s = GetCssFromStyle(_titleStyle);
                    if (s.Length != 0)
                    {
                        writer.AddAttribute("dp_titleStyle", s, false);
                    }
                }
                if (_dayHeaderStyle != null)
                {
                    string s = GetCssFromStyle(_dayHeaderStyle);
                    if (s.Length != 0)
                    {
                        writer.AddAttribute("dp_dayHeaderStyle", s, false);
                    }
                }
                if (_dayStyle != null)
                {
                    string s = GetCssFromStyle(_dayStyle);
                    if (s.Length != 0)
                    {
                        writer.AddAttribute("dp_dayStyle", s, false);
                    }
                }
                if (_otherMonthDayStyle != null)
                {
                    string s = GetCssFromStyle(_otherMonthDayStyle);
                    if (s.Length != 0)
                    {
                        writer.AddAttribute("dp_otherMonthDayStyle", s, false);
                    }
                }
                if (_todayDayStyle != null)
                {
                    string s = GetCssFromStyle(_todayDayStyle);
                    if (s.Length != 0)
                    {
                        writer.AddAttribute("dp_todayDayStyle", s, false);
                    }
                }
                if (_selectedDayStyle != null)
                {
                    string s = GetCssFromStyle(_selectedDayStyle);
                    if (s.Length != 0)
                    {
                        writer.AddAttribute("dp_selectedDayStyle", s, false);
                    }
                }
            }
        }
Example #36
0
 protected override void AddAttributesToRender(HtmlTextWriter output)
 {
     output.AddAttribute("name", UniqueID);
     output.AddAttribute("src", ImageUrl);
     output.AddAttribute("onClick", Page.GetPostBackEventReference(this));
 }
Example #37
0
 public virtual void RenderStart()
 {
     _writer.AddAttribute("id", _elementId);
     _writer.RenderBeginTag(this.Tag);
 }
Example #38
0
        public static void ListenerCallback(HttpListenerContext context)
        {
            var request = context.Request;

            // Obtain a response object.
            var response = context.Response;

            // Construct a response.
            var responseString = "";

            //if requested url already has a port, just return posh
            if (URLPort.ContainsKey(request.RawUrl.ToString().Substring(1)))
            {
                using (var sr = new StreamReader(Path.Combine(TerminalPath, "posh.html")))
                    responseString = sr.ReadToEnd();
            }
            //request for root returns listing of all files
            else if (request.RawUrl == "/")
            {
                var stringWriter = new StringWriter();
                // Put HtmlTextWriter in using block because it needs to call Dispose.
                using (var writer = new HtmlTextWriter(stringWriter))
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Html);
                    writer.RenderBeginTag(HtmlTextWriterTag.Head);
                    writer.AddAttribute(HtmlTextWriterAttribute.Rel, "stylesheet");
                    writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "posh.css");
                    writer.RenderBeginTag(HtmlTextWriterTag.Link);
                    writer.RenderEndTag();
                    writer.RenderEndTag();

                    writer.AddAttribute(HtmlTextWriterAttribute.Id, "rootlist");
                    writer.RenderBeginTag(HtmlTextWriterTag.Body);
                    writer.Write("Available&nbsp;Timelines");
                    writer.WriteBreak();

                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    // Loop over some strings.
//				    foreach (var file in Directory.EnumerateFiles(TerminalPath, "*.xml"))
                    foreach (var url in URLPort.Keys)
                    {
//				        var f = Path.GetFileNameWithoutExtension(file);
                        writer.RenderBeginTag(HtmlTextWriterTag.P);
                        writer.AddAttribute(HtmlTextWriterAttribute.Href, url);
                        writer.RenderBeginTag(HtmlTextWriterTag.A);
                        writer.Write(url);
                        writer.RenderEndTag();
                        writer.RenderEndTag();
                    }
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                }
                // Return the result.
                responseString = stringWriter.ToString();
            }
            //if requested url exists as .xml on disk, open it
            else if (File.Exists(Path.Combine(TerminalPath, request.RawUrl.Split('/').ToList().Last() + ".xml")))
            {
                //this will add url if not already open
                var url = request.RawUrl.Split('/').ToList().Last();
                OpenURL(url);
                response.Redirect("/" + url);
            }
            //if request is for non .xml document, serve it
            else if (File.Exists(Path.Combine(TerminalPath, request.RawUrl.Split('/').ToList().Last())))
            {
                using (var sr = new StreamReader(Path.Combine(TerminalPath, request.RawUrl.Split('/').ToList().Last())))
                    responseString = sr.ReadToEnd();

                if (request.RawUrl == "/posh.js")
                {
                    var port = URLPort[request.UrlReferrer.PathAndQuery.Substring(1)];
                    responseString = responseString.Replace("LOCALIP", GetLocalIP()).Replace("WEBSOCKETPORT", port.ToString());
                }

                if (request.RawUrl.EndsWith(".css"))
                {
                    response.ContentType = "text/css";
                }
                else if (request.RawUrl.EndsWith(".js"))
                {
                    response.ContentType = "text/javascript";
                }
            }
            //unknown urls open new document
            else if (UnknownURL != null)
            {
                //this may add an url
                UnknownURL(request.RawUrl.Split('/').ToList().Last());

                //so now try returning posh again
                using (var sr = new StreamReader(Path.Combine(TerminalPath, "posh.html")))
                    responseString = sr.ReadToEnd();
            }

            var buffer = Encoding.UTF8.GetBytes(responseString);

            // Get a response stream and write the response to it.
            response.ContentLength64 = buffer.Length;
            var output = response.OutputStream;

            output.Write(buffer, 0, buffer.Length);

            // You must close the output stream.
            output.Close();
        }
Example #39
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [jbrinkman]	5/6/2004	Created
        ///		[jhenning] 2/22/2005	Added properties
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "DNNTree");
            writer.AddAttribute(HtmlTextWriterAttribute.Name, _tree.UniqueID);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, _tree.ClientID);
            //_tree.UniqueID.Replace(":", "_"))

            writer.AddAttribute("sysimgpath", _tree.SystemImagesPath);
            writer.AddAttribute("indentw", _tree.IndentWidth.ToString());
            if (_tree.ExpandCollapseImageWidth != 12)
            {
                writer.AddAttribute("expcolimgw", _tree.ExpandCollapseImageWidth.ToString());
            }
            if (_tree.CheckBoxes)
            {
                writer.AddAttribute("checkboxes", "1");
            }
            if (!String.IsNullOrEmpty(_tree.Target))
            {
                writer.AddAttribute("target", _tree.Target);
            }

            if (_tree.ImageList.Count > 0)
            {
                string strList = "";
                foreach (NodeImage objNodeImage in _tree.ImageList)
                {
                    strList += (String.IsNullOrEmpty(strList) ? "" : ",") + objNodeImage.ImageUrl;
                }
                writer.AddAttribute("imagelist", strList);
            }

            //css attributes
            if (!String.IsNullOrEmpty(_tree.DefaultNodeCssClass))
            {
                writer.AddAttribute("css", _tree.DefaultNodeCssClass);
            }
            if (!String.IsNullOrEmpty(_tree.DefaultChildNodeCssClass))
            {
                writer.AddAttribute("csschild", _tree.DefaultChildNodeCssClass);
            }
            if (!String.IsNullOrEmpty(_tree.DefaultNodeCssClassOver))
            {
                writer.AddAttribute("csshover", _tree.DefaultNodeCssClassOver);
            }
            if (!String.IsNullOrEmpty(_tree.DefaultNodeCssClassSelected))
            {
                writer.AddAttribute("csssel", _tree.DefaultNodeCssClassSelected);
            }
            if (!String.IsNullOrEmpty(_tree.DefaultIconCssClass))
            {
                writer.AddAttribute("cssicon", _tree.DefaultIconCssClass);
            }

            if (!String.IsNullOrEmpty(_tree.JSFunction))
            {
                writer.AddAttribute("js", _tree.JSFunction);
            }

            if (!String.IsNullOrEmpty(_tree.WorkImage))
            {
                writer.AddAttribute("working", _tree.WorkImage);
            }
            if (_tree.AnimationFrames != 5)
            {
                writer.AddAttribute("animf", _tree.AnimationFrames.ToString());
            }
            writer.AddAttribute("expimg", _tree.ExpandedNodeImage);
            writer.AddAttribute("colimg", _tree.CollapsedNodeImage);
            writer.AddAttribute("postback", ClientAPI.GetPostBackEventReference(_tree, "[NODEID]" + ClientAPI.COLUMN_DELIMITER + "Click"));

            if (_tree.PopulateNodesFromClient)
            {
                if (DotNetNuke.UI.Utilities.ClientAPI.BrowserSupportsFunctionality(Utilities.ClientAPI.ClientFunctionality.XMLHTTP))
                {
                    writer.AddAttribute("callback", DotNetNuke.UI.Utilities.ClientAPI.GetCallbackEventReference(_tree, "'[NODEXML]'", "this.callBackSuccess", "oTNode", "this.callBackFail", "this.callBackStatus"));
                }
                else
                {
                    writer.AddAttribute("callback", ClientAPI.GetPostBackClientHyperlink(_tree, "[NODEID]" + ClientAPI.COLUMN_DELIMITER + "OnDemand"));
                }
                if (!String.IsNullOrEmpty(_tree.CallbackStatusFunction))
                {
                    writer.AddAttribute("callbackSF", _tree.CallbackStatusFunction);
                }
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.RenderEndTag();
        }
Example #40
0
        /// <summary>
        /// RenderEditMode renders the Edit mode of the control
        /// </summary>
        /// <param name="writer">A HtmlTextWriter.</param>
        protected override void RenderEditMode(HtmlTextWriter writer)
        {
            //Render div
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "dnnLeft");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            IList <CultureInfo> cultures = new List <CultureInfo>();

            switch (ListType)
            {
            case LanguagesListType.All:
                var culturesArray = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
                Array.Sort(culturesArray, new CultureInfoComparer(DisplayMode));
                cultures = culturesArray.ToList();
                break;

            case LanguagesListType.Supported:
                cultures = LocaleController.Instance.GetLocales(Null.NullInteger).Values
                           .Select(c => CultureInfo.GetCultureInfo(c.Code))
                           .ToList();
                break;

            case LanguagesListType.Enabled:
                cultures = LocaleController.Instance.GetLocales(PortalSettings.PortalId).Values
                           .Select(c => CultureInfo.GetCultureInfo(c.Code))
                           .ToList();
                break;
            }

            var promptValue = StringValue == Null.NullString && cultures.Count > 1 && !Required;

            //Render the Select Tag
            writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
            if (promptValue)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Onchange, "onLocaleChanged(this)");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Select);

            //Render None selected option
            //Add the Value Attribute
            writer.AddAttribute(HtmlTextWriterAttribute.Value, Null.NullString);

            if (StringValue == Null.NullString)
            {
                //Add the Selected Attribute
                writer.AddAttribute(HtmlTextWriterAttribute.Selected, "selected");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Option);
            writer.Write(Localization.GetString("Not_Specified", Localization.SharedResourceFile));
            writer.RenderEndTag();

            foreach (var culture in cultures)
            {
                RenderOption(writer, culture);
            }

            //Close Select Tag
            writer.RenderEndTag();

            if (promptValue)
            {
                writer.WriteBreak();

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "dnnFormMessage dnnFormError");
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.Write(Localization.GetString("LanguageNotSelected", Localization.SharedResourceFile));
                writer.RenderEndTag();

                writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
                writer.RenderBeginTag(HtmlTextWriterTag.Script);
                writer.Write(@"
function onLocaleChanged(element){
    var $this = $(element);
    var $error = $this.next().next();
    var value = $this.val();
    value ? $error.hide() : $error.show();
};
");
                writer.RenderEndTag();
            }

            //Render break
            writer.Write("<br />");

            //Render Span
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "dnnFormRadioButtons");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);

            //Render Button Row
            RenderModeButtons(writer);

            //close span
            writer.RenderEndTag();

            //close div
            writer.RenderEndTag();
        }
Example #41
0
 protected override void Render(HtmlTextWriter writer)
 {
     writer.AddAttribute("class", "ztree");
     //writer.AddAttribute("id", this.ID);
     base.Render(writer);
 }
        /// <devdoc>
        /// <para>[To be supplied.]</para>
        /// </devdoc>
        public virtual void RenderBeginHyperlink(HtmlTextWriter writer, string targetUrl, bool encodeUrl, string softkeyLabel, string accessKey) {
            String url;

            // Valid values are null, String.Empty, and single character strings
            if ((accessKey != null) && (accessKey.Length > 1)) {
                throw new ArgumentOutOfRangeException("accessKey");
            }

            if (encodeUrl) {
                url = HttpUtility.HtmlAttributeEncode(targetUrl);
            }
            else {
                url = targetUrl;
            }
            writer.AddAttribute("href", url);
            if (!String.IsNullOrEmpty(accessKey)) {
                writer.AddAttribute("accessKey", accessKey);
            }
            writer.RenderBeginTag("a");
        }
        /// <summary>
        /// Generates a SPARQL Update Form
        /// </summary>
        /// <param name="context">HTTP Context</param>
        protected virtual void ShowUpdateForm(HttpContext context)
        {
            //Set Content Type
            context.Response.Clear();
            context.Response.ContentType = "text/html";

            //Get a HTML Text Writer
            HtmlTextWriter output = new HtmlTextWriter(new StreamWriter(context.Response.OutputStream));

            //Page Header
            output.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
            output.RenderBeginTag(HtmlTextWriterTag.Html);
            output.RenderBeginTag(HtmlTextWriterTag.Head);
            output.RenderBeginTag(HtmlTextWriterTag.Title);
            output.WriteEncodedText("SPARQL Update Interface");
            output.RenderEndTag();
            //Add Stylesheet
            if (!this._config.Stylesheet.Equals(String.Empty))
            {
                output.AddAttribute(HtmlTextWriterAttribute.Href, this._config.Stylesheet);
                output.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
                output.AddAttribute(HtmlTextWriterAttribute.Rel, "stylesheet");
                output.RenderBeginTag(HtmlTextWriterTag.Link);
                output.RenderEndTag();
            }
            output.RenderEndTag();


            //Header Text
            output.RenderBeginTag(HtmlTextWriterTag.Body);
            output.RenderBeginTag(HtmlTextWriterTag.H3);
            output.WriteEncodedText("SPARQL Update Interface");
            output.RenderEndTag();

            //Query Form
            output.AddAttribute(HtmlTextWriterAttribute.Name, "sparqlUpdate");
            output.AddAttribute("method", "get");
            output.AddAttribute("action", context.Request.Path);
            output.RenderBeginTag(HtmlTextWriterTag.Form);

            if (!this._config.IntroductionText.Equals(String.Empty))
            {
                output.RenderBeginTag(HtmlTextWriterTag.P);
                output.Write(this._config.IntroductionText);
                output.RenderEndTag();
            }

            output.WriteEncodedText("Update");
            output.WriteBreak();
            output.AddAttribute(HtmlTextWriterAttribute.Name, "update");
            output.AddAttribute(HtmlTextWriterAttribute.Rows, "15");
            output.AddAttribute(HtmlTextWriterAttribute.Cols, "100");
            output.RenderBeginTag(HtmlTextWriterTag.Textarea);
            output.WriteEncodedText(this._config.DefaultUpdate);
            output.RenderEndTag();
            output.WriteBreak();

            //output.WriteEncodedText("Default Graph URI: ");
            //output.AddAttribute(HtmlTextWriterAttribute.Name, "default-graph-uri");
            //output.AddAttribute(HtmlTextWriterAttribute.Type, "text");
            //output.AddAttribute(HtmlTextWriterAttribute.Size, "100");
            //output.AddAttribute(HtmlTextWriterAttribute.Value, this._config.DefaultGraphURI);
            //output.RenderBeginTag(HtmlTextWriterTag.Input);
            //output.RenderEndTag();
            //output.WriteBreak();

            output.AddAttribute(HtmlTextWriterAttribute.Type, "submit");
            output.AddAttribute(HtmlTextWriterAttribute.Value, "Perform Update");
            output.RenderBeginTag(HtmlTextWriterTag.Input);
            output.RenderEndTag();

            output.RenderEndTag(); //End Form

            //End of Page
            output.RenderEndTag(); //End Body
            output.RenderEndTag(); //End Html

            output.Flush();
        }
        protected internal override void Render(HtmlTextWriter writer) {
            string uniqueID = UniqueID;

            // Make sure we are in a form tag with runat=server.
            if (Page != null) {
                Page.VerifyRenderingInServerForm(this);
                Page.ClientScript.RegisterForEventValidation(uniqueID);
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Type, "hidden");

            if (uniqueID != null) {
                writer.AddAttribute(HtmlTextWriterAttribute.Name, uniqueID);
            }

            if (ID != null) {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
            }

            string s;
            s = Value;
            if (s.Length > 0) {
                writer.AddAttribute(HtmlTextWriterAttribute.Value, s);
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            writer.RenderEndTag();
        }
Example #45
0
        /// <summary>
        /// Renders the base control.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public override void RenderBaseControl(HtmlTextWriter writer)
        {
            Dictionary <string, string> values = null;

            if (DefinedTypeId.HasValue)
            {
                values = new Dictionary <string, string>();
                new DefinedValueService(new RockContext())
                .GetByDefinedTypeId(DefinedTypeId.Value)
                .ToList()
                .ForEach(v => values.Add(v.Id.ToString(), v.Value));
            }
            else if (CustomValues != null)
            {
                values = CustomValues;
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "key-value-list " + this.CssClass);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.WriteLine();

            _hfValue.RenderControl(writer);
            writer.WriteLine();

            StringBuilder html = new StringBuilder();

            html.Append(@"<div class=""controls controls-row form-control-group"">");

            // write key/value html
            if (this.DisplayValueFirst)
            {
                WriteValueHtml(html, values);
                WriteKeyHtml(html);
            }
            else
            {
                WriteKeyHtml(html);
                WriteValueHtml(html, values);
            }


            html.Append(@"<a href=""#"" class=""btn btn-sm btn-danger key-value-remove""><i class=""fa fa-minus-circle""></i></a></div>");

            var hfValueHtml = new HtmlInputHidden();

            hfValueHtml.AddCssClass("js-value-html");
            hfValueHtml.Value = html.ToString();
            hfValueHtml.RenderControl(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "key-value-rows");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.WriteLine();

            string[] nameValues = this.Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string nameValue in nameValues)
            {
                string[] nameAndValue = nameValue.Split(new char[] { '^' });

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "controls controls-row form-control-group");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.WriteLine();

                if (DisplayValueFirst)
                {
                    WriteValueControls(writer, nameAndValue, values);
                    WriteKeyControls(writer, nameAndValue);
                }
                else
                {
                    WriteKeyControls(writer, nameAndValue);
                    WriteValueControls(writer, nameAndValue, values);
                }

                // Write Remove Button
                writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "btn btn-sm btn-danger key-value-remove");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-minus-circle");
                writer.RenderBeginTag(HtmlTextWriterTag.I);
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.WriteLine();

                writer.RenderEndTag();
                writer.WriteLine();
            }

            writer.RenderEndTag();
            writer.WriteLine();


            writer.AddAttribute(HtmlTextWriterAttribute.Class, "actions");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "btn btn-action btn-xs key-value-add");
            writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-plus-circle");
            writer.RenderBeginTag(HtmlTextWriterTag.I);

            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.WriteLine();

            writer.RenderEndTag();
            writer.WriteLine();

            RegisterClientScript();
        }
Example #46
0
        /// <summary>
        /// 将此控件呈现给指定的输出参数。
        /// </summary>
        /// <param name="output"> 要写出到的 HTML 编写器 </param>
        protected override void Render(HtmlTextWriter output)
        {
            output.AddAttribute(HtmlTextWriterAttribute.Id, this.UniqueID);
            output.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
            if (this.CssClass != "")
            {
                output.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);
            }
            if (this.Text != "" && this.Text != null)
            {
                output.AddAttribute(HtmlTextWriterAttribute.Value, this.Text);
            }
            if (this.Size != "" && this.Size != null)
            {
                output.AddAttribute(HtmlTextWriterAttribute.Size, this.Size);
            }
            output.AddAttribute(HtmlTextWriterAttribute.Style, "cursor:hand");
            output.AddAttribute(HtmlTextWriterAttribute.Type, "text");
            output.AddAttribute(HtmlTextWriterAttribute.ReadOnly, "true");
            output.AddAttribute(HtmlTextWriterAttribute.Onclick, "javascript:this.focus()");
            output.AddAttribute("onFocus", "fPopCalendar(this,this,PopCal); return false;");
            output.RenderBeginTag(HtmlTextWriterTag.Input);
            output.RenderEndTag();

            if (!this.Page.ClientScript.IsClientScriptBlockRegistered(this.Page.GetType(), "WCalendarClientScript"))
            {
                output.WriteLine("<script language=\"JavaScript\">");
                output.WriteLine("var gdCtrl = new Object();");
                output.WriteLine("var gcGray = \"#808080\";");          //非当前月应有日期字的颜色
                output.WriteLine("var gcToggle = \"highlight\";");      //鼠标所在日期单元格的底色
                output.WriteLine("var gcBG = \"threedface\";");         //日历背景色
                output.WriteLine("var gMonths = new Array(\"一月\",\"二月\",\"三月\",\"四月\",\"五月\",\"六月\",\"七月\",\"八月\",\"九月\",\"十月\",\"十一月\",\"十二月\");");

                output.WriteLine("var gdCurDate = new Date();");                //gdCurDate--当前日期
                output.WriteLine("var giYear = gdCurDate.getFullYear();");      //giYear--当前年份
                output.WriteLine("var giMonth = gdCurDate.getMonth()+1;");      //giMonth--当前月份(因为getMonth()返回的是0-11间的整数,故当前月要加1)
                output.WriteLine("var giDay = gdCurDate.getDate();");           //giDay--当前日
                output.WriteLine("var sxYear = giYear;");                       //sxYear--所选年份
                output.WriteLine("var sxMonth = giMonth;");                     //sxMonth--所选月份
                output.WriteLine("var sxDay = giDay;");                         //sxDay--所选日
                output.WriteLine("var sxDatestr = gdCtrl.value;");              //以前所选日期

                output.WriteLine("if (sxDatestr != \"\"){");
                output.WriteLine("var sxDate = new Date(sxDatestr);");
                output.WriteLine("sxYear = sxDate.getFullYear();");
                output.WriteLine("}");

                output.WriteLine("var VicPopCal = new Object();");

                #region  标异动到某对象上的一系列函数
                output.WriteLine("function mouseover(obj){");
                output.WriteLine("obj.style.borderTop = 'buttonshadow 1px solid';");
                output.WriteLine("obj.style.borderLeft = 'buttonshadow 1px solid';");
                output.WriteLine("obj.style.borderRight = 'buttonhighlight 1px solid';");
                output.WriteLine("obj.style.borderBottom = 'buttonhighlight 1px solid';");
                output.WriteLine("}");


                output.WriteLine("function mouseout(obj){");
                output.WriteLine("obj.style.borderTop = 'buttonhighlight 1px solid';");
                output.WriteLine("obj.style.borderLeft = 'buttonhighlight 1px solid';");
                output.WriteLine("obj.style.borderRight = 'buttonshadow 1px solid';");
                output.WriteLine("obj.style.borderBottom = 'buttonshadow 1px solid';");
                output.WriteLine("}");

                output.WriteLine("function mousedown(obj){");
                output.WriteLine("obj.style.borderTop = 'buttonshadow 1px solid';");
                output.WriteLine("obj.style.borderLeft = 'buttonshadow 1px solid';");
                output.WriteLine("obj.style.borderRight = 'buttonhighlight 1px solid';");
                output.WriteLine("obj.style.borderBottom = 'buttonhighlight 1px solid';");
                output.WriteLine("}");

                output.WriteLine("function mouseup(obj){");
                output.WriteLine("obj.style.borderTop = 'buttonhighlight 1px solid';");
                output.WriteLine("obj.style.borderLeft = 'buttonhighlight 1px solid';");
                output.WriteLine("obj.style.borderRight = 'buttonshadow 1px solid';");
                output.WriteLine("obj.style.borderBottom = 'buttonshadow 1px solid';");
                output.WriteLine("}");
                #endregion

                #region 日历操作的一系列函数

                output.WriteLine("function fPopCalendar(popCtrl, dateCtrl, popCal){");
                //output.WriteLine("parent.event.cancelBubble=true;");			//2005-09-28
                output.WriteLine("VicPopCal = popCal;");
                output.WriteLine("gdCtrl = dateCtrl;");
                output.WriteLine("fSetYearMon(giYear, giMonth);");
                output.WriteLine("var point = fGetXY(popCtrl);");
                output.WriteLine("with (VicPopCal.style) {left = point.x;top  = point.y+popCtrl.offsetHeight+1;visibility = 'visible';}");
                output.WriteLine("VicPopCal.focus();");
                output.WriteLine("}");

                output.WriteLine("function fSetDate(iYear, iMonth, iDay){");
                output.WriteLine("if ((iYear == 0) && (iMonth == 0) && (iDay == 0)){");
                output.WriteLine("gdCtrl.value = \"\";");
                output.WriteLine("}");
                output.WriteLine("else{");
                output.WriteLine("if (iMonth < 10){iMonth = \"0\"+iMonth;}"); //规格化时间
                output.WriteLine("if (iDay < 10){iDay = \"0\"+iDay;}");
                output.WriteLine("gdCtrl.value = iYear+\"-\"+iMonth+\"-\"+iDay;");
                output.WriteLine("}");
                output.WriteLine("VicPopCal.style.visibility = \"hidden\";");
                output.WriteLine("}");

                output.WriteLine("function fSetSelected(aCell){");
                output.WriteLine("var iOffset = 0;");
                output.WriteLine("var iYear = parseInt(document.all.tbSelYear.value);");
                output.WriteLine("var iMonth = parseInt(document.all.tbSelMonth.value);");
                output.WriteLine("aCell.bgColor = gcBG;");
                output.WriteLine("with (aCell.children[\"cellText\"]){");
                output.WriteLine("var iDay = parseInt(innerText);");
                output.WriteLine("if (color==gcGray){iOffset = (Victor<10)?-1:1;}");
                output.WriteLine("iMonth += iOffset;");
                output.WriteLine("if (iMonth<1) {	iYear--; iMonth = 12;}else{if (iMonth>12){iYear++;iMonth = 1;}}");
                output.WriteLine("}");
                output.WriteLine("fSetDate(iYear, iMonth, iDay);");
                output.WriteLine("}");

                output.WriteLine("function Point(iX, iY){this.x = iX;this.y = iY;}");

                output.WriteLine("function fBuildCal(iYear, iMonth){");
                output.WriteLine("var aMonth=new Array();");
                output.WriteLine("for(i=1;i<7;i++){aMonth[i]=new Array(i);}");
                output.WriteLine("var dCalDate=new Date(iYear, iMonth-1, 1);");
                output.WriteLine("var iDayOfFirst=dCalDate.getDay();");
                output.WriteLine("var iDaysInMonth=new Date(iYear, iMonth, 0).getDate();");
                output.WriteLine("var iOffsetLast=new Date(iYear, iMonth-1, 0).getDate()-iDayOfFirst+1;");
                output.WriteLine("var iDate = 1;");
                output.WriteLine("var iNext = 1;");
                output.WriteLine("for (d = 0; d < 7; d++){aMonth[1][d] = (d<iDayOfFirst)?-(iOffsetLast+d):iDate++;}");
                output.WriteLine("for (w = 2; w < 7; w++){for (d = 0; d < 7; d++){aMonth[w][d] = (iDate<=iDaysInMonth)?iDate++:-(iNext++);}}");
                output.WriteLine("return aMonth;");
                output.WriteLine("}");


                output.WriteLine("function fDrawCal(iYear, iMonth, iDay, iCellWidth, iDateTextSize) {");
                output.WriteLine("var WeekDay = new Array(\"日\",\"一\",\"二\",\"三\",\"四\",\"五\",\"六\");");
                output.WriteLine("var styleTD = \" bgcolor='\"+gcBG+\"' width='\"+iCellWidth+\"' bordercolor='\"+gcBG+\"' valign='middle' align='center' style='font-size: 12px;background: buttonface;border-top: buttonhighlight 1px solid;border-left: buttonhighlight 1px solid;border-right: buttonshadow 1px solid;	border-bottom: buttonshadow 1px solid;\";");
                output.WriteLine("with (document) {");
                output.WriteLine("write(\"<tr align='center'>\");");
                output.WriteLine("for(i=0; i<7; i++){write(\"<td height='20' \"+styleTD+\"color:#990099' >\" + WeekDay[i] + \"</td>\");}");
                output.WriteLine("write(\"</tr>\");");
                output.WriteLine("for (w = 1; w < 7; w++) {");
                output.WriteLine("write(\"<tr align='center'>\");");
                output.WriteLine("for (d = 0; d < 7; d++) {");
                output.WriteLine("write(\"<td width='10%' height='15' id=calCell \"+styleTD+\"cursor:hand;' onmouseover='mouseover(this)' onmouseout='mouseout(this)' onmousedown='mousedown(this)' onmouseup='mouseup(this)' onclick='fSetSelected(this)'>\");");
                output.WriteLine("write(\"<font style='font-size: 13px;' id=cellText Victor='Liming Weng'> </font>\");");
                output.WriteLine("write(\"</td>\");");
                output.WriteLine("}");
                output.WriteLine("write(\"</tr>\");");
                output.WriteLine("}");
                output.WriteLine("}");
                output.WriteLine("}");


                output.WriteLine("function fUpdateCal(iYear, iMonth) {");
                output.WriteLine("sxYear = iYear;");
                output.WriteLine("sxMonth = iMonth;");
                output.WriteLine("yeartd1.innerText = sxYear + \"年\";");
                output.WriteLine("monthtd1.innerText = gMonths[sxMonth-1];");
                output.WriteLine("myMonth = fBuildCal(iYear, iMonth);");
                output.WriteLine("var i = 0;");
                output.WriteLine("for (w = 0; w < 6; w++){");
                output.WriteLine("for (d = 0; d < 7; d++){");
                output.WriteLine("with (cellText[(7*w)+d]) {");
                output.WriteLine("Victor = i++;");
                output.WriteLine("if (myMonth[w+1][d]<0) {");
                output.WriteLine("color = gcGray;");
                output.WriteLine("innerText = -myMonth[w+1][d];");
                output.WriteLine("}else{");
                output.WriteLine("color = ((d==0)||(d==6))?\"red\":\"black\";");
                output.WriteLine("innerText = myMonth[w+1][d];");
                output.WriteLine("}");
                output.WriteLine("}");
                output.WriteLine("}");
                output.WriteLine("}");
                output.WriteLine("}");

                //设置列表框中的年份和月份
                output.WriteLine("function fSetYearMon(iYear, iMon){");
                output.WriteLine("sxYear = iYear;");
                output.WriteLine("sxMonth = iMon;");
                output.WriteLine("yeartd1.innerText = sxYear + \"年\";");
                output.WriteLine("monthtd1.innerText = gMonths[sxMonth-1];");
                output.WriteLine("document.all.tbSelMonth.options[iMon-1].selected = true;");
                output.WriteLine("for (i = 0; i < document.all.tbSelYear.length; i++){");
                output.WriteLine("if (document.all.tbSelYear.options[i].value == iYear){");
                output.WriteLine("document.all.tbSelYear.options[i].selected = true;");
                output.WriteLine("}");
                output.WriteLine("}");
                output.WriteLine("fUpdateCal(iYear, iMon);");
                output.WriteLine("}");

                output.WriteLine("function fPrevMonth(){");
                output.WriteLine("var iMon = document.all.tbSelMonth.value;");
                output.WriteLine("var iYear = document.all.tbSelYear.value;");
                output.WriteLine("if (--iMon<1) {");
                output.WriteLine("iMon = 12;");
                output.WriteLine("iYear--;");
                output.WriteLine("}");
                output.WriteLine("fSetYearMon(iYear, iMon);");
                output.WriteLine("}");


                output.WriteLine("function fNextMonth(){");
                output.WriteLine("var iMon = document.all.tbSelMonth.value;");
                output.WriteLine("var iYear = document.all.tbSelYear.value;");
                output.WriteLine("if (++iMon>12) {");
                output.WriteLine("iMon = 1;");
                output.WriteLine("iYear++;");
                output.WriteLine("}");
                output.WriteLine("fSetYearMon(iYear, iMon);");
                output.WriteLine("}");


                output.WriteLine("function fGetXY(aTag){");
                output.WriteLine("var oTmp = aTag;");
                output.WriteLine("var pt = new Point(0,0);");
                output.WriteLine("do {");
                output.WriteLine("pt.x += oTmp.offsetLeft;");
                output.WriteLine("pt.y += oTmp.offsetTop;");
                output.WriteLine("oTmp = oTmp.offsetParent;");
                output.WriteLine("} while(oTmp.tagName!=\"BODY\");");
                output.WriteLine("return pt;");
                output.WriteLine("}");

                #endregion

                #region 日历体
                output.WriteLine("with (document){");
                output.WriteLine("write(\"<Div id='PopCal' onclick='event.cancelBubble=true' style='POSITION:absolute; VISIBILITY: hidden; bordercolor:#000000;border:2px ridge;width:10;z-index:100;'>\");");

                //增加一个iframe可以解决被select遮挡的问题
                output.WriteLine("write(\"<iframe frameBorder=0 width=180 scrolling=no height=170></iframe>\")");
                //修改table
                output.WriteLine("write(\"<table id='popTable' border='1' bgcolor='#eeede8' cellpadding='0' cellspacing='0' style='font-size:12px;Z-INDEX:202;position:absolute;top:0;left:0;'>\");");
                //原table
                //output.WriteLine("write(\"<table id='popTable' border='1' bgcolor='#eeede8' cellpadding='0' cellspacing='0' style='font-size:12px'>\");");

                output.WriteLine("write(\"<TR>\");");
                output.WriteLine("write(\"<td valign='middle' align='center' style='cursor:default'>\");");
                //日历头
                output.WriteLine("write(\"<table width='176' border='0' cellpadding='0' cellspacing='0'>\");");
                output.WriteLine("write(\"<tr align='center'>\");");
                //上一个月
                output.WriteLine("write(\"<td height='22' width='20' name='PrevMonth' style='font-family:\\\"webdings\\\";font-size:15px' onClick='fPrevMonth()' onmouseover='this.style.color=\\\"#ff9900\\\"' onmouseout='this.style.color=\\\"\\\"'>3</td>\");");
                //显示和选择年份----------

                //显示年份
                output.WriteLine("write(\"<td width='64' id='yeartd1' style='font-size:12px' onmouseover='yeartd1.style.display=\\\"none\\\";yeartd2.style.display=\\\"\\\";' onmouseout='this.style.background=\\\"\\\"'>\");");
                output.WriteLine("write(sxYear + \"年\");");
                output.WriteLine("write(\"</td>\");");
                //年份选择
                //output.WriteLine("write(\"<td width='64' id='yeartd2' style='display:none' onmouseout='yeartd2.style.display=\\\"none\\\";yeartd1.style.display=\\\"\\\";'>\");");
                output.WriteLine("write(\"<td width='64' id='yeartd2' style='display:none'>\");");
                output.WriteLine("write(\"<SELECT style='width:64px;font-size: 12px;font-family: 宋体;' id='tbSelYear' onChange='fUpdateCal(document.all.tbSelYear.value, document.all.tbSelMonth.value);yeartd2.style.display=\\\"none\\\";yeartd1.style.display=\\\"\\\";' Victor='Won'>\");");
                output.WriteLine("for(i=" + (DateTime.Now.Year - 5).ToString() + ";i<" + (DateTime.Now.Year + 5).ToString() + ";i++){");
                output.WriteLine("write(\"<OPTION value='\"+i+\"'>\"+i+\"年</OPTION>\");");
                output.WriteLine("}");
                output.WriteLine("write(\"</SELECT>\");");
                output.WriteLine("write(\"</td>\");");
                //显示和选择月份----------
                //显示月份
                output.WriteLine("write(\"<td width='72' id='monthtd1' style='font-size:12px' onmouseover='monthtd1.style.display=\\\"none\\\";monthtd2.style.display=\\\"\\\";' onmouseout='this.style.background=\\\"\\\"'>\");");
                output.WriteLine("write(gMonths[sxMonth-1]);");
                output.WriteLine("write(\"</td>\");");
                //月份选择
                //output.WriteLine("write(\"<td width='72' id='monthtd2' style='display:none' onmouseout='monthtd2.style.display=\\\"none\\\";monthtd1.style.display=\\\"\\\";'>\");");
                output.WriteLine("write(\"<td width='72' id='monthtd2' style='display:none'>\");");
                output.WriteLine("write(\"<select style='width:72px;font-size: 12px;font-family: 宋体;' id='tbSelMonth' onChange='fUpdateCal(document.all.tbSelYear.value, document.all.tbSelMonth.value);monthtd2.style.display=\\\"none\\\";monthtd1.style.display=\\\"\\\";' Victor='Won'>\");");

                output.WriteLine("for (i=0; i<12; i++){");
                output.WriteLine("write(\"<option value='\"+(i+1)+\"'>\"+gMonths[i]+\"</option>\");");
                output.WriteLine("}");
                output.WriteLine("write(\"</SELECT>\");");
                output.WriteLine("write(\"</td>\");");
                //下一个月
                output.WriteLine("write(\"<td width='20' name='PrevMonth' style='font-family:\\\"webdings\\\";font-size:15px' onclick='fNextMonth()' onmouseover='this.style.color=\\\"#ff9900\\\"' onmouseout='this.style.color=\\\"\\\"'>4</td>\");");

                output.WriteLine("write(\"</tr>\");");
                output.WriteLine("write(\"</table>\");");
                //----------------------------日历头结束----------------
                output.WriteLine("write(\"</td></TR><TR><td align='center'>\");");
                output.WriteLine("write(\"<DIV style='background-color:teal;'><table width='100%' border='0' bgcolor='threedface' cellpadding='0' cellspacing='0'>\");");
                output.WriteLine("fDrawCal(giYear, giMonth, giDay, 19, 14);");
                output.WriteLine("write(\"</table></DIV>\");");
                output.WriteLine("write(\"</td></TR><TR><TD height='20' align='center' valign='bottom'>\");");
                output.WriteLine("write(\"<font style='cursor:hand;font-size:12px' onclick='fSetDate(0,0,0)' onMouseOver='this.style.color=\\\"#0033FF\\\"' onMouseOut='this.style.color=0'>清空</font>\");");
                output.WriteLine("write(\"&nbsp;&nbsp;&nbsp;&nbsp;\");");
                output.WriteLine("write(\"<font style='cursor:hand;font-size:12px' onclick='fSetDate(giYear,giMonth,giDay)' onMouseOver='this.style.color=\\\"#0033FF\\\"' onMouseOut='this.style.color=0'>今天: \"+giYear+\"-\"+giMonth+\"-\"+giDay+\"</font>\");");
                output.WriteLine("write(\"</TD></TR></TD></TR></TABLE>\");");
                output.WriteLine("write(\"</Div>\");");
                output.WriteLine("}");
                #endregion

                output.WriteLine("</script>");
                output.WriteLine("<SCRIPT event=onclick() for=document>PopCal.style.visibility = 'hidden';</SCRIPT>");
                //this.Page.RegisterClientScriptBlock("clientScript", "");
                this.Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "WCalendarClientScript", "");
            }
        }
Example #47
0
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{
			base.AddAttributesToRender (writer);
			if (!ControlStyleCreated || TableStyle.IsEmpty) {
				// for some reason border=X seems to be always present
				// and isn't rendered as a style attribute
				writer.AddAttribute (HtmlTextWriterAttribute.Border, "0", false);
			}
		}
Example #48
0
        internal override void RenderItem(HtmlTextWriter output, FileViewItem item)
        {
            output.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Name Collumn
            if (fileView.Sort == SortMode.Name)
            {
                fileView.DetailsSortedColumnStyle.AddAttributesToRender(output);
            }
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.RenderBeginTag(HtmlTextWriterTag.Td);

            fileView.RenderItemBeginTag(output, item);

            output.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            output.RenderBeginTag(HtmlTextWriterTag.Table);
            output.RenderBeginTag(HtmlTextWriterTag.Tr);
            output.RenderBeginTag(HtmlTextWriterTag.Td);

            output.AddStyleAttribute(HtmlTextWriterStyle.Width, FileManagerController.SmallImageWidth.ToString(CultureInfo.InstalledUICulture));
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, FileManagerController.SmallImageHeight.ToString(CultureInfo.InstalledUICulture));
            output.AddAttribute(HtmlTextWriterAttribute.Src, item.SmallImage);
            output.AddAttribute(HtmlTextWriterAttribute.Alt, item.Info);
            output.RenderBeginTag(HtmlTextWriterTag.Img);
            output.RenderEndTag();

            output.RenderEndTag();
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            output.RenderBeginTag(HtmlTextWriterTag.Td);

            output.AddAttribute(HtmlTextWriterAttribute.Id, item.ClientID + "_Name");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.RenderBeginTag(HtmlTextWriterTag.Div);
            output.Write("&nbsp;");
            RenderItemName(output, item);
            output.RenderEndTag();

            output.RenderEndTag();
            output.RenderEndTag();
            output.RenderEndTag();

            fileView.RenderItemEndTag(output);

            output.RenderEndTag();

            // Size Collumn
            if (fileView.Sort == SortMode.Size)
            {
                fileView.DetailsSortedColumnStyle.AddAttributesToRender(output);
            }
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Direction, "ltr");
            output.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "right");
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            output.Write(item.Size);
            output.RenderEndTag();

            // Type Collumn
            if (fileView.Sort == SortMode.Type)
            {
                fileView.DetailsSortedColumnStyle.AddAttributesToRender(output);
            }
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            output.Write(HttpUtility.HtmlEncode(item.Type));
            output.RenderEndTag();

            // Modified Collumn
            if (fileView.Sort == SortMode.Modified)
            {
                fileView.DetailsSortedColumnStyle.AddAttributesToRender(output);
            }
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "6px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            output.Write(HttpUtility.HtmlEncode(item.Modified));
            output.RenderEndTag();


            output.RenderEndTag();
        }
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{
			base.AddAttributesToRender (writer);
			if (writer == null)
				return;

			int i = ColumnSpan;
			if (i > 0)
				writer.AddAttribute (HtmlTextWriterAttribute.Colspan, i.ToString (Helpers.InvariantCulture), false);

			i = RowSpan;
			if (i > 0)
				writer.AddAttribute (HtmlTextWriterAttribute.Rowspan, i.ToString (Helpers.InvariantCulture), false);
#if NET_2_0
			string[] ahci = AssociatedHeaderCellID;
			if (ahci.Length > 1) {
				StringBuilder sb = new StringBuilder ();
				for (i = 0; i < ahci.Length - 1; i++) {
					sb.Append (ahci [i]);
					sb.Append (",");
				}
				sb.Append (ahci.Length - 1);
				writer.AddAttribute (HtmlTextWriterAttribute.Headers, sb.ToString ());
			} else if (ahci.Length == 1) {
				// most common case (without a StringBuilder)
				writer.AddAttribute (HtmlTextWriterAttribute.Headers, ahci [0]);
			}
#endif
		}
Example #50
0
        public static IHtmlString Terratype(this HtmlHelper htmlHelper, Options options, Models.Model map, params Func <object, object>[] label)
        {
            if (options == null && map == null)
            {
                //  Nothing to do, as no map or options are present
                return(new HtmlString(""));
            }

            if (map == null && options.Provider == null)
            {
                throw new ArgumentNullException("No map provider declared");
            }

            if (options == null)
            {
                options = new Options()
                {
                    MapSetId = Counter
                };
            }

            Models.Model merge = null;

            if (map == null)
            {
                merge = new Models.Model()
                {
                    Provider = options.Provider,
                    Position = options.Position,
                    Zoom     = (options.Zoom != null) ? (int)options.Zoom : 0,
                    Height   = (options.Height != null) ? (int)options.Height : DefaultHeight,
                    Icon     = options.Icon,
                };
            }
            else
            {
                merge = new Models.Model()
                {
                    Provider = map.Provider,
                    Position = map.Position,
                    Zoom     = map.Zoom,
                    Icon     = map.Icon,
                    Height   = map.Height
                };
                if (options.Provider != null)
                {
                    //  Merge providers, with options taking precedents
                    var mergeJson = JObject.FromObject(merge.Provider);
                    mergeJson.Merge(JObject.FromObject(options.Provider), new JsonMergeSettings {
                        MergeArrayHandling = MergeArrayHandling.Replace
                    });
                    var providerType = (options.Provider is Models.Provider) ? map.Provider.GetType() : options.Provider.GetType();
                    merge.Provider = (Models.Provider)mergeJson.ToObject(providerType);
                }
                if (options.Zoom != null)
                {
                    merge.Zoom = (int)options.Zoom;
                }
                if (options.Height != null)
                {
                    merge.Height = (int)options.Height;
                }
                if (options.Icon != null)
                {
                    merge.Icon = options.Icon;
                }
                if (options.Position != null)
                {
                    merge.Position = options.Position;
                }
            }

            var builder = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);

            using (var writer = new HtmlTextWriter(builder))
            {
                const string guid = "9b5a5783-242f-4f75-b31f-d506dcf22bf9";

                writer.AddAttribute(HtmlTextWriterAttribute.Class, nameof(Terratype));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                var hasLabel = map != null && (label != null || (map.Label != null && map.Label.HasContent));
                var labelId  = (hasLabel) ? nameof(Terratype) + Guid.NewGuid().ToString() : null;

                if (!HttpContext.Current.Items.Contains(guid))
                {
                    HttpContext.Current.Items.Add(guid, true);
#if DEBUG
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, UrlPath("scripts/terratype.renderer.js"));
#else
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, UrlPath("scripts/terratype.renderer.min.js"));
#endif
                    //writer.AddAttribute("defer", "");
                    writer.RenderBeginTag(HtmlTextWriterTag.Script);
                    writer.RenderEndTag();
                }

                merge.Provider.GetHtml(writer, options.MapSetId ?? Counter, merge, labelId, merge.Height, options.Language, options.DomMonitorType,
                                       options.AutoShowLabel, options.AutoRecenterAfterRefresh, options.AutoFit, options.Tag);
                if (hasLabel)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, labelId);
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    if (label != null)
                    {
                        foreach (var value in label)
                        {
                            writer.Write(value.DynamicInvoke(htmlHelper.ViewContext));
                        }
                    }
                    else
                    {
                        map.Label.GetHtml(writer, map);
                    }

                    writer.RenderEndTag();
                    writer.RenderEndTag();
                }

                writer.RenderEndTag();
            }
            return(new HtmlString(builder.ToString()));
        }
Example #51
0
		protected virtual void AddAttributesToRender (HtmlTextWriter writer) 
		{
			if (ID != null)
				writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);

			if (AccessKey != string.Empty)
				writer.AddAttribute (HtmlTextWriterAttribute.Accesskey, AccessKey);

			if (!IsEnabled)
				writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);

			if (ToolTip != string.Empty)
				writer.AddAttribute (HtmlTextWriterAttribute.Title, ToolTip);

			if (TabIndex != 0)
				writer.AddAttribute (HtmlTextWriterAttribute.Tabindex, TabIndex.ToString ());

			if (style != null && !style.IsEmpty) {
#if NET_2_0
				//unbelievable, but see WebControlTest.RenderBeginTag_BorderWidth_xxx
				if (TagKey == HtmlTextWriterTag.Span)
					AddDisplayStyleAttribute (writer);
#endif
				style.AddAttributesToRender(writer, this);
			}

			if (attributes != null)
				foreach(string s in attributes.Keys)
					writer.AddAttribute (s, attributes [s]);
		}
Example #52
0
        private void RenderPieChart(PieChart chart, HtmlTextWriter html)
        {
            PieChartRenderer pieChart = new PieChartRenderer(Color.White);

            pieChart.ShowPercents = chart.ShowPercents;

            string[] labels = new string[chart.Items.Count];
            string[] values = new string[chart.Items.Count];

            for (int i = 0; i < chart.Items.Count; ++i)
            {
                ChartItem item = chart.Items[i];

                labels[i] = item.Name;
                values[i] = item.Value.ToString();
            }

            pieChart.CollectDataPoints(labels, values);

            Bitmap bmp = pieChart.Draw();

            string fileName = chart.FileName + ".png";

            bmp.Save(Path.Combine(this.m_OutputDirectory, fileName), ImageFormat.Png);

            html.Write("<!-- ");

            html.AddAttribute(HtmlAttr.Href, "#");
            html.AddAttribute(HtmlAttr.Onclick, String.Format("javascript:window.open('{0}.html','ChildWindow','width={1},height={2},resizable=no,status=no,toolbar=no')", SafeFileName(this.FindNameFrom(chart)), bmp.Width + 30, bmp.Height + 80));
            html.RenderBeginTag(HtmlTag.A);
            html.Write(chart.Name);
            html.RenderEndTag();

            html.Write(" -->");

            html.AddAttribute(HtmlAttr.Cellpadding, "0");
            html.AddAttribute(HtmlAttr.Cellspacing, "0");
            html.AddAttribute(HtmlAttr.Border, "0");
            html.RenderBeginTag(HtmlTag.Table);

            html.RenderBeginTag(HtmlTag.Tr);
            html.AddAttribute(HtmlAttr.Class, "tbl-border");
            html.RenderBeginTag(HtmlTag.Td);

            html.AddAttribute(HtmlAttr.Width, "100%");
            html.AddAttribute(HtmlAttr.Cellpadding, "4");
            html.AddAttribute(HtmlAttr.Cellspacing, "1");
            html.RenderBeginTag(HtmlTag.Table);

            html.RenderBeginTag(HtmlTag.Tr);

            html.AddAttribute(HtmlAttr.Colspan, "10");
            html.AddAttribute(HtmlAttr.Width, "100%");
            html.AddAttribute(HtmlAttr.Align, "center");
            html.AddAttribute(HtmlAttr.Class, "header");
            html.RenderBeginTag(HtmlTag.Td);
            html.Write(chart.Name);
            html.RenderEndTag();
            html.RenderEndTag();

            html.RenderBeginTag(HtmlTag.Tr);

            html.AddAttribute(HtmlAttr.Colspan, "10");
            html.AddAttribute(HtmlAttr.Width, "100%");
            html.AddAttribute(HtmlAttr.Align, "center");
            html.AddAttribute(HtmlAttr.Class, "entry");
            html.RenderBeginTag(HtmlTag.Td);

            html.AddAttribute(HtmlAttr.Width, bmp.Width.ToString());
            html.AddAttribute(HtmlAttr.Height, bmp.Height.ToString());
            html.AddAttribute(HtmlAttr.Src, fileName);
            html.RenderBeginTag(HtmlTag.Img);
            html.RenderEndTag();

            html.RenderEndTag();
            html.RenderEndTag();

            html.RenderEndTag();
            html.RenderEndTag();
            html.RenderEndTag();
            html.RenderEndTag();

            bmp.Dispose();
        }
Example #53
0
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{			
			Page page = Page;
			if (page != null)
				page.VerifyRenderingInServerForm (this);
			
			writer.AddAttribute (HtmlTextWriterAttribute.Type, "image", false);
			writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);

			base.AddAttributesToRender (writer);
#if NET_2_0
			string onclick = OnClientClick;
			if (!String.IsNullOrEmpty (onclick))
				onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick);
			else
				onclick = String.Empty;
			
			if (HasAttributes && Attributes ["onclick"] != null) {
				onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick + Attributes ["onclick"]);
				Attributes.Remove ("onclick");
			}
			
			if (page != null)
				onclick += GetClientScriptEventReference ();
			
			if (onclick.Length > 0)
				writer.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick);
#else
			if (CausesValidation && page != null && page.AreValidatorsUplevel ()) {
				ClientScriptManager csm = new ClientScriptManager (page);
				writer.AddAttribute (HtmlTextWriterAttribute.Onclick, csm.GetClientValidationEvent ());
				writer.AddAttribute ("language", "javascript");
			}
#endif
		}
Example #54
0
        private void RenderBarGraph(BarGraph graph, HtmlTextWriter html)
        {
            BarGraphRenderer barGraph = new BarGraphRenderer(Color.White);

            barGraph.RenderMode = graph.RenderMode;

            barGraph._regions = graph.Regions;
            barGraph.SetTitles(graph.xTitle, null);

            if (graph.yTitle != null)
            {
                barGraph.VerticalLabel = graph.yTitle;
            }

            barGraph.FontColor         = Color.Black;
            barGraph.ShowData          = (graph.Interval == 1);
            barGraph.VerticalTickCount = graph.Ticks;

            string[] labels = new string[graph.Items.Count];
            string[] values = new string[graph.Items.Count];

            for (int i = 0; i < graph.Items.Count; ++i)
            {
                ChartItem item = graph.Items[i];

                labels[i] = item.Name;
                values[i] = item.Value.ToString();
            }

            barGraph._interval = graph.Interval;
            barGraph.CollectDataPoints(labels, values);

            Bitmap bmp = barGraph.Draw();

            string fileName = graph.FileName + ".png";

            bmp.Save(Path.Combine(this.m_OutputDirectory, fileName), ImageFormat.Png);

            html.Write("<!-- ");

            html.AddAttribute(HtmlAttr.Href, "#");
            html.AddAttribute(HtmlAttr.Onclick, String.Format("javascript:window.open('{0}.html','ChildWindow','width={1},height={2},resizable=no,status=no,toolbar=no')", SafeFileName(this.FindNameFrom(graph)), bmp.Width + 30, bmp.Height + 80));
            html.RenderBeginTag(HtmlTag.A);
            html.Write(graph.Name);
            html.RenderEndTag();

            html.Write(" -->");

            html.AddAttribute(HtmlAttr.Cellpadding, "0");
            html.AddAttribute(HtmlAttr.Cellspacing, "0");
            html.AddAttribute(HtmlAttr.Border, "0");
            html.RenderBeginTag(HtmlTag.Table);

            html.RenderBeginTag(HtmlTag.Tr);
            html.AddAttribute(HtmlAttr.Class, "tbl-border");
            html.RenderBeginTag(HtmlTag.Td);

            html.AddAttribute(HtmlAttr.Width, "100%");
            html.AddAttribute(HtmlAttr.Cellpadding, "4");
            html.AddAttribute(HtmlAttr.Cellspacing, "1");
            html.RenderBeginTag(HtmlTag.Table);

            html.RenderBeginTag(HtmlTag.Tr);

            html.AddAttribute(HtmlAttr.Colspan, "10");
            html.AddAttribute(HtmlAttr.Width, "100%");
            html.AddAttribute(HtmlAttr.Align, "center");
            html.AddAttribute(HtmlAttr.Class, "header");
            html.RenderBeginTag(HtmlTag.Td);
            html.Write(graph.Name);
            html.RenderEndTag();
            html.RenderEndTag();

            html.RenderBeginTag(HtmlTag.Tr);

            html.AddAttribute(HtmlAttr.Colspan, "10");
            html.AddAttribute(HtmlAttr.Width, "100%");
            html.AddAttribute(HtmlAttr.Align, "center");
            html.AddAttribute(HtmlAttr.Class, "entry");
            html.RenderBeginTag(HtmlTag.Td);

            html.AddAttribute(HtmlAttr.Width, bmp.Width.ToString());
            html.AddAttribute(HtmlAttr.Height, bmp.Height.ToString());
            html.AddAttribute(HtmlAttr.Src, fileName);
            html.RenderBeginTag(HtmlTag.Img);
            html.RenderEndTag();

            html.RenderEndTag();
            html.RenderEndTag();

            html.RenderEndTag();
            html.RenderEndTag();
            html.RenderEndTag();
            html.RenderEndTag();

            bmp.Dispose();
        }
Example #55
0
		void RenderVert (HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl) 
		{
			int itms = user.RepeatedItemCount;
			// total number of rows/columns in our table
			int cols = RepeatColumns == 0 ? 1 : RepeatColumns;
			// this gets ceil (itms / cols)
			int rows = (itms + cols - 1) / cols;
			bool sep = user.HasSeparators;
			bool oti = OuterTableImplied;
			int hdr_span = cols * ((sep && cols != 1) ? 2 : 1);
			bool table = RepeatLayout == RepeatLayout.Table && !oti;
			bool show_empty_trailing_items = true;
			bool show_empty_trailing_sep = true;
			
			if (! oti)
				RenderBeginTag (w, controlStyle, baseControl);

			if (Caption.Length > 0) {
				if (CaptionAlign != TableCaptionAlign.NotSet)
					w.AddAttribute (HtmlTextWriterAttribute.Align, CaptionAlign.ToString());

				w.RenderBeginTag (HtmlTextWriterTag.Caption);
				w.Write (Caption);
				w.RenderEndTag ();

			}

			// Render the header
			if (user.HasHeader) {
				if (oti)
					user.RenderItem (ListItemType.Header, -1, this, w);
				else if (table) {
					w.RenderBeginTag (HtmlTextWriterTag.Tr);
					// Make sure the header takes up the full width. We have two
					// columns per item if we are using separators, otherwise
					// one per item.
					if (hdr_span != 1)
						w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString (), false);

					if (UseAccessibleHeader)
						w.AddAttribute ("scope", "col", false);
					
					Style s = user.GetItemStyle (ListItemType.Header, -1);
					if (s != null)
						s.AddAttributesToRender (w);

					if (UseAccessibleHeader)
						w.RenderBeginTag (HtmlTextWriterTag.Th);
					else
						w.RenderBeginTag (HtmlTextWriterTag.Td);

					user.RenderItem (ListItemType.Header, -1, this, w);
					w.RenderEndTag (); // td
					w.RenderEndTag (); // tr
				} else {
					user.RenderItem (ListItemType.Header, -1, this, w);
					RenderBr (w);
				}
			}

			for (int r = 0; r < rows; r ++) {
				if (table)
					w.RenderBeginTag (HtmlTextWriterTag.Tr);
				
				for (int c = 0; c < cols; c ++) {
					// Find the item number we are in according to the repeat
					// direction.
					int item = index_vert (rows, cols, r, c, itms);

					// This item is blank because there there not enough items
					// to make a full row.
					if (!show_empty_trailing_items && item >= itms)
						continue;

					if (table) {
						Style s = null;
						if (item < itms)
							s = user.GetItemStyle (ListItemType.Item, item);
						if (s != null)
							s.AddAttributesToRender (w);
						w.RenderBeginTag (HtmlTextWriterTag.Td);
					}
					
					if (item < itms)
						user.RenderItem (ListItemType.Item, item, this, w);

					if (table)
						w.RenderEndTag (); // td

					if (sep && cols != 1) {
						if (table) {
							if (item < itms - 1) {
								Style s = user.GetItemStyle (ListItemType.Separator, item);
								if (s != null)
									s.AddAttributesToRender (w);
							}
							if (item < itms - 1 || show_empty_trailing_sep)
								w.RenderBeginTag (HtmlTextWriterTag.Td);
						}

						if (item < itms - 1)
							user.RenderItem (ListItemType.Separator, item, this, w);

						if (table && (item < itms - 1 || show_empty_trailing_sep))
							w.RenderEndTag (); // td
					}
				}
				if (oti) {
				} else if (table) {
					w.RenderEndTag (); // tr
				} else if (r != rows - 1) {
					RenderBr(w);
				}
				
				if (sep && r != rows - 1 /* no sep on last item */ && cols == 1) {
					if (table) {
						w.RenderBeginTag (HtmlTextWriterTag.Tr);
						Style s = user.GetItemStyle (ListItemType.Separator, r);
						if (s != null)
							s.AddAttributesToRender (w);
					
						w.RenderBeginTag (HtmlTextWriterTag.Td);
					}
					
					user.RenderItem (ListItemType.Separator, r, this, w);

					if (table) {
						w.RenderEndTag (); // td
						w.RenderEndTag (); // tr
					} else if (!oti) {
						RenderBr (w);
					}
				}
			}

			// Render the footer
			if (user.HasFooter) {
				if (oti)
					user.RenderItem (ListItemType.Footer, -1, this, w);
				else if (table) {
					w.RenderBeginTag (HtmlTextWriterTag.Tr);
					if (hdr_span != 1)
						w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString (), false);

					Style s = user.GetItemStyle (ListItemType.Footer, -1);
					if (s != null)
						s.AddAttributesToRender (w);
					
					w.RenderBeginTag (HtmlTextWriterTag.Td);
					user.RenderItem (ListItemType.Footer, -1, this, w);
					w.RenderEndTag (); // td
					w.RenderEndTag (); // tr
				} else {
					// avoid dups on 0 items
					if (itms != 0)
						RenderBr (w);
					user.RenderItem (ListItemType.Footer, -1, this, w);
				}
			}
			if (! oti)
				w.RenderEndTag (); // table/span
			
		}
Example #56
0
        private void RenderReport(Report report, HtmlTextWriter html)
        {
            html.AddAttribute(HtmlAttr.Width, report.Width);
            html.AddAttribute(HtmlAttr.Cellpadding, "0");
            html.AddAttribute(HtmlAttr.Cellspacing, "0");
            html.AddAttribute(HtmlAttr.Border, "0");
            html.RenderBeginTag(HtmlTag.Table);

            html.RenderBeginTag(HtmlTag.Tr);
            html.AddAttribute(HtmlAttr.Class, "tbl-border");
            html.RenderBeginTag(HtmlTag.Td);

            html.AddAttribute(HtmlAttr.Width, "100%");
            html.AddAttribute(HtmlAttr.Cellpadding, "4");
            html.AddAttribute(HtmlAttr.Cellspacing, "1");
            html.RenderBeginTag(HtmlTag.Table);

            html.RenderBeginTag(HtmlTag.Tr);
            html.AddAttribute(HtmlAttr.Colspan, "10");
            html.AddAttribute(HtmlAttr.Width, "100%");
            html.AddAttribute(HtmlAttr.Align, "center");
            html.AddAttribute(HtmlAttr.Class, "header");
            html.RenderBeginTag(HtmlTag.Td);
            html.Write(report.Name);
            html.RenderEndTag();
            html.RenderEndTag();

            bool isNamed = false;

            for (int i = 0; i < report.Columns.Count && !isNamed; ++i)
            {
                isNamed = (report.Columns[i].Name != null);
            }

            if (isNamed)
            {
                html.RenderBeginTag(HtmlTag.Tr);

                for (int i = 0; i < report.Columns.Count; ++i)
                {
                    ReportColumn column = report.Columns[i];

                    html.AddAttribute(HtmlAttr.Class, "header");
                    html.AddAttribute(HtmlAttr.Width, column.Width);
                    html.AddAttribute(HtmlAttr.Align, column.Align);
                    html.RenderBeginTag(HtmlTag.Td);

                    html.Write(column.Name);

                    html.RenderEndTag();
                }

                html.RenderEndTag();
            }

            for (int i = 0; i < report.Items.Count; ++i)
            {
                ReportItem item = report.Items[i];

                html.RenderBeginTag(HtmlTag.Tr);

                for (int j = 0; j < item.Values.Count; ++j)
                {
                    if (!isNamed && j == 0)
                    {
                        html.AddAttribute(HtmlAttr.Width, report.Columns[j].Width);
                    }

                    html.AddAttribute(HtmlAttr.Align, report.Columns[j].Align);
                    html.AddAttribute(HtmlAttr.Class, "entry");
                    html.RenderBeginTag(HtmlTag.Td);

                    if (item.Values[j].Format == null)
                    {
                        html.Write(item.Values[j].Value);
                    }
                    else
                    {
                        html.Write(int.Parse(item.Values[j].Value).ToString(item.Values[j].Format));
                    }

                    html.RenderEndTag();
                }

                html.RenderEndTag();
            }

            html.RenderEndTag();
            html.RenderEndTag();
            html.RenderEndTag();
            html.RenderEndTag();
        }
Example #57
0
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{
			if (Page != null)
				Page.VerifyRenderingInServerForm (this);

			if (ID != null)
				writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);

			if (AutoPostBack) {
				string onchange = Page.ClientScript.GetPostBackEventReference (GetPostBackOptions (), true);
				onchange = String.Concat ("setTimeout('", onchange.Replace ("\\", "\\\\").Replace ("'", "\\'"), "', 0)");
				writer.AddAttribute (HtmlTextWriterAttribute.Onchange, BuildScriptAttribute ("onchange", onchange));
			}
			
			if (SelectionMode == ListSelectionMode.Multiple)
				writer.AddAttribute (HtmlTextWriterAttribute.Multiple,
						"multiple", false);
			writer.AddAttribute (HtmlTextWriterAttribute.Size,
                                        Rows.ToString (Helpers.InvariantCulture));
			
			base.AddAttributesToRender (writer);
		}
Example #58
0
        /// <summary>
        /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            if (NoteTypeName != string.Empty)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "note note-" + NoteTypeName.ToLower().Replace(" ", ""));
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "note");
            }

            if (this.NoteId.HasValue)
            {
                writer.AddAttribute("rel", this.NoteId.Value.ToStringSafe());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Edit Mode HTML...
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel panel-noteentry");
            if (NoteId.HasValue || !AddAlwaysVisible)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            if (DisplayType == NoteDisplayType.Full && UsePersonIcon)
            {
                writer.Write(Person.GetPhotoImageTag(CreatedByPhotoId, CreatedByGender, 50, 50));
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "noteentry-control");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            _tbNote.RenderControl(writer);
            writer.RenderEndTag();

            if (DisplayType == NoteDisplayType.Full)
            {
                // Options
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "settings clearfix");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "options pull-left");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                if (ShowAlertCheckBox)
                {
                    _cbAlert.RenderControl(writer);
                }

                if (ShowPrivateCheckBox)
                {
                    _cbPrivate.RenderControl(writer);
                }

                writer.RenderEndTag();

                if (ShowSecurityButton && this.NoteId.HasValue)
                {
                    _sbSecurity.EntityId = this.NoteId.Value;
                    _sbSecurity.Title    = this.Label;
                    _sbSecurity.RenderControl(writer);
                }

                writer.RenderEndTag();  // settings div
            }

            writer.RenderEndTag();  // panel body

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-footer");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            _lbSaveNote.Text = "Save " + Label;
            _lbSaveNote.RenderControl(writer);

            if (NoteId.HasValue || !AddAlwaysVisible)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "edit-note-cancel btn btn-link btn-xs");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("Cancel");
                writer.RenderEndTag();
            }

            writer.RenderEndTag();  // panel-footer div

            writer.RenderEndTag();  // note-entry div

            if (NoteId.HasValue)
            {
                // View Mode HTML...
                writer.AddAttribute(HtmlTextWriterAttribute.Class, ArticleClass);
                writer.RenderBeginTag("article");

                if (DisplayType == NoteDisplayType.Full)
                {
                    if (UsePersonIcon)
                    {
                        writer.Write(Person.GetPhotoImageTag(CreatedByPhotoId, CreatedByGender, 50, 50));
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, IconClass);
                        writer.RenderBeginTag(HtmlTextWriterTag.I);
                        writer.RenderEndTag();
                    }
                }

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "details");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                if (DisplayType == NoteDisplayType.Full)
                {
                    // Heading
                    writer.RenderBeginTag(HtmlTextWriterTag.H5);
                    string heading = Caption;
                    if (string.IsNullOrWhiteSpace(Caption))
                    {
                        heading = CreatedByName;
                    }
                    writer.Write(heading.EncodeHtml());
                    if (CreatedDateTime.HasValue)
                    {
                        writer.Write(" ");
                        writer.AddAttribute("class", "date");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                        writer.Write(CreatedDateTime.Value.ToRelativeDateString(6));
                        writer.RenderEndTag();
                    }
                    writer.RenderEndTag();

                    writer.Write(Text.EncodeHtml().ConvertCrLfToHtmlBr());
                }
                else
                {
                    writer.Write(Text.EncodeHtml().ConvertCrLfToHtmlBr());
                    writer.Write(" - ");
                    if (!string.IsNullOrWhiteSpace(CreatedByName))
                    {
                        writer.AddAttribute("class", "note-author");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                        writer.Write(CreatedByName);
                        writer.RenderEndTag();
                        writer.Write(" ");
                    }
                    if (CreatedDateTime.HasValue)
                    {
                        writer.AddAttribute("class", "note-created");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                        writer.Write(CreatedDateTime.Value.ToRelativeDateString(6));
                        writer.RenderEndTag();
                    }
                }

                writer.RenderEndTag();  // Details Div

                if (CanEdit)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "actions rollover-item");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);

                    _lbDeleteNote.RenderControl(writer);

                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "edit-note");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-pencil");
                    writer.RenderBeginTag(HtmlTextWriterTag.I);
                    writer.RenderEndTag();
                    writer.RenderEndTag();  // A

                    writer.RenderEndTag();  // actions
                }

                writer.RenderEndTag();  // article
            }

            writer.RenderEndTag();
        }
 public override void RenderControl(HtmlTextWriter writer)
 {
     writer.AddAttribute(ATTR_INSTANCE_ID, this.WidgetInstance.Id.ToString());
     writer.AddAttribute(ATTR_ZONE_ID, this.WidgetInstance.WidgetZone.ID.ToString());
     base.RenderControl(writer);
 }
Example #60
0
        public static string GetMailBody(TestInformations test, bool addLinks,
                                         bool isEventEmail = false, string eventName = "", TestEvent previousRunEvent = null)
        {
            var strWr = new StringWriter();

            using (var writer = new HtmlTextWriter(strWr))
            {
                writer.Write("<!DOCTYPE html>");
                writer.Write(Environment.NewLine);
                writer.RenderBeginTag(HtmlTextWriterTag.Head);
                writer.Tag(HtmlTextWriterTag.Meta, new Dictionary <string, string>
                {
                    { "http-equiv", "X-UA-Compatible" },
                    { "content", @"IE=edge" },
                    { "charset", "utf-8" }
                });
                writer.Tag(HtmlTextWriterTag.Title, "Automation Email");
                writer.Tag(HtmlTextWriterTag.Style, new Dictionary <HtmlTextWriterAttribute, string>
                {
                    { HtmlTextWriterAttribute.Type, @"text/css" }
                });
                writer.Tag(HtmlTextWriterTag.Link, new Dictionary <HtmlTextWriterAttribute, string>
                {
                    { HtmlTextWriterAttribute.Rel, @"stylesheet" },
                    { HtmlTextWriterAttribute.Type, @"text/css" }
                });
                writer.RenderEndTag(); //HEAD

                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, ReportColors.White);
                writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "10px");
                writer.AddStyleAttribute("border", "10px solid " + ReportColors.TestBorderColor);
                writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "0px");
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%");
                writer.AddStyleAttribute(HtmlTextWriterStyle.FontFamily, "Tahoma,Verdana,Segoe,sans-serif");
                writer.RenderBeginTag(HtmlTextWriterTag.Body);

                writer.AddStyleAttribute("box-sizing", "border-box");
                writer.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "auto");
                writer.AddStyleAttribute(HtmlTextWriterStyle.Top, "0%");
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%");
                writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "10px");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "test-window");
                writer.AddAttribute(HtmlTextWriterAttribute.Title, "Test");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "10px");
                writer.AddAttribute(HtmlTextWriterAttribute.Id, test.Guid.ToString());
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.AddTag(HtmlTextWriterTag.B, "Test full name: ");
                writer.Write(test.FullName);
                writer.RenderEndTag(); //P

                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.AddTag(HtmlTextWriterTag.B, "Test name: ");
                writer.Write(test.Name);
                writer.RenderEndTag(); //P

                if (isEventEmail && previousRunEvent != null)
                {
                    var currentEvent = test.Events.First(x => x.Name.Equals(eventName));
                    writer.RenderBeginTag(HtmlTextWriterTag.P);
                    writer.AddTag(HtmlTextWriterTag.B, "Event name: ");
                    writer.Write(currentEvent.Name);
                    writer.RenderEndTag(); //P
                    writer.RenderBeginTag(HtmlTextWriterTag.P);
                    writer.AddTag(HtmlTextWriterTag.B, string.Format("Current duration (event finished at {0}): ", currentEvent.Finished));
                    writer.Write(TimeSpan.FromSeconds(currentEvent.Duration).ToString(@"hh\:mm\:ss\:fff"));
                    writer.RenderEndTag(); //P
                    writer.RenderBeginTag(HtmlTextWriterTag.P);
                    writer.AddTag(HtmlTextWriterTag.B, string.Format("Previous duration (event finished at {0}): ", previousRunEvent.Finished));
                    writer.Write(TimeSpan.FromSeconds(previousRunEvent.Duration).ToString(@"hh\:mm\:ss\:fff"));
                    writer.RenderEndTag(); //P
                    writer.RenderBeginTag(HtmlTextWriterTag.P);
                    writer.AddTag(HtmlTextWriterTag.B, "Difference: ");
                    writer.Write(TimeSpan.FromSeconds(currentEvent.Duration - previousRunEvent.Duration).ToString(@"hh\:mm\:ss\:fff"));
                    writer.RenderEndTag(); //P
                }

                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, test.GetColor());
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.RenderBeginTag(HtmlTextWriterTag.B);
                writer.Write("Test result: ");
                writer.RenderEndTag(); //B
                writer.Write(test.Result);
                writer.RenderEndTag(); //P

                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.AddTag(HtmlTextWriterTag.B, "Test duration: ");
                writer.Write(TimeSpan.FromSeconds(test.TestDuration).ToString(@"hh\:mm\:ss\:fff"));
                writer.RenderEndTag(); //P

                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.AddTag(HtmlTextWriterTag.B, "Time period: ");
                var start = test.DateTimeStart.ToString("dd.MM.yy HH:mm:ss.fff");
                var end   = test.DateTimeFinish.ToString("dd.MM.yy HH:mm:ss.fff");
                writer.Write(start + " - " + end);
                writer.RenderEndTag(); //P

                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.AddTag(HtmlTextWriterTag.B, "Screenshots: ");
                writer.Write(test.Screenshots.Count);
                writer.RenderEndTag(); //P

                var screens = test.Screenshots.OrderBy(x => x.Date);
                foreach (var screenshot in screens)
                {
                    writer.Write("Screenshot (Date: " + screenshot.Date.ToString("dd.MM.yy HH:mm:ss.fff") + "):");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "inherited");
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, @"cid:" + screenshot.Name);
                    writer.AddAttribute(HtmlTextWriterAttribute.Alt, screenshot.Name);
                    writer.RenderBeginTag(HtmlTextWriterTag.Img);
                    writer.RenderEndTag(); //IMG
                    writer.RenderEndTag(); //DIV
                }

                if (!test.IsSuccess())
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.P);
                    writer.AddTag(HtmlTextWriterTag.B, "Stack trace: ");
                    writer.Write(NunitTestHtml.GenerateTxtView(test.TestStackTrace));
                    writer.RenderEndTag(); //P
                    writer.RenderBeginTag(HtmlTextWriterTag.P);
                    writer.AddTag(HtmlTextWriterTag.B, "Message: ");
                    writer.Write(NunitTestHtml.GenerateTxtView(test.TestMessage));
                    writer.RenderEndTag(); //P
                }

                if (addLinks)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.P);
                    writer.AddTag(HtmlTextWriterTag.B, "Test page: ");
                    writer.AddStyleAttribute("background", ReportColors.OpenLogsButtonBackground);
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "black");
                    writer.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, "none !important");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, test.TestHrefAbsolute);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write(Environment.NewLine + "View on site");
                    writer.RenderEndTag(); //A
                    writer.RenderEndTag(); //P
                }

                writer.RenderEndTag(); //DIV
                writer.RenderEndTag(); //DIV

                writer.RenderEndTag(); //BODY

                writer.Write(Environment.NewLine);
                writer.Write("</html>");
                writer.Write(Environment.NewLine);
            }

            return(strWr.ToString());
        }