Author: mhabersack
Date: 2007-05-04 06:58:11 -0400 (Fri, 04 May 2007)
New Revision: 76665
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.HtmlControls/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI/Control.cs
Log:
Another in the series of compatibility fixes discovered thanks to the
QuickStarts... :)
2007-05-04 Marek Habersack <[EMAIL PROTECTED]>
* HtmlAnchor.cs: use ResolveClientUrl when generating
attributes. Necessary if the control is in a master page which is
in a different directory than the current page.
2007-05-04 Marek Habersack <[EMAIL PROTECTED]>
* AdRotator.cs: use the new GetPhysicalFilePath method to look up
the physical path of the ad file.
2007-05-04 Marek Habersack <[EMAIL PROTECTED]>
* TemplateControlCompiler.cs: do not query the parent for
TemplateSourceDirectory if we are generating code for a Master
Page.
2007-05-04 Marek Habersack <[EMAIL PROTECTED]>
* Control.cs: added an internal method to resolve a physical path
to a file from its virtual path considering the possibility that a
control is placed in a master page, which in turn is referenced
from a directory another than that of master page itself.
Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-05-04
10:30:45 UTC (rev 76664)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-05-04
10:58:11 UTC (rev 76665)
@@ -1,3 +1,9 @@
+2007-05-04 Marek Habersack <[EMAIL PROTECTED]>
+
+ * TemplateControlCompiler.cs: do not query the parent for
+ TemplateSourceDirectory if we are generating code for a Master
+ Page.
+
2007-04-30 Marek Habersack <[EMAIL PROTECTED]>
* ConnectionStringsExpressionBuilder.cs: support expressions with
Modified:
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
2007-05-04 10:30:45 UTC (rev 76664)
+++
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
2007-05-04 10:58:11 UTC (rev 76665)
@@ -1449,24 +1449,26 @@
prop.Name = "TemplateSourceDirectory";
prop.Attributes = MemberAttributes.Public |
MemberAttributes.Override;
- // if ((this.Parent != null))
- // return this.Parent.TemplateSourceDirectory;
- CodeFieldReferenceExpression parentField = new
CodeFieldReferenceExpression ();
- parentField.TargetObject = thisRef;
- parentField.FieldName = "Parent";
+ if (!(parser is MasterPageParser)) {
+ // if ((this.Parent != null))
+ // return this.Parent.TemplateSourceDirectory;
+ CodeFieldReferenceExpression parentField = new
CodeFieldReferenceExpression ();
+ parentField.TargetObject = thisRef;
+ parentField.FieldName = "Parent";
- CodeFieldReferenceExpression tsdField = new
CodeFieldReferenceExpression ();
- tsdField.TargetObject = parentField;
- tsdField.FieldName = "TemplateSourceDirectory";
+ CodeFieldReferenceExpression tsdField = new
CodeFieldReferenceExpression ();
+ tsdField.TargetObject = parentField;
+ tsdField.FieldName = "TemplateSourceDirectory";
- CodeMethodReturnStatement parentRet = new
CodeMethodReturnStatement (tsdField);
- CodeConditionStatement condStatement = new
CodeConditionStatement (
- new CodeBinaryOperatorExpression (parentField,
-
CodeBinaryOperatorType.IdentityInequality,
- new
CodePrimitiveExpression (null)),
- parentRet);
+ CodeMethodReturnStatement parentRet = new
CodeMethodReturnStatement (tsdField);
+ CodeConditionStatement condStatement = new
CodeConditionStatement (
+ new CodeBinaryOperatorExpression
(parentField,
+
CodeBinaryOperatorType.IdentityInequality,
+ new
CodePrimitiveExpression (null)),
+ parentRet);
- prop.GetStatements.Add (condStatement);
+ prop.GetStatements.Add (condStatement);
+ }
string tsd, bvd = parser.BaseVirtualDir;
int len = bvd.Length;
Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2007-05-04 10:30:45 UTC
(rev 76664)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2007-05-04 10:58:11 UTC
(rev 76665)
@@ -1,3 +1,10 @@
+2007-05-04 Marek Habersack <[EMAIL PROTECTED]>
+
+ * Control.cs: added an internal method to resolve a physical path
+ to a file from its virtual path considering the possibility that a
+ control is placed in a master page, which in turn is referenced
+ from a directory another than that of master page itself.
+
2007-05-03 Igor Zelmanovich <[EMAIL PROTECTED]>
* AttributeCollection.cs:
Modified: trunk/mcs/class/System.Web/System.Web.UI/Control.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/Control.cs 2007-05-04 10:30:45 UTC
(rev 76664)
+++ trunk/mcs/class/System.Web/System.Web.UI/Control.cs 2007-05-04 10:58:11 UTC
(rev 76665)
@@ -220,10 +220,10 @@
}
#if NET_2_0
- internal string UniqueID2ClientID (string uniqueId)
- {
- return uniqueId.Replace (IdSeparator,
ClientIDSeparator);
- }
+ internal string UniqueID2ClientID (string uniqueId)
+ {
+ return uniqueId.Replace (IdSeparator,
ClientIDSeparator);
+ }
protected char ClientIDSeparator
#else
@@ -947,6 +947,46 @@
throw new HttpException ("Access to the
specified file was denied.");
}
}
+
+ internal string GetPhysicalFilePath (string virtualPath)
+ {
+ Page page = Page;
+
+ if (VirtualPathUtility.IsAbsolute (virtualPath))
+ return page != null ? page.MapPath
(virtualPath) : Context.Server.MapPath (virtualPath);
+
+ // We need to determine whether one of our parents is a
+ // master page. If so, we need to map the path
+ // relatively to the master page and not our containing
+ // page/control. This is necessary for cases when a
+ // relative path is used in a control placed in a master
+ // page and the master page is referenced from a
+ // location other than its own. In such cases MS.NET
looks
+ // for the file in the directory where the master page
+ // is.
+ //
+ // An example of where it is needed is at
+ //
+ //
http://quickstarts.asp.net/QuickStartv20/aspnet/samples/masterpages/masterpages_cs/pages/default.aspx
+ //
+ MasterPage master = null;
+ Control ctrl = Parent;
+
+ while (ctrl != null) {
+ if (ctrl is MasterPage) {
+ master = ctrl as MasterPage;
+ break;
+ }
+ ctrl = ctrl.Parent;
+ }
+
+ string path;
+ if (master != null)
+ path = VirtualPathUtility.Combine
(master.TemplateSourceDirectory, virtualPath);
+ else
+ path = VirtualPathUtility.Combine
(TemplateSourceDirectory, virtualPath);
+ return page != null ? page.MapPath (path) :
Context.Server.MapPath (path);
+ }
#endif
protected void RaiseBubbleEvent(object source, EventArgs args)
Modified: trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
2007-05-04 10:30:45 UTC (rev 76664)
+++ trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
2007-05-04 10:58:11 UTC (rev 76665)
@@ -1,3 +1,9 @@
+2007-05-04 Marek Habersack <[EMAIL PROTECTED]>
+
+ * HtmlAnchor.cs: use ResolveClientUrl when generating
+ attributes. Necessary if the control is in a master page which is
+ in a different directory than the current page.
+
2007-05-01 Marek Habersack <[EMAIL PROTECTED]>
* HtmlForm.cs: do not use User-Agent directly, we must take
Modified: trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
2007-05-04 10:30:45 UTC (rev 76664)
+++ trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
2007-05-04 10:58:11 UTC (rev 76665)
@@ -50,13 +50,13 @@
[DefaultValue ("")]
- [WebSysDescription("")]
- [WebCategory("Action")]
- [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription("")]
+ [WebCategory("Action")]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
#if NET_2_0
- [UrlProperty]
+ [UrlProperty]
#endif
- public string HRef {
+ public string HRef {
get {
string s = Attributes ["href"];
return (s == null) ? String.Empty : s;
@@ -71,10 +71,10 @@
}
[DefaultValue ("")]
- [WebSysDescription("")]
- [WebCategory("Navigation")]
- [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
- public string Name {
+ [WebSysDescription("")]
+ [WebCategory("Navigation")]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ public string Name {
get {
string s = Attributes ["name"];
return (s == null) ? String.Empty : s;
@@ -88,10 +88,10 @@
}
[DefaultValue ("")]
- [WebSysDescription("")]
- [WebCategory("Navigation")]
- [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
- public string Target {
+ [WebSysDescription("")]
+ [WebCategory("Navigation")]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ public string Target {
get {
string s = Attributes ["target"];
return (s == null) ? String.Empty : s;
@@ -105,13 +105,13 @@
}
[DefaultValue ("")]
- [WebSysDescription("")]
- [WebCategory("Appearance")]
- [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
#if NET_2_0
- [Localizable (true)]
+ [Localizable (true)]
#endif
- public string Title {
+ public string Title {
get {
string s = Attributes ["title"];
return (s == null) ? String.Empty : s;
@@ -126,7 +126,7 @@
#if NET_2_0
[DefaultValue (true)]
- public virtual bool CausesValidation {
+ public virtual bool CausesValidation {
get {
return ViewState.GetBool ("CausesValidation",
true);
}
@@ -136,7 +136,7 @@
}
[DefaultValue ("")]
- public virtual string ValidationGroup {
+ public virtual string ValidationGroup {
get {
return ViewState.GetString ("ValidationGroup",
String.Empty);
}
@@ -149,9 +149,9 @@
#if NET_2_0
protected internal
#else
- protected
+ protected
#endif
- override void OnPreRender (EventArgs e)
+ override void OnPreRender (EventArgs e)
{
base.OnPreRender (e);
}
@@ -186,9 +186,9 @@
if (hr != "")
#if TARGET_J2EE
// For J2EE portlets we need to
genreate a render URL.
- HRef = ResolveUrl (hr, String.Compare
(target, "_blank", StringComparison.InvariantCultureIgnoreCase) != 0);
+ HRef = ResolveClientUrl (hr,
String.Compare (target, "_blank", StringComparison.InvariantCultureIgnoreCase)
!= 0);
#else
- HRef = ResolveUrl (hr);
+ HRef = ResolveClientUrl (hr);
#endif
}
@@ -233,8 +233,8 @@
[WebSysDescription("")]
- [WebCategory("Action")]
- public event EventHandler ServerClick {
+ [WebCategory("Action")]
+ public event EventHandler ServerClick {
add { Events.AddHandler (serverClickEvent, value); }
remove { Events.RemoveHandler (serverClickEvent,
value); }
}
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
2007-05-04 10:30:45 UTC (rev 76664)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
2007-05-04 10:58:11 UTC (rev 76665)
@@ -70,7 +70,13 @@
Hashtable ht = null;
if (ad_file != "" && ad_file != null) {
- ReadAdsFromFile (Page.MapPath (ad_file));
+ ReadAdsFromFile (
+#if NET_2_0
+ GetPhysicalFilePath (ad_file)
+#else
+ Page.MapPath (ad_file)
+#endif
+ );
ht = ChooseAd ();
}
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2007-05-04 10:30:45 UTC (rev 76664)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2007-05-04 10:58:11 UTC (rev 76665)
@@ -1,3 +1,8 @@
+2007-05-04 Marek Habersack <[EMAIL PROTECTED]>
+
+ * AdRotator.cs: use the new GetPhysicalFilePath method to look up
+ the physical path of the ad file.
+
2007-05-03 Marek Habersack <[EMAIL PROTECTED]>
* TreeView.cs: honor ChildNodesPadding of the NodeStyle.
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches