瀏覽代碼

2009-06-16 Marek Habersack <[email protected]>

	* HtmlHeadBuilder.cs: use faster String.Compare overloads.

	* HtmlHead.cs: implemented 4.0 properties Description and
	Keywords.

2009-06-16  Marek Habersack  <[email protected]>

	* IPersistedSelector.cs: removed AspNetHostingPermission
	attributes from the 4.0 profile.

	* IDataBoundControl.cs, IDataBoundItemControl.cs,
	IDataBoundListControl.cs, IFieldControl.cs: added

	* DetailsView.cs: control implements 4.0 IDataBoundItemControl
	interface.

	* DataBoundControl.cs: implemented 4.0 property DataSourceObject
	and made the InternalPerformDataBinding method internal for the
	4.0 profile.

2009-06-16  Marek Habersack  <[email protected]>

	* net_4_0_System.Web.dll.sources:
	Added
	System.Web.UI.WebControls/IDataBoundControl.cs,
	System.Web.UI.WebControls/IDataBoundItemControl.cs,
	System.Web.UI.WebControls/IDataBoundListControl.cs,,
	System.Web.UI.WebControls/IFieldControl.cs

svn path=/trunk/mcs/; revision=136192
Marek Habersack 16 年之前
父節點
當前提交
2ad931f695

+ 5 - 1
mcs/class/System.Web/ChangeLog

@@ -3,7 +3,11 @@
 	* net_4_0_System.Web.dll.sources: added. System.Web.Routing and
 	System.Web.Abstractions are part of System.Web.dll in the 4.0
 	profile.
-	Added System.Web.Routing/PageRouteHandler.cs
+	Added System.Web.Routing/PageRouteHandler.cs,
+	System.Web.UI.WebControls/IDataBoundControl.cs,
+	System.Web.UI.WebControls/IDataBoundItemControl.cs,
+	System.Web.UI.WebControls/IDataBoundListControl.cs,,
+	System.Web.UI.WebControls/IFieldControl.cs
 
 2009-06-04  Marek Habersack  <[email protected]>
 

+ 7 - 0
mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog

@@ -1,3 +1,10 @@
+2009-06-16  Marek Habersack  <[email protected]>
+
+	* HtmlHeadBuilder.cs: use faster String.Compare overloads.
+
+	* HtmlHead.cs: implemented 4.0 properties Description and
+	Keywords.
+
 2009-06-11 Gonzalo Paniagua Javier <[email protected]>
 
 	* HtmlTitle.cs: HtmlTitle allows children that are not

+ 56 - 3
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHead.cs

@@ -4,7 +4,7 @@
 // Authors:
 // 	Lluis Sanchez Gual ([email protected])
 //
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2009 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -39,8 +39,14 @@ namespace System.Web.UI.HtmlControls
 	[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
 	// attributes
 	[ControlBuilder (typeof(HtmlHeadBuilder))]
-	public sealed class HtmlHead: HtmlGenericControl, IParserAccessor {
-
+	public sealed class HtmlHead: HtmlGenericControl, IParserAccessor
+	{
+#if NET_4_0
+		string descriptionText;
+		string keywordsText;
+		HtmlMeta descriptionMeta;
+		HtmlMeta keywordsMeta;
+#endif
 		string titleText;
 		HtmlTitle title;
 		//Hashtable metadata;
@@ -94,6 +100,15 @@ namespace System.Web.UI.HtmlControls
 				title = t;
 			}
 
+#if NET_4_0
+			HtmlMeta meta = control as HtmlMeta;
+			if (meta != null) {
+				if (String.Compare ("keywords", meta.Name, StringComparison.OrdinalIgnoreCase) == 0)
+					keywordsMeta = meta;
+				else if (String.Compare ("description", meta.Name, StringComparison.OrdinalIgnoreCase) == 0)
+					descriptionMeta = meta;
+			}
+#endif
 			base.AddedControl (control, index);
 		}
 
@@ -102,6 +117,12 @@ namespace System.Web.UI.HtmlControls
 			if (title == control)
 				title = null;
 
+#if NET_4_0
+			if (keywordsMeta == control)
+				keywordsMeta = null;
+			else if (descriptionMeta == control)
+				descriptionMeta = null;
+#endif
 			base.RemovedControl (control);
 		}
 		
@@ -128,6 +149,38 @@ namespace System.Web.UI.HtmlControls
 //			}
 //		}
 		
+#if NET_4_0
+		public string Description {
+			get {
+				if (descriptionMeta != null)
+					return descriptionMeta.Content;
+				return descriptionText;
+			}
+			
+			set {
+				if (descriptionMeta != null)
+					descriptionMeta.Content = value;
+				else
+					descriptionText = value;
+			}
+		}
+
+		public string Keywords {
+			get {
+				if (keywordsMeta != null)
+					return keywordsMeta.Content;
+				return keywordsText;
+			}
+			
+			set {
+				if (keywordsMeta != null)
+					keywordsMeta.Content = value;
+				else
+					keywordsText = value;
+			}
+		}
+#endif
+		
 		public IStyleSheet StyleSheet {
 			get {
 				if (styleSheet == null) styleSheet = new StyleSheetBag ();

+ 3 - 3
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHeadBuilder.cs

@@ -45,11 +45,11 @@ namespace System.Web.UI.HtmlControls
 		
 		public override Type GetChildControlType (string tagName, IDictionary attribs)
 		{
-			if (String.Compare (tagName, "title", true, CultureInfo.InvariantCulture) == 0)
+			if (String.Compare (tagName, "title", StringComparison.OrdinalIgnoreCase) == 0)
 				return typeof (HtmlTitle);
-			if (String.Compare (tagName, "link", true, CultureInfo.InvariantCulture) == 0)
+			if (String.Compare (tagName, "link", StringComparison.OrdinalIgnoreCase) == 0)
 				return typeof (HtmlLink);
-			if (String.Compare (tagName, "meta", true, CultureInfo.InvariantCulture) == 0)
+			if (String.Compare (tagName, "meta", StringComparison.OrdinalIgnoreCase) == 0)
 				return typeof (HtmlMeta);
 			return null;
 		}

+ 15 - 0
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog

@@ -1,3 +1,18 @@
+2009-06-16  Marek Habersack  <[email protected]>
+
+	* IPersistedSelector.cs: removed AspNetHostingPermission
+	attributes from the 4.0 profile.
+
+	* IDataBoundControl.cs, IDataBoundItemControl.cs,
+	IDataBoundListControl.cs, IFieldControl.cs: added
+
+	* DetailsView.cs: control implements 4.0 IDataBoundItemControl
+	interface.
+
+	* DataBoundControl.cs: implemented 4.0 property DataSourceObject
+	and made the InternalPerformDataBinding method internal for the
+	4.0 profile.
+
 2009-06-11 Gonzalo Paniagua Javier <[email protected]>
 
 	* ContentControlBuilderInternal.cs: detect missing

+ 15 - 7
mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs

@@ -62,11 +62,6 @@ namespace System.Web.UI.WebControls {
 		{
 		}
 		
-		internal IDataSource InternalGetDataSource ()
-		{
-			return GetDataSource ();
-		}
-		
 		protected virtual IDataSource GetDataSource ()
 		{
 			if (IsBoundUsingDataSourceID) {
@@ -205,6 +200,14 @@ namespace System.Web.UI.WebControls {
 				base.DataSourceID = value;
 			}
 		}
+
+#if NET_4_0
+		[Browsable (false)]
+		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+		public IDataSource DataSourceObject {
+			get { return GetDataSource (); }
+		}
+#endif
 		
 		// 
 		// See DataBoundControl.MarkAsDataBound msdn doc for the code example
@@ -240,8 +243,13 @@ namespace System.Web.UI.WebControls {
 			// retrievedData collection to elements of the data-bound control.
 			InternalPerformDataBinding (data);
 		}
-		
-		protected void InternalPerformDataBinding (IEnumerable data)
+
+#if NET_4_0
+		internal
+#else
+		protected
+#endif
+		void InternalPerformDataBinding (IEnumerable data)
 		{
 			DataBoundControlAdapter adapter = Adapter as DataBoundControlAdapter;
 			if (adapter != null)

+ 27 - 0
mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs

@@ -48,6 +48,9 @@ namespace System.Web.UI.WebControls
 	[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
 	[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
 	public class DetailsView: CompositeDataBoundControl, ICallbackEventHandler, ICallbackContainer, IDataItemContainer, INamingContainer, IPostBackEventHandler, IPostBackContainer
+#if NET_4_0
+		, IDataBoundItemControl
+#endif
 	{
 		object dataItem;
 		
@@ -296,6 +299,30 @@ namespace System.Web.UI.WebControls
 				throw new HttpException (String.Format (unhandledEventExceptionMessage, ID, "ItemUpdating"));
 		}
 		
+#if NET_4_0
+		
+		DataBoundControlMode IDataBoundItemControl.Mode {
+			get {
+				switch (CurrentMode) {
+					case DetailsViewMode.ReadOnly:
+						return DataBoundControlMode.ReadOnly;
+
+					case DetailsViewMode.Edit:
+						return DataBoundControlMode.Edit;
+
+					case DetailsViewMode.Insert:
+						return DataBoundControlMode.Insert;
+
+					default:
+						throw new InvalidOperationException (String.Format ("Unsupported CurrentMode value '{0}'", CurrentMode));
+				}
+			}
+		}
+
+		IDataSource IDataBoundControl.DataSourceObject {
+			get { return base.DataSourceObject; }
+		}
+#endif
 		
 		[WebCategoryAttribute ("Paging")]
 		[DefaultValueAttribute (false)]

+ 44 - 0
mcs/class/System.Web/System.Web.UI.WebControls/IDataBoundControl.cs

@@ -0,0 +1,44 @@
+//
+// System.Web.UI.WebControls.IDataBoundControl
+//
+// Authors:
+// 	Marek Habersack <[email protected]>
+//
+// Copyright (C) 2009 Novell, Inc (http://novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.ComponentModel;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.WebControls
+{
+	public interface IDataBoundControl
+	{
+		string[] DataKeyNames { get; set; }
+		string DataMember { get; set; }
+		object DataSource { get; set; }
+		string DataSourceID { get; set; }
+		IDataSource DataSourceObject { get; }
+	}
+}

+ 41 - 0
mcs/class/System.Web/System.Web.UI.WebControls/IDataBoundItemControl.cs

@@ -0,0 +1,41 @@
+//
+// System.Web.UI.WebControls.IDataBoundItemControl
+//
+// Authors:
+// 	Marek Habersack <[email protected]>
+//
+// Copyright (C) 2009 Novell, Inc (http://novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.ComponentModel;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.WebControls
+{
+	public interface IDataBoundItemControl : IDataBoundControl
+	{
+		DataKey DataKey { get; }
+		DataBoundControlMode Mode { get; }
+	}
+}

+ 44 - 0
mcs/class/System.Web/System.Web.UI.WebControls/IDataBoundListControl.cs

@@ -0,0 +1,44 @@
+//
+// System.Web.UI.WebControls.IDataBoundListControl
+//
+// Authors:
+// 	Marek Habersack <[email protected]>
+//
+// Copyright (C) 2009 Novell, Inc (http://novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.ComponentModel;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.WebControls
+{
+	public interface IDataBoundListControl : IDataBoundControl
+	{
+		string[] ClientIDRowSuffix { get; set; }
+		DataKeyArray DataKeys { get; }
+		bool EnablePersistedSelection { get; set; }
+		DataKey SelectedDataKey { get; }
+		int SelectedIndex { get; set; }
+	}
+}

+ 40 - 0
mcs/class/System.Web/System.Web.UI.WebControls/IFieldControl.cs

@@ -0,0 +1,40 @@
+//
+// System.Web.UI.WebControls.IFieldControl
+//
+// Authors:
+// 	Marek Habersack <[email protected]>
+//
+// Copyright (C) 2009 Novell, Inc (http://novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.ComponentModel;
+using System.Collections;
+using System.Security.Permissions;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.WebControls
+{
+	public interface IFieldControl
+	{
+		IAutoFieldGenerator FieldsGenerator { get; set; }
+	}
+}

+ 3 - 1
mcs/class/System.Web/System.Web.UI.WebControls/IPersistedSelector.cs

@@ -4,7 +4,7 @@
 // Author:
 //      Atsushi Enomoto  <[email protected]>
 //
-// (C) 2008 Novell, Inc (http://www.novell.com)
+// (C) 2008-2009 Novell, Inc (http://www.novell.com)
 //
 //
 // Permission is hereby granted, free of charge, to any person obtaining
@@ -35,8 +35,10 @@ using System.Web;
 
 namespace System.Web.UI.WebControls
 {
+#if !NET_4_0
 	[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
 	[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#endif
 	public interface IPersistedSelector
 	{
 		DataKey DataKey { get; set; }

+ 4 - 0
mcs/class/System.Web/net_4_0_System.Web.dll.sources

@@ -935,6 +935,10 @@ System.Web.UI.WebControls/HyperLinkField.cs
 System.Web.UI.WebControls/IButtonControl.cs
 System.Web.UI.WebControls/ICallbackContainer.cs
 System.Web.UI.WebControls/ICompositeControlDesignerAccessor.cs
+System.Web.UI.WebControls/IDataBoundControl.cs
+System.Web.UI.WebControls/IDataBoundItemControl.cs
+System.Web.UI.WebControls/IDataBoundListControl.cs
+System.Web.UI.WebControls/IFieldControl.cs
 System.Web.UI.WebControls/ImageAlign.cs
 System.Web.UI.WebControls/ImageButton.cs
 System.Web.UI.WebControls/Image.cs