Author: lluis
Date: 2005-04-19 14:21:25 -0400 (Tue, 19 Apr 2005)
New Revision: 43277

Modified:
   trunk/mcs/class/System.Web/System.Web.Compilation/AspParser.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
   trunk/mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs
Log:
2005-04-19  Lluis Sanchez Gual <[EMAIL PROTECTED]>

        * AspParser.cs: Fixed parsing of data binding tags in server
        tag attributes. Allow <%...%> blocks not assigned to
        attributes in client tags.
        * TagAttributes.cs: Make sure that data binding blocks in server
        tags are always assigned to attributes.

        * TemplateControlCompiler.cs: Implemented support for two-way
        binding.


Modified: trunk/mcs/class/System.Web/System.Web.Compilation/AspParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/AspParser.cs      
2005-04-19 18:00:01 UTC (rev 43276)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/AspParser.cs      
2005-04-19 18:21:25 UTC (rev 43277)
@@ -309,20 +309,32 @@
 
                        attributes = new TagAttributes ();
                        while ((token = tokenizer.get_token ()) != Token.EOF){
+                               if (token == '<' && Eat ('%')) {
+                                       tokenizer.Verbatim = true;
+                                       attributes.Add ("", "<%" + 
+                                                       GetVerbatim 
(tokenizer.get_token (), "%>") + "%>");
+                                       tokenizer.Verbatim = false;
+                                       tokenizer.InTag = true;
+                                       continue;
+                               }
+                                       
                                if (token != Token.IDENTIFIER)
                                        break;
+
                                id = tokenizer.Value;
                                if (Eat ('=')){
                                        if (Eat (Token.ATTVALUE)){
                                                attributes.Add (id, 
tokenizer.Value);
                                        } else if (Eat ('<') && Eat ('%')) {
-                                               attributes.Add (id, "<%" +
-                                                               GetVerbatim 
(tokenizer.get_token (), "%>"));
+                                               tokenizer.Verbatim = true;
+                                               attributes.Add (id, "<%" + 
+                                                               GetVerbatim 
(tokenizer.get_token (), "%>") + "%>");
+                                               tokenizer.Verbatim = false;
+                                               tokenizer.InTag = true;
                                        } else {
                                                OnError ("expected ATTVALUE");
                                                return null;
                                        }
-                                       
                                } else {
                                        attributes.Add (id, null);
                                }

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2005-04-19 
18:00:01 UTC (rev 43276)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2005-04-19 
18:21:25 UTC (rev 43277)
@@ -1,6 +1,15 @@
+2005-04-19  Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+       * AspParser.cs: Fixed parsing of data binding tags in server
+       tag attributes. Allow <%...%> blocks not assigned to
+       attributes in client tags.
+       * TagAttributes.cs: Make sure that data binding blocks in server
+       tags are always assigned to attributes.
+
 2005-04-15  Lluis Sanchez Gual <[EMAIL PROTECTED]>
 
-       * TemplateControlCompiler.cs: 
+       * TemplateControlCompiler.cs: Implemented support for two-way
+       binding.
 
 2005-04-14  Lluis Sanchez Gual <[EMAIL PROTECTED]>
 

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs  
2005-04-19 18:00:01 UTC (rev 43276)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs  
2005-04-19 18:21:25 UTC (rev 43277)
@@ -53,8 +53,10 @@
                {
                        atts_hash = new Hashtable 
(CaseInsensitiveHashCodeProvider.Default,
                                                   
CaseInsensitiveComparer.Default);
-                       for (int i = 0; i < keys.Count; i++)
+                       for (int i = 0; i < keys.Count; i++) {
+                               CheckServerKey (keys [i]);
                                atts_hash.Add (keys [i], values [i]);
+                       }
                        got_hashed = true;
                        keys = null;
                        values = null;
@@ -82,6 +84,7 @@
                                value = HttpUtility.HtmlDecode (value.ToString 
());
 
                        if (got_hashed) {
+                               CheckServerKey (key);
                                if (atts_hash.ContainsKey (key))
                                        throw new HttpException ("Tag contains 
duplicated '" + key +
                                                                 "' 
attributes.");
@@ -126,9 +129,10 @@
                        }
 
                        set {
-                               if (got_hashed)
+                               if (got_hashed) {
+                                       CheckServerKey (key);
                                        atts_hash [key] = value;
-                               else {
+                               } else {
                                        int idx = CaseInsensitiveSearch 
((string) key);
                                        keys [idx] = value;
                                }
@@ -183,6 +187,12 @@
                                
                        return result.ToString ();
                }
+               
+               void CheckServerKey (object key)
+               {
+                       if (key == null || ((string)key).Length == 0)
+                               throw new HttpException ("The server tag is not 
well formed.");
+               }
        }
 }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to