Author: mhabersack
Date: 2007-03-26 06:42:01 -0500 (Mon, 26 Mar 2007)
New Revision: 74972

Modified:
   trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
   trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
   trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
Log:
2007-03-26  Marek Habersack  <[EMAIL PROTECTED]>

        * TemplateParser.cs: support the meta:resourcekey attribute in
        Page and Control directives. Fixes bug #81204.

2007-03-26  Marek Habersack  <[EMAIL PROTECTED]>

        * TemplateControlCompiler.cs: refactor assining properties from
        resources a bit to support pages and user controls. Fixes bug
        #81204.


Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-03-26 
10:42:33 UTC (rev 74971)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-03-26 
11:42:01 UTC (rev 74972)
@@ -1,3 +1,9 @@
+2007-03-26  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * TemplateControlCompiler.cs: refactor assining properties from
+       resources a bit to support pages and user controls. Fixes bug
+       #81204.
+
 2007-03-21  Marek Habersack  <[EMAIL PROTECTED]>
 
        * BaseCompiler.cs: cast 'this' to CodeFileBaseClass in

Modified: 
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
===================================================================
--- 
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs    
    2007-03-26 10:42:33 UTC (rev 74971)
+++ 
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs    
    2007-03-26 11:42:01 UTC (rev 74972)
@@ -348,7 +348,7 @@
                                }
 #endif
                        }
-
+                       
                        mainClass.Members.Add (method);
                }
 
@@ -787,18 +787,9 @@
 //                     ccs.TrueStatements.Add (assign);
                        method.Statements.Add (assign);
                }
-               
-               void AssignPropertiesFromResources (ControlBuilder builder, 
string attvalue)
+
+               void AssignPropertiesFromResources (CodeMemberMethod method, 
Type controlType, string attvalue)
                {
-                       if (attvalue == null || attvalue.Length == 0)
-                               return;
-                       
-                       Type controlType = builder.ControlType;
-                       if (controlType == null)
-                               return;
-
-                       // object obj = null;
-                       
                        // Process all public fields and properties of the 
control. We don't use GetMembers to make the code
                        // faster
                        FieldInfo [] fields = controlType.GetFields (
@@ -813,14 +804,26 @@
                                        typeof (object),
                                        "localResourceObject",
                                        new CodePrimitiveExpression (null));
-                               builder.method.Statements.Add (cvds);
+                               method.Statements.Add (cvds);
                        }
                        
                        foreach (FieldInfo fi in fields)
-                               AssignPropertyFromResources (builder.method, 
fi, attvalue, "localResourceObject");
+                               AssignPropertyFromResources (method, fi, 
attvalue, "localResourceObject");
                        foreach (PropertyInfo pi in properties)
-                               AssignPropertyFromResources (builder.method, 
pi, attvalue, "localResourceObject");
+                               AssignPropertyFromResources (method, pi, 
attvalue, "localResourceObject");
                }
+               
+               void AssignPropertiesFromResources (ControlBuilder builder, 
string attvalue)
+               {
+                       if (attvalue == null || attvalue.Length == 0)
+                               return;
+                       
+                       Type controlType = builder.ControlType;
+                       if (controlType == null)
+                               return;
+
+                       AssignPropertiesFromResources (builder.method, 
controlType, attvalue);
+               }
 #endif
                
                void AddEventAssign (CodeMemberMethod method, string name, Type 
type, string value)
@@ -839,7 +842,7 @@
                {
                        EventInfo [] ev_info = null;
                        Type type = builder.ControlType;
-
+                       
                        string attvalue = builder.attribs [id] as string;
                        if (id.Length > 2 && id.Substring (0, 2).ToUpper () == 
"ON"){
                                if (ev_info == null)
@@ -1385,6 +1388,12 @@
                        
                        if (!childrenAsProperties && typeof 
(Control).IsAssignableFrom (builder.ControlType))
                                builder.method.Statements.Add (new 
CodeMethodReturnStatement (ctrlVar));
+
+#if NET_2_0
+                       if (builder is RootBuilder)
+                               if (!String.IsNullOrEmpty 
(parser.MetaResourceKey))
+                                       AssignPropertiesFromResources 
(builder.method, parser.BaseType, parser.MetaResourceKey);
+#endif
                }
                
                protected internal override void CreateMethods ()

Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2007-03-26 10:42:33 UTC 
(rev 74971)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2007-03-26 11:42:01 UTC 
(rev 74972)
@@ -1,3 +1,8 @@
+2007-03-26  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * TemplateParser.cs: support the meta:resourcekey attribute in
+       Page and Control directives. Fixes bug #81204.
+
 2007-03-21  Marek Habersack  <[EMAIL PROTECTED]>
 
        * UnknownAttributeDescriptor.cs: an internal helper class for

Modified: trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs  2007-03-26 
10:42:33 UTC (rev 74971)
+++ trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs  2007-03-26 
11:42:01 UTC (rev 74972)
@@ -80,6 +80,7 @@
                string src;
                string partialClassName;
                string codeFileBaseClass;
+               string metaResourceKey;
                Type codeFileBaseClassType;
                List <UnknownAttributeDescriptor> unknownMainAttributes;
 #endif
@@ -598,6 +599,9 @@
                                ThrowParseException (String.Format ("'{0}' is 
not valid for 'className'", className));
 
 #if NET_2_0
+                       if (this is TemplateControlParser)
+                               metaResourceKey = GetString (atts, 
"meta:resourcekey", null);
+                       
                        if (inherits != null && (this is PageParser || this is 
UserControlParser) && atts.Count > 0) {
                                if (unknownMainAttributes == null)
                                        unknownMainAttributes = new List 
<UnknownAttributeDescriptor> ();
@@ -745,21 +749,22 @@
                }
 
 #if NET_2_0
-               internal bool IsPartial
-               {
+               internal bool IsPartial {
                        get { return src != null; }
                }
 
-               internal string PartialClassName
-               {
+               internal string PartialClassName {
                        get { return partialClassName; }
                }
 
-               internal string CodeFileBaseClass
-               {
+               internal string CodeFileBaseClass {
                        get { return codeFileBaseClass; }
                }
 
+               internal string MetaResourceKey {
+                       get { return metaResourceKey; }
+               }
+               
                internal Type CodeFileBaseClassType
                {
                        get { return codeFileBaseClassType; }

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

Reply via email to