Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@novell.com>2005-06-13 20:55:11 +0400
committerLluis Sanchez <lluis@novell.com>2005-06-13 20:55:11 +0400
commitf3846ab1a87203755c6b3377ea1547fdb1713663 (patch)
tree1adf742654eecd9a03876a96046838f6405ba1f0 /mcs
parent563425bb505eb531296b490f9b6c4de1302ba647 (diff)
2005-06-13 Lluis Sanchez Gual <lluis@novell.com>
* PageParser.cs: Added MasterType property. Get the type from the MasterType directive. * MasterPageParser.cs: Added GetCompiledMasterType method. svn path=/trunk/mcs/; revision=45884
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.Web/System.Web.UI/ChangeLog6
-rw-r--r--mcs/class/System.Web/System.Web.UI/MasterPageParser.cs6
-rw-r--r--mcs/class/System.Web/System.Web.UI/PageParser.cs31
3 files changed, 43 insertions, 0 deletions
diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog
index 43aeafc3b1b..f63beb24d18 100644
--- a/mcs/class/System.Web/System.Web.UI/ChangeLog
+++ b/mcs/class/System.Web/System.Web.UI/ChangeLog
@@ -1,3 +1,9 @@
+2005-06-13 Lluis Sanchez Gual <lluis@novell.com>
+
+ * PageParser.cs: Added MasterType property. Get the type from the
+ MasterType directive.
+ * MasterPageParser.cs: Added GetCompiledMasterType method.
+
2005-06-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UserControl.cs:
diff --git a/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs b/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs
index ac8a9407e5e..6eceb28a861 100644
--- a/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs
+++ b/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs
@@ -52,6 +52,12 @@ namespace System.Web.UI
return (MasterPage) mpp.GetCompiledInstance ();
}
+ public static Type GetCompiledMasterType (string virtualPath, string inputFile, HttpContext context)
+ {
+ MasterPageParser mpp = new MasterPageParser (virtualPath, inputFile, context);
+ return mpp.CompileIntoType ();
+ }
+
internal override Type DefaultBaseType {
get { return typeof (MasterPage); }
}
diff --git a/mcs/class/System.Web/System.Web.UI/PageParser.cs b/mcs/class/System.Web/System.Web.UI/PageParser.cs
index cbc72569bfc..8490c6e4850 100644
--- a/mcs/class/System.Web/System.Web.UI/PageParser.cs
+++ b/mcs/class/System.Web/System.Web.UI/PageParser.cs
@@ -60,6 +60,7 @@ namespace System.Web.UI
#if NET_2_0
string masterPage;
+ Type masterType;
#endif
public PageParser ()
@@ -243,6 +244,9 @@ namespace System.Web.UI
#if NET_2_0
masterPage = GetString (atts, "MasterPageFile", null);
+
+ // Make sure the page exists
+ MasterPageParser.GetCompiledMasterType (masterPage, HttpContext.Current.Request.MapPath (masterPage), HttpContext.Current);
#endif
// Ignored by now
GetString (atts, "EnableViewStateMac", null);
@@ -251,6 +255,29 @@ namespace System.Web.UI
base.ProcessMainAttributes (atts);
}
+#if NET_2_0
+ internal override void AddDirective (string directive, Hashtable atts)
+ {
+ if (String.Compare ("MasterType", directive, true) == 0) {
+ string type = GetString (atts, "TypeName", null);
+ if (type != null) {
+ masterType = LoadType (type);
+ if (masterType == null)
+ ThrowParseException ("Could not load type '" + type + "'.");
+ } else {
+ string path = GetString (atts, "VirtualPath", null);
+ if (path != null)
+ masterType = MasterPageParser.GetCompiledMasterType (path, HttpContext.Current.Request.MapPath (path), HttpContext.Current);
+ else
+ ThrowParseException ("The MasterType directive must have either a TypeName or a VirtualPath attribute.");
+ }
+ AddAssembly (masterType.Assembly, true);
+ }
+ else
+ base.AddDirective (directive, atts);
+ }
+#endif
+
static string SuggestCulture (string culture)
{
string retval = null;
@@ -343,6 +370,10 @@ namespace System.Web.UI
internal string MasterPageFile {
get { return masterPage; }
}
+
+ internal Type MasterType {
+ get { return masterType; }
+ }
#endif
}
}