Example #1
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 #2
0
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{
			const string ListStyleType = "list-style-type";
			const string ListStyleImage = "list-style-image";
			
			bool isNumeric = false;
			switch (BulletStyle)
			{
				case BulletStyle.NotSet:
					break;
				
				case BulletStyle.Numbered:
					writer.AddStyleAttribute (ListStyleType, "decimal");
					isNumeric = true;
					break;
				
				case BulletStyle.LowerAlpha:
					writer.AddStyleAttribute (ListStyleType, "lower-alpha");
					isNumeric = true;
					break;
				
				case BulletStyle.UpperAlpha:
					writer.AddStyleAttribute (ListStyleType, "upper-alpha");
					isNumeric = true;
					break;
				
				case BulletStyle.LowerRoman:
					writer.AddStyleAttribute (ListStyleType, "lower-roman");
					isNumeric = true;
					break;
				
				case BulletStyle.UpperRoman:
					writer.AddStyleAttribute (ListStyleType, "upper-roman");
					isNumeric = true;
					break;

				case BulletStyle.Disc:
					writer.AddStyleAttribute (ListStyleType, "disc");
					break;
				
				case BulletStyle.Circle:
					writer.AddStyleAttribute (ListStyleType, "circle");
					break;
				
				case BulletStyle.Square:
					writer.AddStyleAttribute (ListStyleType, "square");
					break;
								
				case BulletStyle.CustomImage:
					writer.AddStyleAttribute (ListStyleImage, "url(" + ResolveClientUrl (BulletImageUrl) + ")");
					break;
			}

			if (isNumeric && FirstBulletNumber != 1)
				writer.AddAttribute ("start", FirstBulletNumber.ToString ());
			
			base.AddAttributesToRender (writer);
		}
Example #3
0
        protected override void Render(HtmlTextWriter writer)
        {
            // установка значений для атрибута style
            writer.AddStyleAttribute("padding", "20px");
            writer.AddStyleAttribute("width", "200px");
            writer.AddStyleAttribute("height", "50px");
            writer.AddStyleAttribute("color", "black");
            writer.AddStyleAttribute("background-color", "white");
            writer.AddStyleAttribute("border", "1px solid gray");

            // добавление атрибута onclick c вызовом функции __doPostBack. Если функции нет на странице она создается.
            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, Page.ClientScript.GetPostBackEventReference(this, String.Empty));

            // создание элемента div с применением значений style заданных выше
            writer.RenderBeginTag("div");

            base.Render(writer);

            writer.Write(Text);

            // создание закрывающего элемента div
            writer.RenderEndTag();
        }
Example #4
0
        private void Deny_Unrestricted(HtmlTextWriter htw)
        {
            Assert.IsTrue(htw.Indent >= 0, "Indent");
            Assert.AreSame(sw, htw.InnerWriter, "InnerWriter");
            htw.NewLine = Environment.NewLine;
            Assert.IsNotNull(htw.NewLine, "NewLine");

            htw.AddAttribute(HtmlTextWriterAttribute.Bgcolor, "blue");
            htw.AddAttribute(HtmlTextWriterAttribute.Bgcolor, "blue", false);
            htw.AddAttribute("align", "left");
            htw.AddAttribute("align", "left", false);

            htw.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "blue");
            htw.AddStyleAttribute("left", "1");

            htw.RenderBeginTag(HtmlTextWriterTag.Table);
            htw.RenderBeginTag("<tr>");
            htw.RenderEndTag();

            htw.WriteAttribute("align", "left");
            htw.WriteAttribute("align", "left", false);
            htw.WriteBeginTag("table");
            htw.WriteEndTag("table");
            htw.WriteFullBeginTag("div");

            htw.WriteStyleAttribute("left", "2");
            htw.WriteStyleAttribute("left", "3", false);

            htw.Write(new char[1], 0, 1);
            htw.Write((double)1.0);
            htw.Write(Char.MinValue);
            htw.Write(new char[1]);
            htw.Write((int)1);
            htw.Write("{0}", 1);
            htw.Write("{0}{1}", 1, 2);
            htw.Write("{0}{1}{2}", 1, 2, 3);
            htw.Write(String.Empty);
            htw.Write((long)1);
            htw.Write(this);
            htw.Write((float)1.0);
            htw.Write(false);

            htw.WriteLine(new char[1], 0, 1);
            htw.WriteLine((double)1.0);
            htw.WriteLine(Char.MinValue);
            htw.WriteLine(new char[1]);
            htw.WriteLine((int)1);
            htw.WriteLine("{0}", 1);
            htw.WriteLine("{0}{1}", 1, 2);
            htw.WriteLine("{0}{1}{2}", 1, 2, 3);
            htw.WriteLine(String.Empty);
            htw.WriteLine((long)1);
            htw.WriteLine(this);
            htw.WriteLine((float)1.0);
            htw.WriteLine(false);
            htw.WriteLine((uint)0);
            htw.WriteLine();
            htw.WriteLineNoTabs(String.Empty);

            htw.Flush();
            htw.Close();
        }
Example #5
0
        /// <summary>
        /// Renders the base control.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public void RenderBaseControl(HtmlTextWriter writer)
        {
            bool rockMergeFieldEnabled   = MergeFields.Any();
            bool rockFileBrowserEnabled  = false;
            bool rockAssetManagerEnabled = false;
            var  currentPerson           = this.RockBlock().CurrentPerson;

            // only show the File/Image plugin if they have Auth to the file browser page
            var fileBrowserPage = new Rock.Model.PageService(new RockContext()).Get(Rock.SystemGuid.Page.HTMLEDITOR_ROCKFILEBROWSER_PLUGIN_FRAME.AsGuid());

            if (fileBrowserPage != null && currentPerson != null)
            {
                rockFileBrowserEnabled = fileBrowserPage.IsAuthorized(Authorization.VIEW, currentPerson);
            }

            var assetManagerPage = new Rock.Model.PageService(new RockContext()).Get(Rock.SystemGuid.Page.HTMLEDITOR_ROCKASSETMANAGER_PLUGIN_FRAME.AsGuid());

            if (assetManagerPage != null && currentPerson != null)
            {
                rockAssetManagerEnabled = assetManagerPage.IsAuthorized(Authorization.VIEW, currentPerson);
            }

            string documentFolderRoot = this.DocumentFolderRoot;
            string imageFolderRoot    = this.ImageFolderRoot;

            if (this.UserSpecificRoot)
            {
                var currentUser = this.RockBlock().CurrentUser;
                if (currentUser != null)
                {
                    documentFolderRoot = System.Web.VirtualPathUtility.Combine(documentFolderRoot.EnsureTrailingBackslash(), currentUser.UserName.ToString());
                    imageFolderRoot    = System.Web.VirtualPathUtility.Combine(imageFolderRoot.EnsureTrailingBackslash(), currentUser.UserName.ToString());
                }
            }

            string callbacksOption = string.Empty;

            if (!string.IsNullOrEmpty(this.CallbackOnKeyupScript) || !string.IsNullOrEmpty(this.CallbackOnChangeScript))
            {
                callbacksOption =
                    $@"
onKeyup: function(e) {{
    {this.CallbackOnKeyupScript}
}},
onChange: function(contents, $editable) {{
    {this.CallbackOnChangeScript}
}}
";
            }


            string summernoteInitScript = $@"
function pageLoad() {{
  // remove any leftover popovers that summernote might have created and orphaned
  $('.note-popover.popover').hide();
}}

$(document).ready( function() {{

    var summerNoteEditor_{this.ClientID} = $('#{this.ClientID}').summernote({{
        height: '{this.Height}', //set editable area's height
        toolbar: Rock.htmlEditor.toolbar_RockCustomConfig{this.Toolbar.ConvertToString()},

        popover: {{
          image: [
            ['custom1', ['rockimagelink']],
            ['imagesize', ['resizeFull', 'resizeHalf', 'resizeQuarter']],
            ['custom2', ['rockimagebrowser', 'rockassetmanager']],
            ['float', ['floatLeft', 'floatRight', 'floatNone']],
            ['remove', ['removeMedia']]
          ],
          link: [
            ['link', ['linkDialogShow', 'unlink']]
          ],
          air: [
            ['color', ['color']],
            ['font', ['bold', 'underline', 'clear']],
            ['para', ['ul', 'paragraph']],
            ['table', ['table']],
            ['insert', ['link', 'picture']]
          ]
        }},
        callbacks: {{
            onInit: function() {{
                $(this).parent().removeClass('loading').css('min-height', '');
            }},
           {callbacksOption}
        }},

        buttons: {{
            rockfilebrowser: RockFileBrowser,
            rockimagebrowser: RockImageBrowser,
            rockimagelink: RockImageLink,
            rockassetmanager: RockAssetManager,
            rockmergefield: RockMergeField,
            rockcodeeditor: RockCodeEditor,
            rockpastetext: RockPasteText,
            rockpastefromword: RockPasteFromWord
        }},

        rockFileBrowserOptions: {{
            enabled: {rockFileBrowserEnabled.ToTrueFalse().ToLower()},
            documentFolderRoot: '{Rock.Security.Encryption.EncryptString( documentFolderRoot )}',
            imageFolderRoot: '{Rock.Security.Encryption.EncryptString( imageFolderRoot )}'
        }},

        rockAssetManagerOptions: {{
            enabled: { rockAssetManagerEnabled.ToTrueFalse().ToLower() }
        }},

        rockMergeFieldOptions: {{
            enabled: {rockMergeFieldEnabled.ToTrueFalse().ToLower()},
            mergeFields: '{this.MergeFields.AsDelimited( "," )}'
        }},
        rockTheme: '{( ( RockPage ) this.Page ).Site.Theme}',

        codeEditorOptions: {{
            controlId: '{_ceEditor.ClientID}',
            inCodeEditorModeHiddenFieldId: '{_hfInCodeEditorMode.ClientID}'
        }},

        disableDragAndDrop: true,
    }});

    if ({StartInCodeEditorMode.ToTrueFalse().ToLower()} && RockCodeEditor) {{
        RockCodeEditor(summerNoteEditor_{this.ClientID}.data('summernote'), true).trigger('click');
    }}

}});
";

            ScriptManager.RegisterStartupScript(this, this.GetType(), "summernote_init_script_" + this.ClientID, summernoteInitScript, true);

            // add script on demand only when there will be an htmleditor rendered
            if (ScriptManager.GetCurrent(this.Page).IsInAsyncPostBack)
            {
                ScriptManager.RegisterClientScriptInclude(this.Page, this.Page.GetType(), "summernote-lib", ((RockPage)this.Page).ResolveRockUrl("~/Scripts/summernote/summernote.js", true));
                var bundleUrl = System.Web.Optimization.BundleResolver.Current.GetBundleUrl("~/Scripts/Bundles/RockHtmlEditorPlugins");
                ScriptManager.RegisterClientScriptInclude(this.Page, this.Page.GetType(), "summernote-plugins", bundleUrl);
            }

            // set this textbox hidden until we can run the js to attach summernote to it
            this.Style[HtmlTextWriterStyle.Display] = "none";

            writer.AddAttribute("class", "html-editor-container loading");
            writer.AddStyleAttribute("min-height", this.Height.ToString());
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            base.RenderControl(writer);

            writer.RenderEndTag();
        }
Example #6
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            this.EnsureChildControls();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "buttonMenuTable");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "1");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Height, this.Height.ToString());
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute("onselectstart", "return false;");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, this.Width.ToString());
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "ButtonTd");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            bool flag = (this.ButtonType == ButtonMenuType.ImageButton || this.ButtonType == ButtonMenuType.ImageDropDown) && !string.IsNullOrWhiteSpace(this.ButtonImage);

            if (flag)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
                writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "19");
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "19");
                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "ButtonTdIco");
                writer.AddAttribute(HtmlTextWriterAttribute.Src, this.GetUrlString("~/Images/Tim/" + this.ButtonImage));
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
                writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "true");
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
                writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.Write("  ");
                writer.RenderEndTag();
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "true");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(this.Text);
            writer.RenderEndTag();
            writer.RenderEndTag();
            bool flag2 = this.ButtonType == ButtonMenuType.DropDown;

            if (flag2)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "buttonMenuTdDrop");
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "DropDownTd");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                bool flag3 = !this.DropDownImage.Trim().Equals("");
                if (flag3)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, this.GetUrlString(this.DropDownImage));
                    writer.RenderBeginTag(HtmlTextWriterTag.Img);
                    writer.RenderEndTag();
                }
                writer.RenderEndTag();
            }
            writer.RenderEndTag();
            writer.RenderEndTag();
        }
Example #7
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (Tabs != null && Visible == true)
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();

                int    i             = 0;
                string controlToLoad = "";
                writer = new HtmlTextWriter(writer, string.Empty);
                AddAttributesToRender(writer);
                foreach (Tab tab in Tabs)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, "div" + tab.ControlKey);
                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "am_toggleTab(this);");
                    if (i == 0)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "amtabsel");
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "amtab");
                    }

                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, "div" + tab.ControlKey + "_text");
                    if (i == 0)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "amtabseltext");
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "amtabtext");
                    }
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "amtabtext");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    writer.Write(tab.Text);
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                    i += 1;
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "amtabcontent");
                writer.AddAttribute(HtmlTextWriterAttribute.Id, "amtabcontent");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                i = 0;
                foreach (Tab tab in Tabs)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, "div" + tab.ControlKey + "_amcnt");
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "amtabdisplay");
                    if (i == 0)
                    {
                        writer.AddStyleAttribute("display", "block");
                    }
                    else
                    {
                        writer.AddStyleAttribute("display", "none");
                    }

                    writer.AddStyleAttribute("text-align", "left");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    if (tab.Content != null)
                    {
                        //For Each ctl As Control In tab.Content.Controls
                        //    ctl.RenderControl(writer)
                        //    'tab.Content.RenderControl(writer)
                        //Next
                        tab.Content.RenderControl(writer);
                    }
                    writer.RenderEndTag();
                    i += 1;
                }
                writer.RenderEndTag();
            }
        }
Example #8
0
        protected override void Render(HtmlTextWriter output)
        {
            if (Tabs.Count == 0)
            {
                return;
            }

            base.Render(output);

            string height = "";

            if (!(Height.IsEmpty || Height.Value == 0))
            {
                height = "height='" + Height.Value.ToString() + GetUnit(Height.Type.ToString()) + "'";
            }

            string width = "";

            if (!(Width.IsEmpty || Width.Value == 0))
            {
                width = "width='" + Width.Value.ToString() + GetUnit(Width.Type.ToString()) + "'";
            }

            string htmltabs = "";;

            for (int i = 0; i < tabs.Count; i++)
            {
                bool b = (i == selectedindex);
                htmltabs += FormatTab(0, i, tabs.Count, b, tabs[i].Text);
            }

            output.AddStyleAttribute("width", Width.ToString());
            output.RenderBeginTag("div");
            #region htmltabtable
            string htmltabtable =
                @"<table %width% cellpadding=""0"" cellspacing=""0"" width=""100%"" border=0>
						<tr id=""{0}:Row{1}"">
						{2}
						</tr>
						</table>"                        ;
            #endregion
            htmltabtable = htmltabtable.Replace("%width%", width);
            htmltabtable = String.Format(htmltabtable, this.UniqueID, 1, htmltabs);

            string htmltablemain =
                @"	<TABLE {0} style=""BORDER-RIGHT: #CCCCCC thin solid; Z-INDEX: 101; LEFT: 232px; BORDER-LEFT: #CCCCCC thin solid; BORDER-BOTTOM: #CCCCCC thin solid;"" cellSpacing=1 cellPadding=1 border=0>
						<TR>
							<TD valign=""top"">"                            ;

            htmltablemain = String.Format(htmltablemain, width + " " + height);

            string htmltablemainb =
                @"		</TD>
						</TR>
						</TABLE>"                        ;

            if (!Page.ClientScript.IsClientScriptBlockRegistered("Dbworks.Web.Controls.TabControl"))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Dbworks.Web.Controls.TabControl", JavaScript());
            }

            output.Write(JavaScript());

            output.Write(TabStyle());
            output.Write(htmltabtable);

            output.Write(htmltablemain);
            for (int i = 0; i < tabs.Count; i++)
            {
                output.Write(FormatContentTableA(i, (i == selectedindex)));
                try
                {
                    //	Tabs[i].TabContent.InstantiateIn(Tabs[i].TabPanel);
                    //	Tabs[i].Visible = true; //TabPanelRenderControl(output);
                }
                catch (Exception e)
                {
                    output.Write(e.Message);
                }
                Tabs[i].RenderControl(output);
                output.Write(FormatContentTableB());
            }
            output.Write(htmltablemainb);
            output.RenderEndTag();
        }
Example #9
0
        /// <summary>
        /// Writes the <see cref="T:System.Web.UI.WebControls.CompositeControl" /> content to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object, for display on the client.
        /// </summary>
        /// <param name="writer">An <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel panel-widget workflow-action");
            writer.AddAttribute("data-key", _hfActionTypeGuid.Value);
            writer.RenderBeginTag("article");

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "clearfix clickable panel-heading");
            writer.RenderBeginTag("header");

            // Hidden Field to track expansion
            _hfExpanded.RenderControl(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "pull-left workflow-action-name");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _lblActionTypeName.Text = _tbActionTypeName.Text;
            _lblActionTypeName.RenderControl(writer);
            writer.RenderEndTag();

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

            string criteriaExistsClass = _ddlCriteriaAttribute.SelectedValueAsGuid().HasValue ? " criteria-exists" : string.Empty;

            writer.WriteLine(string.Format("<a class='btn btn-xs btn-link js-workflow-action-criteria{0}'><i class='fa fa-filter'></i></a>", criteriaExistsClass));
            writer.WriteLine("<a class='btn btn-xs btn-link workflow-action-reorder'><i class='fa fa-bars'></i></a>");
            writer.WriteLine(string.Format("<a class='btn btn-xs btn-link'><i class='workflow-action-state fa {0}'></i></a>",
                                           Expanded ? "fa fa-chevron-up" : "fa fa-chevron-down"));

            if (IsDeleteEnabled)
            {
                _lbDeleteActionType.Visible = true;

                _lbDeleteActionType.RenderControl(writer);
            }
            else
            {
                _lbDeleteActionType.Visible = false;
            }

            // Add/ChevronUpDown/Delete div
            writer.RenderEndTag();

            // header div
            writer.RenderEndTag();

            if (!Expanded)
            {
                // hide details if the name has already been filled in
                writer.AddStyleAttribute("display", "none");
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // add Criteria fields
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row conditional-run-criteria alert-warning");
            if (!_ddlCriteriaAttribute.SelectedValueAsGuid().HasValue)
            {
                writer.AddStyleAttribute("display", "none");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

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

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-xs-7");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _ddlCriteriaAttribute.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-xs-5");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _ddlCriteriaComparisonType.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();  // row

            writer.RenderEndTag();  // col-md-6

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            var comparisonType = _ddlCriteriaComparisonType.SelectedValueAsEnum <ComparisonType>();

            _tbddlCriteriaValue.Style["display"] = (comparisonType == ComparisonType.IsBlank || comparisonType == ComparisonType.IsNotBlank) ? "none" : "block";
            _tbddlCriteriaValue.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();

            // action edit fields
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _tbActionTypeName.ValidationGroup = ValidationGroup;
            _tbActionTypeName.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _cbIsActionCompletedOnSuccess.ValidationGroup = ValidationGroup;
            _cbIsActionCompletedOnSuccess.RenderControl(writer);
            _cbIsActivityCompletedOnSuccess.ValidationGroup = ValidationGroup;
            _cbIsActivityCompletedOnSuccess.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();  // row

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

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-4");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _wfatpEntityType.ValidationGroup = ValidationGroup;
            _wfatpEntityType.RenderControl(writer);
            writer.RenderEndTag();

            // Add an overview(description) of the selected action type
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-8");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            EntityTypeCache entityType   = null;
            int?            entityTypeId = _wfatpEntityType.SelectedValueAsInt();

            if (entityTypeId.HasValue)
            {
                entityType = EntityTypeCache.Get(entityTypeId.Value);
                if (entityType != null)
                {
                    var component = ActionContainer.GetComponent(entityType.Name);
                    if (component != null)
                    {
                        string description   = string.Empty;
                        var    propAttribute = component.GetType().GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false).FirstOrDefault();
                        if (propAttribute != null)
                        {
                            var descAttribute = propAttribute as System.ComponentModel.DescriptionAttribute;
                            if (descAttribute != null)
                            {
                                _rlEntityTypeOverview.Label = string.Format("'{0}' Overview", entityType.FriendlyName);
                                _rlEntityTypeOverview.Text  = descAttribute.Description;
                                _rlEntityTypeOverview.RenderControl(writer);
                            }
                        }
                    }
                }
            }
            writer.RenderEndTag();  // col-md-8

            writer.RenderEndTag();  // row

            if (entityType != null && entityType.Name == typeof(Rock.Workflow.Action.UserEntryForm).FullName)
            {
                _formEditor.ValidationGroup = ValidationGroup;
                _formEditor.RenderControl(writer);
            }

            _phActionAttributes.RenderControl(writer);

            // widget-content div
            writer.RenderEndTag();

            // article tag
            writer.RenderEndTag();
        }
        /// <summary>
        /// Render renders the control
        /// </summary>
        /// <param name="writer">A HtmlTextWriter.</param>
        /// <history>
        ///     [cnurse]	05/03/2006	created
        /// </history>
        protected override void Render(HtmlTextWriter writer)
        {
            //Render Div container
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "dnnFormVisibility dnnDropdownSettings");
            writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            //Render dnnButtonDropdown
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "dnnButtonDropdown");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            //Render dnnButton Icon
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "dnnButtonIcon");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            //writer.AddAttribute(HtmlTextWriterAttribute.Src, IconController.IconURL("Lock"));
            //writer.RenderBeginTag(HtmlTextWriterTag.Img);

            //Close Image Tag
            //writer.RenderEndTag();

            //Close dnnButtonIcon
            writer.RenderEndTag();

            //render dnnButton Arrow
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "dnnButtonArrow");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.RenderEndTag();

            //Close dnnButton Dropdown
            writer.RenderEndTag();

            //Render UL for radio Button List
            //writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "dnnButtonDropdown-ul");

            writer.RenderBeginTag(HtmlTextWriterTag.Ul);

            RenderVisibility(writer, "0", UserVisibilityMode.AllUsers, Localization.GetString("Public").Trim());

            RenderVisibility(writer, "1", UserVisibilityMode.MembersOnly, Localization.GetString("MembersOnly").Trim());

            RenderVisibility(writer, "2", UserVisibilityMode.AdminOnly, Localization.GetString("AdminOnly").Trim());

            RenderVisibility(writer, "3", UserVisibilityMode.FriendsAndGroups, Localization.GetString("FriendsGroups").Trim());

            //Render UL for check Box List
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, Visibility.VisibilityMode == UserVisibilityMode.FriendsAndGroups ? "block" : "none");
            writer.RenderBeginTag(HtmlTextWriterTag.Ul);

            RenderRelationships(writer);
            RenderGroups(writer);

            //Close UL
            writer.RenderEndTag();

            //Close UL
            writer.RenderEndTag();

            //Close Div
            writer.RenderEndTag();
        }
Example #11
0
		protected internal override void RenderContents (HtmlTextWriter w)
		{
			string skip_id = ClientID + "_SkipLink";
			string altText = SkipLinkText;
			bool needAnchor = !String.IsNullOrEmpty (altText);
			
			if (needAnchor) {
				// Anchor start
				w.AddAttribute (HtmlTextWriterAttribute.Href, "#" + skip_id);
				w.RenderBeginTag (HtmlTextWriterTag.A);

				// Image
				w.AddAttribute (HtmlTextWriterAttribute.Alt, altText);
				w.AddAttribute (HtmlTextWriterAttribute.Height, "0");
				w.AddAttribute (HtmlTextWriterAttribute.Width, "0");
				w.AddAttribute (HtmlTextWriterAttribute.Src, Page.ClientScript.GetWebResourceUrl (typeof (SiteMapPath), "transparent.gif"));
				w.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0px");
				w.RenderBeginTag (HtmlTextWriterTag.Img);
				w.RenderEndTag ();

				w.RenderEndTag ();
			}

			base.RenderContents (w);

			if (needAnchor) {
				 w.AddAttribute(HtmlTextWriterAttribute.Id, skip_id);
				 w.RenderBeginTag(HtmlTextWriterTag.A);
				 w.RenderEndTag();
			}
		}
Example #12
0
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{
			/* if we're rendering uplevel, add our attributes */
			if (render_uplevel) {
				/* force an ID here if we weren't assigned one */
				if (ID == null)
					writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);

				if (ControlToValidate != String.Empty)
					RegisterExpandoAttribute (ClientID, "controltovalidate", GetControlRenderID (ControlToValidate));

				if (ErrorMessage != String.Empty)
					RegisterExpandoAttribute (ClientID, "errormessage", ErrorMessage, true);

				if (ValidationGroup != String.Empty)
					RegisterExpandoAttribute (ClientID, "validationGroup", ValidationGroup, true);

				if (SetFocusOnError)
					RegisterExpandoAttribute (ClientID, "focusOnError", "t");

				bool enabled = IsEnabled;
				if (!enabled)
					RegisterExpandoAttribute (ClientID, "enabled", "False");

				if (enabled && !IsValid)
					RegisterExpandoAttribute (ClientID, "isvalid", "False");
				else {
					if (Display == ValidatorDisplay.Static)
						writer.AddStyleAttribute ("visibility", "hidden");
					else
						writer.AddStyleAttribute ("display", "none");
				}

				if (Display != ValidatorDisplay.Static)
					RegisterExpandoAttribute (ClientID, "display", Display.ToString ());
			}

			base.AddAttributesToRender (writer);
		}
            private void RenderItems(HtmlTextWriter writer, bool staticOnly, MenuItemCollection items, int level, bool needsAccessKey) {
                if (level == 1 || level > Menu.StaticDisplayLevels) {  // Render a <UL> to start, and for all dynamic descendents
                    if (Menu.DesignMode && Menu.Orientation == Orientation.Horizontal) {
                        writer.AddStyleAttribute("float", "left");
                    }
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, GetMenuCssClass(level));
                    writer.RenderBeginTag(HtmlTextWriterTag.Ul);
                }

                foreach (MenuItem item in items) {
                    if (Menu.DesignMode && Menu.Orientation == Orientation.Horizontal) {
                        writer.AddStyleAttribute("float", "left");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                    }
                    writer.RenderBeginTag(HtmlTextWriterTag.Li);

                    needsAccessKey = RenderItem(writer, item, level, GetMenuItemCssClass(item, level), needsAccessKey);

                    if (level < Menu.StaticDisplayLevels) {  // Close off <LI> if we (and our direct descendents) are static
                        writer.RenderEndTag();
                    }

                    if (item.ChildItems.Count > 0 && !IsChildPastMaximumDepth(item) && item.Enabled) {
                        if (level < Menu.StaticDisplayLevels || !staticOnly) {
                            RenderItems(writer, staticOnly, item.ChildItems, level + 1, needsAccessKey);
                        }
                    }

                    if (level >= Menu.StaticDisplayLevels) {  // Close off <LI> if we (or our direct descendents) are dynamic
                        writer.RenderEndTag();
                    }
                }

                if (level == 1 || level > Menu.StaticDisplayLevels) {
                    writer.RenderEndTag();
                }
            }
            private bool RenderItem(HtmlTextWriter writer, MenuItem item, int level, string cssClass, bool needsAccessKey) {
                RenderItemPreSeparator(writer, item);

                if (Menu.DesignMode && Menu.Orientation == Orientation.Horizontal) {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                }
                needsAccessKey = RenderItemLinkAttributes(writer, item, level, cssClass, needsAccessKey);
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                RenderItemIcon(writer, item);
                item.RenderText(writer);
                // popout image is in the A's background css
                writer.RenderEndTag();  // </a>

                RenderItemPostSeparator(writer, item);

                return needsAccessKey;
            }
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            string str2;

            base.AddAttributesToRender(writer);
            string imageUrl = this.ImageUrl;

            if (!this.UrlResolved)
            {
                imageUrl = base.ResolveClientUrl(imageUrl);
            }
            if ((imageUrl.Length > 0) || !base.EnableLegacyRendering)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, imageUrl);
            }
            imageUrl = this.DescriptionUrl;
            if (imageUrl.Length != 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Longdesc, base.ResolveClientUrl(imageUrl));
            }
            imageUrl = this.AlternateText;
            if ((imageUrl.Length > 0) || this.GenerateEmptyAlternateText)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Alt, imageUrl);
            }
            switch (this.ImageAlign)
            {
            case System.Web.UI.WebControls.ImageAlign.Left:
                str2 = "left";
                break;

            case System.Web.UI.WebControls.ImageAlign.Right:
                str2 = "right";
                break;

            case System.Web.UI.WebControls.ImageAlign.Baseline:
                str2 = "baseline";
                break;

            case System.Web.UI.WebControls.ImageAlign.Top:
                str2 = "top";
                break;

            case System.Web.UI.WebControls.ImageAlign.Middle:
                str2 = "middle";
                break;

            case System.Web.UI.WebControls.ImageAlign.Bottom:
                str2 = "bottom";
                break;

            case System.Web.UI.WebControls.ImageAlign.AbsBottom:
                str2 = "absbottom";
                break;

            case System.Web.UI.WebControls.ImageAlign.AbsMiddle:
                str2 = "absmiddle";
                break;

            case System.Web.UI.WebControls.ImageAlign.NotSet:
                goto Label_00FA;

            default:
                str2 = "texttop";
                break;
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Align, str2);
Label_00FA:
            if (this.BorderWidth.IsEmpty && (this.RenderingCompatibility < VersionUtil.Framework40))
            {
                if (base.EnableLegacyRendering)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Border, "0", false);
                    return;
                }
                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "0px");
            }
        }
Example #16
0
        void RenderCustomContent(HtmlTextWriter writer)
        {
            GetDivWidth();
            string divId   = this.ClientID + "_div";
            string cmbDown = this.ClientID + "_imgDown";
            string cmbUp   = this.ClientID + "_imgUp";

            // base.RenderContents(writer);
            ////控制項顯示主體

            writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            if (this.Enabled)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format("toggleDivShowState('{0}','{1}','{2}');", this.ClientID, Splitor, this.Items.Count));
            }
            ////控制項主體文本框
            txt.RenderControl(writer);

            writer.Write("<br/>");
            ////隱藏下拉麵板
            writer.AddAttribute(HtmlTextWriterAttribute.Id, divId);
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "#ECECE3");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
            writer.AddStyleAttribute(HtmlTextWriterStyle.ZIndex, "32766");
            writer.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, "Gray");
            writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "thin");
            writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "double");
            writer.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "top");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, this.Width.ToString());
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            ////呈現 item 列表
            ModifyRenderedCheckboxes(writer);
            writer.RenderEndTag(); //end div

            writer.RenderEndTag(); //end td
            ////下拉圖示
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "relative");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Left, "-8px");
            writer.AddAttribute(HtmlTextWriterAttribute.Src, this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "WebDropDownCheckBoxList.Resources.cmb_down.jpg"));

            if (this.Enabled)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format("toggleDivShowState('{0}','{1}','{2}');", this.ClientID, Splitor, this.Items.Count));
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Id, cmbDown);
            writer.RenderBeginTag(HtmlTextWriterTag.Img);
            writer.RenderEndTag();//end img
            writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "relative");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Left, "-8px");
            writer.AddAttribute(HtmlTextWriterAttribute.Src, this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "WebDropDownCheckBoxList.Resources.cmb_up.jpg"));
            if (this.Enabled)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format("toggleDivShowState('{0}','{1}','{2}');", this.ClientID, Splitor, this.Items.Count));
            }
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, cmbUp);
            writer.RenderBeginTag(HtmlTextWriterTag.Img);
            writer.RenderEndTag(); //end img

            writer.RenderEndTag(); //end td
            writer.RenderEndTag(); //end tr
        }
		void RenderMenuItemSpacing (HtmlTextWriter writer, Unit itemSpacing)
		{
			writer.AddStyleAttribute ("height", itemSpacing.ToString ());
			writer.RenderBeginTag (HtmlTextWriterTag.Tr);
			writer.RenderBeginTag (HtmlTextWriterTag.Td);
			writer.RenderEndTag ();
			writer.RenderEndTag ();
		}
Example #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        protected override void Render(HtmlTextWriter writer)
        {
            // The following only works in IE, because calling the click() method
            //on an input type=file DOM element is not supported in Firefox.

            //See: http://www.quirksmode.org/dom/inputfile.html
            //And: http://www.michaelmcgrady.com/simple.jsp

            /*
             * writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
             * writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
             * if (!String.IsNullOrEmpty(_CssClass))
             *  writer.AddAttribute(HtmlTextWriterAttribute.Class, _CssClass);
             * if (!_Width.IsEmpty)
             *  writer.AddStyleAttribute(HtmlTextWriterStyle.Width, _Width.ToString());
             * if (!_Height.IsEmpty)
             *  writer.AddStyleAttribute(HtmlTextWriterStyle.Height, _Height.ToString());
             * //writer.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "pointer");
             * writer.RenderBeginTag(HtmlTextWriterTag.A);
             * writer.Write(this.Text);
             * writer.RenderEndTag(); //A
             *
             * writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_Inputs");
             * writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
             * //but Safari is supposed to prefer the following to display:none
             * //writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
             * //writer.AddStyleAttribute(HtmlTextWriterStyle.Left, "-1000px");
             * writer.RenderBeginTag(HtmlTextWriterTag.Div);
             *
             * writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_Input_0");
             * writer.AddAttribute(HtmlTextWriterAttribute.Name, this.ClientID + "_Input_0");
             * writer.AddAttribute(HtmlTextWriterAttribute.Type, "file");
             * writer.RenderBeginTag(HtmlTextWriterTag.Input);
             * writer.RenderEndTag(); //Input
             *
             * writer.RenderEndTag(); //Div
             */

            //The general idea is to have a file input control over the label or image
            //with opacity = 0 so that it is not displayed but receives the click event
            //when clicking the label or image.

            //<span id="<id>" style="position: relative;">
            //	<span id="<id>_Link" style='position: relative; left: 0px;'>browse...</span>
            //	<input type="file" id="<id>_Input_<key>" name="X" size="1" style="position:absolute; z-index: 1; left:-42px; font-size:16px; opacity:0; filter:alpha(opacity: 0); -moz-opacity:0; -khtml-opacity: 0; cursor:pointer;" />
            //	<span id="<id>_Mask" style="position: absolute; top:-2px; left:-50px; width: 50px; height:28px; z-index:2 ; background-color: transparent; cursor:default;">&nbsp;</span>
            //</span>
            //<div id="<id>_Inputs" style="display:none;"></div>

            //<id> is the span representing the control
            //<id>_Link is the span containing the text
            //<id>_Input_<key> is the current file input control
            //<id>_Mask masks the textbox portion of the file input conrol so that it does not get the focus
            //<id>_Inputs is a hidden div containing the file input controls which have been used


            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "relative");
            if (!_Width.IsEmpty)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, _Width.ToString());
            }
            if (!_Height.IsEmpty)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, _Height.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Span); //BEGIN Span <id>

            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_Link");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "relative");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Left, "0px"); //Just to make sure the CssClass does not break the alignment with the input and the mask
            if (!String.IsNullOrEmpty(_CssClass))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, _CssClass);
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Span); //BEGIN Span <id>_Link
            writer.Write(this.Text);
            writer.RenderEndTag();                         //END Span <id>_Link

            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_Input_0");
            writer.AddAttribute(HtmlTextWriterAttribute.Name, this.ClientID + "_Input_0");
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "file");
            writer.AddAttribute(HtmlTextWriterAttribute.Size, "1");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
            writer.AddStyleAttribute(HtmlTextWriterStyle.ZIndex, "1");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Left, "-42px");
            writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "16px"); //A little bit larger to make sure the button covers the link
            writer.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "pointer");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Filter, "alpha(opacity:0)");
            writer.AddStyleAttribute("opacity", "0");
            writer.AddStyleAttribute("-moz-opacity", "0");
            writer.AddStyleAttribute("-khtml-opacity", "0");
            writer.AddStyleAttribute("opacity", "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
            writer.RenderBeginTag(HtmlTextWriterTag.Input); //BEGIN Input <id>_Input_<key>
            writer.RenderEndTag();                          //END Input <id>_Input_<key>

            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_Mask");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
            writer.AddStyleAttribute(HtmlTextWriterStyle.ZIndex, "2");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Top, "-2px");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Left, "-50px");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "50px");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "28px");
            writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "transparent");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            writer.RenderBeginTag(HtmlTextWriterTag.Span); //BEGIN Span <id>_Mask
            writer.RenderEndTag();                         //END Span <id>_Mask

            writer.RenderEndTag();                         //END Span <id>

            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_Inputs");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            //but Safari is supposed to prefer the following to display:none
            //writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
            //writer.AddStyleAttribute(HtmlTextWriterStyle.Left, "-1000px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.RenderEndTag(); //Div <id>_Inputs

            //Register the Ajax extension properties of the control
            if (!this.DesignMode)
            {
                ScriptManager.GetCurrent(this.Page).RegisterScriptDescriptors(this);
            }

            base.Render(writer); //Was on top of method
        }
Example #19
0
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{
			base.AddAttributesToRender (writer);
#if NET_2_0
			// src is always present, even if empty, in 2.0
			writer.AddAttribute (HtmlTextWriterAttribute.Src, ResolveClientUrl (ImageUrl));
			string s = AlternateText;
			if ((s.Length > 0) || GenerateEmptyAlternateText)
				writer.AddAttribute (HtmlTextWriterAttribute.Alt, s);
			s = DescriptionUrl;
			if (s.Length > 0)
				writer.AddAttribute (HtmlTextWriterAttribute.Longdesc, ResolveClientUrl (s));
#else
			string s = ImageUrl;
			if (s.Length > 0)
				writer.AddAttribute (HtmlTextWriterAttribute.Src, ResolveClientUrl (s));
			// alt is always present, even if empty, in 1.x
			writer.AddAttribute (HtmlTextWriterAttribute.Alt, AlternateText);
			// added in Fx 1.1 SP1 but the HtmlTextWriterAttribute wasn't
			s = DescriptionUrl;
			if (s.Length > 0)
				writer.AddAttribute ("longdesc", s);
#endif
			switch (ImageAlign) {
			case ImageAlign.Left:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "left", false);
				break;
			case ImageAlign.Right:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "right", false);
				break;
			case ImageAlign.Baseline:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "baseline", false);
				break;
			case ImageAlign.Top:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "top", false);
				break;
			case ImageAlign.Middle:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "middle", false);
				break;
			case ImageAlign.Bottom:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "bottom", false);
				break;
			case ImageAlign.AbsBottom:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "absbottom", false);
				break;
			case ImageAlign.AbsMiddle:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "absmiddle", false);
				break;
			case ImageAlign.TextTop:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "texttop", false);
				break;
			}
#if NET_2_0
#if BUG_78875_FIXED
			if (Context.Request.Browser.SupportsCss)
#endif
			if (BorderWidth.IsEmpty)
				writer.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0px");
#if BUG_78875_FIXED
			else
#endif
#else
			// if border-with is not specified in style or 
			// no style is defined - set image to no border
			if (!ControlStyleCreated || ControlStyle.BorderWidth.IsEmpty)
				writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
#endif
		}
Example #20
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.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, item.SmallImage);
            if (item.Hidden)
            {
                fileView.Controller.HiddenItemStyle.AddAttributesToRender(output);
            }
            output.RenderBeginTag(HtmlTextWriterTag.Div);
            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();
        }
Example #21
0
		protected internal override void RenderContents (HtmlTextWriter w)	
		{
			if (HasControls () || HasRenderMethodDelegate ()) {
				base.RenderContents (w);
				return;
			}
			string image_url = ImageUrl;
			if (!String.IsNullOrEmpty (image_url)) {
				string str = ToolTip;
				if (!String.IsNullOrEmpty (str))
					w.AddAttribute (HtmlTextWriterAttribute.Title, str);

				w.AddAttribute (HtmlTextWriterAttribute.Src, ResolveClientUrl (image_url));
				str = Text;
#if !NET_4_0
				if (!String.IsNullOrEmpty (str))
#endif
					w.AddAttribute (HtmlTextWriterAttribute.Alt, str);
#if !NET_4_0
				w.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0px");
#endif
				w.RenderBeginTag (HtmlTextWriterTag.Img);
				w.RenderEndTag ();
			} else
				w.Write (Text);
		}
        /// <summary>
        /// Generates a report containing details about all file nodes with a backup count of 1.</summary>
        /// <returns>Returns the file path of the generated report if it was successfully created.</returns>
        public static async Task <string> GenerateMissingBackupReport(List <Archive> exportArchiveList, string ReportPath)
        {
            using (var sw = new StringWriter())
            {
                using (var writer = new HtmlTextWriter(sw))
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Div); // div1

                    // Report header
                    writer.AddStyleAttribute(HtmlTextWriterStyle.MarginBottom, "5px");
                    writer.RenderBeginTag(HtmlTextWriterTag.H2);
                    await writer.WriteAsync("Missing Backup Report");

                    writer.RenderEndTag();

                    writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "grey");
                    writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "small");
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    await writer.WriteAsync("Generated: " + DateTime.Now);

                    writer.RenderEndTag();

                    // Generate a separate table for each provided archive
                    foreach (var exportArchive in exportArchiveList)
                    {
                        var exportNodes = exportArchive.GetFileNodes().Where(x => x.BackupCount == 1);
                        if (exportNodes.Count() == 0)
                        {
                            continue;
                        }

                        //archive header

                        writer.AddStyleAttribute(HtmlTextWriterStyle.MarginBottom, "5px");
                        writer.RenderBeginTag(HtmlTextWriterTag.H3);
                        await writer.WriteAsync(exportArchive.Label);

                        writer.RenderEndTag();

                        writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "grey");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "small");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                        await writer.WriteAsync("Root Directory Path: " + exportArchive.RootDirectoryPath + " | Volume Serial Number: " + exportArchive.Volume.SerialNumber + " | Last Scan date: " + exportArchive.LastScanDate);

                        writer.RenderEndTag();

                        writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "15");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
                        writer.RenderBeginTag(HtmlTextWriterTag.Table); // table

                        // table header
                        writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "white");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "left");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "dimgrey");
                        writer.RenderBeginTag(HtmlTextWriterTag.Tr);


                        writer.RenderBeginTag(HtmlTextWriterTag.Th);
                        await writer.WriteAsync("Archive");

                        writer.RenderEndTag();

                        writer.RenderBeginTag(HtmlTextWriterTag.Th);
                        await writer.WriteAsync("Directory");

                        writer.RenderEndTag();

                        writer.RenderBeginTag(HtmlTextWriterTag.Th);
                        await writer.WriteAsync("Name");

                        writer.RenderEndTag();

                        writer.RenderBeginTag(HtmlTextWriterTag.Th);
                        await writer.WriteAsync("Extension");

                        writer.RenderEndTag();

                        writer.RenderEndTag(); // Tr

                        bool evenLine = true;
                        // table content
                        foreach (var node in exportNodes)
                        {
                            if (evenLine)
                            {
                                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "aliceblue");
                            }

                            evenLine = !evenLine;

                            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                            writer.RenderBeginTag(HtmlTextWriterTag.Td);
                            await writer.WriteAsync(node.Archive.Label);

                            writer.RenderEndTag();

                            writer.RenderBeginTag(HtmlTextWriterTag.Td);
                            await writer.WriteAsync(node.DirectoryName);

                            writer.RenderEndTag();

                            writer.RenderBeginTag(HtmlTextWriterTag.Td);
                            await writer.WriteAsync(node.Name);

                            writer.RenderEndTag();

                            writer.RenderBeginTag(HtmlTextWriterTag.Td);
                            await writer.WriteAsync(node.Extension);

                            writer.RenderEndTag();

                            writer.RenderEndTag(); // Tr
                        }

                        writer.RenderEndTag(); // table
                    }

                    writer.RenderEndTag(); // div1
                }
                //return sw.ToString();
                return(await WriteFileAsync(sw.ToString(), ReportPath));
            }
        }
Example #23
0
		// for 2.0: not XHTML attributes must be registered with RegisterExpandoAttribute 
		// when it will be implemented, in this case WebUIValidation_2.0.js muist be refactored
		protected override void AddAttributesToRender(HtmlTextWriter writer) {
			base.AddAttributesToRender (writer);

#if NET_2_0
			if (EnableClientScript && pre_render_called && Page.AreValidatorsUplevel (ValidationGroup)) {
#else
			if (EnableClientScript && pre_render_called && Page.AreValidatorsUplevel ()) {
#endif
				/* force an ID here if we weren't assigned one */
				if (ID == null)
					writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
#if NET_2_0
				if (ValidationGroup != String.Empty)
					RegisterExpandoAttribute (ClientID, "validationGroup", ValidationGroup);

				if (HeaderText.Length > 0)
					RegisterExpandoAttribute (ClientID, "headertext", HeaderText);

				if (ShowMessageBox)
					RegisterExpandoAttribute (ClientID, "showmessagebox", "True");

				if (!ShowSummary)
					RegisterExpandoAttribute (ClientID, "showsummary", "False");

				if (DisplayMode != ValidationSummaryDisplayMode.BulletList)
					RegisterExpandoAttribute (ClientID, "displaymode", DisplayMode.ToString ());
#else
				if (HeaderText != "")
					writer.AddAttribute ("headertext", HeaderText);

				if (ShowMessageBox)
					writer.AddAttribute ("showmessagebox", ShowMessageBox.ToString());

				if (ShowSummary == false)
					writer.AddAttribute ("showsummary", ShowSummary.ToString());

				if (DisplayMode != ValidationSummaryDisplayMode.BulletList)
					writer.AddAttribute ("displaymode", DisplayMode.ToString());
#endif

				if (!has_errors)
					writer.AddStyleAttribute ("display", "none");
			}
		}

#if NET_2_0
		internal void RegisterExpandoAttribute (string controlId, string attributeName, string attributeValue) {
			RegisterExpandoAttribute (controlId, attributeName, attributeValue, false);
		}
            public override void RenderBeginTag(HtmlTextWriter writer, bool staticOnly) {
                ControlRenderingHelper.WriteSkipLinkStart(writer, Menu.RenderingCompatibility, Menu.DesignMode, Menu.SkipLinkText, SpacerImageUrl, Menu.ClientID);

                if (Menu.DesignMode && Menu.IncludeStyleBlock) {
                    // Need to render style block in design mode, since it won't be present
                    CreateStyleBlock().Render(writer);
                }

                // Add expando attributes
                if (Menu.HasAttributes) {
                    foreach (string key in Menu.Attributes.Keys) {
                        writer.AddAttribute(key, Menu.Attributes[key]);
                    }
                }

                // CSS class, including disabled class if it's set
                string cssClass = Menu.CssClass ?? "";
                if (!Menu.Enabled) {
                    cssClass = (cssClass + " " + DisabledCssClass).Trim();
                }
                if (!String.IsNullOrEmpty(cssClass)) {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);
                }

                // Need to simulate the float done by Javascript when we're in design mode
                if (Menu.DesignMode) {
                    writer.AddStyleAttribute("float", "left");
                }

                writer.AddAttribute(HtmlTextWriterAttribute.Id, Menu.ClientID);
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
            }
Example #25
0
File: Image.cs Project: nobled/mono
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{
			base.AddAttributesToRender (writer);
			// src is always present, even if empty, in 2.0
			writer.AddAttribute (HtmlTextWriterAttribute.Src, ResolveClientUrl (ImageUrl));
			string s = AlternateText;
			if ((s.Length > 0) || GenerateEmptyAlternateText)
				writer.AddAttribute (HtmlTextWriterAttribute.Alt, s);
			s = DescriptionUrl;
			if (s.Length > 0)
				writer.AddAttribute (HtmlTextWriterAttribute.Longdesc, ResolveClientUrl (s));

			switch (ImageAlign) {
				case ImageAlign.Left:
					writer.AddAttribute (HtmlTextWriterAttribute.Align, "left", false);
					break;
				case ImageAlign.Right:
					writer.AddAttribute (HtmlTextWriterAttribute.Align, "right", false);
					break;
				case ImageAlign.Baseline:
					writer.AddAttribute (HtmlTextWriterAttribute.Align, "baseline", false);
					break;
				case ImageAlign.Top:
					writer.AddAttribute (HtmlTextWriterAttribute.Align, "top", false);
					break;
				case ImageAlign.Middle:
					writer.AddAttribute (HtmlTextWriterAttribute.Align, "middle", false);
					break;
				case ImageAlign.Bottom:
					writer.AddAttribute (HtmlTextWriterAttribute.Align, "bottom", false);
					break;
				case ImageAlign.AbsBottom:
					writer.AddAttribute (HtmlTextWriterAttribute.Align, "absbottom", false);
					break;
				case ImageAlign.AbsMiddle:
					writer.AddAttribute (HtmlTextWriterAttribute.Align, "absmiddle", false);
					break;
				case ImageAlign.TextTop:
					writer.AddAttribute (HtmlTextWriterAttribute.Align, "texttop", false);
					break;
			}
#if BUG_78875_FIXED
			if (Context.Request.Browser.SupportsCss)
#endif
#if !NET_4_0
			if (BorderWidth.IsEmpty)
				writer.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0px");
#endif
		}
Example #26
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 (this.Visible)
            {
                bool visible = _hfVisible.Value == "true";

                writer.AddAttribute("class", "grid-filter");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.Write("<header>");

                writer.AddAttribute(HtmlTextWriterAttribute.Class, visible ? "btn btn-link btn-xs btn-filter-toggle is-open" : "btn btn-link btn-xs btn-filter-toggle");
                writer.RenderBeginTag(HtmlTextWriterTag.Button);
                writer.Write("Filter Options");

                _hfVisible.RenderControl(writer);

                writer.AddAttribute("class", visible ? "btn-icon fa fa-chevron-up toggle-filter" : "btn-icon fa fa-chevron-down toggle-filter");
                writer.RenderBeginTag(HtmlTextWriterTag.I);
                writer.RenderEndTag();

                writer.RenderEndTag();

                writer.Write("</header>");

                // Filter Overview
                writer.AddAttribute("class", "grid-filter-overview");
                if (visible)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
                }

                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                var filterDisplay = new Dictionary <string, string>();
                AdditionalFilterDisplay.ToList().ForEach(d => filterDisplay.Add(d.Key, d.Value));

                List <UserPreference> userPreferencesForFilter;
                if (this.UserPreferenceKeyPrefix.IsNotNullOrWhiteSpace())
                {
                    userPreferencesForFilter = _userPreferences.Where(a => a.Key.StartsWith(this.UserPreferenceKeyPrefix)).ToList();
                }
                else
                {
                    userPreferencesForFilter = _userPreferences;
                }

                var nonEmptyValues = userPreferencesForFilter.Where(v => !string.IsNullOrEmpty(v.Value)).ToList();
                if (nonEmptyValues.Count > 0)
                {
                    foreach (var userPreference in nonEmptyValues)
                    {
                        DisplayFilterValueArgs args = new DisplayFilterValueArgs(userPreference, this.UserPreferenceKeyPrefix);
                        if (DisplayFilterValue != null)
                        {
                            DisplayFilterValue(this, args);
                        }

                        if (!string.IsNullOrWhiteSpace(args.Value))
                        {
                            filterDisplay.AddOrReplace(args.Name, args.Value);
                        }
                    }
                }

                if (filterDisplay.Any())
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);
                    writer.WriteLine("<h4>Enabled Filters</h4>");
                    writer.WriteLine("<div class='row'>");

                    // Calculate the filter column size by dividing the Bootstrap 12-column layout into equal widths.
                    int columnSize = (this.FieldLayout == GridFilterLayoutSpecifier.TwoColumnLayout) ? 6 : 4;

                    foreach (var filterNameValue in filterDisplay.OrderBy(f => f.Key))
                    {
                        writer.WriteLine("<div class='col-md-{0}'>", columnSize);
                        writer.WriteLine(string.Format("<label>{0}:</label> {1}", filterNameValue.Key, filterNameValue.Value));
                        writer.WriteLine("</div>");
                    }
                    writer.WriteLine("</div>");
                    writer.RenderEndTag();
                }

                writer.RenderEndTag();

                // Filter Entry
                writer.AddAttribute("class", "grid-filter-entry");
                if (!visible)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);

                writer.Write("<h4>Filter Options</h4>");

                base.RenderControl(writer);

                writer.RenderEndTag();

                _lbFilter.RenderControl(writer);

                if (ClearFilterClick != null)
                {
                    writer.WriteLine();
                    _lbClearFilter.RenderControl(writer);
                }

                writer.RenderEndTag();

                writer.RenderEndTag();

                if (_isDirty)
                {
                    SaveUserPreferences();
                    _isDirty = false;
                }

                RegisterJavaScript();
            }
        }
Example #27
0
		public override void RenderBeginTag (HtmlTextWriter writer)
		{
			string skipLinkText = SkipLinkText;
			
			if (!String.IsNullOrEmpty (skipLinkText)) {
				writer.AddAttribute (HtmlTextWriterAttribute.Href, "#" + ClientID + "_SkipLink");
				writer.RenderBeginTag (HtmlTextWriterTag.A);

				ClientScriptManager csm = new ClientScriptManager (null);
				
				writer.AddAttribute (HtmlTextWriterAttribute.Alt, skipLinkText);
				writer.AddAttribute (HtmlTextWriterAttribute.Src, csm.GetWebResourceUrl (typeof (SiteMapPath), "transparent.gif"));
				writer.AddAttribute (HtmlTextWriterAttribute.Height, "0");
				writer.AddAttribute (HtmlTextWriterAttribute.Width, "0");
				writer.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0px");
				writer.RenderBeginTag (HtmlTextWriterTag.Img);
				
				writer.RenderEndTag (); // img
				writer.RenderEndTag (); // a
			}
			base.RenderBeginTag (writer);
		}
Example #28
0
		void WriteStyleAttributes (HtmlTextWriter writer) 
		{
			string s;
			Color		color;
			BorderStyle	bs;
			Unit		u;

			if (CheckBit ((int) Styles.BackColor)) {
				color = (Color)viewstate["BackColor"];
				if (!color.IsEmpty)
					writer.AddStyleAttribute (HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(color));
			}

			if (CheckBit ((int) Styles.BorderColor)) {
				color = (Color)viewstate["BorderColor"];
				if (!color.IsEmpty)
					writer.AddStyleAttribute (HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(color));
			}

			bool have_width = false;
			if (CheckBit ((int) Styles.BorderWidth)) {
				u = (Unit)viewstate["BorderWidth"];
				if (!u.IsEmpty) {
					if (u.Value > 0)
						have_width = true;
					writer.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, u.ToString());
				}
			}

			if (CheckBit ((int) Styles.BorderStyle)) {
				bs = (BorderStyle)viewstate["BorderStyle"];
				if (bs != BorderStyle.NotSet) 
					writer.AddStyleAttribute (HtmlTextWriterStyle.BorderStyle, bs.ToString());
				else {
					if (CheckBit ((int) Styles.BorderWidth))
						writer.AddStyleAttribute (HtmlTextWriterStyle.BorderStyle, "solid");
				}
			} else if (have_width) {
				writer.AddStyleAttribute (HtmlTextWriterStyle.BorderStyle, "solid");
			}

			if (CheckBit ((int) Styles.ForeColor)) {
				color = (Color)viewstate["ForeColor"];
				if (!color.IsEmpty)
					writer.AddStyleAttribute (HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(color));
			}

			if (CheckBit ((int) Styles.Height)) {
				u = (Unit)viewstate["Height"];
				if (!u.IsEmpty)
					writer.AddStyleAttribute (HtmlTextWriterStyle.Height, u.ToString());
			}

			if (CheckBit ((int) Styles.Width)) {
				u = (Unit)viewstate["Width"];
				if (!u.IsEmpty)
					writer.AddStyleAttribute (HtmlTextWriterStyle.Width, u.ToString());
			}

			if (CheckBit ((int) Style.Styles.FontAll)) {
				// Fonts are a bit weird
				FontInfo font = Font;
				if (font.Name != string.Empty) {
					s = font.Names[0];
					for (int i = 1; i < font.Names.Length; i++)
						s += "," + font.Names[i];
					writer.AddStyleAttribute (HtmlTextWriterStyle.FontFamily, s);
				}

				if (font.Bold)
					writer.AddStyleAttribute (HtmlTextWriterStyle.FontWeight, "bold");

				if (font.Italic)
					writer.AddStyleAttribute (HtmlTextWriterStyle.FontStyle, "italic");

				if (!font.Size.IsEmpty)
					writer.AddStyleAttribute (HtmlTextWriterStyle.FontSize, font.Size.ToString());

				// These styles are munged into a attribute decoration
				s = string.Empty;

				if (font.Overline)
					s += "overline ";

				if (font.Strikeout)
					s += "line-through ";

				if (font.Underline)
					s += "underline ";

				s = (s != "") ? s : AlwaysRenderTextDecoration ? "none" : "";
				if (s != "")
					writer.AddStyleAttribute (HtmlTextWriterStyle.TextDecoration, s);
			}
		}
Example #29
0
 		void RenderNode (HtmlTextWriter writer, TreeNode node, int level, ArrayList levelLines, bool hasPrevious, bool hasNext)
		{
			if (node.PopulateOnDemand && node.HadChildrenBeforePopulating)
				throw new InvalidOperationException ("PopulateOnDemand cannot be set to true on a node that already has children.");
			
			DecorateNode(node);
			
			string nodeImage;
			bool clientExpand = EnableClientScript && Events [TreeNodeCollapsedEvent] == null && Events [TreeNodeExpandedEvent] == null;
			ImageStyle imageStyle = GetImageStyle ();
			bool renderChildNodes = node.Expanded.HasValue && node.Expanded.Value;
			
			if (clientExpand && !renderChildNodes)
				renderChildNodes = (!node.PopulateOnDemand || node.Populated);
				
			bool hasChildNodes;
			
			if (renderChildNodes)
				hasChildNodes = node.ChildNodes.Count > 0;
			else
				hasChildNodes = (node.PopulateOnDemand && !node.Populated) || node.ChildNodes.Count > 0;
				
			writer.AddAttribute (HtmlTextWriterAttribute.Cellpadding, "0", false);
			writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, "0", false);
			writer.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0");
			writer.RenderBeginTag (HtmlTextWriterTag.Table);

			Unit nodeSpacing = GetNodeSpacing (node);
#if !NET_4_0
			if (nodeSpacing != Unit.Empty && (node.Depth > 0 || node.Index > 0))
				RenderMenuItemSpacing (writer, nodeSpacing);
#endif
			writer.RenderBeginTag (HtmlTextWriterTag.Tr);
			
			// Vertical lines from previous levels

			nodeImage = GetNodeImageUrl ("i", imageStyle);
			for (int n=0; n<level; n++) {
				writer.RenderBeginTag (HtmlTextWriterTag.Td);
				writer.AddStyleAttribute (HtmlTextWriterStyle.Width, NodeIndent + "px");
				writer.AddStyleAttribute (HtmlTextWriterStyle.Height, "1px");
				writer.RenderBeginTag (HtmlTextWriterTag.Div);
				if (ShowLines && levelLines [n] != null) {
					writer.AddAttribute (HtmlTextWriterAttribute.Src, nodeImage);
					writer.AddAttribute (HtmlTextWriterAttribute.Alt, String.Empty, false);
					writer.RenderBeginTag (HtmlTextWriterTag.Img);
					writer.RenderEndTag ();
				}
				writer.RenderEndTag ();
				writer.RenderEndTag ();	// TD
			}
			
			// Node image + line
			bool showExpandCollapse = ShowExpandCollapse;
			bool showLines = ShowLines;
			if (showExpandCollapse || showLines) {
				bool buttonImage = false;
				string tooltip = String.Empty;
				string shape = String.Empty;
				
				if (showLines) {
					if (hasPrevious && hasNext)
						shape = "t";
					else if (hasPrevious && !hasNext)
						shape = "l";
					else if (!hasPrevious && hasNext)
						shape = "r";
					else
						shape = "dash";
				}
				
				if (showExpandCollapse) {
					if (hasChildNodes) {
						buttonImage = true;
						if (node.Expanded.HasValue && node.Expanded.Value)
							shape += "minus";
						else
							shape += "plus";
						tooltip = GetNodeImageToolTip (!(node.Expanded.HasValue && node.Expanded.Value), node.Text);
					} else if (!showLines)
						shape = "noexpand";
				}

				if (!String.IsNullOrEmpty (shape)) {
					nodeImage = GetNodeImageUrl (shape, imageStyle);
					writer.RenderBeginTag (HtmlTextWriterTag.Td);	// TD
					
					if (buttonImage) {
						if (!clientExpand || (!PopulateNodesFromClient && node.PopulateOnDemand && !node.Populated))
							writer.AddAttribute (HtmlTextWriterAttribute.Href, GetClientEvent (node, "ec"));
						else
							writer.AddAttribute (HtmlTextWriterAttribute.Href, GetClientExpandEvent(node));
						writer.RenderBeginTag (HtmlTextWriterTag.A);	// Anchor
					}

					// tooltip is 'HtmlAttributeEncoded'
					writer.AddAttribute (HtmlTextWriterAttribute.Alt, tooltip);

					if (buttonImage && clientExpand)
						writer.AddAttribute (HtmlTextWriterAttribute.Id, GetNodeClientId (node, "img"));
					writer.AddAttribute (HtmlTextWriterAttribute.Src, nodeImage);
					if (buttonImage)
						writer.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0");
					writer.RenderBeginTag (HtmlTextWriterTag.Img);
					writer.RenderEndTag ();
					
					if (buttonImage)
						writer.RenderEndTag ();		// Anchor

					writer.RenderEndTag ();		// TD
				}
			}
			
			// Node icon
			
			string imageUrl = node.ImageUrl.Length > 0 ? ResolveClientUrl (node.ImageUrl) : null;
			if (String.IsNullOrEmpty (imageUrl) && imageStyle != null) {
				if (imageStyle.RootIcon != null && node.IsRootNode)
					imageUrl = GetNodeIconUrl (imageStyle.RootIcon);
				else if (imageStyle.ParentIcon != null && node.IsParentNode)
					imageUrl = GetNodeIconUrl (imageStyle.ParentIcon);
				else if (imageStyle.LeafIcon != null && node.IsLeafNode)
					imageUrl = GetNodeIconUrl (imageStyle.LeafIcon);
			}
			
			if (level < LevelStyles.Count && LevelStyles [level].ImageUrl != null)
				imageUrl = ResolveClientUrl (LevelStyles [level].ImageUrl);
			
			if (!String.IsNullOrEmpty (imageUrl)) {
				writer.RenderBeginTag (HtmlTextWriterTag.Td);	// TD
#if NET_4_0
				writer.AddAttribute (HtmlTextWriterAttribute.Tabindex, "-1");
#endif
				BeginNodeTag (writer, node, clientExpand);
				writer.AddAttribute (HtmlTextWriterAttribute.Src, imageUrl);
				writer.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0");
				writer.AddAttribute (HtmlTextWriterAttribute.Alt, node.ImageToolTip);
				writer.RenderBeginTag (HtmlTextWriterTag.Img);
				writer.RenderEndTag ();	// IMG
				writer.RenderEndTag ();	// style tag
				writer.RenderEndTag ();	// TD
			}

			if (!NodeWrap)
				writer.AddStyleAttribute (HtmlTextWriterStyle.WhiteSpace, "nowrap");

			bool nodeIsSelected = node == SelectedNode && selectedNodeStyle != null;
			if (!nodeIsSelected && selectedNodeStyle != null) {
				if (!String.IsNullOrEmpty (activeSiteMapPath))
					nodeIsSelected = String.Compare (activeSiteMapPath, node.NavigateUrl, RuntimeHelpers.StringComparison) == 0;
			}
			
			AddNodeStyle (writer, node, level, nodeIsSelected);
			if (EnableClientScript) {
				writer.AddAttribute ("onmouseout", "TreeView_UnhoverNode(this)", false);
				writer.AddAttribute ("onmouseover", "TreeView_HoverNode('" + ClientID + "', this)");
			}
			writer.RenderBeginTag (HtmlTextWriterTag.Td);	// TD
			
			// Checkbox
			
			if (node.ShowCheckBoxInternal) {
				writer.AddAttribute (HtmlTextWriterAttribute.Name, ClientID + "_cs_" + node.Path);
				writer.AddAttribute (HtmlTextWriterAttribute.Type, "checkbox", false);
#if NET_4_0
				string str = node.ToolTip;
				if (!String.IsNullOrEmpty (str))
					writer.AddAttribute (HtmlTextWriterAttribute.Title, str);
#else
				writer.AddAttribute (HtmlTextWriterAttribute.Title, node.Text);
#endif
				if (node.Checked)
					writer.AddAttribute (HtmlTextWriterAttribute.Checked, "checked", false);
				writer.RenderBeginTag (HtmlTextWriterTag.Input);	// INPUT
				writer.RenderEndTag ();	// INPUT
			}
			
			// Text
			
			node.BeginRenderText (writer);
			
			if (clientExpand)
				writer.AddAttribute (HtmlTextWriterAttribute.Id, GetNodeClientId (node, "txt"));
			AddNodeLinkStyle (writer, node, level, nodeIsSelected);
			BeginNodeTag (writer, node, clientExpand);
			writer.Write (node.Text);
			writer.RenderEndTag ();	// style tag
			
			node.EndRenderText (writer);
			
			writer.RenderEndTag ();	// TD
			
			writer.RenderEndTag ();	// TR
#if !NET_4_0
			if (nodeSpacing != Unit.Empty)
				RenderMenuItemSpacing (writer, nodeSpacing);
#endif
			
			writer.RenderEndTag ();	// TABLE
			
			// Children
			
			if (hasChildNodes) {
				if (level >= levelLines.Count) {
					if (hasNext)
						levelLines.Add (this);
					else
						levelLines.Add (null);
				} else {
					if (hasNext)
						levelLines [level] = this;
					else
						levelLines [level] = null;
				}
				
				if (clientExpand) {
					if (!(node.Expanded.HasValue && node.Expanded.Value))
						writer.AddStyleAttribute (HtmlTextWriterStyle.Display, "none");
					else
						writer.AddStyleAttribute (HtmlTextWriterStyle.Display, "block");
					writer.AddAttribute (HtmlTextWriterAttribute.Id, GetNodeClientId (node, null));
					writer.RenderBeginTag (HtmlTextWriterTag.Span);
					
					if (renderChildNodes) {
						AddChildrenPadding (writer, node);
						int num = node.ChildNodes.Count;
						for (int n=0; n<num; n++)
							RenderNode (writer, node.ChildNodes [n], level + 1, levelLines, true, n<num-1);
						if (hasNext)
							AddChildrenPadding (writer, node);
					}
					writer.RenderEndTag ();	// SPAN
				} else if (renderChildNodes) {
					AddChildrenPadding (writer, node);
					int num = node.ChildNodes.Count;
					for (int n=0; n<num; n++)
						RenderNode (writer, node.ChildNodes [n], level + 1, levelLines, true, n<num-1);
					if (hasNext)
						AddChildrenPadding (writer, node);
				}
			}
		}
Example #30
0
// ---------------------------------------------------------------------------
        public static void AddServerRequiredStyle(HtmlTextWriter w)
        {
            w.AddStyleAttribute("border", "2px solid red");
        }
Example #31
0
		void RenderMenuItemSpacing (HtmlTextWriter writer, Unit itemSpacing)
		{
#if !NET_4_0
			writer.AddStyleAttribute (HtmlTextWriterStyle.Height, itemSpacing.ToString ());
#endif
			writer.RenderBeginTag (HtmlTextWriterTag.Tr);
			writer.RenderBeginTag (HtmlTextWriterTag.Td);
			writer.RenderEndTag ();
			writer.RenderEndTag ();
		}
Example #32
0
		internal void AddDisplayStyleAttribute (HtmlTextWriter writer)
		{
			if (!ControlStyleCreated)
				return;

			if (!ControlStyle.BorderWidth.IsEmpty ||
			(ControlStyle.BorderStyle != BorderStyle.None && ControlStyle.BorderStyle != BorderStyle.NotSet) ||
			!ControlStyle.Height.IsEmpty ||
			!ControlStyle.Width.IsEmpty)
				writer.AddStyleAttribute (HtmlTextWriterStyle.Display, "inline-block");
		}
Example #33
0
		void AddNodeLinkStyle (HtmlTextWriter writer, TreeNode node, int level, bool nodeIsSelected)
		{
			Style style = new Style ();
#if NET_4_0
			bool addBorderStyle = false;
#endif
			if (Page.Header != null) {
				// styles are registered
				style.AddCssClass (ControlLinkStyle.RegisteredCssClass);

				if (nodeStyle != null) {
					style.AddCssClass (nodeLinkStyle.CssClass);
					style.AddCssClass (nodeLinkStyle.RegisteredCssClass);
				}

				if (levelLinkStyles != null && levelLinkStyles.Count > level) {
					style.AddCssClass (levelLinkStyles [level].CssClass);
					style.AddCssClass (levelLinkStyles [level].RegisteredCssClass);
#if NET_4_0
					addBorderStyle = true;
#endif
				}
				
				if (node.IsLeafNode) {
					if (leafNodeStyle != null) {
						style.AddCssClass (leafNodeLinkStyle.CssClass);
						style.AddCssClass (leafNodeLinkStyle.RegisteredCssClass);
					}
				} else if (node.IsRootNode) {
					if (rootNodeStyle != null) {
						style.AddCssClass (rootNodeLinkStyle.CssClass);
						style.AddCssClass (rootNodeLinkStyle.RegisteredCssClass);
					}
				} else if (node.IsParentNode) {
					if (parentNodeStyle != null) {
						style.AddCssClass (parentNodeLinkStyle.CssClass);
						style.AddCssClass (parentNodeLinkStyle.RegisteredCssClass);
					}
				}
				
				if (nodeIsSelected) {
					style.AddCssClass (selectedNodeLinkStyle.CssClass);
					style.AddCssClass (selectedNodeLinkStyle.RegisteredCssClass);
				}
			} else {
				// styles are not registered
				style.CopyFrom (ControlLinkStyle);
				if (nodeStyle != null)
					style.CopyFrom (nodeLinkStyle);
				
				if (levelLinkStyles != null && levelLinkStyles.Count > level) {
					style.CopyFrom (levelLinkStyles [level]);
#if NET_4_0
					addBorderStyle = true;
#endif
				}
				
				if (node.IsLeafNode) {
					if (node.IsLeafNode && leafNodeStyle != null)
						style.CopyFrom (leafNodeLinkStyle);
				} else if (node.IsRootNode) {
					if (node.IsRootNode && rootNodeStyle != null)
						style.CopyFrom (rootNodeLinkStyle);
				} else if (node.IsParentNode) {
					if (node.IsParentNode && parentNodeStyle != null)
						style.CopyFrom (parentNodeLinkStyle);
				}
				
				if (nodeIsSelected)
					style.CopyFrom (selectedNodeLinkStyle);
				
				style.AlwaysRenderTextDecoration = true;
			}
#if NET_4_0
			if (addBorderStyle) {
				// This appears not to come from any style. Instead, it's added
				// whenever a level style is present.
				writer.AddStyleAttribute (HtmlTextWriterStyle.BorderStyle, "none");
				writer.AddStyleAttribute (HtmlTextWriterStyle.FontSize, "1em");
			}		
#endif
			style.AddAttributesToRender (writer);
		}
Example #34
0
        protected void ModifyRenderedCheckboxes(HtmlTextWriter writer)
        {
            int index = 0;

            string spanId   = "";
            string wapperId = "";
            string allChkId = "";

            writer.AddAttribute(HtmlTextWriterAttribute.Width, this.Width.ToString());
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_Optiontable");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "relative");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Left, "0px");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            #region 首選項

            if (ShowSelectAllOption)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                wapperId = string.Format("{0}_{1}", this.ClientID, "chkAllItemWapper");
                allChkId = string.Format("{0}_{1}", this.ClientID, "chkAllItemValue");
                spanId   = string.Format("{0}_{1}", this.ClientID, "chkAllItemText");

                writer.AddAttribute("onmouseover", string.Format("setStyleOnMouseOver('{0}');", wapperId));
                writer.AddAttribute("onmouseout", string.Format("setStyleOnMouseOut('{0}');", wapperId));

                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, (this.Width.Value - 10).ToString());
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "20px");
                writer.AddAttribute(HtmlTextWriterAttribute.Id, wapperId);
                writer.AddStyleAttribute("cursor", "pointer");
                writer.AddStyleAttribute("cursor", "hand");
                writer.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "5px");
                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "5px");
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format("return clickChangeValueWhenCheckAllCheckBox(event,'{0}','{1}');", allChkId, this.ClientID));
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute(HtmlTextWriterAttribute.Id, allChkId);
                writer.AddStyleAttribute("cursor", "pointer");
                writer.AddStyleAttribute("cursor", "hand");
                writer.AddAttribute(HtmlTextWriterAttribute.Value, "");
                writer.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "5px");
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format("return mouseUpdateValueWhenSelectAllStateChanged(event,this,'{0}');", this.ClientID));
                writer.AddAttribute(HtmlTextWriterAttribute.Type, "checkbox");
                writer.RenderBeginTag(HtmlTextWriterTag.Input);
                writer.RenderEndTag();//end input

                writer.AddAttribute(HtmlTextWriterAttribute.Id, spanId);
                writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "small");
                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingTop, "5px");
                writer.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "5px");
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format("return mouseUpdateValueWhenCheckAllCheckBox(event,'{0}','{1}');", allChkId, this.ClientID));
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.Write(SelectAllOptionLabel);
                writer.RenderEndTag(); //end span

                writer.RenderEndTag(); //td
                writer.RenderEndTag(); //tr
            }
            #endregion

            #region 內容選項
            string chkId = "";
            foreach (ListItem item in this.Items)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                wapperId = string.Format("{0}_{1}{2}", this.ClientID, "chkItemWapper", index.ToString());
                chkId    = string.Format("{0}_{1}{2}", this.ClientID, "chkItemValue", index.ToString());
                spanId   = string.Format("{0}_{1}{2}", this.ClientID, "chkItemText", index.ToString());

                writer.AddAttribute("onmouseover", string.Format("setStyleOnMouseOver('{0}');", wapperId));
                writer.AddAttribute("onmouseout", string.Format("setStyleOnMouseOut('{0}');", wapperId));

                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, (this.Width.Value - 10).ToString());
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "20px");
                writer.AddAttribute(HtmlTextWriterAttribute.Id, wapperId);
                writer.AddStyleAttribute("cursor", "pointer");
                writer.AddStyleAttribute("cursor", "hand");
                writer.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "5px");
                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "5px");

                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format("return clickChangeValueWhenCheckItemCheckBox(event,'{0}','{1}','{2}','{3}');", chkId, spanId, allChkId, this.ClientID));
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute(HtmlTextWriterAttribute.Id, chkId);
                writer.AddStyleAttribute("cursor", "pointer");
                writer.AddStyleAttribute("cursor", "hand");
                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingTop, "5px");
                writer.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "5px");
                writer.AddAttribute(HtmlTextWriterAttribute.Width, "16px");
                writer.AddAttribute(HtmlTextWriterAttribute.Value, item.Value);
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format("return mouseUpdateValueWhenCheckItemStateChanged(event,'{0}','{1}','{2}','{3}');", chkId, spanId, allChkId, this.ClientID));
                writer.AddAttribute(HtmlTextWriterAttribute.Type, "checkbox");
                writer.RenderBeginTag(HtmlTextWriterTag.Input);
                writer.RenderEndTag();//end input

                writer.AddAttribute(HtmlTextWriterAttribute.Id, spanId);
                writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "small");
                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingTop, "5px");
                writer.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingBottom, "5px");
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format("return mouseUpdateValueWhenCheckItemCheckBox(event,'{0}','{1}','{2}','{3}');", chkId, spanId, allChkId, this.ClientID));
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                if (DisplayMode == Comfy.UI.WebControls.WebDropDownCheckBoxList.DisplayMode.Label)
                {
                    writer.Write(item.Text);
                }
                else
                {
                    writer.Write(item.Value);
                }

                writer.RenderEndTag(); //end span

                writer.RenderEndTag(); //td
                writer.RenderEndTag(); //tr
                index++;
            }
            #endregion

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            hfValue.RenderControl(writer);
            hfValueText.RenderControl(writer);
            writer.RenderEndTag(); //end td
            writer.RenderEndTag(); //end tr
            writer.RenderEndTag(); //end table
        }
Example #35
0
        private void RenderFolderCreator(HtmlTextWriter writer)
        {
            var controlMode = SPContext.Current.FormContext.FormMode;

            writer.AddAttribute(HtmlTextWriterAttribute.Id, "part1");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formtable");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.MarginTop, "8px");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Td
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formlabel");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "190px");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-standardheader");
            writer.RenderBeginTag(HtmlTextWriterTag.H3);

            writer.Write("Name");

            if (controlMode != SPControlMode.Display)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Title, "This is a required field.");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formvalidation");
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.Write(" *");
                writer.RenderEndTag(); // span
            }

            writer.RenderEndTag(); // h3
            writer.RenderEndTag(); // td

            // Td
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formbody");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            SPListItem folder = null;

            if (controlMode != SPControlMode.New)
            {
                folder = SPContext.Current.List.GetItemById(Convert.ToInt32(Page.Request.QueryString["ID"]));
            }

            if (controlMode == SPControlMode.Display)
            {
                var viewUrl = Page.Request.QueryString["Source"];
                if (string.IsNullOrEmpty(viewUrl))
                {
                    viewUrl = SPContext.Current.List.DefaultViewUrl;
                }

                var urlBuilder = new UrlBuilder(viewUrl);
                urlBuilder.ClearQueryString();
                // ReSharper disable PossibleNullReferenceException
                urlBuilder.AddQueryString("RootFolder", folder.Folder.ServerRelativeUrl);
                // ReSharper restore PossibleNullReferenceException

                writer.AddAttribute(HtmlTextWriterAttribute.Rel, "sp_DialogLinkNavigate");
                writer.AddAttribute(HtmlTextWriterAttribute.Href, urlBuilder.ToString());
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write(SPEncode.HtmlEncode(folder.Name));
                writer.RenderEndTag(); // a
            }
            else
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Span);

                if (!Page.IsPostBack && SPContext.Current.FormContext.FormMode == SPControlMode.Edit)
                {
                    // ReSharper disable PossibleNullReferenceException
                    writer.AddAttribute(HtmlTextWriterAttribute.Value, folder.Name);
                    // ReSharper restore PossibleNullReferenceException
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Value, folderName);
                }

                writer.AddAttribute(HtmlTextWriterAttribute.Title, "Name");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-long");
                writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID + "$onetidIOFile");
                writer.RenderBeginTag(HtmlTextWriterTag.Input);

                if (!IsValid)
                {
                    writer.Write("<br/>");
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formvalidation");
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);

                    writer.AddAttribute("role", "alert");
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    writer.Write(ErrorMessage);
                    writer.RenderEndTag(); // span
                    writer.RenderEndTag(); // span
                }

                writer.RenderEndTag(); // input

                writer.RenderEndTag(); // span
            }

            writer.RenderEndTag(); // td

            writer.RenderEndTag(); // tr

            writer.RenderEndTag(); // table

            // Table
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formline");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("<img width=\"1\" height=\"1\" alt=\"\" src=\"/_layouts/15/images/blank.gif\" complete=\"complete\"/>");
            writer.RenderEndTag(); // td

            writer.RenderEndTag(); // tr
            writer.RenderEndTag(); // table

            // Table
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingTop, "7px");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // Table
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formtoolbar");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Td
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            if (controlMode == SPControlMode.New)
            {
                writer.Write("&nbsp;");
            }
            else
            {
                createdModifiedInfo.ControlMode = controlMode;
                createdModifiedInfo.RenderControl(writer);
            }
            writer.RenderEndTag(); // td

            // Td
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "99%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-toolbar");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("<img width=\"1\" height=\"18\" alt=\"\" src=\"/_layouts/15/images/blank.gif\" complete=\"complete\"/>");
            writer.RenderEndTag(); // td

            if (controlMode == SPControlMode.Display)
            {
                // Td
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-toolbar");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                RenderButton(writer, "Close", "C", "SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel, null);");
                writer.RenderEndTag(); // td
            }
            else
            {
                // Td
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-toolbar");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                RenderButton(writer, "Save", "O", Page.ClientScript.GetPostBackEventReference(this, "ADD_OR_EDIT_FOLDER"));
                writer.RenderEndTag(); // td

                // Td
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-separator");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.Write("&nbsp;");
                writer.RenderEndTag(); // td

                // Td
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-toolbar");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                RenderButton(writer, "Cancel", "C", "SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel, null);");
                writer.RenderEndTag(); // td
            }

            writer.RenderEndTag(); // tr
            writer.RenderEndTag(); // table

            writer.RenderEndTag(); // td

            writer.RenderEndTag(); // tr
            writer.RenderEndTag(); // table

            writer.RenderEndTag(); // div

            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
            writer.RenderBeginTag(HtmlTextWriterTag.Script);
            writer.Write("SetUploadPageTitle();");
            writer.RenderEndTag(); // script
        }
        protected override void Render(HtmlTextWriter output)
        {
            if (this.Visible)
            {
                autocompletePanel.Visible = false;
                comboboxPanel.Visible     = false;
                if (Mode != "A")
                {
                    comboboxPanel.Visible = true;
                    System.Collections.IEnumerator keys = base.Attributes.Keys.GetEnumerator();
                    String key;
                    while (keys.MoveNext())
                    {
                        key = (string)keys.Current;
                        if ("onchange".IndexOf(key.ToLower()) >= 0)
                        {
                            ibWild.Attributes.Add("OnClick", base.Attributes[key]);
                            ibDDFind.Attributes.Add("OnClick", base.Attributes[key]);
                            ibFirst.Attributes.Add("OnClick", base.Attributes[key]);
                            ibPrev.Attributes.Add("OnClick", base.Attributes[key]);
                            ibNext.Attributes.Add("OnClick", base.Attributes[key]);
                            ibLast.Attributes.Add("OnClick", base.Attributes[key]);
                        }
                        tBox.Attributes.Add(key, base.Attributes[key]);
                        ddList.Attributes.Add(key, base.Attributes[key]);
                    }
                    output.AddAttribute(HtmlTextWriterAttribute.Class, "combobox");
                    output.RenderBeginTag(HtmlTextWriterTag.Div);

                    tBox.Attributes.Add("OnFocus", "this.select();");

                    if (!ddList.Enabled)
                    {
                        ddList.Visible = true; tBox.Visible = false;
                    }

                    if (ddList.Visible)
                    {
                        output.AddAttribute(HtmlTextWriterAttribute.Id, ddList.ClientID);
                        output.AddAttribute(HtmlTextWriterAttribute.Class, "combobox-dropdownlist");
                    }
                    ddList.RenderControl(output);
                    if (tBox.Visible)
                    {
                        output.AddAttribute(HtmlTextWriterAttribute.Id, tBox.ClientID);
                        output.AddAttribute(HtmlTextWriterAttribute.Class, "combobox-textbox");
                    }
                    tBox.RenderControl(output);


                    if (!ddList.Visible)
                    {
                        output.AddStyleAttribute(HtmlTextWriterStyle.Left, (tBox.Width.Value + 4).ToString() + "px");
                        output.AddAttribute(HtmlTextWriterAttribute.Class, "combobox-controls combobox-control-textbox");
                        output.RenderBeginTag(HtmlTextWriterTag.Div);

                        ibWild.CausesValidation = false;
                        output.AddAttribute(HtmlTextWriterAttribute.Tabindex, "-1");
                        ibWild.RenderControl(output);
                        lbMsg.RenderControl(output);
                        output.RenderEndTag(); //</div> - combobox-controls
                    }
                    if (ddList.Enabled && ddList.Visible)
                    {
                        output.AddStyleAttribute(HtmlTextWriterStyle.Left, (ddList.Width.Value).ToString() + "px");
                        output.AddAttribute(HtmlTextWriterAttribute.Class, "combobox-controls combobox-control-dropdownlist");
                        output.RenderBeginTag(HtmlTextWriterTag.Div);
                        ibDDFind.CausesValidation = false;
                        output.AddAttribute(HtmlTextWriterAttribute.Tabindex, "-1");
                        ibDDFind.RenderControl(output);

                        lbPages.RenderControl(output);

                        ibFirst.CausesValidation = false;
                        output.AddAttribute(HtmlTextWriterAttribute.Tabindex, "-1");
                        ibFirst.RenderControl(output);

                        ibPrev.CausesValidation = false;
                        output.AddAttribute(HtmlTextWriterAttribute.Tabindex, "-1");
                        ibPrev.RenderControl(output);

                        ibNext.CausesValidation = false;
                        output.AddAttribute(HtmlTextWriterAttribute.Tabindex, "-1");
                        ibNext.RenderControl(output);

                        ibLast.CausesValidation = false;
                        output.AddAttribute(HtmlTextWriterAttribute.Tabindex, "-1");
                        ibLast.RenderControl(output);
                        output.RenderEndTag(); //</div> - combobox-controls
                    }

                    output.RenderEndTag(); //</div> - combobox
                }
                else
                {
                    autocompletePanel.Visible = true;
                    System.Collections.IEnumerator keys = base.Attributes.Keys.GetEnumerator();
                    String key;
                    while (keys.MoveNext())
                    {
                        key = (string)keys.Current;
                        string attr = base.Attributes[key] ?? "";
                        if (key.ToLower() == "onchange" && AutoPostBack && !attr.Contains("CanPostBack"))
                        {
                            attr = attr + " if (!CanPostBack(true,this)) return false;";
                        }
                        tKeyBox.Attributes.Add(key, attr);
                        if (key.ToLower() != "onchange")
                        {
                            tLabelBox.Attributes.Add(key, attr);
                        }
                    }
                    System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();
                    string url = AutoCompleteUrl;
                    Dictionary <string, string> context = DataContext;

                    output.AddAttribute(HtmlTextWriterAttribute.Class, "autocomplete-container");
                    output.RenderBeginTag(HtmlTextWriterTag.Div); // container wrapper

                    output.AddAttribute(HtmlTextWriterAttribute.Id, tKeyBox.ClientID);
                    output.AddAttribute(HtmlTextWriterAttribute.Tabindex, "-1");
                    tKeyBox.Style["display"] = "none";

                    tKeyBox.RenderControl(output);

                    output.AddAttribute(HtmlTextWriterAttribute.Id, tLabelBox.ClientID);

                    output.AddAttribute(HtmlTextWriterAttribute.Class, "ui-autocomplete-input ui-widget ui-widget-content ui-corner-left autocomplete-box-input");
                    output.AddAttribute("readonly", "true");
                    output.AddAttribute("onfocus", "ActivateAutocomplete" + tKeyBox.ClientID + "(this ,event);return false;");
                    tLabelBox.RenderControl(output);
                    // simulate button layer
                    output.AddAttribute(HtmlTextWriterAttribute.Class, "ui-button ui-widget ui-state-default ui-button-icon-only ui-corner-right ui-button-icon autocomplete-box-button");
                    output.AddAttribute(HtmlTextWriterAttribute.Style, "box-sizing:border-box;");
                    output.AddAttribute(HtmlTextWriterAttribute.Onclick, "ActivateAutocomplete" + tKeyBox.ClientID + "(this ,event);return false;");
                    output.RenderBeginTag(HtmlTextWriterTag.Span);
                    Label searchBox = new Label();
                    output.AddAttribute(HtmlTextWriterAttribute.Class, "ui-button-icon-primary ui-icon ui-icon-search");
                    output.AddAttribute(HtmlTextWriterAttribute.Style, "display:inline-block;");
                    searchBox.RenderControl(output);

                    output.RenderEndTag(); // Span

                    output.RenderEndTag(); // div
                    ClientScriptManager cs = this.Page.ClientScript;
                    ScriptManager.RegisterStartupScript(tKeyBox, tKeyBox.GetType(), tKeyBox.ClientID + "combobox",
                                                        @"function ActivateAutocomplete" + tKeyBox.ClientID + "(ele ,event) { ApplyAutoComplete(ele,'" + tKeyBox.ClientID + "','" + url + "'," + jss.Serialize(context) + ", event);}"
                                                        , true);
//                    if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
//                    {
//                        ScriptManager.RegisterStartupScript(tKeyBox, tKeyBox.GetType(), tKeyBox.ClientID + "combobox",
//                        @"
//                        try {
//                           Sys.Application.add_load(
//                            function() {
//                                CreateComboAuto('" + tKeyBox.ClientID + @"','" + url + @"'," + jss.Serialize(context) + @", true);
//                             });
//                        } catch (e) {}
//                        ",
//                                true);
//                    }
//                    else
//                    {
//                                ScriptManager.RegisterStartupScript(tKeyBox, tKeyBox.GetType(), tKeyBox.ClientID + "combobox",
//                                @"
//                        try {
//                                CreateComboAuto('" + tKeyBox.ClientID + @"','" + url + @"'," + jss.Serialize(context) + @", true);
//                        } catch (e) {}
//                        ",
//                        true);

//                    }
                }
            }
        }
Example #37
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 (this.Visible)
            {
                bool visible = _hfVisible.Value == "true";

                writer.AddAttribute("class", "grid-filter");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.Write("<header>");

                writer.RenderBeginTag(HtmlTextWriterTag.H3);
                writer.Write("Filter Options");
                writer.RenderEndTag();

                _hfVisible.RenderControl(writer);

                writer.AddAttribute("class", visible ? "fa fa-chevron-up toggle-filter" : "fa fa-chevron-down toggle-filter");
                writer.RenderBeginTag(HtmlTextWriterTag.I);
                writer.RenderEndTag();

                writer.Write("</header>");

                // Filter Overview
                writer.AddAttribute("class", "grid-filter-overview");
                if (visible)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                var           nonEmptyValues = _userPreferences.Where(v => !string.IsNullOrEmpty(v.Value)).ToList();
                StringBuilder filtersHtml    = new StringBuilder();
                if (nonEmptyValues.Count > 0)
                {
                    foreach (var userPreference in nonEmptyValues)
                    {
                        DisplayFilterValueArgs args = new DisplayFilterValueArgs(userPreference);
                        if (DisplayFilterValue != null)
                        {
                            DisplayFilterValue(this, args);
                        }

                        if (!string.IsNullOrWhiteSpace(args.Value))
                        {
                            filtersHtml.AppendLine("<div>");
                            filtersHtml.AppendLine(string.Format("<label>{0}:</label> {1}", args.Name, args.Value));
                            filtersHtml.AppendLine("</div>");
                        }
                    }
                }

                if (filtersHtml.Length > 0)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);
                    writer.Write("<h4>Enabled Filters</h4>");
                    writer.Write(filtersHtml.ToString());
                    writer.RenderEndTag();
                }

                writer.RenderEndTag();

                // Filter Entry
                writer.AddAttribute("class", "grid-filter-entry");
                if (!visible)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);

                writer.Write("<h4>Filter Options</h4>");

                base.RenderControl(writer);

                writer.RenderEndTag();

                _lbFilter.RenderControl(writer);

                writer.RenderEndTag();

                writer.RenderEndTag();

                if (_isDirty)
                {
                    SaveUserPreferences();
                    _isDirty = false;
                }

                RegisterJavaScript();
            }
        }
Example #38
0
        /// <summary>
        /// This is where you implement the simple aspects of rendering your control.  The rest
        /// will be handled by calling RenderControlHelper's RenderControl() method.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public void RenderBaseControl(HtmlTextWriter writer)
        {
            writer.AddAttribute("class", "fileupload-group");
            writer.AddAttribute("id", this.ClientID);

            if (ToolTip.IsNotNullOrWhiteSpace())
            {
                writer.AddAttribute("title", ToolTip);
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            if (BinaryFileId != null || !string.IsNullOrWhiteSpace(this.UploadedContentFilePath))
            {
                if (IsBinaryFile)
                {
                    _aFileName.HRef      = string.Format("{0}GetFile.ashx?id={1}", ResolveUrl("~"), BinaryFileId);
                    _aFileName.InnerText = new BinaryFileService(new RockContext()).Queryable().Where(f => f.Id == BinaryFileId).Select(f => f.FileName).FirstOrDefault();
                }
                else
                {
                    _aFileName.HRef      = ResolveUrl(this.UploadedContentFilePath);
                    _aFileName.InnerText = this.UploadedContentFilePath;
                }

                _aFileName.AddCssClass("file-exists");
                _aRemove.Style[HtmlTextWriterStyle.Display] = "block";
            }
            else
            {
                _aFileName.HRef      = string.Empty;
                _aFileName.InnerText = string.Empty;
                _aFileName.RemoveCssClass("file-exists");
                _aRemove.Style[HtmlTextWriterStyle.Display] = "none";
            }

            if (this.Enabled)
            {
                if (this.DisplayMode == UploaderDisplayMode.DropZone)
                {
                    writer.AddAttribute("class", "fileupload-thumbnail");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    _hfBinaryFileId.RenderControl(writer);
                    _hfBinaryFileTypeGuid.RenderControl(writer);
                    _aFileName.RenderControl(writer);


                    writer.AddAttribute("class", "fileupload-remove");
                    if (!ShowDeleteButton)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Visibility, "hidden");
                    }

                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    _aRemove.RenderControl(writer);
                    writer.RenderEndTag();

                    writer.RenderEndTag();
                }

                string uploadClass = this.DisplayMode == UploaderDisplayMode.DefaultButton ? "upload-progress-sm" : "upload-progress";
                string spinnerSize = this.DisplayMode == UploaderDisplayMode.DefaultButton ? "fa-lg" : "fa-3x";

                writer.Write($@"
                    <div class='js-upload-progress {uploadClass}' style='display:none;'>
                        <i class='fa fa-refresh {spinnerSize} fa-spin'></i>
                        <div class='js-upload-progress-percent'></div>
                    </div>");

                if (this.DisplayMode == UploaderDisplayMode.Button)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "fileupload-button");
                }
                else if (this.DisplayMode == UploaderDisplayMode.DefaultButton)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "fileuploaddefault-button");
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "fileupload-dropzone");
                }

                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.Write(this.UploadButtonText);
                writer.RenderEndTag();

                _fileUpload.Attributes["name"] = string.Format("{0}[]", this.ID);
                _fileUpload.RenderControl(writer);
                writer.RenderEndTag();
            }

            RegisterStartupScript();

            writer.RenderEndTag();
        }
Example #39
0
        /// <summary>
        /// Writes the <see cref="T:System.Web.UI.WebControls.CompositeControl" /> content to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object, for display on the client.
        /// </summary>
        /// <param name="writer">An <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel panel-widget template-form");

            writer.AddAttribute("data-key", _hfFormGuid.Value);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ID + "_section");
            writer.RenderBeginTag("section");

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-heading clearfix clickable");
            writer.RenderBeginTag("header");

            // Hidden Field to track expansion
            _hfExpanded.RenderControl(writer);

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

            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _lblFormName.Text = _tbFormName.Text;
            _lblFormName.RenderControl(writer);

            // H3 tag
            writer.RenderEndTag();

            // Name div
            writer.RenderEndTag();

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

            writer.WriteLine("<a class='btn btn-xs btn-link form-reorder'><i class='fa fa-bars'></i></a>");
            writer.WriteLine(string.Format("<a class='btn btn-xs btn-link'><i class='form-state fa {0}'></i></a>",
                                           Expanded ? "fa fa-chevron-up" : "fa fa-chevron-down"));

            if (IsDeleteEnabled)
            {
                _lbDeleteForm.Visible = true;
                _lbDeleteForm.RenderControl(writer);
            }
            else
            {
                _lbDeleteForm.Visible = false;
            }

            // Add/ChevronUpDown/Delete div
            writer.RenderEndTag();

            // header div
            writer.RenderEndTag();

            if (!Expanded)
            {
                // hide details if the activity and actions are valid
                writer.AddStyleAttribute("display", "none");
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // activity edit fields
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _hfFormGuid.RenderControl(writer);
            _hfFormId.RenderControl(writer);
            _tbFormName.ValidationGroup = ValidationGroup;
            _tbFormName.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.RenderEndTag();

            writer.RenderEndTag();

            _gFields.RenderControl(writer);

            // widget-content div
            writer.RenderEndTag();

            // section tag
            writer.RenderEndTag();
        }
        /// <summary>
        /// Render header part of the TabContainer.
        /// </summary>
        /// <param name="writer">HtmlTextWriter object</param>
        protected virtual void RenderHeader(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_header");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ajax__tab_header" + GetSuffixTabStripPlacementCss());
            if (_tabStripPlacement == TabStripPlacement.BottomRight ||
                _tabStripPlacement == TabStripPlacement.TopRight)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Direction, "rtl");
            }

            if (_useVerticalStripPlacement)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "block");
                if (_tabStripPlacement == TabStripPlacement.Bottom || _tabStripPlacement == TabStripPlacement.Top)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Style, "float:left");
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Style, "float:right");
                }
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, _verticalStripWidth.ToString());
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            if (_tabStripPlacement == TabStripPlacement.Bottom || _tabStripPlacement == TabStripPlacement.BottomRight)
            {
                RenderSpannerForVerticalTabs(writer);
            }

            if (!_useVerticalStripPlacement &&
                (_tabStripPlacement == TabStripPlacement.BottomRight ||
                 _tabStripPlacement == TabStripPlacement.TopRight))
            {
                // reverse tab order placement
                var tabs = Tabs.Count;
                for (int i = tabs - 1; i >= 0; i--)
                {
                    var panel = Tabs[i];
                    if (panel.Visible)
                    {
                        panel.RenderHeader(writer);
                    }
                }
            }
            else
            {
                foreach (TabPanel panel in Tabs)
                {
                    if (panel.Visible)
                    {
                        panel.RenderHeader(writer);
                    }
                }
            }

            if (_tabStripPlacement == TabStripPlacement.Top || _tabStripPlacement == TabStripPlacement.TopRight)
            {
                RenderSpannerForVerticalTabs(writer);
            }

            writer.RenderEndTag();
        }
        /// <summary>
        /// 按钮控件输出
        /// </summary>
        /// <param name="writer"></param>
        protected override void Render(HtmlTextWriter writer)
        {
            if (this.Width.Value > 0)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, this.Width.ToString());
            }
            if (this.Height.Value > 0)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, this.Height.ToString());
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "btn-group");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            if (this.HashDataSource.Count > 0)
            {
                ArrayList arrarykeys = new ArrayList(HashDataSource.Keys);
                arrarykeys.Sort();

                foreach (string item in arrarykeys)
                {
                    DefineValueList _value = (DefineValueList)HashDataSource[item];
                    if (item.ToString() == "Order_1")
                    {
                        string _AddClass = string.Empty;
                        if (this.LaySkins != ButtonObject.empty)
                        {
                            _AddClass = " layui-btn-" + this.LaySkins.ToString();
                        }
                        switch (this.LaySize)
                        {
                        case ButtonSize.mini:
                            _AddClass += " layui-btn-xs";
                            break;

                        case ButtonSize.small:
                            _AddClass += " layui-btn-sm";
                            break;

                        case ButtonSize.big:
                            _AddClass += " layui-btn-lg";
                            break;

                        default:
                            _AddClass += " layui-btn-sm";
                            break;
                        }
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-btn" + _AddClass + (this.Radius ? " layui-btn-radius" : ""));
                        writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_" + _value.Value2);
                        if (string.IsNullOrEmpty(this.OnClientClick))
                        {
                            writer.AddAttribute("onclick", "JointLibrary.fnButtonClick('" + _value.Value2 + "', '" + _value.Value1 + "');return false;");
                        }
                        else
                        {
                            writer.AddAttribute("onclick", this.OnClientClick);
                        }
                        writer.RenderBeginTag(HtmlTextWriterTag.Button);

                        if (!string.IsNullOrEmpty(_value.Value3))
                        {
                            writer.Write("<i class=\"layui-icon " + _value.Value3 + " \"></i>");
                        }
                        writer.Write(_value.Value1);
                        writer.RenderEndTag();
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "dropdown-toggle layui-btn" + _AddClass + (this.Radius ? " layui-btn-radius" : ""));
                        //writer.AddAttribute("data-toggle", "dropdown");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "0px 0px");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "26px");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.MarginLeft, "0px");
                        writer.AddAttribute("onclick", "$(this).next().toggle();return false;");
                        writer.RenderBeginTag(HtmlTextWriterTag.Button);
                        writer.Write("<span class=\"caret\"></span>");
                        writer.RenderEndTag();

                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "dropdown-menu");
                        writer.RenderBeginTag(HtmlTextWriterTag.Ul);
                    }
                    else
                    {
                        writer.RenderBeginTag(HtmlTextWriterTag.Li);
                        if (!string.IsNullOrEmpty(_value.Value2))
                        {
                            writer.AddAttribute("onclick", "JointLibrary.fnButtonClick('" + _value.Value2 + "', '" + _value.Value1 + "');return false;");
                        }
                        writer.RenderBeginTag(HtmlTextWriterTag.A);

                        if (!string.IsNullOrEmpty(_value.Value3))
                        {
                            writer.Write("<i class=\"layui-icon " + _value.Value3 + " \"></i>");
                        }
                        writer.Write(_value.Value1);
                        writer.RenderEndTag();
                        writer.RenderEndTag();
                    }
                }
                writer.RenderEndTag();
            }
            writer.RenderEndTag();
        }
Example #42
0
        /// <summary>
        /// Writes the <see cref="T:System.Web.UI.WebControls.CompositeControl" /> content to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object, for display on the client.
        /// </summary>
        /// <param name="writer">An <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            if (!Expanded)
            {
                foreach (WorkflowActionTypeEditor workflowActionTypeEditor in this.Controls.OfType <WorkflowActionTypeEditor>())
                {
                    if (workflowActionTypeEditor.Expanded)
                    {
                        Expanded = true;
                        break;
                    }
                }
            }

            string inactiveCss = _cbActivityTypeIsActive.Checked ? string.Empty : " workflow-activity-inactive";
            string activatedWithWorkflowCss = _cbActivityTypeIsActivatedWithWorkflow.Checked ? " activated-with-workflow" : string.Empty;

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel panel-widget workflow-activity" + inactiveCss + activatedWithWorkflowCss);

            writer.AddAttribute("data-key", _hfActivityTypeGuid.Value);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ID + "_section");
            writer.RenderBeginTag("section");

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-heading clearfix clickable");
            writer.RenderBeginTag("header");

            // Hidden Field to track expansion
            _hfExpanded.RenderControl(writer);

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

            writer.AddAttribute("class", "panel-title");
            writer.RenderBeginTag(HtmlTextWriterTag.H3);
            _lblActivityTypeName.Text = _tbActivityTypeName.Text;
            _lblActivityTypeName.RenderControl(writer);

            // H3 tag
            writer.RenderEndTag();
            _lblActivityTypeDescription.Text = _tbActivityTypeDescription.Text;
            _lblActivityTypeDescription.RenderControl(writer);

            // Name/Description div
            writer.RenderEndTag();

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

            if (_sbSecurity.EntityId != 0)
            {
                writer.WriteLine(string.Format("<span class=\"label label-default\">Id: {0}</span>", _sbSecurity.EntityId));
            }
            writer.WriteLine("<a class='btn btn-xs btn-link workflow-activity-reorder'><i class='fa fa-bars'></i></a>");
            writer.WriteLine(string.Format("<a class='btn btn-xs btn-link'><i class='workflow-activity-state fa {0}'></i></a>",
                                           Expanded ? "fa fa-chevron-up" : "fa fa-chevron-down"));

            if (IsDeleteEnabled)
            {
                _lbDeleteActivityType.Visible = true;
                _lbDeleteActivityType.RenderControl(writer);
            }
            else
            {
                _lbDeleteActivityType.Visible = false;
            }

            // Add/ChevronUpDown/Delete div
            writer.RenderEndTag();

            _lblInactive.Style[HtmlTextWriterStyle.Display] = _cbActivityTypeIsActive.Checked ? "none" : string.Empty;
            _lblInactive.RenderControl(writer);

            // header div
            writer.RenderEndTag();

            if (!Expanded)
            {
                // hide details if the activity and actions are valid
                writer.AddStyleAttribute("display", "none");
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // activity edit fields
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _tbActivityTypeName.ValidationGroup = ValidationGroup;
            _tbActivityTypeName.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-2");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _cbActivityTypeIsActive.ValidationGroup = ValidationGroup;
            _cbActivityTypeIsActive.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-4");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            if (_sbSecurity.EntityId > 0)
            {
                _sbSecurity.Title = _tbActivityTypeName.Text;
                _sbSecurity.RenderControl(writer);
            }

            _cbActivityTypeIsActivatedWithWorkflow.ValidationGroup = ValidationGroup;
            _cbActivityTypeIsActivatedWithWorkflow.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();

            _tbActivityTypeDescription.ValidationGroup = ValidationGroup;
            _tbActivityTypeDescription.RenderControl(writer);

            _pwAttributes.RenderControl(writer);

            // actions
            writer.RenderBeginTag("fieldset");

            writer.RenderBeginTag("legend");
            writer.WriteLine("Actions");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "pull-right");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            _lbAddActionType.RenderControl(writer);
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "workflow-action-list");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            foreach (WorkflowActionTypeEditor workflowActionTypeEditor in this.Controls.OfType <WorkflowActionTypeEditor>())
            {
                workflowActionTypeEditor.ValidationGroup = ValidationGroup;
                workflowActionTypeEditor.RenderControl(writer);
            }

            // workflow-action-list div
            writer.RenderEndTag();

            // actions fieldset
            writer.RenderEndTag();

            // widget-content div
            writer.RenderEndTag();

            // section tag
            writer.RenderEndTag();
        }
Example #43
0
        /// <summary>
        /// Renders the base control.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public void RenderBaseControl(HtmlTextWriter writer)
        {
            RegisterJavaScript();

            // controls div
            writer.AddAttribute("class", "controls");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            _hfGeoDisplayName.RenderControl(writer);
            _hfGeoPath.RenderControl(writer);

            if (this.Enabled)
            {
                writer.AddAttribute("id", this.ClientID.ToString());
                writer.AddAttribute("class", "picker picker-geography rollover-container");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.Write(string.Format(@"
                    <a class='picker-label' href='#'>
                        <i class='fa fa-map-marker'></i>
                        <span id='selectedGeographyLabel_{0}'>{1}</span>
                        <b class='fa fa-caret-down pull-right'></b>
                    </a>", this.ClientID, this.GeoDisplayName));
                writer.WriteLine();

                _btnSelectNone.RenderControl(writer);

                // picker menu
                writer.AddAttribute("class", "picker-menu dropdown-menu");
                if (ShowDropDown)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "block");
                }

                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                // mode panel
                if (ModePanel != null)
                {
                    ModePanel.RenderControl(writer);
                }

                // map
                writer.Write(@"
                    <h4>Geography Picker <a class='pull-right btn btn-link btn-minimal' title='Toggle Fullscreen' id='btnExpandToggle_{0}'><i class='fa fa-expand'></i></a></h4>
                    <!-- Our custom delete button that we add to the map for deleting polygons. -->
                    <div style='display:none; z-index: 10; position: absolute; left: 200px; margin-top: 5px; line-height:0;' id='gmnoprint-delete-button_{0}'>
                        <div onmouseover=""this.style.background='WhiteSmoke';"" onmouseout=""this.style.background='white';""style='direction: ltr; overflow: hidden; text-align: left; position: relative; color: rgb(140, 75, 75); font-family: Arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); padding: 4px; border-radius: 2px; -webkit-background-clip: padding-box; background-clip: padding-box; -webkit-box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; font-weight: 500; background-position: initial initial; background-repeat: initial initial;' title='Delete selected shape'>
                            <span style='display: inline-block;'><div style='width: 16px; height: 16px; overflow: hidden; position: relative;'><i class='fa fa-times' style='font-size: 16px; padding-left: 2px; color: #aaa;'></i></div></span>
                        </div>
                    </div>
                    <!-- This is where the Google Map (with Drawing Tools) will go. -->
                    <div id='geoPicker_{0}' style='height: 300px; width: 500px' ></div>", this.ClientID);
                writer.WriteLine();

                // picker actions
                writer.AddAttribute("class", "picker-actions");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _btnSelect.RenderControl(writer);
                writer.Write("<a class='btn btn-link btn-xs' id='btnCancel_{0}'>Cancel</a>", this.ClientID);
                writer.WriteLine();
                writer.RenderEndTag();

                // closing div of picker-menu
                writer.RenderEndTag();

                // closing div of picker
                writer.RenderEndTag();
            }
            else
            {
                // this picker is not enabled (readonly), so just render a readonly version
                writer.AddAttribute("class", "picker picker-select");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                LinkButton linkButton = new LinkButton();
                linkButton.CssClass = "picker-label";
                linkButton.Text     = string.Format("<i class='{1}'></i><span>{0}</span>", this.GeoDisplayName, "fa fa-map-marker");
                linkButton.Enabled  = false;
                linkButton.RenderControl(writer);
                writer.WriteLine();
                writer.RenderEndTag();
            }

            // controls div
            writer.RenderEndTag();
        }
        /// <summary>
        /// Generates a report containing details about all file hashes and related nodes in the provided archives.</summary>
        /// <returns>Returns the file path of the generated report if it was successfully created.</returns>
        public static async Task <string> GenerateFileCopyReport(List <Archive> exportArchiveList, string ReportPath)
        {
            // build a distinct list of all file hashes in the provided archives
            var exportHashes = new HashSet <FileHash>();

            foreach (var archive in exportArchiveList)
            {
                foreach (var hash in archive.GetFileHashes())
                {
                    exportHashes.Add(hash);
                }
            }

            using (var sw = new StringWriter())
            {
                using (var writer = new HtmlTextWriter(sw))
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Div); // div1

                    // Report header
                    writer.AddStyleAttribute(HtmlTextWriterStyle.MarginBottom, "5px");
                    writer.RenderBeginTag(HtmlTextWriterTag.H2);
                    await writer.WriteAsync("File Hash Report");

                    writer.RenderEndTag();

                    writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "grey");
                    writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "small");
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    await writer.WriteAsync("Generated: " + DateTime.Now);

                    writer.RenderEndTag();

                    writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "15");
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
                    writer.RenderBeginTag(HtmlTextWriterTag.Table); // table

                    // table header
                    writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold");
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "white");
                    writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "left");
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "dimgrey");
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                    writer.RenderBeginTag(HtmlTextWriterTag.Th);
                    await writer.WriteAsync("Checksum");

                    writer.RenderEndTag();

                    writer.RenderBeginTag(HtmlTextWriterTag.Th);
                    await writer.WriteAsync("Archive");

                    writer.RenderEndTag();

                    writer.RenderBeginTag(HtmlTextWriterTag.Th);
                    await writer.WriteAsync("Directory");

                    writer.RenderEndTag();

                    writer.RenderBeginTag(HtmlTextWriterTag.Th);
                    await writer.WriteAsync("Name");

                    writer.RenderEndTag();

                    writer.RenderBeginTag(HtmlTextWriterTag.Th);
                    await writer.WriteAsync("Extension");

                    writer.RenderEndTag();

                    writer.RenderEndTag(); // Tr

                    bool   evenLine        = true;
                    bool   evenFileLine    = true;
                    string currentChecksum = "";

                    // table content
                    foreach (var hash in exportHashes)
                    {
                        foreach (var node in hash.Nodes)
                        {
                            if (hash.Checksum != currentChecksum)
                            {
                                //Add some additional formatting whenever changing the current hash
                                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "solid none none none");
                                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "1px");
                                evenFileLine = evenLine; // make sure that the first line of each node has the same color as its hash
                            }

                            if (evenFileLine = !evenFileLine)
                            {
                                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "aliceblue");
                            }

                            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                            if (hash.Checksum != currentChecksum)
                            {
                                currentChecksum = hash.Checksum;
                                // new hash, add cell information
                                if (evenLine = !evenLine)
                                {
                                    writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "aliceblue");
                                }
                                else
                                {
                                    writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "white");
                                }

                                writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, hash.NodeCount.ToString());
                                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                                await writer.WriteAsync(hash.Checksum);

                                writer.RenderEndTag();
                            }

                            writer.RenderBeginTag(HtmlTextWriterTag.Td);
                            await writer.WriteAsync(node.Archive.Label);

                            writer.RenderEndTag();

                            writer.RenderBeginTag(HtmlTextWriterTag.Td);
                            await writer.WriteAsync(node.DirectoryName);

                            writer.RenderEndTag();

                            writer.RenderBeginTag(HtmlTextWriterTag.Td);
                            await writer.WriteAsync(node.Name);

                            writer.RenderEndTag();

                            writer.RenderBeginTag(HtmlTextWriterTag.Td);
                            await writer.WriteAsync(node.Extension);

                            writer.RenderEndTag();

                            writer.RenderEndTag(); // Tr
                        }
                    }

                    writer.RenderEndTag(); // table
                    writer.RenderEndTag(); // div1
                }
                //return sw.ToString();
                return(await WriteFileAsync(sw.ToString(), ReportPath));
            }
        }
Example #45
0
        protected override void Render(HtmlTextWriter output)
        {
            #region ======= 外层标记 - <SPAN>...</SPAN> =======

            string         height = this.Height.ToString() + "pt";
            LiteralControl lc     = new LiteralControl();
            lc.Text = "aaaa";
            this.CreateChildControls();

            this.Controls.Add(lc);

            // 外层标记 - <SPAN>...</SPAN>
            output.AddStyleAttribute(HtmlTextWriterStyle.Color, this.PagerFontColor);
            output.AddStyleAttribute(HtmlTextWriterStyle.FontFamily, this.PagerFontFamily);
            output.AddStyleAttribute(HtmlTextWriterStyle.FontSize, this.PagerFontSize);
            output.RenderBeginTag(HtmlTextWriterTag.Span);

            //当前页是否显示
            PageJump pageJump = this.PageJump;
            if (pageJump.CurrentPageVisiable == true)
            {
                writeHtml += this.PageIndex.ToString() + " / " + this.PageCount.ToString() + "&nbsp;页&nbsp;&nbsp;";
            }

            output.Write(writeHtml);

            #endregion

            #region ======= 首页 =======

            // 首页
            if (this.FirstPageDescription.Trim() != "" && this.FirstPageDescription != null && lbFirst != null && this.PageIndex > 1)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, "none");
                output.AddStyleAttribute(HtmlTextWriterStyle.Color, this.PagerFontColor);
                output.Write(this.PagerLeftText);
                lbFirst.RenderControl(output);
                output.Write(this.PagerRightText);
                output.Write("&nbsp;&nbsp;");
            }

            #endregion

            #region ======= 上一页 =======

            // 上一页
            if (this.FirstPageDescription.Trim() != "" && this.FirstPageDescription != null && lbPrevious != null && this.PageIndex > 1)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, "none");
                output.AddStyleAttribute(HtmlTextWriterStyle.Color, this.PagerFontColor);
                output.Write(this.PagerLeftText);
                lbPrevious.RenderControl(output);
                output.Write(this.PagerRightText);
                output.Write("&nbsp;&nbsp;");
            }

            #endregion

            #region ======= 前翻 =======

            // 如果是前 ShowPageNumberCount 页则不显示“前翻”
            if (this.PageUpDescription.Trim() != "" && this.PageUpDescription != null && lbPreBatch != null && this.PageIndex > this.ShowPageNumberCount)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, "none");
                output.AddStyleAttribute(HtmlTextWriterStyle.Color, this.PagerFontColor);
                output.Write(this.PagerLeftText);
                lbPreBatch.RenderControl(output);
                output.Write(this.PagerRightText);
                output.Write("&nbsp;&nbsp;");
            }

            #endregion

            #region ======= 数字页码 =======

            // 呈现页码部分
            this.RenderPageNumber(output);

            #endregion

            #region ======= 后翻 =======

            if (this.PageDownDescription.Trim() != "" && this.PageDownDescription != null && lbNextBatch != null && (this.PageCount >= (this.PageIndex + this.ShowPageNumberCount)))
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, "none");
                output.AddStyleAttribute(HtmlTextWriterStyle.Color, this.PagerFontColor);
                output.Write(this.PagerLeftText);
                lbNextBatch.RenderControl(output);
                output.Write(this.PagerRightText);
                output.Write("&nbsp;&nbsp;");
            }

            #endregion

            #region ======= 下一页 =======

            if (this.LastPageDescription.Trim() != "" && this.LastPageDescription != null && lbNext != null && this.PageIndex < this.PageCount)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, "none");
                output.AddStyleAttribute(HtmlTextWriterStyle.Color, this.PagerFontColor);
                output.Write(this.PagerLeftText);
                lbNext.RenderControl(output);
                output.Write(this.PagerRightText);
                output.Write("&nbsp;&nbsp;");
            }

            #endregion

            #region ======= 末页 =======

            // 末页
            if (this.LastPageDescription.Trim() != "" && this.LastPageDescription != null && lbLast != null && this.PageIndex < this.PageCount)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, "none");
                output.AddStyleAttribute(HtmlTextWriterStyle.Color, this.PagerFontColor);
                output.Write(this.PagerLeftText);
                lbLast.RenderControl(output);
                output.Write(this.PagerRightText);
                output.Write("&nbsp;&nbsp;");
            }

            #endregion

            #region ======= 索引跳转 =======

            // 呈现索引跳转
            this.RenderPageIndexContent(output);

            #endregion

            #region =======每页显示行数跳转=======
            // 呈现每页显示行数跳转
            this.RenderPageNumJump(output);
            #endregion =======每页显示行数跳转=======

            output.RenderEndTag();
        }
        public override void BuildDisplay(HtmlTextWriter writer, ViewContext viewContext, IWorkContextAccessor workContextAccessor)
        {
            if (SliderId == Guid.Empty)
            {
                return;
            }

            var workContext   = workContextAccessor.GetContext(viewContext.HttpContext);
            var sliderService = workContext.Resolve <ISliderService>();
            var slider        = sliderService.GetById(SliderId);

            if (slider == null)
            {
                return;
            }

            var slideService = workContext.Resolve <ISlideService>();
            var slides       = slideService.GetSlides(SliderId);

            if (slides.Count == 0)
            {
                return;
            }
            var urlHelper = workContext.Resolve <UrlHelper>();

            writer.Write("<div id=\"layerslider-{0}\" style=\"width: {1}px; height: {2}px;\">", Id, slider.Width, slider.Height);

            foreach (var slide in slides)
            {
                if (slide.SlideDelay.HasValue)
                {
                    writer.AddStyleAttribute("slidedelay", slide.SlideDelay.Value.ToString(CultureInfo.InvariantCulture));
                }
                if (!string.IsNullOrEmpty(slide.Transition2D))
                {
                    writer.AddStyleAttribute("transition2d", slide.Transition2D);
                }
                if (!string.IsNullOrEmpty(slide.Transition3D))
                {
                    writer.AddStyleAttribute("transition3d", slide.Transition3D);
                }
                writer.AddStyleAttribute("slidedirection", slide.SlideDirection);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "ls-layer");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                if (!string.IsNullOrEmpty(slide.BackgroundUrl))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "ls-bg");
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, urlHelper.Content(slide.BackgroundUrl));

                    if (!string.IsNullOrEmpty(slide.Title))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Alt, slide.Title);
                    }

                    if (!string.IsNullOrEmpty(slide.OnClick))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, slide.OnClick);
                    }

                    writer.RenderBeginTag(HtmlTextWriterTag.Img);
                    writer.RenderEndTag();
                }

                writer.Write(slide.Sublayers);

                writer.RenderEndTag();
            }

            writer.Write("</div>");

            var options = new JObject
            {
                // ReSharper disable Html.PathError
                { "skinsPath", urlHelper.Content("~/Styles/LayerSlider/Skins/") },
                // ReSharper restore Html.PathError
                { "responsive", true },
                { "navPrevNext", false },
                { "skin", Skin }
            };

            writer.WriteLine("<script type=\"text/javascript\">");
            writer.WriteLine("$(document).ready(function(){");
            writer.Write("$('#layerslider-{0}').layerSlider({1});", Id, options);
            writer.WriteLine("});");
            writer.Write("</script>");
        }
Example #47
0
        internal void Render(HtmlTextWriter writer)
        {
            var l = new List <string>(CssClasses);

            if (Expanded != true && ChildNodes.Count > 0)
            {
                l.Add("closed");
            }
            if (l.Count > 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, string.Join(" ", l.ToArray()));
            }
            if (!string.IsNullOrEmpty(ToolTip))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Title, ToolTip);
            }
            if (!string.IsNullOrEmpty(Value))
            {
                writer.AddAttribute("uid", Value);
            }
            if (Draggable)
            {
                writer.AddAttribute("drag", "true");
                writer.AddAttribute("unselectable", "on");
            }
            if (ShowCheckBox)
            {
                writer.AddAttribute("checked", Checked.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Li);
            if (!string.IsNullOrEmpty(ImageUrl))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, ImageUrl);
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag(); //img
            }
            //if (Draggable)
            //{
            //    writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
            //    writer.RenderBeginTag(HtmlTextWriterTag.A);
            //}

            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(Text);
            writer.RenderEndTag(); //span
            //if (Draggable)
            //    writer.RenderEndTag(); //a
            if (ChildNodes.Count > 0)
            {
                writer.AddStyleAttribute("list-style-type", "none");
                writer.RenderBeginTag(HtmlTextWriterTag.Ul);
                foreach (var n in ChildNodes)
                {
                    n.Render(writer);
                }
                writer.RenderEndTag(); //ul
            }
            writer.RenderEndTag();     //li


            //HtmlInputCheckBox cb = new HtmlInputCheckBox();
            //cb.Checked = m.Visible;

            //StringWriter cw = new StringWriter();
            //HtmlTextWriter writer = new HtmlTextWriter(cw);
            //cb.RenderControl(writer);
            //n.Text = cw.ToString() + n.Text;
        }
Example #48
0
        /// <summary>
        /// Writes the <see cref="T:System.Web.UI.WebControls.CompositeControl" /> content to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object, for display on the client.
        /// </summary>
        /// <param name="writer">An <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel panel-widget checkin-grouptype");
            writer.AddAttribute("data-key", _hfGroupTypeGuid.Value);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ID + "_section");
            writer.RenderBeginTag("section");

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-heading clearfix clickable");
            writer.RenderBeginTag("header");

            // Hidden Field to track expansion
            _hfExpanded.RenderControl(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "filter-toggle pull-left");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-title");
            writer.RenderBeginTag(HtmlTextWriterTag.H3);
            _lblGroupTypeName.Text = _tbGroupTypeName.Text;
            _lblGroupTypeName.RenderControl(writer);

            // H3 tag
            writer.RenderEndTag();

            // Name/Description div
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "pull-right panel-actions");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.WriteLine("<a class='btn btn-link btn-xs checkin-grouptype-reorder'><i class='fa fa-bars'></i></a>");
            writer.WriteLine(string.Format("<a class='btn btn-xs btn-link'><i class='checkin-grouptype-state fa {0}'></i></a>",
                                           Expanded ? "fa fa-chevron-up" : "fa fa-chevron-down"));

            if (IsDeleteEnabled)
            {
                _lbDeleteGroupType.Visible = true;
                _lbDeleteGroupType.RenderControl(writer);
            }
            else
            {
                _lbDeleteGroupType.Visible = false;
            }

            // Add/ChevronUpDown/Delete div
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "pull-right panel-actions btn-group");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            _lbAddCheckinGroupType.RenderControl(writer);
            writer.WriteLine();
            _lbAddCheckinGroup.RenderControl(writer);
            writer.WriteLine();

            writer.RenderEndTag();

            // header div
            writer.RenderEndTag();

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

            if (!Expanded)
            {
                writer.AddStyleAttribute("display", "none");
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // make two span6 columns: Left Column for Name and Attributes. Right Column for Labels Grid
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-sm-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // grouptype edit fields
            _tbGroupTypeName.RenderControl(writer);
            _ddlGroupTypeInheritFrom.RenderControl(writer);

            // attributes
            _phGroupTypeAttributes.RenderControl(writer);

            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-sm-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Check-in Labels grid
            writer.WriteLine("<h3>Check-in Labels</h3>");
            _gCheckinLabels.DataSource = this.CheckinLabels;
            _gCheckinLabels.DataBind();
            _gCheckinLabels.RenderControl(writer);

            // span6
            writer.RenderEndTag();

            // rowfluid
            writer.RenderEndTag();

            // groups
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "checkin-grouptype-list");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            foreach (CheckinGroupTypeEditor checkinGroupTypeEditor in this.Controls.OfType <CheckinGroupTypeEditor>())
            {
                checkinGroupTypeEditor.RenderControl(writer);
            }

            // checkin-grouptype-list div
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "checkin-group-list");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            foreach (CheckinGroupEditor checkinGroupEditor in this.Controls.OfType <CheckinGroupEditor>())
            {
                checkinGroupEditor.RenderControl(writer);
            }

            // checkin-group-list div
            writer.RenderEndTag();

            // widget-content div
            writer.RenderEndTag();

            // section tag
            writer.RenderEndTag();
        }
Example #49
0
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{
			/* if we're rendering uplevel, add our attributes */
			if (render_uplevel) {
				/* force an ID here if we weren't assigned one */
				if (ID == null)
					writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);

				if (ControlToValidate != String.Empty)
#if NET_2_0
					RegisterExpandoAttribute (ClientID, "controltovalidate", GetControlRenderID (ControlToValidate));
#else
					writer.AddAttribute ("controltovalidate", GetControlRenderID (ControlToValidate));
#endif

				if (ErrorMessage != String.Empty)
#if NET_2_0
					RegisterExpandoAttribute (ClientID, "errormessage", ErrorMessage, true);
#else
					writer.AddAttribute ("errormessage", ErrorMessage);

				if (Text != String.Empty)
					writer.AddAttribute ("text", Text);
#endif

#if NET_2_0
				if (ValidationGroup != String.Empty)
					RegisterExpandoAttribute (ClientID, "validationGroup", ValidationGroup, true);

				if (SetFocusOnError)
					RegisterExpandoAttribute (ClientID, "focusOnError", "t");
#endif
				if (!IsEnabled)
#if NET_2_0
					RegisterExpandoAttribute (ClientID, "enabled", "False");
#else
					writer.AddAttribute ("enabled", "false", false);
#endif

#if NET_2_0
				if (IsEnabled && !IsValid) {
					RegisterExpandoAttribute (ClientID, "isvalid", "False");
#else
				if (!IsValid) {
					writer.AddAttribute ("isvalid", "false", false);
#endif
				}
				else {
					if (Display == ValidatorDisplay.Static)
						writer.AddStyleAttribute ("visibility", "hidden");
					else
						writer.AddStyleAttribute ("display", "none");
				}

				if (Display != ValidatorDisplay.Static)
#if NET_2_0
					RegisterExpandoAttribute (ClientID, "display", Display.ToString ());
#else
					writer.AddAttribute ("display", Display.ToString());
#endif
			}

			base.AddAttributesToRender (writer);
		}

#if NET_2_0
		internal void RegisterExpandoAttribute (string controlId, string attributeName, string attributeValue) {
			RegisterExpandoAttribute (controlId, attributeName, attributeValue, false);
		}