--- /dev/null
+//
+// System.Web.UI.WebControls.AdCreatedEventHandler
+//
+// Author:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI.WebControls {
+ public delegate void AdCreatedEventHandler (object sender, AdCreatedEventArgs e);
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.AdRotator
+//
+// Author:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Xml;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+ [DefaultEvent("AdCreated")]
+ [DefaultProperty("AdvertisementFile")]
+ [Designer("System.Web.UI.Design.WebControls.AdRotatorDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+#if NET_2_0
+ [ToolboxData("<{0}:AdRotator runat=\"server\"></{0}:AdRotator>")]
+#else
+ [ToolboxData("<{0}:AdRotator runat=\"server\" Height=\"60px\" Width=\"468px\"></{0}:AdRotator>")]
+#endif
+ public class AdRotator :
+#if NET_2_0
+ DataBoundControl
+#else
+ WebControl
+#endif
+ {
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+
+#if NET_2_0
+ [MonoTODO]
+ protected internal override void OnInit (EventArgs e)
+ {
+ base.OnInit(e);
+ }
+#endif
+
+#if NET_2_0
+ protected internal
+#else
+ protected
+#endif
+ override void OnPreRender (EventArgs eee)
+ {
+ Hashtable ht = null;
+
+ if (ad_file != "" && ad_file != null) {
+ ReadAdsFromFile (Page.MapPath (ad_file));
+ ht = ChooseAd ();
+ }
+
+ AdCreatedEventArgs e = new AdCreatedEventArgs (ht);
+ OnAdCreated (e);
+ createdargs = e;
+
+ }
+
+#if NET_2_0
+ [MonoTODO]
+ protected internal override void PerformDataBinding (IEnumerable data)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void PerformSelect ()
+ {
+ throw new NotImplementedException ();
+ }
+#endif
+
+ AdCreatedEventArgs createdargs;
+
+#if NET_2_0
+ protected internal
+#else
+ protected
+#endif
+ override void Render (HtmlTextWriter w)
+ {
+ AdCreatedEventArgs e = createdargs;
+
+ base.AddAttributesToRender (w);
+
+ if (e.NavigateUrl != null)
+ w.AddAttribute (HtmlTextWriterAttribute.Href, ResolveUrl (e.NavigateUrl));
+ w.AddAttribute (HtmlTextWriterAttribute.Target, Target);
+
+ w.RenderBeginTag (HtmlTextWriterTag.A);
+
+ if (e.NavigateUrl != null)
+ w.AddAttribute (HtmlTextWriterAttribute.Src, ResolveUrl (e.ImageUrl));
+
+ w.AddAttribute (HtmlTextWriterAttribute.Alt, e.AlternateText == null ? "" : e.AlternateText);
+ w.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+ w.RenderBeginTag (HtmlTextWriterTag.Img);
+ w.RenderEndTag (); // img
+ w.RenderEndTag (); // a
+ }
+
+ //
+ // We take all the ads in the ad file and add up their
+ // impression weight. We then take a random number [0,
+ // TotalImpressions). We then choose the ad that is
+ // that number or less impressions for the beginning
+ // of the file. This lets us respect the weights
+ // given.
+ //
+ Hashtable ChooseAd ()
+ {
+ // cache for performance
+ string KeywordFilter = this.KeywordFilter;
+
+ int total_imp = 0;
+ int cur_imp = 0;
+
+ foreach (Hashtable a in ads) {
+ if (KeywordFilter == "" || KeywordFilter == (string) a ["Keyword"])
+ total_imp += a ["Impressions"] != null ? int.Parse ((string) a ["Impressions"]) : 1;
+ }
+
+ int r = new Random ().Next (total_imp);
+
+ foreach (Hashtable a in ads) {
+ if (KeywordFilter != "" && KeywordFilter != (string) a ["Keyword"])
+ continue;
+ cur_imp += a ["Impressions"] != null ? int.Parse ((string) a ["Impressions"]) : 1;
+
+ if (cur_imp > r)
+ return a;
+ }
+
+ if (total_imp != 0)
+ throw new Exception ("I should only get here if no ads matched");
+
+ return null;
+ }
+
+ ArrayList ads = new ArrayList ();
+
+ void ReadAdsFromFile (string s)
+ {
+ XmlDocument d = new XmlDocument ();
+ try {
+ d.Load (s);
+ } catch (Exception e) {
+ throw new HttpException ("AdRotator could not parse the xml file", e);
+ }
+
+ ads.Clear ();
+
+ foreach (XmlNode n in d.DocumentElement.ChildNodes) {
+
+ Hashtable ad = new Hashtable ();
+
+ foreach (XmlNode nn in n.ChildNodes)
+ ad.Add (nn.Name, nn.InnerText);
+
+ ads.Add (ad);
+ }
+ }
+
+ string ad_file = "";
+
+#if NET_2_0
+ [UrlProperty]
+#endif
+ [Bindable(true)]
+ [DefaultValue("")]
+ [Editor("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ public string AdvertisementFile {
+ get {
+ return ad_file;
+ }
+ set {
+ ad_file = value;
+ }
+
+ }
+
+#if NET_2_0
+ [DefaultValue ("AlternateText")]
+ [MonoTODO]
+ public string AlternateTextField
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+#endif
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override FontInfo Font {
+ get {
+ return base.Font;
+ }
+ }
+
+#if NET_2_0
+ [DefaultValue ("ImageUrl")]
+ [MonoTODO]
+ public string ImageUrlField
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+#endif
+
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ public string KeywordFilter {
+ get {
+ return ViewState.GetString ("KeywordFilter", "");
+ }
+ set {
+ ViewState ["KeywordFilter"] = value;
+ }
+
+ }
+
+#if NET_2_0
+ [DefaultValue ("NavigateUrl")]
+ [MonoTODO]
+ public string NavigateUrlField
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ /* listed in corcompare */
+ [MonoTODO]
+ public override Page Page
+ {
+ get {
+ return base.Page;
+ }
+ set {
+ base.Page = value;
+ }
+ }
+#endif
+
+ [Bindable(true)]
+ [DefaultValue("_top")]
+ [TypeConverter(typeof(System.Web.UI.WebControls.TargetConverter))]
+ public string Target {
+ get {
+ return ViewState.GetString ("Target", "_top");
+ }
+ set {
+ ViewState ["Target"] = value;
+ }
+
+ }
+
+#if NET_2_0
+ /* all these are listed in corcompare */
+ [MonoTODO]
+ public override string UniqueID
+ {
+ get {
+ return base.UniqueID;
+ }
+ }
+
+ [MonoTODO]
+ protected override HtmlTextWriterTag TagKey
+ {
+ get {
+ return base.TagKey;
+ }
+ }
+
+ [MonoTODO]
+ protected override StateBag ViewState
+ {
+ get {
+ return base.ViewState;
+ }
+ }
+#endif
+
+ protected virtual void OnAdCreated (AdCreatedEventArgs e)
+ {
+ AdCreatedEventHandler h = (AdCreatedEventHandler) Events [AdCreatedEvent];
+ if (h != null)
+ h (this, e);
+ }
+ static readonly object AdCreatedEvent = new object ();
+ public event AdCreatedEventHandler AdCreated {
+ add { Events.AddHandler (AdCreatedEvent, value); }
+ remove { Events.RemoveHandler (AdCreatedEvent, value); }
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.DataGridColumnCollection
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+ public sealed class DataGridColumnCollection : ICollection, IStateManager {
+ public DataGridColumnCollection (DataGrid owner, ArrayList columns)
+ {
+ this.owner = owner;
+ this.columns = columns;
+ }
+
+
+ public void Add (DataGridColumn column)
+ {
+ columns.Add (column);
+ column.Set_Owner (owner);
+ }
+
+ public void AddAt (int index, DataGridColumn column)
+ {
+ columns.Insert (index, column);
+ column.Set_Owner (owner);
+ }
+
+ public void Clear ()
+ {
+ columns.Clear ();
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ columns.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return columns.GetEnumerator ();
+ }
+
+ public int IndexOf (DataGridColumn column)
+ {
+ return columns.IndexOf (column);
+ }
+
+ [Obsolete ("figure out what you need with me")]
+ internal void OnColumnsChanged ()
+ {
+ // Do something
+ }
+
+ public void Remove (DataGridColumn column)
+ {
+ columns.Remove (column);
+ }
+
+ public void RemoveAt (int index)
+ {
+ columns.RemoveAt (index);
+ }
+
+ void System.Web.UI.IStateManager.LoadViewState (object savedState)
+ {
+ object [] o = (object []) savedState;
+ if (o == null)
+ return;
+
+ int i = 0;
+ foreach (IStateManager ism in this)
+ ism.LoadViewState (o [i++]);
+ }
+
+ object System.Web.UI.IStateManager.SaveViewState ()
+ {
+ object [] o = new object [Count];
+
+ int i = 0;
+ foreach (IStateManager ism in this)
+ o [i++] = ism.SaveViewState ();
+
+ foreach (object a in o)
+ if (a != null)
+ return o;
+ return null;
+ }
+
+ void System.Web.UI.IStateManager.TrackViewState ()
+ {
+ track = true;
+ foreach (IStateManager ism in this)
+ ism.TrackViewState ();
+ }
+
+ [Browsable(false)]
+ public int Count {
+ get { return columns.Count; }
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return track; }
+ }
+
+ [Browsable(false)]
+ public bool IsReadOnly {
+ get { return columns.IsReadOnly; }
+ }
+
+ [Browsable(false)]
+ public bool IsSynchronized {
+ get { return columns.IsSynchronized; }
+ }
+
+ [Browsable(false)]
+ public DataGridColumn this [int index] {
+ get { return (DataGridColumn) columns [index]; }
+ }
+
+ [Browsable(false)]
+ public object SyncRoot {
+ get { return columns.SyncRoot; }
+ }
+
+ DataGrid owner;
+ ArrayList columns;
+ bool track;
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.Label.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// TODO: Are we missing something in LoadViewState?
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.ComponentModel;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls {
+ [ControlBuilder(typeof(HyperLinkControlBuilder))]
+ [DataBindingHandler("System.Web.UI.Design.HyperLinkDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ [ParseChildren (false)]
+#if NET_2_0
+ [ToolboxData("<{0}:HyperLink runat=\"server\">HyperLink</{0}:HyperLink>")]
+#else
+ [ToolboxData("<{0}:HyperLink runat=server>HyperLink</{0}:HyperLink>")]
+#endif
+ [DefaultProperty("Text")]
+ [Designer("System.Web.UI.Design.WebControls.HyperLinkDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class HyperLink : WebControl {
+
+ public HyperLink () : base (HtmlTextWriterTag.A)
+ {
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter w)
+ {
+ base.AddAttributesToRender (w);
+ // add attributes - only if they're not empty
+ string s = NavigateUrl;
+ if (s.Length > 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Href, ResolveUrl (s));
+ s = Target;
+ if (s.Length > 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Target, s);
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if (HasControls ()) {
+ base.AddParsedSubObject (obj);
+ return;
+ }
+
+ LiteralControl lc = obj as LiteralControl;
+
+ if (lc == null) {
+ string s = Text;
+ if (s.Length != 0) {
+ Text = null;
+ Controls.Add (new LiteralControl (s));
+ }
+ base.AddParsedSubObject (obj);
+ } else {
+ Text = lc.Text;
+ }
+ }
+
+
+ [MonoTODO ("Why override?")]
+ protected override void LoadViewState (object savedState)
+ {
+ base.LoadViewState (savedState);
+ }
+
+#if NET_2_0
+ protected internal
+#else
+ protected
+#endif
+ override void RenderContents (HtmlTextWriter w)
+ {
+ if (HasControls ())
+ base.RenderContents (w);
+ else if (ImageUrl != "") {
+ w.AddAttribute (HtmlTextWriterAttribute.Src, ResolveUrl (ImageUrl));
+#if NET_2_0
+ string s = Text;
+ if (s.Length > 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Alt, s);
+ w.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0px");
+#else
+ w.AddAttribute (HtmlTextWriterAttribute.Alt, Text);
+ w.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+#endif
+ w.RenderBeginTag (HtmlTextWriterTag.Img);
+ w.RenderEndTag ();
+ } else {
+ w.Write (Text);
+ }
+
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [Editor("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+#if NET_2_0
+ [UrlProperty]
+#endif
+ public virtual string ImageUrl {
+ get {
+ return ViewState.GetString ("ImageUrl", "");
+ }
+ set {
+ ViewState ["ImageUrl"] = value;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [Editor("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+#if NET_2_0
+ [UrlProperty]
+#endif
+ public string NavigateUrl {
+ get {
+ return ViewState.GetString ("NavigateUrl", "");
+ }
+ set {
+ ViewState ["NavigateUrl"] = value;
+ }
+ }
+
+#if ONLY_1_1
+ [Bindable(true)]
+#endif
+ [DefaultValue("")]
+ [TypeConverter(typeof(System.Web.UI.WebControls.TargetConverter))]
+ public string Target {
+ get {
+ return ViewState.GetString ("Target", "");
+ }
+ set {
+ ViewState ["Target"] = value;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [PersistenceMode(PersistenceMode.InnerDefaultProperty)]
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ public virtual string Text {
+ get {
+ return ViewState.GetString ("Text", "");
+ }
+ set {
+ ViewState ["Text"] = value;
+ if (HasControls ())
+ Controls.Clear ();
+ }
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.HyperLinkControlBuilder
+//
+// Authors:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI.WebControls {
+ public class HyperLinkControlBuilder : ControlBuilder {
+ public override bool AllowWhitespaceLiterals ()
+ {
+ return false;
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.IRepeatInfoUser
+//
+// Author:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI.WebControls {
+
+ public interface IRepeatInfoUser {
+
+ Style GetItemStyle (ListItemType itemType, int repeatIndex);
+ void RenderItem (WebControls.ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer);
+
+ bool HasFooter {
+ get;
+ }
+ bool HasHeader {
+ get;
+ }
+ bool HasSeparators {
+ get;
+ }
+ int RepeatedItemCount {
+ get;
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.LabelControlBuilder
+//
+// Authors:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI.WebControls {
+ public class LabelControlBuilder : ControlBuilder {
+ public override bool AllowWhitespaceLiterals ()
+ {
+ return false;
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.LinkButton.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+ [ControlBuilder(typeof(LinkButtonControlBuilder))]
+ [DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ [DefaultEvent("Click")]
+ [DefaultProperty("Text")]
+ [Designer("System.Web.UI.Design.WebControls.LinkButtonDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [ParseChildren(false)]
+#if NET_2_0
+ [ToolboxData("<{0}:LinkButton runat=\"server\">LinkButton</{0}:LinkButton>")]
+#else
+ [ToolboxData("<{0}:LinkButton runat=server>LinkButton</{0}:LinkButton>")]
+#endif
+ public class LinkButton : WebControl, IPostBackEventHandler
+#if NET_2_0
+ , IButtonControl
+#endif
+ {
+
+ public LinkButton () : base (HtmlTextWriterTag.A)
+ {
+ }
+
+
+ protected override void AddAttributesToRender (HtmlTextWriter w)
+ {
+ if (Page != null)
+ Page.VerifyRenderingInServerForm (this);
+
+ base.AddAttributesToRender (w);
+ if (Page == null)
+ return;
+
+ if (CausesValidation && Page.AreValidatorsUplevel ()) {
+ ClientScriptManager csm = new ClientScriptManager (Page);
+ w.AddAttribute (HtmlTextWriterAttribute.Href,
+ String.Format ("javascript:{{if (typeof(Page_ClientValidate) != 'function' || Page_ClientValidate()) {0};}}",
+ csm.GetPostBackEventReference (this, String.Empty)));
+ w.AddAttribute ("language", "javascript");
+ } else {
+ w.AddAttribute (HtmlTextWriterAttribute.Href, Page.GetPostBackClientHyperlink (this, ""));
+ }
+ }
+
+#if NET_2_0
+ [MonoTODO]
+ protected virtual void RaisePostBackEvent (string eventArgument)
+ {
+ throw new NotImplementedException ();
+ }
+#endif
+
+ void IPostBackEventHandler.RaisePostBackEvent (string ea)
+ {
+ if (CausesValidation)
+#if NET_2_0
+ Page.Validate (ValidationGroup);
+#else
+ Page.Validate ();
+#endif
+
+ OnClick (EventArgs.Empty);
+ OnCommand (new CommandEventArgs (CommandName, CommandArgument));
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if (HasControls ()) {
+ base.AddParsedSubObject (obj);
+ return;
+ }
+
+ LiteralControl lc = obj as LiteralControl;
+
+ if (lc == null) {
+ string s = Text;
+ if (s.Length != 0) {
+ Text = null;
+ Controls.Add (new LiteralControl (s));
+ }
+ base.AddParsedSubObject (obj);
+ } else {
+ Text = lc.Text;
+ }
+ }
+
+#if NET_2_0
+ [MonoTODO]
+ protected virtual PostBackOptions GetPostBackOptions ()
+ {
+ throw new NotImplementedException ();
+ }
+#endif
+
+ protected override void LoadViewState (object savedState)
+ {
+ base.LoadViewState (savedState);
+
+ // Make sure we clear child controls when this happens
+ if (ViewState ["Text"] != null)
+ Text = (string) ViewState ["Text"];
+ }
+
+ [MonoTODO ("Why override?")]
+#if NET_2_0
+ protected internal
+#else
+ protected
+#endif
+ override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ }
+
+#if NET_2_0
+ protected internal
+#else
+ protected
+#endif
+ override void RenderContents (HtmlTextWriter writer)
+ {
+ if (HasControls ())
+ base.RenderContents (writer);
+ else
+ writer.Write (Text);
+ }
+
+
+#if ONLY_1_1
+ [Bindable(false)]
+#endif
+ [DefaultValue(true)]
+#if NET_2_0
+ [Themeable (false)]
+ public virtual
+#else
+ public
+#endif
+ bool CausesValidation {
+ get {
+ return ViewState.GetBool ("CausesValidation", true);
+ }
+ set {
+ ViewState ["CausesValidation"] = value;
+ }
+
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+#if NET_2_0
+ [Themeable (false)]
+ public virtual
+#else
+ public
+#endif
+ string CommandArgument {
+ get {
+ return ViewState.GetString ("CommandArgument", "");
+ }
+ set {
+ ViewState ["CommandArgument"] = value;
+ }
+ }
+
+ [DefaultValue("")]
+#if NET_2_0
+ [Themeable (false)]
+ public virtual
+#else
+ public
+#endif
+ string CommandName {
+ get {
+ return ViewState.GetString ("CommandName", "");
+ }
+
+ set {
+ ViewState ["CommandName"] = value;
+ }
+
+ }
+
+#if NET_2_0
+ [DefaultValue ("")]
+ [Themeable (false)]
+ [MonoTODO]
+ public virtual string OnClientClick
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+#endif
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [PersistenceMode(PersistenceMode.InnerDefaultProperty)]
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ public virtual string Text {
+ get {
+ return ViewState.GetString ("Text", "");
+ }
+ set {
+ ViewState ["Text"] = value;
+ if (HasControls ())
+ Controls.Clear ();
+ }
+ }
+
+ protected virtual void OnClick (EventArgs e)
+ {
+ EventHandler h = (EventHandler) Events [ClickEvent];
+ if (h != null)
+ h (this, e);
+ }
+ static readonly object ClickEvent = new object ();
+ public event EventHandler Click {
+ add { Events.AddHandler (ClickEvent, value); }
+ remove { Events.RemoveHandler (ClickEvent, value); }
+ }
+
+ protected virtual void OnCommand (CommandEventArgs e)
+ {
+ CommandEventHandler h = (CommandEventHandler) Events [CommandEvent];
+ if (h != null)
+ h (this, e);
+
+ RaiseBubbleEvent (this, e);
+ }
+ static readonly object CommandEvent = new object ();
+ public event CommandEventHandler Command {
+ add { Events.AddHandler (CommandEvent, value); }
+ remove { Events.RemoveHandler (CommandEvent, value); }
+ }
+#if NET_2_0
+ [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+ [Themeable (false)]
+ [UrlProperty ("*.aspx")]
+ [DefaultValue ("")]
+ [MonoTODO]
+ public string PostBackUrl {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [DefaultValue ("")]
+ [Themeable (false)]
+ public string ValidationGroup {
+ get {
+ return ViewState.GetString ("ValidationGroup", "");
+ }
+ set {
+ ViewState ["ValidationGroup"] = value;
+ }
+ }
+#endif
+ }
+}
+
--- /dev/null
+//
+// System.Web.UI.WebControls.LinkButtonControlBuilder
+//
+// Authors:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI.WebControls {
+ public class LinkButtonControlBuilder : ControlBuilder {
+ public override bool AllowWhitespaceLiterals ()
+ {
+ return false;
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.ListItem.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls {
+ [ControlBuilder(typeof(ListItemControlBuilder))]
+ [TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
+ public sealed class ListItem : IAttributeAccessor, IParserAccessor, IStateManager {
+
+ public ListItem (string text, string value)
+ {
+ Text = text;
+ Value = value;
+ }
+
+ public ListItem (string text) : this (text, null)
+ {
+ }
+
+ public ListItem () : this (null, null)
+ {
+ }
+
+ public static ListItem FromString (string text)
+ {
+ return new ListItem (text);
+ }
+
+ public override bool Equals (object o)
+ {
+ ListItem li = o as ListItem;
+ if (li == null)
+ return false;
+ return li.Text == Text && li.Value == Value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return Text.GetHashCode () ^ Value.GetHashCode ();
+
+ }
+
+ string IAttributeAccessor.GetAttribute (string key)
+ {
+ if (attrs == null)
+ return null;
+
+ return (string) Attributes [key];
+ }
+
+ void IAttributeAccessor.SetAttribute (string key, string value)
+ {
+ Attributes [key] = value;
+ }
+
+ void IParserAccessor.AddParsedSubObject (object obj)
+ {
+ LiteralControl lc = obj as LiteralControl;
+ if (lc != null)
+ Text = lc.Text;
+ }
+
+ void IStateManager.LoadViewState (object state)
+ {
+ LoadViewState (state);
+ }
+
+ internal void LoadViewState (object state)
+ {
+ Triplet t = (Triplet) state;
+ if (!(t.First is bool))
+ text = (string) t.First;
+ if (!(t.Second is bool))
+ value = (string) t.Second;
+ sb = (StateBag) t.Third;
+ }
+
+
+ object IStateManager.SaveViewState ()
+ {
+ return SaveViewState ();
+ }
+
+ internal object SaveViewState ()
+ {
+ Triplet t = new Triplet ();
+ t.First = text_dirty ? (object) text : (object) false;
+ t.Second = value_dirty ? (object) value : (object) false;
+ t.Third = sb;
+ return t;
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ TrackViewState ();
+ }
+
+ internal void TrackViewState ()
+ {
+ tracking = true;
+ }
+
+
+ public override string ToString ()
+ {
+ return Text;
+ }
+
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public AttributeCollection Attributes {
+ get {
+ if (attrs != null)
+ return attrs;
+
+ if (sb == null) {
+ sb = new StateBag (true);
+ if (tracking)
+ sb.TrackViewState ();
+ }
+
+ return attrs = new AttributeCollection (sb);
+ }
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get {
+ return tracking;
+ }
+
+ }
+
+ [DefaultValue(false)]
+ public bool Selected {
+ get {
+ return selected;
+ }
+
+ set {
+ selected = value;
+ }
+ }
+
+ [DefaultValue("")]
+ [PersistenceMode(PersistenceMode.EncodedInnerDefaultProperty)]
+ public string Text {
+ get {
+ string r = text;
+ if (r == null)
+ r = value;
+ if (r == null)
+ r = "";
+ return r;
+ }
+
+ set {
+ text = value;
+ text_dirty |= tracking;
+ }
+ }
+
+ [DefaultValue("")]
+ public string Value {
+ get {
+ string r = value;
+ if (r == null)
+ r = text;
+ if (r == null)
+ r = "";
+ return r;
+ }
+
+ set {
+ this.value = value;
+ value_dirty |= tracking;
+ }
+ }
+
+
+ internal bool Dirty {
+ get {
+ return value_dirty || text_dirty;
+ }
+
+ set {
+ value_dirty = text_dirty = value;
+ }
+ }
+
+ string text;
+ string value;
+ bool selected;
+ bool tracking;
+ bool text_dirty;
+ bool value_dirty;
+ StateBag sb;
+ AttributeCollection attrs;
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.ListItemControlBuilder
+//
+// Authors:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI.WebControls {
+ public class ListItemControlBuilder : ControlBuilder {
+ public override bool AllowWhitespaceLiterals ()
+ {
+ return false;
+ }
+
+ public override bool HtmlDecodeLiterals ()
+ {
+ return true;
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.LiteralControlBuilder
+//
+// Authors:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI.WebControls {
+ public class LiteralControlBuilder : ControlBuilder {
+ public override bool AllowWhitespaceLiterals ()
+ {
+ return false;
+ }
+
+ public override void AppendSubBuilder (ControlBuilder subBuilder)
+ {
+ throw new HttpException ("LiteralControlBuilder should never be called");
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.Panel.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// TODO: Are we missing something in LoadViewState?
+// What to do in AddParsedSubObject
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+ [Designer ("System.Web.UI.Design.WebControls.PanelDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [ParseChildren (false)]
+ [PersistChildren (true)]
+ [ToolboxData ("<{0}:Panel runat=server>Panel</{0}:Panel>")]
+ public class Panel : WebControl {
+
+ public Panel () : base (HtmlTextWriterTag.Div)
+ {
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter w)
+ {
+ base.AddAttributesToRender (w);
+
+ if (BackImageUrl != "")
+ w.AddStyleAttribute (HtmlTextWriterStyle.BackgroundImage, BackImageUrl);
+
+ if (!Wrap) {
+#if NET_2_0
+ w.AddStyleAttribute (HtmlTextWriterStyle.WhiteSpace, "nowrap");
+#else
+ w.AddAttribute (HtmlTextWriterAttribute.Nowrap, "nowrap");
+#endif
+ }
+
+ 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.AddAttribute (HtmlTextWriterAttribute.Align, align);
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [Editor("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ public virtual string BackImageUrl {
+ get {
+ return ViewState.GetString ("BackImageUrl", "");
+ }
+
+ set {
+ ViewState ["BackImageUrl"] = value;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(HorizontalAlign.NotSet)]
+ public virtual HorizontalAlign HorizontalAlign {
+ get {
+ return (HorizontalAlign) ViewState.GetInt ("HorizontalAlign", (int) HorizontalAlign.NotSet);
+ }
+ set {
+ ViewState ["HorizontalAlign"] = (int) value;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(true)]
+ public virtual bool Wrap {
+ get {
+ return ViewState.GetBool ("Wrap", true);
+ }
+ set {
+ ViewState ["Wrap"] = value;
+ }
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.PlaceHolder.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// TODO: Are we missing something in LoadViewState?
+// What to do in AddParsedSubObject
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+namespace System.Web.UI.WebControls {
+ [ControlBuilder (typeof (PlaceHolderControlBuilder))]
+ public class PlaceHolder : Control {
+ // Nada?
+ }
+
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.PlaceHolderControlBuilder
+//
+// Authors:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI.WebControls {
+ public class PlaceHolderControlBuilder : ControlBuilder {
+ public override bool AllowWhitespaceLiterals ()
+ {
+ return false;
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.RepeatInfo.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+//#define DEBUG_REPEAT_INFO
+
+using System.Diagnostics;
+
+namespace System.Web.UI.WebControls {
+
+ public sealed class RepeatInfo {
+
+ // What is baseControl for ?
+ public void RenderRepeater (HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
+ {
+ PrintValues (user);
+
+ if (RepeatDirection == RepeatDirection.Vertical)
+ RenderVert (w, user, controlStyle, baseControl);
+ else
+ RenderHoriz (w, user, controlStyle, baseControl);
+ }
+
+ void RenderBr (HtmlTextWriter w)
+ {
+#if NET_2_0
+ w.Write ("<br />");
+#else
+ // grrr, not xhtml...
+ w.Write ("<br>");
+#endif
+
+ }
+
+ void RenderVert (HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
+ {
+ int itms = user.RepeatedItemCount;
+ // total number of rows/columns in our table
+ int cols = RepeatColumns == 0 ? 1 : RepeatColumns;
+ // this gets ceil (itms / cols)
+ int rows = (itms + cols - 1) / cols;
+ bool sep = user.HasSeparators;
+ bool oti = OuterTableImplied;
+ int hdr_span = cols * ((sep && cols != 1) ? 2 : 1);
+
+ bool table = RepeatLayout == RepeatLayout.Table && !oti;
+
+#if NET_2_0
+ bool show_empty_trailing_items = true;
+ bool show_empty_trailing_sep = true;
+#else
+ bool show_empty_trailing_items = false;
+ bool show_empty_trailing_sep = false;
+#endif
+
+ if (! oti)
+ RenderBeginTag (w, controlStyle, baseControl);
+
+ // Render the header
+ if (user.HasHeader) {
+ if (oti)
+ user.RenderItem (ListItemType.Header, -1, this, w);
+ else if (table) {
+ w.RenderBeginTag (HtmlTextWriterTag.Tr);
+ // Make sure the header takes up the full width. We have two
+ // columns per item if we are using separators, otherwise
+ // one per item.
+ if (hdr_span != 1)
+ w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+
+ Style s = user.GetItemStyle (ListItemType.Header, -1);
+ if (s != null)
+ s.AddAttributesToRender (w);
+
+ w.RenderBeginTag (HtmlTextWriterTag.Td);
+ user.RenderItem (ListItemType.Header, -1, this, w);
+ w.RenderEndTag (); // td
+ w.RenderEndTag (); // tr
+ } else {
+ user.RenderItem (ListItemType.Header, -1, this, w);
+ RenderBr (w);
+ }
+ }
+
+ for (int r = 0; r < rows; r ++) {
+ if (table)
+ w.RenderBeginTag (HtmlTextWriterTag.Tr);
+
+ for (int c = 0; c < cols; c ++) {
+ // Find the item number we are in according to the repeat
+ // direction.
+ int item = index_vert (rows, cols, r, c, itms);
+
+ // This item is blank because there there not enough items
+ // to make a full row.
+ if (!show_empty_trailing_items && item >= itms)
+ continue;
+
+ if (table) {
+ Style s = null;
+ if (item < itms)
+ s = user.GetItemStyle (ListItemType.Item, item);
+ if (s != null)
+ s.AddAttributesToRender (w);
+ w.RenderBeginTag (HtmlTextWriterTag.Td);
+ }
+
+ if (item < itms)
+ user.RenderItem (ListItemType.Item, item, this, w);
+
+ if (table)
+ w.RenderEndTag (); // td
+
+ if (sep && cols != 1) {
+ if (table) {
+ if (item < itms - 1) {
+ Style s = user.GetItemStyle (ListItemType.Separator, item);
+ if (s != null)
+ s.AddAttributesToRender (w);
+ }
+ if (item < itms - 1 || show_empty_trailing_sep)
+ w.RenderBeginTag (HtmlTextWriterTag.Td);
+ }
+
+ if (item < itms - 1)
+ user.RenderItem (ListItemType.Separator, item, this, w);
+
+ if (table && (item < itms - 1 || show_empty_trailing_sep))
+ w.RenderEndTag (); // td
+ }
+ }
+ if (oti) {
+ } else if (table) {
+ w.RenderEndTag (); // tr
+ } else if (r != rows - 1) {
+ RenderBr(w);
+ }
+
+ if (sep && r != rows - 1 /* no sep on last item */ && cols == 1) {
+ if (table) {
+ w.RenderBeginTag (HtmlTextWriterTag.Tr);
+ Style s = user.GetItemStyle (ListItemType.Separator, r);
+ if (s != null)
+ s.AddAttributesToRender (w);
+
+ w.RenderBeginTag (HtmlTextWriterTag.Td);
+ } else if (oti) {
+#if !NET_2_0
+ /* 2.0 doesn't render this <br /> */
+ RenderBr (w);
+#endif
+ }
+
+ user.RenderItem (ListItemType.Separator, r, this, w);
+
+ if (table) {
+ w.RenderEndTag (); // td
+ w.RenderEndTag (); // tr
+ } else if (!oti) {
+ RenderBr (w);
+ }
+ }
+ }
+
+ // Render the footer
+ if (user.HasFooter) {
+ if (oti)
+ user.RenderItem (ListItemType.Footer, -1, this, w);
+ else if (table) {
+ w.RenderBeginTag (HtmlTextWriterTag.Tr);
+ if (hdr_span != 1)
+ w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+
+ Style s = user.GetItemStyle (ListItemType.Footer, -1);
+ if (s != null)
+ s.AddAttributesToRender (w);
+
+ w.RenderBeginTag (HtmlTextWriterTag.Td);
+ user.RenderItem (ListItemType.Footer, -1, this, w);
+ w.RenderEndTag (); // td
+ w.RenderEndTag (); // tr
+ } else {
+ // avoid dups on 0 items
+ if (itms != 0)
+ RenderBr (w);
+ user.RenderItem (ListItemType.Footer, -1, this, w);
+ }
+ }
+ if (! oti)
+ w.RenderEndTag (); // table/span
+
+ }
+
+ void RenderHoriz (HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
+ {
+ int itms = user.RepeatedItemCount;
+ // total number of rows/columns in our table
+ int cols = RepeatColumns == 0 ? itms : RepeatColumns;
+ // this gets ceil (itms / cols)
+ int rows = cols == 0 ? 0 : (itms + cols - 1) / cols;
+ bool sep = user.HasSeparators;
+ //bool oti = OuterTableImplied;
+ int hdr_span = cols * (sep ? 2 : 1);
+
+ bool table = RepeatLayout == RepeatLayout.Table;
+
+#if NET_2_0
+ bool show_empty_trailing_items = true;
+ bool show_empty_trailing_sep = true;
+#else
+ bool show_empty_trailing_items = false;
+ bool show_empty_trailing_sep = false;
+#endif
+
+ RenderBeginTag (w, controlStyle, baseControl);
+
+ // Render the header
+ if (user.HasHeader) {
+ if (table) {
+ w.RenderBeginTag (HtmlTextWriterTag.Tr);
+ // Make sure the header takes up the full width. We have two
+ // columns per item if we are using separators, otherwise
+ // one per item.
+ if (hdr_span != 1)
+ w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+
+ Style s = user.GetItemStyle (ListItemType.Header, -1);
+ if (s != null)
+ s.AddAttributesToRender (w);
+
+ w.RenderBeginTag (HtmlTextWriterTag.Td);
+ user.RenderItem (ListItemType.Header, -1, this, w);
+ w.RenderEndTag (); // td
+ w.RenderEndTag (); // tr
+ } else {
+ user.RenderItem (ListItemType.Header, -1, this, w);
+ if (!table && RepeatColumns != 0 && itms != 0)
+ RenderBr (w);
+ }
+ }
+
+ for (int r = 0; r < rows; r ++) {
+ if (table)
+ w.RenderBeginTag (HtmlTextWriterTag.Tr);
+
+ for (int c = 0; c < cols; c ++) {
+ // Find the item number we are in according to the repeat
+ // direction.
+ int item = r * cols + c;
+
+ // This item is blank because there there not enough items
+ // to make a full row.
+ if (!show_empty_trailing_items && item >= itms)
+ continue;
+
+ if (table) {
+ Style s = null;
+ if (item < itms)
+ s = user.GetItemStyle (ListItemType.Item, item);
+
+ if (s != null)
+ s.AddAttributesToRender (w);
+ w.RenderBeginTag (HtmlTextWriterTag.Td);
+ }
+
+ if (item < itms)
+ user.RenderItem (ListItemType.Item, item, this, w);
+
+ if (table)
+ w.RenderEndTag (); // td
+
+ if (sep) {
+ if (table) {
+ if (item < itms - 1) {
+ Style s = user.GetItemStyle (ListItemType.Separator, item);
+ if (s != null)
+ s.AddAttributesToRender (w);
+ }
+ if (item < itms - 1 || show_empty_trailing_sep)
+ w.RenderBeginTag (HtmlTextWriterTag.Td);
+ }
+
+ if (item < itms - 1)
+ user.RenderItem (ListItemType.Separator, item, this, w);
+
+ if (table && (item < itms - 1 || show_empty_trailing_sep))
+ w.RenderEndTag (); // td
+ }
+ }
+
+ if (table) {
+ // if (!oti)
+ w.RenderEndTag (); // tr
+ } else if (!(r == rows -1 && RepeatColumns == 0))
+ RenderBr (w);
+
+ }
+
+ // Render the footer
+ if (user.HasFooter) {
+ if (table) {
+ w.RenderBeginTag (HtmlTextWriterTag.Tr);
+ if (hdr_span != 1)
+ w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+
+ Style s = user.GetItemStyle (ListItemType.Footer, -1);
+ if (s != null)
+ s.AddAttributesToRender (w);
+
+ w.RenderBeginTag (HtmlTextWriterTag.Td);
+ user.RenderItem (ListItemType.Footer, -1, this, w);
+ w.RenderEndTag (); // td
+ w.RenderEndTag (); // tr
+ } else {
+ user.RenderItem (ListItemType.Footer, -1, this, w);
+ }
+ }
+ if (true)
+ w.RenderEndTag (); // table/span
+
+ }
+
+ int index_vert (int rows, int cols, int r, int c, int items)
+ {
+ int last = items % cols;
+
+ if (last == 0)
+ last = cols;
+ if (r == rows - 1 && c >= last)
+ return items;
+
+
+ int add;
+ int v;
+ if (c > last){
+ add = last * rows + (c-last) * (rows-1);
+ v = add + r;
+ } else
+ v = rows * c + r;
+
+ return v;
+ }
+
+ void RenderBeginTag (HtmlTextWriter w, Style s, WebControl wc)
+ {
+ WebControl c;
+ if (RepeatLayout == RepeatLayout.Table)
+ c = new Table ();
+ else
+ c = new Label ();
+
+ c.ID = wc.ClientID;
+ c.CopyBaseAttributes (wc);
+ c.ApplyStyle (s);
+ c.RenderBeginTag (w);
+ }
+
+
+ bool outer_table_implied;
+ public bool OuterTableImplied {
+ get {
+ return outer_table_implied;
+ }
+ set {
+ outer_table_implied = value;
+ }
+ }
+
+ int repeat_cols;
+ public int RepeatColumns {
+ get {
+ return repeat_cols;
+ }
+ set {
+ repeat_cols = value;
+ }
+ }
+
+ RepeatDirection dir = RepeatDirection.Vertical;
+ public RepeatDirection RepeatDirection {
+ get {
+ return dir;
+ }
+ set {
+ if (value != RepeatDirection.Horizontal &&
+ value != RepeatDirection.Vertical)
+ throw new ArgumentOutOfRangeException ();
+
+ dir = value;
+ }
+ }
+
+ RepeatLayout layout;
+ public RepeatLayout RepeatLayout {
+ get {
+ return layout;
+ }
+ set {
+ if (value != RepeatLayout.Flow &&
+ value != RepeatLayout.Table)
+ throw new ArgumentOutOfRangeException ();
+ layout = value;
+ }
+ }
+
+ [Conditional ("DEBUG_REPEAT_INFO")]
+ internal void PrintValues (IRepeatInfoUser riu)
+ {
+ string s = String.Format ("Layout {0}; Direction {1}; Cols {2}; OuterTableImplied {3}\n" +
+ "User: itms {4}, hdr {5}; ftr {6}; sep {7}", RepeatLayout, RepeatDirection,
+ RepeatColumns, OuterTableImplied, riu.RepeatedItemCount, riu.HasSeparators, riu.HasHeader,
+ riu.HasFooter, riu.HasSeparators
+ );
+ Console.WriteLine (s);
+ if (HttpContext.Current != null)
+ HttpContext.Current.Trace.Write (s);
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.Repeater.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+// Helpful resources while implementing this class:
+//
+// _Developing Microsoft ASP.NET Server Controls and Components_ (Kothari, Datye)
+// Chapters 16 and 20 (especially listing 20-3 on page 559)
+//
+// "Building DataBound Templated Custom ASP.NET Server Controls" (Mitchell) on MSDN
+// Right now, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/databoundtemplatedcontrols.asp
+// works, but with msdn we all know that urls have a very short lifetime :-)
+//
+
+using System.Collections;
+using System.ComponentModel;
+using System.Web.Util;
+
+namespace System.Web.UI.WebControls {
+ [DefaultEvent ("ItemCommand")]
+ [DefaultProperty ("DataSource")]
+ [Designer ("System.Web.UI.Design.WebControls.RepeaterDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [ParseChildren (true)]
+ [PersistChildren (false)]
+ public class Repeater : Control, INamingContainer {
+
+ // See Kothari, listing 20-3
+#if NET_2_0
+ protected internal
+#else
+ protected
+#endif
+ override void CreateChildControls ()
+ {
+ // We are recreating the children from viewstate
+ Controls.Clear();
+
+ // Build the children from the viewstate
+ if (ViewState ["Items"] != null)
+ CreateControlHierarchy (false);
+ }
+
+ // See Kothari, listing 20-3
+ protected override void OnDataBinding (EventArgs e)
+ {
+ base.OnDataBinding (EventArgs.Empty);
+
+ Controls.Clear ();
+ ClearChildViewState ();
+ TrackViewState ();
+
+ CreateControlHierarchy (true);
+
+ ChildControlsCreated = true;
+ }
+
+ void DoItem (int i, ListItemType t, object d, bool databind)
+ {
+ RepeaterItem itm = CreateItem (i, t);
+
+ if (t == ListItemType.Item || t == ListItemType.AlternatingItem)
+ items.Add (itm);
+
+ itm.DataItem = d;
+ RepeaterItemEventArgs e = new RepeaterItemEventArgs (itm);
+ InitializeItem (itm);
+
+ //
+ // It is very important that this be called *before* data
+ // binding. Otherwise, we won't save our state in the viewstate.
+ //
+ Controls.Add (itm);
+ OnItemCreated (e);
+
+ if (databind) {
+ itm.DataBind ();
+ OnItemDataBound (e);
+ }
+ }
+
+ protected virtual void CreateControlHierarchy (bool useDataSource)
+ {
+ IEnumerable ds;
+ items = new ArrayList ();
+ itemscol = null;
+
+ if (useDataSource)
+ ds = DataSourceResolver.ResolveDataSource (DataSource, DataMember);
+ else
+ // Optimize (shouldn't need all this memory ;-)
+ ds = new object [(int) ViewState ["Items"]];
+
+ // If there is no datasource, then we don't show anything. the "Items"
+ // viewstate won't get set, so on postback, we won't get here
+ if (ds == null)
+ return;
+
+ if (HeaderTemplate != null)
+ DoItem (-1, ListItemType.Header, null, useDataSource);
+
+ int idx = 0;
+ foreach (object o in ds) {
+ if (idx != 0 && SeparatorTemplate != null)
+ DoItem (idx - 1, ListItemType.Separator, null, useDataSource);
+
+ DoItem (idx, idx % 2 == 0 ? ListItemType.Item : ListItemType.AlternatingItem, o, useDataSource);
+ idx ++;
+ }
+
+ if (FooterTemplate != null)
+ DoItem (-1, ListItemType.Footer, null, useDataSource);
+
+ ViewState ["Items"] = idx;
+ }
+
+ // Why does this get overriden?
+ public override void DataBind ()
+ {
+ // In all the examples I've seen online, this does base.OnDataBinding and
+ // then does all the create child controls stuff. But from stack traces on
+ // windows, this doesn't seem to be the case here.
+ OnDataBinding (EventArgs.Empty);
+
+ }
+
+ protected virtual RepeaterItem CreateItem (int itemIndex, ListItemType itemType)
+ {
+ return new RepeaterItem (itemIndex, itemType);
+ }
+
+ protected virtual void InitializeItem (RepeaterItem item)
+ {
+ ITemplate t = null;
+
+ switch (item.ItemType) {
+ case ListItemType.Header:
+ t = HeaderTemplate;
+ break;
+ case ListItemType.Footer:
+ t = FooterTemplate;
+ break;
+ case ListItemType.Item:
+ t = ItemTemplate;
+ break;
+ case ListItemType.AlternatingItem:
+ t = AlternatingItemTemplate;
+ if (t == null)
+ t = ItemTemplate;
+ break;
+ case ListItemType.Separator:
+ t = SeparatorTemplate;
+ break;
+ }
+
+ if (t != null)
+ t.InstantiateIn (item);
+ }
+
+
+ protected override bool OnBubbleEvent (object sender, EventArgs e)
+ {
+ RepeaterCommandEventArgs rcea = e as RepeaterCommandEventArgs;
+ if (rcea != null) {
+ OnItemCommand (rcea);
+ return true;
+ }
+
+ return false;
+ }
+
+
+ public override ControlCollection Controls {
+ get {
+ EnsureChildControls ();
+ return base.Controls;
+ }
+
+ }
+
+ RepeaterItemCollection itemscol;
+ ArrayList items;
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual RepeaterItemCollection Items {
+ get {
+ if (itemscol == null)
+ itemscol = new RepeaterItemCollection (items);
+ return itemscol;
+ }
+ }
+
+ [DefaultValue("")]
+ public virtual string DataMember {
+ get {
+ return ViewState.GetString ("DataMember", "");
+ }
+ set {
+ ViewState ["DataMember"] = value;
+ }
+ }
+
+ object datasource;
+ [Bindable(true)]
+ [DefaultValue(null)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual object DataSource {
+ get {
+ return datasource;
+ }
+
+ set {
+ if (value == null || value is IListSource || value is IEnumerable)
+ datasource = value;
+ else
+ throw new ArgumentException ();
+ }
+ }
+
+#if NET_2_0
+ [DefaultValue ("")]
+ [IDReferenceProperty (typeof (DataSourceControl))]
+ [MonoTODO]
+ public virtual string DataSourceID
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [Browsable (true)]
+ [MonoTODO]
+ public virtual new bool EnableTheming
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+#endif
+
+ ITemplate alt_itm_tmpl;
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [PersistenceMode(PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof (RepeaterItem))]
+ public virtual ITemplate AlternatingItemTemplate {
+ get {
+ return alt_itm_tmpl;
+ }
+ set {
+ alt_itm_tmpl = value;
+ }
+ }
+
+ ITemplate footer_tmpl;
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [PersistenceMode(PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof (RepeaterItem))]
+ public virtual ITemplate FooterTemplate {
+ get {
+ return footer_tmpl;
+ }
+ set {
+ footer_tmpl = value;
+ }
+ }
+
+ ITemplate header_tmpl;
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [PersistenceMode(PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof (RepeaterItem))]
+ public virtual ITemplate HeaderTemplate {
+ get {
+ return header_tmpl;
+ }
+ set {
+ header_tmpl = value;
+ }
+ }
+
+ ITemplate item_tmpl;
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [PersistenceMode(PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof (RepeaterItem))]
+ public virtual ITemplate ItemTemplate {
+ get {
+ return item_tmpl;
+ }
+ set {
+ item_tmpl = value;
+ }
+ }
+
+ ITemplate separator_tmpl;
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [PersistenceMode(PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof (RepeaterItem))]
+ public virtual ITemplate SeparatorTemplate {
+ get {
+ return separator_tmpl;
+ }
+ set {
+ separator_tmpl = value;
+ }
+ }
+
+
+ protected virtual void OnItemCommand (RepeaterCommandEventArgs e)
+ {
+ RepeaterCommandEventHandler h = (RepeaterCommandEventHandler) Events [ItemCommandEvent];
+ if (h != null)
+ h (this, e);
+ }
+
+ static readonly object ItemCommandEvent = new object ();
+ public event RepeaterCommandEventHandler ItemCommand {
+ add { Events.AddHandler (ItemCommandEvent, value); }
+ remove { Events.RemoveHandler (ItemCommandEvent, value); }
+ }
+
+
+ protected virtual void OnItemCreated (RepeaterItemEventArgs e)
+ {
+ RepeaterItemEventHandler h = (RepeaterItemEventHandler) Events [ItemCreatedEvent];
+ if (h != null)
+ h (this, e);
+ }
+
+ static readonly object ItemCreatedEvent = new object ();
+ public event RepeaterItemEventHandler ItemCreated {
+ add { Events.AddHandler (ItemCreatedEvent, value); }
+ remove { Events.RemoveHandler (ItemCreatedEvent, value); }
+ }
+
+ protected virtual void OnItemDataBound (RepeaterItemEventArgs e)
+ {
+ RepeaterItemEventHandler h = (RepeaterItemEventHandler) Events [ItemDataBoundEvent];
+ if (h != null)
+ h (this, e);
+ }
+
+ static readonly object ItemDataBoundEvent = new object ();
+ public event RepeaterItemEventHandler ItemDataBound {
+ add { Events.AddHandler (ItemDataBoundEvent, value); }
+ remove { Events.RemoveHandler (ItemDataBoundEvent, value); }
+ }
+
+#if NET_2_0
+ [MonoTODO]
+ protected bool Initialized
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ protected bool IsBoundUsingDataSourceID
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ protected bool RequiresDataBinding
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ protected DataSourceSelectArguments SelectArguments
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ protected virtual DataSourceSelectArguments CreateDataSourceSelectArguments ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void EnsureDataBound ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual IEnumerable GetData ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnDataPropertyChanged ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnDataSourceViewChanged (object sender, EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void OnInit (EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void OnLoad (EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void OnPreRender (EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+#endif
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.RepeaterItem
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+ [ToolboxItem ("")]
+ public class RepeaterItem : Control, INamingContainer {
+
+ public RepeaterItem (int itemIndex, ListItemType itemType)
+ {
+ idx = itemIndex;
+ type = itemType;
+ }
+
+ // see ... "Building DataBound Templated Custom ASP.NET " on msdn
+ //
+ // This technique is used in the DataGrid, DataList, and Repeater to handle the
+ // Command event of Buttons, LinkButtons, and ImageButtons within the
+ // controls. Since the button's Command event calls RaiseBubbleEvent(), this
+ // percolates the event up to the button's parent.
+ protected override bool OnBubbleEvent (object source, EventArgs e)
+ {
+ CommandEventArgs ce = e as CommandEventArgs;
+ if (ce != null) {
+ base.RaiseBubbleEvent (this, new RepeaterCommandEventArgs (this, source, ce));
+ return true;
+ }
+
+ return false;
+ }
+
+ public virtual object DataItem {
+ get {
+ return data_item;
+ }
+ set {
+ data_item = value;
+ }
+ }
+
+ public virtual int ItemIndex {
+ get {
+ return idx;
+ }
+ }
+
+ public virtual ListItemType ItemType {
+ get {
+ return type;
+ }
+ }
+
+ object data_item;
+ int idx;
+ ListItemType type;
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.RepeaterItemCollection
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections;
+
+namespace System.Web.UI.WebControls {
+ public sealed class RepeaterItemCollection : ICollection {
+
+ ArrayList l;
+
+ public RepeaterItemCollection (ArrayList items)
+ {
+ l = items;
+ }
+
+
+ public void CopyTo (Array array, int index)
+ {
+ l.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return l.GetEnumerator ();
+ }
+
+
+ public int Count {
+ get {
+ return l.Count;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ public RepeaterItem this [int index] {
+ get {
+ return (RepeaterItem) l [index];
+ }
+ }
+
+ public object SyncRoot {
+ get {
+ return l.SyncRoot;
+ }
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.RequiredFieldValidator
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+ [ToolboxData ("<{0}:RequiredFieldValidator runat=server ErrorMessage=\"RequiredFieldValidator\"></{0}:RequiredFieldValidator>")]
+ public class RequiredFieldValidator : BaseValidator {
+ protected override void AddAttributesToRender (HtmlTextWriter w)
+ {
+ if (RenderUplevel) {
+ w.AddAttribute ("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid");
+ w.AddAttribute ("initialvalue", InitialValue);
+ }
+
+ base.AddAttributesToRender (w);
+ }
+
+ protected override bool EvaluateIsValid ()
+ {
+ return GetControlValidationValue (ControlToValidate) != InitialValue;
+ }
+
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ public string InitialValue {
+ get {
+ return ViewState.GetString ("InitialValue", "");
+ }
+ set {
+ ViewState ["InitialValue"] = value;
+ }
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.SelectedDatesCollection
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections;
+
+namespace System.Web.UI.WebControls {
+ public sealed class SelectedDatesCollection : ICollection {
+
+ ArrayList l;
+
+ public SelectedDatesCollection (ArrayList dateList)
+ {
+ l = dateList;
+ }
+
+
+ public void Add (DateTime date)
+ {
+ if (Contains (date) == false)
+ l.Add (date);
+ }
+
+ public void Clear ()
+ {
+ l.Clear ();
+ }
+
+ public bool Contains (DateTime date)
+ {
+ return l.Contains (date);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ l.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return l.GetEnumerator ();
+ }
+
+ public void Remove (DateTime date)
+ {
+ l.Remove (date);
+ }
+
+ public void SelectRange (DateTime fromDate, DateTime toDate)
+ {
+ l.Clear ();
+ for (DateTime dt = fromDate; dt <= toDate; dt = dt.AddDays (1))
+ Add (dt);
+ }
+
+ public int Count {
+ get {
+ return l.Count;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return l.IsReadOnly;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return l.IsSynchronized;
+ }
+ }
+
+ public DateTime this [int index] {
+ get {
+ return (DateTime) l [index];
+ }
+ }
+
+ public object SyncRoot {
+ get {
+ return this;
+ }
+ }
+
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.TableCellControlBuilder
+//
+// Authors:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI.WebControls {
+ public class TableCellControlBuilder : ControlBuilder {
+ public override bool AllowWhitespaceLiterals ()
+ {
+ return false;
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.TemplateColumn
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.ComponentModel;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls {
+ public class TemplateColumn : DataGridColumn {
+ public override void InitializeCell (TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell (cell, columnIndex, itemType);
+ ITemplate t = null;
+ switch (itemType) {
+ case ListItemType.Header:
+ t = HeaderTemplate;
+ break;
+ case ListItemType.Footer:
+ t = FooterTemplate;
+ break;
+ case ListItemType.Item:
+ case ListItemType.AlternatingItem:
+ t = ItemTemplate;
+ break;
+ case ListItemType.EditItem:
+ t = EditItemTemplate;
+ if (t == null)
+ t = ItemTemplate;
+ break;
+ }
+
+ if (t != null)
+ t.InstantiateIn (cell);
+ }
+
+ ITemplate editItemTemplate, footerTemplate, headerTemplate, itemTemplate;
+
+ [Browsable(false)]
+ [DefaultValue (null)]
+ [PersistenceMode(PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof(DataGridItem))]
+ public virtual ITemplate EditItemTemplate {
+ get { return editItemTemplate; }
+ set { editItemTemplate = value; }
+ }
+
+ [Browsable(false)]
+ [DefaultValue (null)]
+ [PersistenceMode(PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof(DataGridItem))]
+ public virtual ITemplate FooterTemplate {
+ get { return footerTemplate; }
+ set { footerTemplate = value; }
+ }
+
+ [Browsable(false)]
+ [DefaultValue (null)]
+ [PersistenceMode(PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof(DataGridItem))]
+ public virtual ITemplate HeaderTemplate {
+ get { return headerTemplate; }
+ set { headerTemplate = value; }
+ }
+
+ [Browsable(false)]
+ [DefaultValue (null)]
+ [PersistenceMode(PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof(DataGridItem))]
+ public virtual ITemplate ItemTemplate {
+ get { return itemTemplate; }
+ set { itemTemplate = value; }
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.TextBox.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@novell.com)
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+
+namespace System.Web.UI.WebControls {
+ [DataBindingHandler ("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ [DefaultEvent ("TextChanged")]
+ [DefaultProperty ("Text")]
+ [ValidationProperty ("Text")]
+ [ControlBuilder (typeof (TextBoxControlBuilder))]
+#if NET_2_0
+ [Designer ("System.Web.UI.Design.WebControls.PreviewControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [ParseChildren (true, "Text")]
+ [ControlValueProperty ("Text", null)]
+#else
+ [ParseChildren (false)]
+#endif
+ public class TextBox : WebControl, IPostBackDataHandler
+#if NET_2_0
+ , IEditableTextControl, ITextControl
+#endif
+ {
+ protected override void AddAttributesToRender (HtmlTextWriter w)
+ {
+ if (Page != null)
+ Page.VerifyRenderingInServerForm (this);
+
+ base.AddAttributesToRender (w);
+
+ switch (TextMode) {
+ case TextBoxMode.MultiLine:
+ if (Columns != 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Cols, Columns.ToString ());
+ if (Rows != 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Rows, Rows.ToString ());
+ if (!Wrap)
+ w.AddAttribute (HtmlTextWriterAttribute.Wrap, "off");
+
+ break;
+
+ case TextBoxMode.SingleLine:
+ case TextBoxMode.Password:
+
+ if (TextMode == TextBoxMode.Password)
+ w.AddAttribute (HtmlTextWriterAttribute.Type, "password");
+ else {
+ w.AddAttribute (HtmlTextWriterAttribute.Type, "text");
+ w.AddAttribute (HtmlTextWriterAttribute.Value, Text);
+ }
+
+ if (Columns != 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Size, Columns.ToString ());
+
+ if (MaxLength != 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Maxlength, MaxLength.ToString ());
+ break;
+ }
+
+ if (AutoPostBack)
+ w.AddAttribute (HtmlTextWriterAttribute.Onchange, Page.ClientScript.GetPostBackClientHyperlink (this, ""));
+
+ if (ReadOnly)
+ w.AddAttribute (HtmlTextWriterAttribute.ReadOnly, "ReadOnly");
+
+ w.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ LiteralControl l = obj as LiteralControl;
+ if (l != null)
+ Text = l.Text;
+ }
+
+ [MonoTODO]
+#if NET_2_0
+ protected internal
+#else
+ protected
+#endif
+ override void OnPreRender (EventArgs e)
+ {
+ // What do i do here?
+ base.OnPreRender (e);
+ }
+
+ [MonoTODO ("Am I missing something here")]
+#if NET_2_0
+ protected internal
+#else
+ protected
+#endif
+ override void Render (HtmlTextWriter w)
+ {
+ // Why didn't msft just override RenderContents!?
+ RenderBeginTag (w);
+ if (TextMode == TextBoxMode.MultiLine)
+ HttpUtility.HtmlEncode (Text, w);
+ RenderEndTag (w);
+ }
+
+#if NET_2_0
+ [MonoTODO]
+ protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void RaisePostDataChangedEvent ()
+ {
+ throw new NotImplementedException ();
+ }
+#endif
+
+ bool IPostBackDataHandler.LoadPostData (string key, NameValueCollection col)
+ {
+ if (Text != col [key]) {
+ Text = col [key];
+ return true;
+ }
+
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnTextChanged (EventArgs.Empty);
+ }
+
+#if NET_2_0
+ [MonoTODO]
+ protected override object SaveViewState ()
+ {
+ return base.SaveViewState ();
+ }
+#endif
+
+#if NET_2_0
+ [DefaultValue (AutoCompleteType.None)]
+ [Themeable (false)]
+ [MonoTODO]
+ public virtual AutoCompleteType AutoCompleteType
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+#endif
+
+ [DefaultValue(false)]
+#if NET_2_0
+ [Themeable (false)]
+#endif
+ public virtual bool AutoPostBack {
+ get {
+ return ViewState.GetBool ("AutoPostBack", false);
+ }
+ set {
+ ViewState ["AutoPostBack"] = value;
+ }
+ }
+
+#if NET_2_0
+ [DefaultValue (false)]
+ [Themeable (false)]
+ public virtual bool CausesValidation
+ {
+ get {
+ return ViewState.GetBool ("CausesValidation", false);
+ }
+ set {
+ ViewState["CausesValidation"] = value;
+ }
+ }
+#endif
+
+#if ONLY_1_1
+ [Bindable(true)]
+#endif
+ [DefaultValue(0)]
+ public virtual int Columns {
+ get {
+ return ViewState.GetInt ("Columns", 0);
+ }
+ set {
+ ViewState ["Columns"] = value;
+ }
+ }
+
+#if ONLY_1_1
+ [Bindable(true)]
+#endif
+ [DefaultValue(0)]
+#if NET_2_0
+ [Themeable (false)]
+#endif
+ public virtual int MaxLength {
+ get {
+ return ViewState.GetInt ("MaxLength", 0);
+ }
+ set {
+ ViewState ["MaxLength"] = value;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(false)]
+#if NET_2_0
+ [Themeable (false)]
+#endif
+ public virtual bool ReadOnly {
+ get {
+ return ViewState.GetBool ("ReadOnly", false);
+ }
+ set {
+ ViewState ["ReadOnly"] = value;
+ }
+ }
+
+#if ONLY_1_1
+ [Bindable(true)]
+#endif
+ [DefaultValue(0)]
+#if NET_2_0
+ [Themeable (false)]
+#endif
+ public virtual int Rows {
+ get {
+ return ViewState.GetInt ("Rows", 0);
+ }
+ set {
+ ViewState ["Rows"] = value;
+ }
+ }
+
+#if NET_2_0 && HAVE_CONTROL_ADAPTERS
+ protected virtual new
+#else
+ protected override
+#endif
+ HtmlTextWriterTag TagKey {
+ get {
+ return TextMode == TextBoxMode.MultiLine ? HtmlTextWriterTag.Textarea : HtmlTextWriterTag.Input;
+ }
+ }
+
+#if NET_2_0
+ [Bindable(true, BindingDirection.TwoWay)]
+#else
+ [Bindable(true)]
+#endif
+ [DefaultValue("")]
+ [PersistenceMode(PersistenceMode.EncodedInnerDefaultProperty)]
+#if NET_2_0
+ [Localizable (true)]
+ [Editor ("System.ComponentModel.Design.MultilineStringEditor," + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+#endif
+ public virtual string Text {
+ get {
+ return ViewState.GetString ("Text", "");
+ }
+ set {
+ ViewState ["Text"] = value;
+ if (TextMode == TextBoxMode.Password)
+ ViewState.SetItemDirty ("Text", false);
+ }
+ }
+
+ [DefaultValue(TextBoxMode.SingleLine)]
+#if NET_2_0
+ [Themeable (false)]
+#endif
+ public virtual TextBoxMode TextMode {
+ get {
+ return (TextBoxMode) ViewState.GetInt ("TextMode", (int) TextBoxMode.SingleLine);
+ }
+ set {
+ ViewState ["TextMode"] = (int) value;
+ }
+ }
+
+#if NET_2_0
+ [Themeable (false)]
+ [DefaultValue ("")]
+ public string ValidationGroup
+ {
+ get {
+ return ViewState.GetString ("ValidationGroup", "");
+ }
+ set {
+ ViewState ["ValidationGroup"] = value;
+ }
+ }
+#endif
+
+ [DefaultValue(true)]
+ public virtual bool Wrap {
+ get {
+ return ViewState.GetBool ("Wrap", true);
+ }
+ set {
+ ViewState ["Wrap"] = value;
+ }
+ }
+
+ protected virtual void OnTextChanged (EventArgs e)
+ {
+ EventHandler h = (EventHandler) Events [TextChangedEvent];
+ if (h != null)
+ h (this, e);
+ }
+
+ static readonly object TextChangedEvent = new object ();
+ public event EventHandler TextChanged {
+ add { Events.AddHandler (TextChangedEvent, value); }
+ remove { Events.RemoveHandler (TextChangedEvent, value); }
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.WebControls.TextBoxControlBuilder
+//
+// Authors:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI.WebControls {
+ public class TextBoxControlBuilder : ControlBuilder {
+ public override bool AllowWhitespaceLiterals ()
+ {
+ return false;
+ }
+
+ public override bool HtmlDecodeLiterals ()
+ {
+ return true;
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UI.HtmlTextWriter
+//
+// Author:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.IO;
+using System.Globalization;
+using System.Collections;
+using System.Text;
+
+namespace System.Web.UI {
+
+ public class HtmlTextWriter : TextWriter {
+
+
+ public HtmlTextWriter (TextWriter writer) : this (writer, DefaultTabString)
+ {
+ }
+
+ public HtmlTextWriter (TextWriter writer, string tabString)
+ {
+ if (writer == null)
+ throw new ArgumentNullException ();
+
+ b = writer;
+ tab_string = tabString;
+ }
+
+ internal static string StaticGetStyleName (System.Web.UI.HtmlTextWriterStyle styleKey)
+ {
+ if ((int) styleKey < htmlstyles.Length)
+ return htmlstyles [(int) styleKey].name;
+
+ return null;
+ }
+
+ [MonoTODO]
+ protected static void RegisterAttribute (string name, HtmlTextWriterAttribute key)
+ {
+ }
+
+ [MonoTODO]
+ protected static void RegisterStyle (string name, HtmlTextWriterStyle key)
+ {
+ }
+
+ [MonoTODO]
+ protected static void RegisterTag (string name, HtmlTextWriterTag key)
+ {
+ }
+
+
+ public virtual void AddAttribute (HtmlTextWriterAttribute key, string value, bool fEncode)
+ {
+ if (fEncode)
+ value = EncodeAttributeValue (key, value);
+ AddAttribute (GetAttributeName (key), value, key);
+ }
+
+
+ public virtual void AddAttribute (HtmlTextWriterAttribute key, string value)
+ {
+ AddAttribute (key, value, true);
+ }
+
+
+ public virtual void AddAttribute (string name, string value, bool fEncode)
+ {
+ if (fEncode)
+ value = HttpUtility.HtmlAttributeEncode (value);
+
+ AddAttribute (name, value, GetAttributeKey (name));
+ }
+
+ public virtual void AddAttribute (string name, string value)
+ {
+ AddAttribute (name, value, true);
+ }
+
+ protected virtual void AddAttribute (string name, string value, HtmlTextWriterAttribute key)
+ {
+ NextAttrStack ();
+ attrs [attrs_pos].name = name;
+ attrs [attrs_pos].value = value;
+ attrs [attrs_pos].key = key;
+ }
+
+
+ protected virtual void AddStyleAttribute (string name, string value, HtmlTextWriterStyle key)
+ {
+ NextStyleStack ();
+ styles [styles_pos].name = name;
+ styles [styles_pos].value = value;
+ styles [styles_pos].key = key;
+ }
+
+
+ public virtual void AddStyleAttribute (string name, string value)
+ {
+ AddStyleAttribute (name, value, GetStyleKey (name));
+ }
+
+ public virtual void AddStyleAttribute (HtmlTextWriterStyle key, string value)
+ {
+ AddStyleAttribute (GetStyleName (key), value, key);
+ }
+
+ public override void Close ()
+ {
+ b.Close ();
+ }
+
+ [MonoTODO]
+ protected virtual string EncodeAttributeValue (HtmlTextWriterAttribute attrKey, string value)
+ {
+ return value;
+ }
+
+ [MonoTODO]
+ protected string EncodeAttributeValue (string value, bool fEncode)
+ {
+ return value;
+ }
+
+ [MonoTODO]
+ protected string EncodeUrl (string url)
+ {
+ return url;
+ }
+
+
+ protected virtual void FilterAttributes ()
+ {
+ AddedAttr style_attr = new AddedAttr ();
+
+ for (int i = 0; i <= attrs_pos; i ++) {
+ AddedAttr a = attrs [i];
+ if (OnAttributeRender (a.name, a.value, a.key)) {
+ if (a.key == HtmlTextWriterAttribute.Style) {
+ style_attr = a;
+ continue;
+ }
+
+ WriteAttribute (a.name, a.value, false);
+ }
+ }
+
+ if (styles_pos != -1 || style_attr.value != null) {
+ Write (SpaceChar);
+ Write ("style");
+ Write (EqualsDoubleQuoteString);
+
+
+ for (int i = 0; i <= styles_pos; i ++) {
+ AddedStyle a = styles [i];
+ if (OnStyleAttributeRender (a.name, a.value, a.key))
+ WriteStyleAttribute (a.name, a.value, false);
+ }
+
+ Write (style_attr.value);
+ Write (DoubleQuoteChar);
+ }
+
+ styles_pos = attrs_pos = -1;
+ }
+
+ public override void Flush ()
+ {
+ b.Flush ();
+ }
+
+ [MonoTODO]
+ protected HtmlTextWriterAttribute GetAttributeKey (string attrName)
+ {
+ // I don't think we want to binary search
+ // because there might be something added to
+ // the enum later. Do we really need anything
+ // faster than a linear search?
+
+ foreach (HtmlAttribute t in htmlattrs) {
+ if (t.name == attrName)
+ return t.key;
+ }
+
+ return 0;
+ }
+
+ [MonoTODO]
+ protected string GetAttributeName (HtmlTextWriterAttribute attrKey)
+ {
+ if ((int) attrKey < htmlattrs.Length)
+ return htmlattrs [(int) attrKey].name;
+
+ return null;
+ }
+
+ [MonoTODO]
+ protected HtmlTextWriterStyle GetStyleKey (string styleName)
+ {
+ // I don't think we want to binary search
+ // because there might be something added to
+ // the enum later. Do we really need anything
+ // faster than a linear search?
+
+ foreach (HtmlStyle t in htmlstyles) {
+ if (t.name == styleName)
+ return t.key;
+ }
+
+ return 0;
+ }
+
+ [MonoTODO]
+ protected string GetStyleName (HtmlTextWriterStyle styleKey)
+ {
+ return StaticGetStyleName (styleKey);
+ }
+
+ [MonoTODO]
+ protected virtual HtmlTextWriterTag GetTagKey (string tagName)
+ {
+ // I don't think we want to binary search
+ // because there might be something added to
+ // the enum later. Do we really need anything
+ // faster than a linear search?
+
+ foreach (HtmlTag t in tags) {
+ if (t.name == tagName)
+ return t.key;
+ }
+
+ return HtmlTextWriterTag.Unknown;
+ }
+
+ internal static string StaticGetTagName (HtmlTextWriterTag tagKey)
+ {
+ if ((int) tagKey < tags.Length)
+ return tags [(int) tagKey].name;
+
+ return null;
+ }
+
+
+ [MonoTODO]
+ protected virtual string GetTagName (HtmlTextWriterTag tagKey)
+ {
+ if ((int) tagKey < tags.Length)
+ return tags [(int) tagKey].name;
+
+ return null;
+ }
+
+ protected bool IsAttributeDefined (HtmlTextWriterAttribute key)
+ {
+ string value;
+ return IsAttributeDefined (key, out value);
+ }
+
+ protected bool IsAttributeDefined (HtmlTextWriterAttribute key, out string value)
+ {
+ for (int i = 0; i <= attrs_pos; i ++)
+ if (attrs [i].key == key){
+ value = attrs [i].value;
+ return true;
+ }
+
+ value = null;
+ return false;
+ }
+
+ protected bool IsStyleAttributeDefined (HtmlTextWriterStyle key)
+ {
+ string value;
+ return IsStyleAttributeDefined (key, out value);
+ }
+
+ protected bool IsStyleAttributeDefined (HtmlTextWriterStyle key, out string value)
+ {
+ for (int i = 0; i <= styles_pos; i ++)
+ if (styles [i].key == key){
+ value = styles [i].value;
+ return true;
+ }
+
+ value = null;
+ return false;
+ }
+
+ protected virtual bool OnAttributeRender (string name, string value, HtmlTextWriterAttribute key)
+ {
+ return true;
+ }
+
+ protected virtual bool OnStyleAttributeRender (string name, string value, HtmlTextWriterStyle key)
+ {
+ return true;
+ }
+
+ protected virtual bool OnTagRender (string name, HtmlTextWriterTag key)
+ {
+ return true;
+ }
+
+
+ protected virtual void OutputTabs ()
+ {
+ if (! newline)
+ return;
+ newline = false;
+
+ for (int i = 0; i < Indent; i ++)
+ b.Write (tab_string);
+ }
+
+
+
+ protected string PopEndTag ()
+ {
+ if (tagstack_pos == -1)
+ throw new InvalidOperationException ();
+
+ string s = TagName;
+ tagstack_pos --;
+ return s;
+ }
+
+ protected void PushEndTag (string endTag)
+ {
+ NextTagStack ();
+ TagName = endTag;
+ }
+
+ void PushEndTag (HtmlTextWriterTag t)
+ {
+ NextTagStack ();
+ TagKey = t;
+ }
+
+
+ protected virtual string RenderAfterContent ()
+ {
+ return null;
+ }
+
+ protected virtual string RenderAfterTag ()
+ {
+ return null;
+ }
+
+ protected virtual string RenderBeforeContent ()
+ {
+ return null;
+ }
+
+ protected virtual string RenderBeforeTag ()
+ {
+ return null;
+ }
+
+ public virtual void RenderBeginTag (string tagName)
+ {
+ if (! OnTagRender (tagName, GetTagKey (tagName)))
+ return;
+
+ PushEndTag (tagName);
+
+ DoBeginTag ();
+ }
+
+ public virtual void RenderBeginTag (HtmlTextWriterTag tagKey)
+ {
+ if (! OnTagRender (GetTagName (tagKey), tagKey))
+ return;
+
+ PushEndTag (tagKey);
+
+ DoBeginTag ();
+ }
+
+ void WriteIfNotNull (string s)
+ {
+ if (s != null)
+ Write (s);
+ }
+
+
+ void DoBeginTag ()
+ {
+ WriteIfNotNull (RenderBeforeTag ());
+ WriteBeginTag (TagName);
+ FilterAttributes ();
+
+ HtmlTextWriterTag key = (int) TagKey < tags.Length ? TagKey : HtmlTextWriterTag.Unknown;
+
+ switch (tags [(int) key].tag_type) {
+ case TagType.Inline:
+ Write (TagRightChar);
+ break;
+ case TagType.Block:
+ Write (TagRightChar);
+ WriteLine ();
+ Indent ++;
+ break;
+ case TagType.SelfClosing:
+ Write (SelfClosingTagEnd);
+ break;
+ }
+
+ // FIXME what do i do for self close here?
+ WriteIfNotNull (RenderBeforeContent ());
+ }
+
+
+ public virtual void RenderEndTag ()
+ {
+ // FIXME what do i do for self close here?
+ WriteIfNotNull (RenderAfterContent ());
+
+ HtmlTextWriterTag key = (int) TagKey < tags.Length ? TagKey : HtmlTextWriterTag.Unknown;
+
+ switch (tags [(int) key].tag_type) {
+ case TagType.Inline:
+ WriteEndTag (TagName);
+ break;
+ case TagType.Block:
+ Indent --;
+ WriteLineNoTabs ("");
+ WriteEndTag (TagName);
+
+ break;
+ case TagType.SelfClosing:
+ // NADA
+ break;
+ }
+ WriteIfNotNull (RenderAfterTag ());
+
+ PopEndTag ();
+ }
+
+
+ public virtual void WriteAttribute (string name, string value, bool fEncode)
+ {
+ Write (SpaceChar);
+ Write (name);
+ if (value != null) {
+ Write (EqualsDoubleQuoteString);
+ value = EncodeAttributeValue (value, fEncode);
+ Write (value);
+ Write (DoubleQuoteChar);
+ }
+ }
+
+
+ public virtual void WriteBeginTag (string tagName)
+ {
+ Write (TagLeftChar);
+ Write (tagName);
+ }
+
+ public virtual void WriteEndTag (string tagName)
+ {
+ Write (EndTagLeftChars);
+ Write (tagName);
+ Write (TagRightChar);
+ }
+
+ public virtual void WriteFullBeginTag (string tagName)
+ {
+ Write (TagLeftChar);
+ Write (tagName);
+ Write (TagRightChar);
+ }
+
+ public virtual void WriteStyleAttribute (string name, string value)
+ {
+ WriteStyleAttribute (name, value, true);
+ }
+
+ public virtual void WriteStyleAttribute (string name, string value, bool fEncode)
+ {
+#if NET_2_0
+ if (name == "background-image") {
+ value = String.Concat ("url(", value, ")");
+ }
+#endif
+ Write (name);
+ Write (StyleEqualsChar);
+ Write (EncodeAttributeValue (value, fEncode));
+ Write (SemicolonChar);
+ }
+
+ public override void Write (char [] buffer, int index, int count)
+ {
+ OutputTabs ();
+ b.Write (buffer, index, count);
+ }
+
+ public override void Write (double value)
+ {
+ OutputTabs ();
+ b.Write (value);
+ }
+
+ public override void Write (char value)
+ {
+ OutputTabs ();
+ b.Write (value);
+ }
+
+ public override void Write (char [] buffer)
+ {
+ OutputTabs ();
+ b.Write (buffer);
+ }
+
+ public override void Write (int value)
+ {
+ OutputTabs ();
+ b.Write (value);
+ }
+
+ public override void Write (string format, object arg0)
+ {
+ OutputTabs ();
+ b.Write (format, arg0);
+ }
+
+ public override void Write (string format, object arg0, object arg1)
+ {
+ OutputTabs ();
+ b.Write (format, arg0, arg1);
+ }
+
+ public override void Write (string format, params object [] args)
+ {
+ OutputTabs ();
+ b.Write (format, args);
+ }
+
+ public override void Write (string s)
+ {
+ OutputTabs ();
+ b.Write (s);
+ }
+
+ public override void Write (long value)
+ {
+ OutputTabs ();
+ b.Write (value);
+ }
+
+ public override void Write (object value)
+ {
+ OutputTabs ();
+ b.Write (value);
+ }
+
+ public override void Write (float value)
+ {
+ OutputTabs ();
+ b.Write (value);
+ }
+
+ public override void Write (bool value)
+ {
+ OutputTabs ();
+ b.Write (value);
+ }
+
+ public virtual void WriteAttribute (string name, string value)
+ {
+ WriteAttribute (name, value, true);
+ }
+
+ public override void WriteLine (char value)
+ {
+ OutputTabs ();
+ b.WriteLine (value);
+ newline = true;
+ }
+
+ public override void WriteLine (long value)
+ {
+ OutputTabs ();
+ b.WriteLine (value);
+ newline = true;
+ }
+
+ public override void WriteLine (object value)
+ {
+ OutputTabs ();
+ b.WriteLine (value);
+ newline = true;
+ }
+
+ public override void WriteLine (double value)
+ {
+ OutputTabs ();
+ b.WriteLine (value);
+ newline = true;
+ }
+
+ public override void WriteLine (char [] buffer, int index, int count)
+ {
+ OutputTabs ();
+ b.WriteLine (buffer, index, count);
+ newline = true;
+ }
+
+ public override void WriteLine (char [] buffer)
+ {
+ OutputTabs ();
+ b.WriteLine (buffer);
+ newline = true;
+ }
+
+ public override void WriteLine (bool value)
+ {
+ OutputTabs ();
+ b.WriteLine (value);
+ newline = true;
+ }
+
+ public override void WriteLine ()
+ {
+ OutputTabs ();
+ b.WriteLine ();
+ newline = true;
+ }
+
+ public override void WriteLine (int value)
+ {
+ OutputTabs ();
+ b.WriteLine (value);
+ newline = true;
+ }
+
+ public override void WriteLine (string format, object arg0, object arg1)
+ {
+ OutputTabs ();
+ b.WriteLine (format, arg0, arg1);
+ newline = true;
+ }
+
+ public override void WriteLine (string format, object arg0)
+ {
+ OutputTabs ();
+ b.WriteLine (format, arg0);
+ newline = true;
+ }
+
+ public override void WriteLine (string format, params object [] args)
+ {
+ OutputTabs ();
+ b.WriteLine (format, args);
+ newline = true;
+ }
+
+ [CLSCompliant (false)]
+ public override void WriteLine (uint value)
+ {
+ OutputTabs ();
+ b.WriteLine (value);
+ newline = true;
+ }
+
+ public override void WriteLine (string s)
+ {
+ OutputTabs ();
+ b.WriteLine (s);
+ newline = true;
+ }
+
+ public override void WriteLine (float value)
+ {
+ OutputTabs ();
+ b.WriteLine (value);
+ newline = true;
+ }
+
+ public void WriteLineNoTabs (string s)
+ {
+ b.WriteLine (s);
+ newline = true;
+ }
+
+ public override Encoding Encoding {
+ get {
+ return b.Encoding;
+ }
+ }
+
+ int indent;
+ public int Indent {
+ get {
+ return indent;
+ }
+ set {
+ indent = value;
+ }
+ }
+
+ public System.IO.TextWriter InnerWriter {
+ get {
+ return b;
+ }
+ set {
+ b = value;
+ }
+ }
+
+ public override string NewLine {
+ get {
+ return b.NewLine;
+ }
+ set {
+ b.NewLine = value;
+ }
+ }
+
+ protected HtmlTextWriterTag TagKey {
+ get {
+ if (tagstack_pos == -1)
+ throw new InvalidOperationException ();
+
+ return tagstack [tagstack_pos].key;
+ }
+ set {
+ tagstack [tagstack_pos].key = value;
+ tagstack [tagstack_pos].name = GetTagName (value);
+ }
+ }
+
+ protected string TagName {
+ get {
+ if (tagstack_pos == -1)
+ throw new InvalidOperationException ();
+
+ return tagstack [tagstack_pos].name;
+ }
+ set {
+ tagstack [tagstack_pos].name = value;
+ tagstack [tagstack_pos].key = GetTagKey (value);
+ if (tagstack [tagstack_pos].key != HtmlTextWriterTag.Unknown)
+ tagstack [tagstack_pos].name = GetTagName (tagstack [tagstack_pos].key);
+ }
+ }
+
+
+ TextWriter b;
+ string tab_string;
+ bool newline;
+
+ //
+ // These emulate generic Stack <T>, since we can't use that ;-(. _pos is the current
+ // element.IE, you edit blah [blah_pos]. I *really* want generics, sigh.
+ //
+ AddedStyle [] styles;
+ AddedAttr [] attrs;
+ AddedTag [] tagstack;
+
+ int styles_pos = -1, attrs_pos = -1, tagstack_pos = -1;
+
+ struct AddedTag {
+ public string name;
+ public HtmlTextWriterTag key;
+ }
+
+ struct AddedStyle {
+ public string name;
+ public HtmlTextWriterStyle key;
+ public string value;
+ }
+
+ struct AddedAttr {
+ public string name;
+ public HtmlTextWriterAttribute key;
+ public string value;
+ }
+
+ void NextStyleStack ()
+ {
+ if (styles == null)
+ styles = new AddedStyle [16];
+
+ if (++styles_pos < styles.Length)
+ return;
+
+ int nsize = styles.Length * 2;
+ AddedStyle [] ncontents = new AddedStyle [nsize];
+
+ Array.Copy (styles, ncontents, styles.Length);
+ styles = ncontents;
+ }
+
+ void NextAttrStack ()
+ {
+ if (attrs == null)
+ attrs = new AddedAttr [16];
+
+ if (++attrs_pos < attrs.Length)
+ return;
+
+ int nsize = attrs.Length * 2;
+ AddedAttr [] ncontents = new AddedAttr [nsize];
+
+ Array.Copy (attrs, ncontents, attrs.Length);
+ attrs = ncontents;
+ }
+
+ void NextTagStack ()
+ {
+ if (tagstack == null)
+ tagstack = new AddedTag [16];
+
+ if (++tagstack_pos < tagstack.Length)
+ return;
+
+ int nsize = tagstack.Length * 2;
+ AddedTag [] ncontents = new AddedTag [nsize];
+
+ Array.Copy (tagstack, ncontents, tagstack.Length);
+ tagstack = ncontents;
+ }
+
+ public const string DefaultTabString = "\t";
+ public const char DoubleQuoteChar = '"';
+ public const string EndTagLeftChars = "</";
+ public const char EqualsChar = '=';
+ public const string EqualsDoubleQuoteString = "=\"";
+ public const string SelfClosingChars = " /";
+ public const string SelfClosingTagEnd = " />";
+ public const char SemicolonChar = ';';
+ public const char SingleQuoteChar = '\'';
+ public const char SlashChar = '/';
+ public const char SpaceChar = ' ' ;
+ public const char StyleEqualsChar = ':';
+ public const char TagLeftChar = '<';
+ public const char TagRightChar = '>';
+
+ enum TagType {
+ Block,
+ Inline,
+ SelfClosing,
+ }
+
+
+ struct HtmlTag {
+ public HtmlTextWriterTag key;
+ public string name;
+ public TagType tag_type;
+
+ public HtmlTag (HtmlTextWriterTag k, string n, TagType tt)
+ {
+ key = k;
+ name = n;
+ tag_type = tt;
+ }
+ }
+
+ struct HtmlStyle {
+ public HtmlTextWriterStyle key;
+ public string name;
+
+ public HtmlStyle (HtmlTextWriterStyle k, string n)
+ {
+ key = k;
+ name = n;
+ }
+ }
+
+
+ struct HtmlAttribute {
+ public HtmlTextWriterAttribute key;
+ public string name;
+
+ public HtmlAttribute (HtmlTextWriterAttribute k, string n)
+ {
+ key = k;
+ name = n;
+ }
+ }
+
+ static HtmlTag [] tags = {
+ new HtmlTag (HtmlTextWriterTag.Unknown, "", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.A, "a", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Acronym, "acronym", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Address, "address", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Area, "area", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.B, "b", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Base, "base", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Basefont, "basefont", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Bdo, "bdo", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Bgsound, "bgsound", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Big, "big", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Blockquote, "blockquote", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Body, "body", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Br, "br", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Button, "button", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Caption, "caption", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Center, "center", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Cite, "cite", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Code, "code", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Col, "col", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Colgroup, "colgroup", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Dd, "dd", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Del, "del", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Dfn, "dfn", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Dir, "dir", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Div, "div", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Dl, "dl", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Dt, "dt", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Em, "em", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Embed, "embed", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Fieldset, "fieldset", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Font, "font", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Form, "form", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Frame, "frame", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Frameset, "frameset", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.H1, "h1", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.H2, "h2", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.H3, "h3", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.H4, "h4", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.H5, "h5", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.H6, "h6", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Head, "head", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Hr, "hr", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Html, "html", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.I, "i", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Iframe, "iframe", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Img, "img", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Input, "input", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Ins, "ins", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Isindex, "isindex", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Kbd, "kbd", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Label, "label", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Legend, "legend", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Li, "li", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Link, "link", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Map, "map", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Marquee, "marquee", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Menu, "menu", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Meta, "meta", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Nobr, "nobr", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Noframes, "noframes", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Noscript, "noscript", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Object, "object", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Ol, "ol", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Option, "option", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.P, "p", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Param, "param", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Pre, "pre", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Q, "q", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Rt, "rt", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Ruby, "ruby", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.S, "s", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Samp, "samp", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Script, "script", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Select, "select", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Small, "small", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Span, "span", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Strike, "strike", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Strong, "strong", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Style, "style", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Sub, "sub", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Sup, "sup", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Table, "table", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Tbody, "tbody", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Td, "td", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Textarea, "textarea", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Tfoot, "tfoot", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Th, "th", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Thead, "thead", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Title, "title", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Tr, "tr", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Tt, "tt", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.U, "u", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Ul, "ul", TagType.Block),
+ new HtmlTag (HtmlTextWriterTag.Var, "var", TagType.Inline),
+ new HtmlTag (HtmlTextWriterTag.Wbr, "wbr", TagType.SelfClosing),
+ new HtmlTag (HtmlTextWriterTag.Xml, "xml", TagType.Block),
+ };
+
+ static HtmlAttribute [] htmlattrs = {
+ new HtmlAttribute (HtmlTextWriterAttribute.Accesskey, "accesskey"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Align, "align"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Alt, "alt"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Background, "background"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Bgcolor, "bgcolor"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Border, "border"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Bordercolor, "bordercolor"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Cellpadding, "cellpadding"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Cellspacing, "cellspacing"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Checked, "checked"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Class, "class"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Cols, "cols"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Colspan, "colspan"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Disabled, "disabled"),
+ new HtmlAttribute (HtmlTextWriterAttribute.For, "for"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Height, "height"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Href, "href"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Id, "id"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Maxlength, "maxlength"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Multiple, "multiple"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Name, "name"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Nowrap, "nowrap"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Onchange, "onchange"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Onclick, "onclick"),
+ new HtmlAttribute (HtmlTextWriterAttribute.ReadOnly, "readonly"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Rows, "rows"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Rowspan, "rowspan"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Rules, "rules"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Selected, "selected"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Size, "size"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Src, "src"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Style, "style"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Tabindex, "tabindex"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Target, "target"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Title, "title"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Type, "type"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Valign, "valign"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Value, "value"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Width, "width"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Wrap, "wrap"),
+#if NET_2_0
+ new HtmlAttribute (HtmlTextWriterAttribute.Abbr, "abbr"),
+ new HtmlAttribute (HtmlTextWriterAttribute.AutoComplete, "autocomplete"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Axis, "axis"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Content, "content"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Coords, "coords"),
+ new HtmlAttribute (HtmlTextWriterAttribute.DesignerRegion, "_designerregion"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Dir, "dir"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Headers, "headers"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Longdesc, "longdesc"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Rel, "rel"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Scope, "scope"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Shape, "shape"),
+ new HtmlAttribute (HtmlTextWriterAttribute.Usemap, "usemap"),
+ new HtmlAttribute (HtmlTextWriterAttribute.VCardName, "vcard_name"),
+#endif
+ };
+
+ static HtmlStyle [] htmlstyles = {
+ new HtmlStyle (HtmlTextWriterStyle.BackgroundColor, "background-color"),
+ new HtmlStyle (HtmlTextWriterStyle.BackgroundImage, "background-image"),
+ new HtmlStyle (HtmlTextWriterStyle.BorderCollapse, "border-collapse"),
+ new HtmlStyle (HtmlTextWriterStyle.BorderColor, "border-color"),
+ new HtmlStyle (HtmlTextWriterStyle.BorderStyle, "border-style"),
+ new HtmlStyle (HtmlTextWriterStyle.BorderWidth, "border-width"),
+ new HtmlStyle (HtmlTextWriterStyle.Color, "color"),
+ new HtmlStyle (HtmlTextWriterStyle.FontFamily, "font-family"),
+ new HtmlStyle (HtmlTextWriterStyle.FontSize, "font-size"),
+ new HtmlStyle (HtmlTextWriterStyle.FontStyle, "font-style"),
+ new HtmlStyle (HtmlTextWriterStyle.FontWeight, "font-weight"),
+ new HtmlStyle (HtmlTextWriterStyle.Height, "height"),
+ new HtmlStyle (HtmlTextWriterStyle.TextDecoration, "text-decoration"),
+ new HtmlStyle (HtmlTextWriterStyle.Width, "width"),
+#if NET_2_0
+ new HtmlStyle (HtmlTextWriterStyle.ListStyleImage, "list-style-image"),
+ new HtmlStyle (HtmlTextWriterStyle.ListStyleType, "list-style-type"),
+ new HtmlStyle (HtmlTextWriterStyle.Cursor, "cursor"),
+ new HtmlStyle (HtmlTextWriterStyle.Direction, "direction"),
+ new HtmlStyle (HtmlTextWriterStyle.Display, "display"),
+ new HtmlStyle (HtmlTextWriterStyle.Filter, "filter"),
+ new HtmlStyle (HtmlTextWriterStyle.FontVariant, "font-variant"),
+ new HtmlStyle (HtmlTextWriterStyle.Left, "left"),
+ new HtmlStyle (HtmlTextWriterStyle.Margin, "margin"),
+ new HtmlStyle (HtmlTextWriterStyle.MarginBottom, "margin-bottom"),
+ new HtmlStyle (HtmlTextWriterStyle.MarginLeft, "margin-left"),
+ new HtmlStyle (HtmlTextWriterStyle.MarginRight, "margin-right"),
+ new HtmlStyle (HtmlTextWriterStyle.MarginTop, "margin-top"),
+ new HtmlStyle (HtmlTextWriterStyle.Overflow, "overflow"),
+ new HtmlStyle (HtmlTextWriterStyle.OverflowX, "overflow-x"),
+ new HtmlStyle (HtmlTextWriterStyle.OverflowY, "overflow-y"),
+ new HtmlStyle (HtmlTextWriterStyle.Padding, "padding"),
+ new HtmlStyle (HtmlTextWriterStyle.PaddingBottom, "padding-bottom"),
+ new HtmlStyle (HtmlTextWriterStyle.PaddingLeft, "padding-left"),
+ new HtmlStyle (HtmlTextWriterStyle.PaddingRight, "padding-right"),
+ new HtmlStyle (HtmlTextWriterStyle.PaddingTop, "padding-top"),
+ new HtmlStyle (HtmlTextWriterStyle.Position, "position"),
+ new HtmlStyle (HtmlTextWriterStyle.TextAlign, "text-align"),
+ new HtmlStyle (HtmlTextWriterStyle.VerticalAlign, "vertical-align"),
+ new HtmlStyle (HtmlTextWriterStyle.TextOverflow, "text-overflow"),
+ new HtmlStyle (HtmlTextWriterStyle.Top, "top"),
+ new HtmlStyle (HtmlTextWriterStyle.Visibility, "visibility"),
+ new HtmlStyle (HtmlTextWriterStyle.WhiteSpace, "white-space"),
+ new HtmlStyle (HtmlTextWriterStyle.ZIndex, "z-index"),
+#endif
+ };
+ }
+}
--- /dev/null
+//
+// System.Web.UI.HtmlTextWriterTag
+//
+// Author:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI {
+ [Serializable]
+ public enum HtmlTextWriterAttribute {
+ Accesskey,
+ Align,
+ Alt,
+ Background,
+ Bgcolor,
+ Border,
+ Bordercolor,
+ Cellpadding,
+ Cellspacing,
+ Checked,
+ Class,
+ Cols,
+ Colspan,
+ Disabled,
+ For,
+ Height,
+ Href,
+ Id,
+ Maxlength,
+ Multiple,
+ Name,
+ Nowrap,
+ Onchange,
+ Onclick,
+ ReadOnly,
+ Rows,
+ Rowspan,
+ Rules,
+ Selected,
+ Size,
+ Src,
+ Style,
+ Tabindex,
+ Target,
+ Title,
+ Type,
+ Valign,
+ Value,
+ Width,
+ Wrap,
+#if NET_2_0
+ Abbr,
+ AutoComplete,
+ Axis,
+ Content,
+ Coords,
+ DesignerRegion,
+ Dir,
+ Headers,
+ Longdesc,
+ Rel,
+ Scope,
+ Shape,
+ Usemap,
+ VCardName
+#endif
+ }
+}
--- /dev/null
+//
+// System.Web.UI.HtmlTextWriterStyle
+//
+// Author:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI {
+ [Serializable]
+ public enum HtmlTextWriterStyle {
+ BackgroundColor,
+ BackgroundImage,
+ BorderCollapse,
+ BorderColor,
+ BorderStyle,
+ BorderWidth,
+ Color,
+ FontFamily,
+ FontSize,
+ FontStyle,
+ FontWeight,
+ Height,
+ TextDecoration,
+ Width,
+#if NET_2_0
+ ListStyleImage,
+ ListStyleType,
+ Cursor,
+ Direction,
+ Display,
+ Filter,
+ FontVariant,
+ Left,
+ Margin,
+ MarginBottom,
+ MarginLeft,
+ MarginRight,
+ MarginTop,
+ Overflow,
+ OverflowX,
+ OverflowY,
+ Padding,
+ PaddingBottom,
+ PaddingLeft,
+ PaddingRight,
+ PaddingTop,
+ Position,
+ TextAlign,
+ VerticalAlign,
+ TextOverflow,
+ Top,
+ Visibility,
+ WhiteSpace,
+ ZIndex
+#endif
+ }
+
+}
--- /dev/null
+//
+// System.Web.UI.HtmlTextWriterTag
+//
+// Author:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI {
+ [Serializable]
+ public enum HtmlTextWriterTag {
+ Unknown,
+ A,
+ Acronym,
+ Address,
+ Area,
+ B,
+ Base,
+ Basefont,
+ Bdo,
+ Bgsound,
+ Big,
+ Blockquote,
+ Body,
+ Br,
+ Button,
+ Caption,
+ Center,
+ Cite,
+ Code,
+ Col,
+ Colgroup,
+ Dd,
+ Del,
+ Dfn,
+ Dir,
+ Div,
+ Dl,
+ Dt,
+ Em,
+ Embed,
+ Fieldset,
+ Font,
+ Form,
+ Frame,
+ Frameset,
+ H1,
+ H2,
+ H3,
+ H4,
+ H5,
+ H6,
+ Head,
+ Hr,
+ Html,
+ I,
+ Iframe,
+ Img,
+ Input,
+ Ins,
+ Isindex,
+ Kbd,
+ Label,
+ Legend,
+ Li,
+ Link,
+ Map,
+ Marquee,
+ Menu,
+ Meta,
+ Nobr,
+ Noframes,
+ Noscript,
+ Object,
+ Ol,
+ Option,
+ P,
+ Param,
+ Pre,
+ Q,
+ Rt,
+ Ruby,
+ S,
+ Samp,
+ Script,
+ Select,
+ Small,
+ Span,
+ Strike,
+ Strong,
+ Style,
+ Sub,
+ Sup,
+ Table,
+ Tbody,
+ Td,
+ Textarea,
+ Tfoot,
+ Th,
+ Thead,
+ Title,
+ Tr,
+ Tt,
+ U,
+ Ul,
+ Var,
+ Wbr,
+ Xml
+ }
+}
--- /dev/null
+//
+// System.Web.UI.Pair
+//
+// Author:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.UI {
+ public class Pair {
+
+ public Pair (object first, object second)
+ {
+ First = first;
+ Second = second;
+ }
+
+ public Pair ()
+ {
+ }
+
+ public object First;
+ public object Second;
+ }
+}
--- /dev/null
+//
+// System.Web.UI.StateBag
+//
+// Author:
+// Ben Maurer <bmaurer@novell.com>
+//
+// (c) 2005 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+
+
+ public sealed class StateBag : IDictionary, IStateManager {
+
+ HybridDictionary ht;
+ bool track;
+
+ public StateBag (bool ignoreCase)
+ {
+ ht = new HybridDictionary (ignoreCase);
+ }
+
+ public StateBag () : this (false)
+ {
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ LoadViewState (savedState);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ return SaveViewState ();
+ }
+
+
+ void IStateManager.TrackViewState ()
+ {
+ TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get {
+ return track;
+ }
+ }
+
+ internal bool IsTrackingViewState {
+ get {
+ return track;
+ }
+ }
+
+
+ internal void LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ foreach (DictionaryEntry de in (Hashtable) savedState)
+ Add ((string) de.Key, de.Value);
+ }
+
+ internal object SaveViewState ()
+ {
+ Hashtable h = null;
+
+ foreach (DictionaryEntry de in ht) {
+ StateItem si = (StateItem) de.Value;
+ if (si.IsDirty) {
+ if (h == null)
+ h = new Hashtable ();
+ h.Add (de.Key, si.Value);
+ }
+ }
+
+ return h;
+ }
+
+ internal void TrackViewState ()
+ {
+ track = true;
+ }
+
+ public StateItem Add (string key, object value)
+ {
+ StateItem si = ht [key] as StateItem;
+ if (si == null)
+ ht [key] = si = new StateItem (value);
+ si.Value = value;
+ si.IsDirty |= track;
+
+ return si;
+ }
+
+ internal string GetString (string key, string def)
+ {
+ string s = (string) this [key];
+ return s == null ? def : s;
+ }
+
+ internal bool GetBool (string key, bool def)
+ {
+ object o = this [key];
+ return o == null ? def : (bool) o;
+ }
+
+ internal int GetInt (string key, int def)
+ {
+ object o = this [key];
+ return o == null ? def : (int) o;
+ }
+
+ internal short GetShort (string key, short def)
+ {
+ object o = this [key];
+ return o == null ? def : (short) o;
+ }
+
+ public void Clear ()
+ {
+ ht.Clear ();
+ }
+
+ public IDictionaryEnumerator GetEnumerator ()
+ {
+ return ht.GetEnumerator ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ public bool IsItemDirty (string key)
+ {
+ StateItem si = ht [key] as StateItem;
+ return si != null && si.IsDirty;
+ }
+
+ public void Remove (string key)
+ {
+ ht.Remove (key);
+ }
+
+ public void SetItemDirty (string key, bool dirty)
+ {
+ StateItem si = (StateItem) ht [key];
+ if (si != null)
+ si.IsDirty = dirty;
+ }
+
+ public int Count {
+ get {
+ return ht.Count;
+ }
+ }
+
+ public object this [string key] {
+ get {
+ StateItem i = ht [key] as StateItem;
+ if (i != null)
+ return i.Value;
+ return null;
+ }
+
+ set {
+ if (value == null && ! IsTrackingViewState)
+ Remove (key);
+ else
+ Add (key, value);
+ }
+ }
+
+ public ICollection Keys {
+ get {
+ return ht.Keys;
+ }
+
+ }
+
+ public ICollection Values {
+ get {
+ return ht.Values;
+ }
+ }
+
+ void IDictionary.Add (object key, object value)
+ {
+ Add ((string) key, value);
+ }
+
+ void IDictionary.Remove (object key)
+ {
+ Remove ((string) key);
+ }
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ ht.CopyTo (array, index);
+ }
+
+ bool IDictionary.Contains (object key)
+ {
+ return ht.Contains (key);
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ return ht;
+ }
+ }
+
+ object IDictionary.this [object key] {
+ get {
+ return this [(string) key];
+ }
+
+ set {
+ this [(string) key] = value;
+ }
+ }
+
+ bool IDictionary.IsFixedSize {
+ get {
+ return false;
+ }
+ }
+
+ bool IDictionary.IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+#if NET_2_0
+ public void SetDirty (bool dirty)
+ {
+ foreach (DictionaryEntry de in ht) {
+ StateItem si = (StateItem) de.Value;
+ si.IsDirty = dirty;
+ }
+ }
+
+ internal void SetDirty ()
+ {
+ // Just lets me compile
+ }
+#endif
+ }
+}