2006-02-12 Cesar Lopez Nataren <cnataren@novell.com>
[mono.git] / mcs / class / System.Web / System.Web.UI / HtmlTextWriter.cs
index 51f71a24939dd4ffb8a1dcc51f59881e6dd49c9b..925d94316272c7803ff67a582489dcd67734cb72 100644 (file)
@@ -137,22 +137,21 @@ namespace System.Web.UI {
                        b.Close ();     
                }
 
-               [MonoTODO]
                protected virtual string EncodeAttributeValue (HtmlTextWriterAttribute attrKey, string value)
                {
-                       return value;
+                       return HttpUtility.HtmlEncode (value);
                }
                
-               [MonoTODO]
                protected string EncodeAttributeValue (string value, bool fEncode)
                {
+                       if (fEncode)
+                               return HttpUtility.HtmlEncode (value);
                        return value;
                }
                
-               [MonoTODO]
                protected string EncodeUrl (string url)
                {
-                       return url;
+                       return HttpUtility.UrlPathEncode (url);
                }
                
 
@@ -205,11 +204,11 @@ namespace System.Web.UI {
                        // faster than a linear search?
                        
                        foreach (HtmlAttribute t in htmlattrs) {
-                               if (t.name == attrName)
+                               if (String.Compare(t.name, attrName, true, CultureInfo.InvariantCulture) == 0)
                                        return t.key;
                        }
 
-                       return 0;               
+                       return (HtmlTextWriterAttribute)(-1);           
                }
 
                [MonoTODO]
@@ -230,11 +229,11 @@ namespace System.Web.UI {
                        // faster than a linear search?
                        
                        foreach (HtmlStyle t in htmlstyles) {
-                               if (t.name == styleName)
+                               if (String.Compare(t.name, styleName, true, CultureInfo.InvariantCulture) == 0)
                                        return t.key;
                        }
 
-                       return 0;                       
+                       return (HtmlTextWriterStyle)(-1);                       
                }
                
                [MonoTODO]
@@ -252,7 +251,7 @@ namespace System.Web.UI {
                        // faster than a linear search?
                        
                        foreach (HtmlTag t in tags) {
-                               if (t.name == tagName)
+                               if (String.Compare(t.name, tagName, true, CultureInfo.InvariantCulture) == 0)
                                        return t.key;
                        }
 
@@ -334,7 +333,7 @@ namespace System.Web.UI {
                        if (! newline)
                                return;
                        newline = false;
-                       
+
                        for (int i = 0; i < Indent; i ++)
                                b.Write (tab_string);
                }
@@ -1114,5 +1113,20 @@ namespace System.Web.UI {
                        new HtmlStyle (HtmlTextWriterStyle.ZIndex,             "z-index"),
 #endif
                };
+
+#if NET_2_0
+               public virtual bool IsValidFormAttribute (string attribute)
+               {
+                       return true;
+               }
+
+               // writes <br />
+               public virtual void WriteBreak ()
+               {
+                       string br = GetTagName (HtmlTextWriterTag.Br);
+                       WriteBeginTag (br);
+                       Write (SelfClosingTagEnd);
+               }
+#endif
        }
 }